Lines 16-22
Link Here
|
16 |
xrdp: A Remote Desktop Protocol server. |
16 |
xrdp: A Remote Desktop Protocol server. |
17 |
Copyright (C) Jay Sorg 2005-2008 |
17 |
Copyright (C) Jay Sorg 2005-2008 |
18 |
*/ |
18 |
*/ |
19 |
|
19 |
/* |
|
|
20 |
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
21 |
* All rights reserved |
22 |
* |
23 |
* As far as I am concerned, the code I have written for this software |
24 |
* can be used freely for any purpose. Any derived versions of this |
25 |
* software must be clearly marked as such, and if the derived work is |
26 |
* incompatible with the protocol description in the RFC file, it must be |
27 |
* called by a name other than "ssh" or "Secure Shell". |
28 |
* |
29 |
* SSH2 support by Markus Friedl. |
30 |
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
31 |
* |
32 |
* Redistribution and use in source and binary forms, with or without |
33 |
* modification, are permitted provided that the following conditions |
34 |
* are met: |
35 |
* 1. Redistributions of source code must retain the above copyright |
36 |
* notice, this list of conditions and the following disclaimer. |
37 |
* 2. Redistributions in binary form must reproduce the above copyright |
38 |
* notice, this list of conditions and the following disclaimer in the |
39 |
* documentation and/or other materials provided with the distribution. |
40 |
* |
41 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
42 |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
43 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
44 |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
45 |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
46 |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
47 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
48 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
49 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
50 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
51 |
* |
52 |
* Copyright (c) 2011 Iwao, Koichiro <meta@club.kyutech.ac.jp>, |
53 |
* Kyushu Institute of Technology. |
54 |
* All rights reserved. |
55 |
* |
56 |
* from: OpenBSD: session.c,v 1.252 2010/03/07 11:57:13 dtucker Exp |
57 |
* with some ideas about process grouping from OpenSSH to xrdp |
58 |
* |
59 |
*/ |
20 |
/** |
60 |
/** |
21 |
* |
61 |
* |
22 |
* @file session.c |
62 |
* @file session.c |
Lines 373-378
Link Here
|
373 |
g_sprintf(geometry, "%dx%d", width, height); |
413 |
g_sprintf(geometry, "%dx%d", width, height); |
374 |
g_sprintf(depth, "%d", bpp); |
414 |
g_sprintf(depth, "%d", bpp); |
375 |
g_sprintf(screen, ":%d", display); |
415 |
g_sprintf(screen, ":%d", display); |
|
|
416 |
#ifdef __FreeBSD__ |
417 |
/* |
418 |
* Create a new session and process group since 4.4BSD |
419 |
* setlogin affects the entire process group. |
420 |
*/ |
421 |
pid_t bsdsespid = g_fork(); |
422 |
|
423 |
if (bsdsespid == -1) |
424 |
{ |
425 |
} |
426 |
else if (bsdsespid == 0) /* BSD session leader */ |
427 |
{ |
428 |
if (setsid() < 0) |
429 |
{ |
430 |
log_message(&(g_cfg->log), LOG_LEVEL_ERROR, |
431 |
"setsid failed: %.100s", strerror(errno)); |
432 |
} |
433 |
|
434 |
if (setlogin(username) < 0) |
435 |
{ |
436 |
log_message(&(g_cfg->log), LOG_LEVEL_ERROR, |
437 |
"setlogin failed: %.100s", strerror(errno)); |
438 |
} |
439 |
} |
440 |
|
441 |
g_waitpid(bsdsespid); |
442 |
#endif |
376 |
wmpid = g_fork(); |
443 |
wmpid = g_fork(); |
377 |
if (wmpid == -1) |
444 |
if (wmpid == -1) |
378 |
{ |
445 |
{ |