summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-20 23:12:58 +1000
committerDamien Miller <djm@mindrot.org>2000-04-20 23:12:58 +1000
commitd0cff3ecc49204c03c06428f7b779b8a18c0486f (patch)
tree97eaecdaec4a134fc48d5704a33f4ad3ba9ca1f4
parent166fca8894807de71b741a779330bd23edfec013 (diff)
- Merge fixes from Debian patch from Phil Hands <phil@hands.com>
- 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
-rw-r--r--ChangeLog4
-rw-r--r--auth-pam.c5
-rw-r--r--configure.in2
-rw-r--r--pty.c21
-rw-r--r--ssh-agent.c4
-rw-r--r--ssh.h6
6 files changed, 34 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 168e583b..192ca2c7 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 <phil@hands.com>
+ - 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 f6458949..e1e24854 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 b676193d..596c4e09 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 c6af6f47..21ddab5c 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 <util.h>
@@ -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 5a265e6b..c9a84a4a 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 7bc0c561..87821398 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 */