diff --git a/ChangeLog b/ChangeLog index 168e583b4..192ca2c7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ [session.c] - remove bogus chan_read_failed. this could cause data corruption (missing data) at end of a SSH2 session. + - Merge fixes from Debian patch from Phil Hands + - Allow setting of PAM service name through CFLAGS (SSHD_PAM_SERVICE) + - Use vhangup to clean up Linux ttys + - Force posix getopt processing on GNU libc systems 20000419 - OpenBSD CVS updates diff --git a/auth-pam.c b/auth-pam.c index f6458949e..e1e24854f 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -13,7 +13,7 @@ #include "xmalloc.h" #include "servconf.h" -RCSID("$Id: auth-pam.c,v 1.2 2000/01/26 23:55:38 damien Exp $"); +RCSID("$Id: auth-pam.c,v 1.3 2000/04/20 13:12:58 damien Exp $"); /* Callbacks */ static int pamconv(int num_msg, const struct pam_message **msg, @@ -215,7 +215,8 @@ void start_pam(struct passwd *pw) debug("Starting up PAM with username \"%.200s\"", pw->pw_name); - pam_retval = pam_start("sshd", pw->pw_name, &conv, (pam_handle_t**)&pamh); + pam_retval = pam_start(SSHD_PAM_SERVICE, pw->pw_name, &conv, + (pam_handle_t**)&pamh); if (pam_retval != PAM_SUCCESS) fatal("PAM initialisation failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval)); diff --git a/configure.in b/configure.in index b676193d3..596c4e09f 100644 --- a/configure.in +++ b/configure.in @@ -110,7 +110,7 @@ fi AC_CHECK_HEADERS(bstring.h endian.h lastlog.h login.h maillock.h netdb.h netgroup.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h util.h utmp.h utmpx.h) # Checks for library functions. -AC_CHECK_FUNCS(arc4random bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf _getpty) +AC_CHECK_FUNCS(arc4random bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf vhangup _getpty) AC_CHECK_FUNC(login, [AC_DEFINE(HAVE_LOGIN)], diff --git a/pty.c b/pty.c index c6af6f471..21ddab5c2 100644 --- a/pty.c +++ b/pty.c @@ -14,7 +14,7 @@ */ #include "includes.h" -RCSID("$Id: pty.c,v 1.18 2000/04/16 01:18:44 damien Exp $"); +RCSID("$Id: pty.c,v 1.19 2000/04/20 13:12:59 damien Exp $"); #ifdef HAVE_UTIL_H # include @@ -201,6 +201,9 @@ void pty_make_controlling_tty(int *ttyfd, const char *ttyname) { int fd; +#ifdef HAVE_VHANGUP + void *old; +#endif /* HAVE_VHANGUP */ /* First disconnect from the old controlling tty. */ #ifdef TIOCNOTTY @@ -232,12 +235,22 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname) */ ioctl(*ttyfd, TIOCSCTTY, NULL); #endif /* TIOCSCTTY */ +#ifdef HAVE_VHANGUP + old = signal(SIGHUP, SIG_IGN); + vhangup(); + signal(SIGHUP, old); +#endif /* HAVE_VHANGUP */ fd = open(ttyname, O_RDWR); - if (fd < 0) + if (fd < 0) { error("%.100s: %.100s", ttyname, strerror(errno)); - else + } else { +#ifdef HAVE_VHANGUP + close(*ttyfd); + *ttyfd = fd; +#else /* HAVE_VHANGUP */ close(fd); - +#endif /* HAVE_VHANGUP */ + } /* Verify that we now have a controlling tty. */ fd = open("/dev/tty", O_WRONLY); if (fd < 0) diff --git a/ssh-agent.c b/ssh-agent.c index 5a265e6b8..c9a84a4a0 100644 --- a/ssh-agent.c +++ b/ssh-agent.c @@ -511,7 +511,11 @@ main(int ac, char **av) __progname); exit(1); } +#ifdef __GNU_LIBRARY__ + while ((ch = getopt(ac, av, "+cks")) != -1) { +#else /* __GNU_LIBRARY__ */ while ((ch = getopt(ac, av, "cks")) != -1) { +#endif /* __GNU_LIBRARY__ */ switch (ch) { case 'c': if (s_flag) diff --git a/ssh.h b/ssh.h index 7bc0c5618..87821398c 100644 --- a/ssh.h +++ b/ssh.h @@ -13,7 +13,7 @@ * */ -/* RCSID("$Id: ssh.h,v 1.33 2000/04/19 21:42:22 damien Exp $"); */ +/* RCSID("$Id: ssh.h,v 1.34 2000/04/20 13:12:59 damien Exp $"); */ #ifndef SSH_H #define SSH_H @@ -71,6 +71,10 @@ */ #define SSH_SERVICE_NAME "ssh" +#if defined(USE_PAM) && !defined(SSHD_PAM_SERVICE) +# define SSHD_PAM_SERVICE "sshd" +#endif + #ifndef ETCDIR #define ETCDIR "/etc" #endif /* ETCDIR */