summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-12 22:36:51 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-12 22:36:51 +1000
commit6832b83744b807437488d7e122128f9b363dac43 (patch)
treeea34f56320fd41c90789d57f82fb1f232754567a
parent8ae66a50327751f881156aaf0997d03791d5b08a (diff)
- markus@cvs.openbsd.org 2004/07/28 08:56:22
[sshd.c] call setsid() _before_ re-exec
-rw-r--r--ChangeLog6
-rw-r--r--sshd.c32
2 files changed, 21 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 48ffaa566..fbe2bbaa0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
120040812 120040812
2 - (dtucker) [sshd.c] Remove duplicate variable imported during sync. 2 - (dtucker) [sshd.c] Remove duplicate variable imported during sync.
3 - (dtucker) OpenBSD CVS Sync
4 - markus@cvs.openbsd.org 2004/07/28 08:56:22
5 [sshd.c]
6 call setsid() _before_ re-exec
3 7
420040720 820040720
5 - (djm) OpenBSD CVS Sync 9 - (djm) OpenBSD CVS Sync
@@ -1567,4 +1571,4 @@
1567 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1571 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1568 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1572 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1569 1573
1570$Id: ChangeLog,v 1.3489 2004/08/12 12:16:55 dtucker Exp $ 1574$Id: ChangeLog,v 1.3490 2004/08/12 12:36:51 dtucker Exp $
diff --git a/sshd.c b/sshd.c
index 8b797e07e..cc051432f 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.299 2004/07/17 05:31:41 dtucker Exp $"); 45RCSID("$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.