[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
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));
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)],
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
*/
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)
__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)
*/
#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 */