diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-08-12 22:36:51 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-08-12 22:36:51 +1000 |
commit | 6832b83744b807437488d7e122128f9b363dac43 (patch) | |
tree | ea34f56320fd41c90789d57f82fb1f232754567a /sshd.c | |
parent | 8ae66a50327751f881156aaf0997d03791d5b08a (diff) |
- markus@cvs.openbsd.org 2004/07/28 08:56:22
[sshd.c]
call setsid() _before_ re-exec
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -42,7 +42,7 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include "includes.h" | 44 | #include "includes.h" |
45 | RCSID("$OpenBSD: sshd.c,v 1.299 2004/07/17 05:31:41 dtucker Exp $"); | 45 | RCSID("$OpenBSD: sshd.c,v 1.300 2004/07/28 08:56:22 markus Exp $"); |
46 | 46 | ||
47 | #include <openssl/dh.h> | 47 | #include <openssl/dh.h> |
48 | #include <openssl/bn.h> | 48 | #include <openssl/bn.h> |
@@ -1548,6 +1548,21 @@ main(int ac, char **av) | |||
1548 | /* This is the child processing a new connection. */ | 1548 | /* This is the child processing a new connection. */ |
1549 | setproctitle("%s", "[accepted]"); | 1549 | setproctitle("%s", "[accepted]"); |
1550 | 1550 | ||
1551 | /* | ||
1552 | * Create a new session and process group since the 4.4BSD | ||
1553 | * setlogin() affects the entire process group. We don't | ||
1554 | * want the child to be able to affect the parent. | ||
1555 | */ | ||
1556 | #if !defined(SSHD_ACQUIRES_CTTY) | ||
1557 | /* | ||
1558 | * If setsid is called, on some platforms sshd will later acquire a | ||
1559 | * controlling terminal which will result in "could not set | ||
1560 | * controlling tty" errors. | ||
1561 | */ | ||
1562 | if (!debug_flag && !inetd_flag && setsid() < 0) | ||
1563 | error("setsid: %.100s", strerror(errno)); | ||
1564 | #endif | ||
1565 | |||
1551 | if (rexec_flag) { | 1566 | if (rexec_flag) { |
1552 | int fd; | 1567 | int fd; |
1553 | 1568 | ||
@@ -1588,21 +1603,6 @@ main(int ac, char **av) | |||
1588 | } | 1603 | } |
1589 | 1604 | ||
1590 | /* | 1605 | /* |
1591 | * Create a new session and process group since the 4.4BSD | ||
1592 | * setlogin() affects the entire process group. We don't | ||
1593 | * want the child to be able to affect the parent. | ||
1594 | */ | ||
1595 | #if !defined(SSHD_ACQUIRES_CTTY) | ||
1596 | /* | ||
1597 | * If setsid is called, on some platforms sshd will later acquire a | ||
1598 | * controlling terminal which will result in "could not set | ||
1599 | * controlling tty" errors. | ||
1600 | */ | ||
1601 | if (!debug_flag && !inetd_flag && setsid() < 0) | ||
1602 | error("setsid: %.100s", strerror(errno)); | ||
1603 | #endif | ||
1604 | |||
1605 | /* | ||
1606 | * Disable the key regeneration alarm. We will not regenerate the | 1606 | * Disable the key regeneration alarm. We will not regenerate the |
1607 | * key since we are no longer in a position to give it to anyone. We | 1607 | * key since we are no longer in a position to give it to anyone. We |
1608 | * will not restart on SIGHUP since it no longer makes sense. | 1608 | * will not restart on SIGHUP since it no longer makes sense. |