- 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
This commit is contained in:
Damien Miller 2000-04-20 23:12:58 +10:00
parent 166fca8894
commit d0cff3ecc4
6 changed files with 34 additions and 8 deletions

View File

@ -7,6 +7,10 @@
[session.c] [session.c]
- remove bogus chan_read_failed. this could cause data - remove bogus chan_read_failed. this could cause data
corruption (missing data) at end of a SSH2 session. 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 20000419
- OpenBSD CVS updates - OpenBSD CVS updates

View File

@ -13,7 +13,7 @@
#include "xmalloc.h" #include "xmalloc.h"
#include "servconf.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 */ /* Callbacks */
static int pamconv(int num_msg, const struct pam_message **msg, 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); 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) if (pam_retval != PAM_SUCCESS)
fatal("PAM initialisation failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval)); fatal("PAM initialisation failed: %.200s", PAM_STRERROR((pam_handle_t *)pamh, pam_retval));

View File

@ -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) 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. # 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_CHECK_FUNC(login,
[AC_DEFINE(HAVE_LOGIN)], [AC_DEFINE(HAVE_LOGIN)],

21
pty.c
View File

@ -14,7 +14,7 @@
*/ */
#include "includes.h" #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 #ifdef HAVE_UTIL_H
# include <util.h> # include <util.h>
@ -201,6 +201,9 @@ void
pty_make_controlling_tty(int *ttyfd, const char *ttyname) pty_make_controlling_tty(int *ttyfd, const char *ttyname)
{ {
int fd; int fd;
#ifdef HAVE_VHANGUP
void *old;
#endif /* HAVE_VHANGUP */
/* First disconnect from the old controlling tty. */ /* First disconnect from the old controlling tty. */
#ifdef TIOCNOTTY #ifdef TIOCNOTTY
@ -232,12 +235,22 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
*/ */
ioctl(*ttyfd, TIOCSCTTY, NULL); ioctl(*ttyfd, TIOCSCTTY, NULL);
#endif /* TIOCSCTTY */ #endif /* TIOCSCTTY */
#ifdef HAVE_VHANGUP
old = signal(SIGHUP, SIG_IGN);
vhangup();
signal(SIGHUP, old);
#endif /* HAVE_VHANGUP */
fd = open(ttyname, O_RDWR); fd = open(ttyname, O_RDWR);
if (fd < 0) if (fd < 0) {
error("%.100s: %.100s", ttyname, strerror(errno)); error("%.100s: %.100s", ttyname, strerror(errno));
else } else {
#ifdef HAVE_VHANGUP
close(*ttyfd);
*ttyfd = fd;
#else /* HAVE_VHANGUP */
close(fd); close(fd);
#endif /* HAVE_VHANGUP */
}
/* Verify that we now have a controlling tty. */ /* Verify that we now have a controlling tty. */
fd = open("/dev/tty", O_WRONLY); fd = open("/dev/tty", O_WRONLY);
if (fd < 0) if (fd < 0)

View File

@ -511,7 +511,11 @@ main(int ac, char **av)
__progname); __progname);
exit(1); exit(1);
} }
#ifdef __GNU_LIBRARY__
while ((ch = getopt(ac, av, "+cks")) != -1) {
#else /* __GNU_LIBRARY__ */
while ((ch = getopt(ac, av, "cks")) != -1) { while ((ch = getopt(ac, av, "cks")) != -1) {
#endif /* __GNU_LIBRARY__ */
switch (ch) { switch (ch) {
case 'c': case 'c':
if (s_flag) if (s_flag)

6
ssh.h
View File

@ -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 #ifndef SSH_H
#define SSH_H #define SSH_H
@ -71,6 +71,10 @@
*/ */
#define SSH_SERVICE_NAME "ssh" #define SSH_SERVICE_NAME "ssh"
#if defined(USE_PAM) && !defined(SSHD_PAM_SERVICE)
# define SSHD_PAM_SERVICE "sshd"
#endif
#ifndef ETCDIR #ifndef ETCDIR
#define ETCDIR "/etc" #define ETCDIR "/etc"
#endif /* ETCDIR */ #endif /* ETCDIR */