- Added autoconf option to enable AFS support (untested)
- Added autoconf option to enable S/Key support (untested)
- Added autoconf option to enable TCP wrappers support (compiles OK)
+ - Renamed BSD helper function files to bsd-*
+ - Added tests for login and daemon and OpenBSD replacements for when they
+ are absent.
19991118
- Merged OpenBSD CVS changes
hostfile.o log-client.o login.o log-server.o match.o mpaux.o \
packet.o pty.o readconf.o readpass.o rsa.o servconf.o serverloop.o \
sshconnect.o tildexpand.o ttymodes.o uidswap.o xmalloc.o \
- helper.o mktemp.o strlcpy.o rc4.o
+ helper.o bsd-mktemp.o bsd-strlcpy.o bsd-daemon.o bsd-login.o rc4.o
all: $(OBJS) $(TARGETS)
-libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o mktemp.o strlcpy.o log.o fingerprint.o
+libssh.a: authfd.o authfile.o bufaux.o buffer.o canohost.o channels.o cipher.o compat.o compress.o crc32.o deattack.o hostfile.o match.o mpaux.o nchan.o packet.o readpass.o rsa.o tildexpand.o ttymodes.o uidswap.o xmalloc.o helper.o rc4.o bsd-mktemp.o bsd-strlcpy.o log.o fingerprint.o
$(AR) rv $@ $^
$(RANLIB) $@
ssh: ssh.o sshconnect.o log-client.o readconf.o clientloop.o libssh.a
$(CC) -o $@ $^ $(LFLAGS) $(LIBS)
-sshd: sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o log-server.o login.o servconf.o serverloop.o libssh.a
+sshd: sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o pty.o log-server.o login.o servconf.o serverloop.o bsd-login.o bsd-daemon.o libssh.a
$(CC) -o $@ $^ $(LFLAGS) $(LIBS)
scp: scp.o libssh.a
http://www.openssh.com/
This port consists of the re-introduction of autoconf support, PAM
-support (for Linux and Solaris), EGD[1] support, and replacements for
-OpenBSD library functions that are (regrettably) absent from most
-other unices. This patch has been best tested on Linux, though some
+support (for Linux and Solaris), EGD[1] support, and replacements
+for OpenBSD library functions that are (regrettably) absent from
+other unices. This port has been best tested on Linux, though some
Solaris support is beginning to filter in. This version actively
tracks changes in the OpenBSD CVS repository.
All new code is released under a XFree style license, which is very
liberal. Please refer to the source files for details. The code in
-strlcpy.c and mktemp.c is from the OpenBSD project and has its own
-license (again, see source file for details).
+bsd-*.[ch] is from the OpenBSD project and has its own license (again,
+see the source files for details).
OpenSSH depends on Zlib[2], OpenSSL[3] and optionally PAM[4]. To build
the GNOME[5] pass-phrase requester (--with-gnome-askpass), you will
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt, and Dug Song - Creators of OpenSSH
'jonchen' - the original author of PAM support of SSH
+Chip Salzenberg <chip@valinux.com> - Assorted patches
Dan Brosemer <odin@linuxfreak.com> - Autoconf and build fixes & Debian scripts
+Jim Knoble <jmknoble@pobox.com> - RPM spec file fixes
+Marc G. Fournier <marc.fournier@acadiau.ca> - Solaris patches
Nalin Dahyabhai <nalin.dahyabhai@pobox.com> - PAM environment patch
-Phil Hands <phil@hands.com> - Debian scripts, assorted patches
Niels Kristian Bech Jensen <nkbj@image.dk> - Assorted patches
-Marc G. Fournier <marc.fournier@acadiau.ca> - Solaris patches
+Phil Hands <phil@hands.com> - Debian scripts, assorted patches
Thomas Neumann <tom@smart.ruhr.de> - Shadow passwords
-Jim Knoble <jmknoble@pobox.com> - RPM spec file fixes
Miscellania -
/* Define if you want TCP Wrappers support */
#undef LIBWRAP
+/* Define if your libraries define login() */
+#undef HAVE_LOGIN
+
+/* Define if your libraries define daemon() */
+#undef HAVE_DAEMON
+
@BOTTOM@
/* ******************* Shouldn't need to edit below this line ************** */
--- /dev/null
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#ifndef HAVE_DAEMON
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: daemon.c,v 1.2 1996/08/19 08:22:13 tholo Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <fcntl.h>
+#include <paths.h>
+#include <unistd.h>
+
+int
+daemon(nochdir, noclose)
+ int nochdir, noclose;
+{
+ int fd;
+
+ switch (fork()) {
+ case -1:
+ return (-1);
+ case 0:
+ break;
+ default:
+ _exit(0);
+ }
+
+ if (setsid() == -1)
+ return (-1);
+
+ if (!nochdir)
+ (void)chdir("/");
+
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ (void)dup2(fd, STDIN_FILENO);
+ (void)dup2(fd, STDOUT_FILENO);
+ (void)dup2(fd, STDERR_FILENO);
+ if (fd > 2)
+ (void)close (fd);
+ }
+ return (0);
+}
+
+#endif /* !HAVE_DAEMON */
+
--- /dev/null
+#ifndef _BSD_DAEMON_H
+#define _BSD_DAEMON_H
+
+#include "config.h"
+#ifndef HAVE_DAEMON
+int daemon(int nochdir, int noclose);
+#endif /* !HAVE_DAEMON */
+
+#endif /* _BSD_DAEMON_H */
--- /dev/null
+/* $OpenBSD: login.c,v 1.5 1998/07/13 02:11:12 millert Exp $ */
+/*
+ * Copyright (c) 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#ifndef HAVE_LOGIN
+
+#if defined(LIBC_SCCS) && !defined(lint)
+/* from: static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; */
+static char *rcsid = "$Id: bsd-login.c,v 1.1 1999/11/19 04:32:34 damien Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <utmp.h>
+#include <stdio.h>
+
+void
+login(utp)
+ struct utmp *utp;
+{
+ struct utmp old_ut;
+ register int fd;
+ int tty;
+
+ tty = ttyslot();
+ if (tty > 0 && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) >= 0) {
+ (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
+ /*
+ * Prevent luser from zero'ing out ut_host.
+ * If the new ut_line is empty but the old one is not
+ * and ut_line and ut_name match, preserve the old ut_line.
+ */
+ if (read(fd, &old_ut, sizeof(struct utmp)) ==
+ sizeof(struct utmp) && utp->ut_host[0] == '\0' &&
+ old_ut.ut_host[0] != '\0' &&
+ strncmp(old_ut.ut_line, utp->ut_line, UT_LINESIZE) == 0 &&
+ strncmp(old_ut.ut_name, utp->ut_name, UT_NAMESIZE) == 0)
+ (void)memcpy(utp->ut_host, old_ut.ut_host, UT_HOSTSIZE);
+ (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), SEEK_SET);
+ (void)write(fd, utp, sizeof(struct utmp));
+ (void)close(fd);
+ }
+ if ((fd = open(_PATH_WTMP, O_WRONLY|O_APPEND, 0)) >= 0) {
+ (void)write(fd, utp, sizeof(struct utmp));
+ (void)close(fd);
+ }
+}
+
+#endif /* HAVE_LOGIN */
--- /dev/null
+#ifndef _BSD_LOGIN_H
+#define _BSD_LOGIN_H
+
+#include "config.h"
+#ifndef HAVE_LOGIN
+
+#include <utmp.h>
+
+void login(struct utmp *utp);
+
+#endif /* !HAVE_LOGIN */
+
+#endif /* _BSD_LOGIN_H */
* SUCH DAMAGE.
*/
+#include "config.h"
+
+#ifndef HAVE_MKDTEMP
+
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: mktemp.c,v 1.13 1998/06/30 23:03:13 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <ctype.h>
#include <unistd.h>
-#include "config.h"
#include "helper.h"
-#ifndef HAVE_MKDTEMP
-
static int _gettemp(char *, int *, int, int);
int
-#ifndef _MKTEMP_H
-#define _MKTEMP_H
+#ifndef _BSD_MKTEMP_H
+#define _BSD_MKTEMP_H
#include "config.h"
#ifndef HAVE_MKDTEMP
char *mkdtemp(char *path);
#endif /* !HAVE_MKDTEMP */
-#endif /* _MKTEMP_H */
+#endif /* _BSD_MKTEMP_H */
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+#ifndef HAVE_STRLCPY
+
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <string.h>
-#include "config.h"
-#ifndef HAVE_STRLCPY
-
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
-#ifndef _STRLCPY_H
-#define _STRLCPY_H
+#ifndef _BSD_STRLCPY_H
+#define _BSD_STRLCPY_H
#include "config.h"
#ifndef HAVE_STRLCPY
+#include <sys/types.h>
size_t strlcpy(char *dst, const char *src, size_t siz);
#endif /* !HAVE_STRLCPY */
-#endif /* _STRLCPY_H */
+#endif /* _BSD_STRLCPY_H */
dnl Checks for library functions.
AC_CHECK_FUNCS(openpty strlcpy mkdtemp arc4random setproctitle setlogin)
+AC_CHECK_FUNC(login,
+ [AC_DEFINE(HAVE_LOGIN)],
+ [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
+)
+
+AC_CHECK_FUNC(daemon,
+ [AC_DEFINE(HAVE_DAEMON)],
+ [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
+)
+
dnl Check whether use wants to disable the external ssh-askpass
INSTALL_ASKPASS="yes"
AC_MSG_CHECKING([whether to enable external ssh-askpass support])
AC_MSG_CHECKING([whether libc defines __progname])
AC_TRY_LINK([],
- [extern char *__progname;],
+ [extern char *__progname; printf("%s", __progname);],
[
AC_DEFINE(HAVE___PROGNAME)
AC_MSG_RESULT(yes)
#endif
#ifdef HAVE_LIBPAM
# include <security/pam_appl.h>
-#endif /* HAVE_PAM */
+#endif
#include "version.h"
#include "helper.h"
-#include "mktemp.h"
-#include "strlcpy.h"
+#include "bsd-strlcpy.h"
+#include "bsd-mktemp.h"
/* Define this to be the path of the xauth program. */
#ifndef XAUTH_PATH