]> andersk Git - gssapi-openssh.git/commitdiff
merged OpenSSH 4.7p1 to trunk
authorbasney <basney>
Tue, 11 Sep 2007 20:44:38 +0000 (20:44 +0000)
committerbasney <basney>
Tue, 11 Sep 2007 20:44:38 +0000 (20:44 +0000)
51 files changed:
openssh/Makefile.in
openssh/README.platform
openssh/auth-pam.c
openssh/auth-shadow.c
openssh/auth.c
openssh/auth2.c
openssh/channels.c
openssh/channels.h
openssh/cipher-3des1.c
openssh/cipher-bf1.c
openssh/cipher-ctr.c
openssh/clientloop.c
openssh/clientloop.h
openssh/configure.ac
openssh/defines.h
openssh/gss-genr.c
openssh/gss-serv.c
openssh/includes.h
openssh/kex.c
openssh/kex.h
openssh/key.c
openssh/log.c
openssh/mdoc2man.awk
openssh/monitor.c
openssh/monitor_wrap.c
openssh/myproposal.h
openssh/openbsd-compat/bsd-getpeereid.c
openssh/openbsd-compat/getrrsetbyname.c
openssh/openbsd-compat/port-aix.c
openssh/openbsd-compat/xcrypt.c
openssh/openbsd-compat/xmmap.c
openssh/packet.c
openssh/readconf.c
openssh/scard-opensc.c
openssh/scp.c
openssh/servconf.c
openssh/session.c
openssh/ssh-agent.c
openssh/ssh-gss.h
openssh/ssh-keysign.8
openssh/ssh-rand-helper.c
openssh/ssh.1
openssh/ssh.c
openssh/ssh_config
openssh/ssh_config.5
openssh/sshconnect2.c
openssh/sshd.8
openssh/sshd.c
openssh/sshd_config
openssh/sshd_config.5
openssh/version.h

index 71ab1f2de009f0f3140a49943bf299fd9790b354..19ad1764cb6c9506cc1799e7f8de8fc7bc9cf8f7 100644 (file)
@@ -44,11 +44,8 @@ LD=@LD@
 CFLAGS=@CFLAGS@
 CPPFLAGS=-I. -I$(srcdir) @CPPFLAGS@ $(PATHS) @DEFS@
 LIBS=@LIBS@
-LIBSELINUX=@LIBSELINUX@
 SSHDLIBS=@SSHDLIBS@
 LIBEDIT=@LIBEDIT@
-LIBPAM=@LIBPAM@
-LIBWRAP=@LIBWRAP@
 AR=@AR@
 AWK=@AWK@
 RANLIB=@RANLIB@
@@ -75,7 +72,8 @@ LIBSSH_OBJS=acss.o authfd.o authfile.o bufaux.o bufbn.o buffer.o \
        atomicio.o key.o dispatch.o kex.o mac.o uidswap.o uuencode.o misc.o \
        monitor_fdpass.o rijndael.o ssh-dss.o ssh-rsa.o dh.o kexdh.o \
        kexgex.o kexdhc.o kexgexc.o scard.o msg.o progressmeter.o dns.o \
-       entropy.o scard-opensc.o gss-genr.o kexgssc.o
+       kexgssc.o \
+       entropy.o scard-opensc.o gss-genr.o umac.o
 
 SSHOBJS= ssh.o readconf.o clientloop.o sshtty.o \
        sshconnect.o sshconnect1.o sshconnect2.o
@@ -141,7 +139,7 @@ ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
        $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
 
 sshd$(EXEEXT): libssh.a        $(LIBCOMPAT) $(SSHDOBJS)
-       $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBWRAP) $(LIBPAM) $(LIBSELINUX) $(SSHDLIBS) $(LIBS)
+       $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHDLIBS) $(LIBS)
 
 scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o progressmeter.o
        $(LD) -o $@ scp.o progressmeter.o bufaux.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
index 5724b688f965df7e70bf8b30ba4af36fb24e253f..c54dbf45001ae3a35193bbdf1d558de240193ea0 100644 (file)
@@ -23,6 +23,20 @@ to force the previous IPv4-only behaviour.
 IPv6 known to work: 5.1ML7 5.2ML2 5.2ML5
 IPv6 known broken: 4.3.3ML11 5.1ML4
 
+If you wish to use dynamic libraries that aren't in the normal system
+locations (eg IBM's OpenSSL and zlib packages) then you will need to
+define the environment variable blibpath before running configure, eg
+
+blibpath=/lib:/usr/lib:/opt/freeware/lib ./configure \
+  --with-ssl-dir=/opt/freeware --with-zlib=/opt/freeware
+
+If sshd is built with the WITH_AIXAUTHENTICATE option (which is enabled
+by default) then sshd checks that users are permitted via the
+loginrestrictions() function, in particular that the user has the
+"rlogin" attribute set.  This check is not done for the root account,
+instead the PermitRootLogin setting in sshd_config is used.
+
+
 Cygwin
 ------
 To build on Cygwin, OpenSSH requires the following packages:
index c08d4722912da474a5a6b8951310b168d9c161c1..a07f1fe77d86e7290209ffcbf8346bf97b9786a2 100644 (file)
@@ -161,9 +161,9 @@ sshpam_sigchld_handler(int sig)
            WTERMSIG(sshpam_thread_status) == SIGTERM)
                return; /* terminated by pthread_cancel */
        if (!WIFEXITED(sshpam_thread_status))
-               fatal("PAM: authentication thread exited unexpectedly");
+               sigdie("PAM: authentication thread exited unexpectedly");
        if (WEXITSTATUS(sshpam_thread_status) != 0)
-               fatal("PAM: authentication thread exited uncleanly");
+               sigdie("PAM: authentication thread exited uncleanly");
 }
 
 /* ARGSUSED */
@@ -686,8 +686,7 @@ sshpam_init_ctx(Authctxt *authctxt)
                return (NULL);
        }
 
-       ctxt = xmalloc(sizeof *ctxt);
-       memset(ctxt, 0, sizeof(*ctxt));
+       ctxt = xcalloc(1, sizeof *ctxt);
 
        /* Start the authentication thread */
        if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, socks) == -1) {
@@ -985,7 +984,8 @@ sshpam_tty_conv(int n, sshpam_const struct pam_message **msg,
                        break;
                case PAM_PROMPT_ECHO_ON:
                        fprintf(stderr, "%s\n", PAM_MSG_MEMBER(msg, i, msg));
-                       fgets(input, sizeof input, stdin);
+                       if (fgets(input, sizeof input, stdin) == NULL)
+                               input[0] = '\0';
                        if ((reply[i].resp = strdup(input)) == NULL)
                                goto fail;
                        reply[i].resp_retcode = PAM_SUCCESS;
@@ -1130,9 +1130,8 @@ sshpam_passwd_conv(int n, sshpam_const struct pam_message **msg,
        if (n <= 0 || n > PAM_MAX_NUM_MSG)
                return (PAM_CONV_ERR);
 
-       if ((reply = malloc(n * sizeof(*reply))) == NULL)
+       if ((reply = calloc(n, sizeof(*reply))) == NULL)
                return (PAM_CONV_ERR);
-       memset(reply, 0, n * sizeof(*reply));
 
        for (i = 0; i < n; ++i) {
                switch (PAM_MSG_MEMBER(msg, i, msg_style)) {
index 8b3160aeedb7d06674f1104bc134bf8c67d4980b..2190916776122d80e55a649b6bb5292ed510938f 100644 (file)
@@ -28,6 +28,7 @@
 #include <shadow.h>
 #include <stdarg.h>
 #include <string.h>
+#include <time.h>
 
 #include "key.h"
 #include "hostfile.h"
index 4085a8abdcf385207952c2565b608100eaa16bd0..68e350bc1c0d77321fdf61f26037f758c5d48207 100644 (file)
@@ -115,11 +115,11 @@ allowed_user(struct passwd * pw)
        /* grab passwd field for locked account check */
 #ifdef USE_SHADOW
        if (spw != NULL)
-#if defined(HAVE_LIBIAF)  &&  !defined(BROKEN_LIBIAF)
+#ifdef USE_LIBIAF
                passwd = get_iaf_password(pw);
 #else
                passwd = spw->sp_pwdp;
-#endif /* HAVE_LIBIAF  && !BROKEN_LIBIAF */
+#endif /* USE_LIBIAF */
 #else
        passwd = pw->pw_passwd;
 #endif
@@ -141,9 +141,9 @@ allowed_user(struct passwd * pw)
                if (strstr(passwd, LOCKED_PASSWD_SUBSTR))
                        locked = 1;
 #endif
-#if defined(HAVE_LIBIAF)  &&  !defined(BROKEN_LIBIAF)
+#ifdef USE_LIBIAF
                free(passwd);
-#endif /* HAVE_LIBIAF  && !BROKEN_LIBIAF */
+#endif /* USE_LIBIAF */
                if (locked) {
                        logit("User %.100s not allowed because account is locked",
                            pw->pw_name);
index 82306ba723504f7027ebe31469a34e85438aff8d..76724f4406babbfb66593f48c241c0194726461d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2.c,v 1.114 2007/03/01 10:28:02 dtucker Exp $ */
+/* $OpenBSD: auth2.c,v 1.115 2007/04/14 22:01:58 stevesk Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -337,8 +337,6 @@ userauth_finish(Authctxt *authctxt, int authenticated, char *method)
        }
 }
 
-#define        DELIM   ","
-
 static char *
 authmethods_get(void)
 {
index 030a2deb9b6fb4656dc845e3a87851cbdbae8be0..3c3f04ad81d8928503e98ba9fd5312c6192803f2 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.268 2007/01/03 03:01:40 stevesk Exp $ */
+/* $OpenBSD: channels.c,v 1.270 2007/06/25 08:20:03 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1471,14 +1471,13 @@ static int
 channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset)
 {
        char buf[CHAN_RBUF];
-       int len;
+       int len, force;
 
-       if (c->rfd != -1 &&
-           (c->detach_close || FD_ISSET(c->rfd, readset))) {
+       force = c->isatty && c->detach_close && c->istate != CHAN_INPUT_CLOSED;
+       if (c->rfd != -1 && (force || FD_ISSET(c->rfd, readset))) {
                errno = 0;
                len = read(c->rfd, buf, sizeof(buf));
-               if (len < 0 && (errno == EINTR ||
-                   (errno == EAGAIN && !(c->isatty && c->detach_close))))
+               if (len < 0 && (errno == EINTR || (errno == EAGAIN && !force)))
                        return 1;
 #ifndef PTY_ZEROREAD
                if (len <= 0) {
@@ -1683,7 +1682,9 @@ channel_check_window(Channel *c)
 {
        if (c->type == SSH_CHANNEL_OPEN &&
            !(c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD)) &&
-           c->local_window < c->local_window_max/2 &&
+           ((c->local_window_max - c->local_window >
+           c->local_maxpacket*3) ||
+           c->local_window < c->local_window_max/2) &&
            c->local_consumed > 0) {
                u_int addition = 0;
                /* adjust max window size if we are in a dynamic environment */
index 91bc0ae0087b850e7175c07bb5f44e089fb1f97e..105fe641db9686821c63f33c40f4a07d1201db65 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.h,v 1.88 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: channels.h,v 1.89 2007/06/11 09:14:00 markus Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -123,17 +123,12 @@ struct Channel {
 #define CHAN_EXTENDED_WRITE            2
 
 /* default window/packet sizes for tcp/x11-fwd-channel */
-#define CHAN_SES_PACKET_DEFAULT                (32*1024)
-#define CHAN_SES_WINDOW_DEFAULT_HPN    (160*CHAN_TCP_PACKET_DEFAULT)
-#define CHAN_SES_WINDOW_DEFAULT                (4*CHAN_SES_PACKET_DEFAULT)
-
-#define CHAN_TCP_PACKET_DEFAULT                (32*1024)
-#define CHAN_TCP_WINDOW_DEFAULT_HPN    (160*CHAN_TCP_PACKET_DEFAULT)
-#define CHAN_TCP_WINDOW_DEFAULT                (4*CHAN_TCP_PACKET_DEFAULT)
-
-#define CHAN_X11_PACKET_DEFAULT                (16*1024)
-#define CHAN_X11_WINDOW_DEFAULT_HPN    (4*CHAN_X11_PACKET_DEFAULT)
-#define CHAN_X11_WINDOW_DEFAULT                (4*CHAN_X11_PACKET_DEFAULT)
+#define CHAN_SES_PACKET_DEFAULT        (32*1024)
+#define CHAN_SES_WINDOW_DEFAULT        (64*CHAN_SES_PACKET_DEFAULT)
+#define CHAN_TCP_PACKET_DEFAULT        (32*1024)
+#define CHAN_TCP_WINDOW_DEFAULT        (64*CHAN_TCP_PACKET_DEFAULT)
+#define CHAN_X11_PACKET_DEFAULT        (16*1024)
+#define CHAN_X11_WINDOW_DEFAULT        (4*CHAN_X11_PACKET_DEFAULT)
 
 /* possible input states */
 #define CHAN_INPUT_OPEN                        0
index fc16e20d7e790762ec7af1e73918e68577d28f0c..17a13a133abbc0dc5de69101edb26eaca95ef020 100644 (file)
@@ -35,9 +35,7 @@
 #include "xmalloc.h"
 #include "log.h"
 
-#if OPENSSL_VERSION_NUMBER < 0x00906000L
-#define SSH_OLD_EVP
-#endif
+#include "openbsd-compat/openssl-compat.h"
 
 /*
  * This is used by SSH1:
index 292488c5c61778bb4a1fd15577e40ae5a2c80266..e0e33b4c051158a6c981fcab13ccb9720f514f80 100644 (file)
@@ -35,9 +35,7 @@
 #include "xmalloc.h"
 #include "log.h"
 
-#if OPENSSL_VERSION_NUMBER < 0x00906000L
-#define SSH_OLD_EVP
-#endif
+#include "openbsd-compat/openssl-compat.h"
 
 /*
  * SSH1 uses a variation on Blowfish, all bytes must be swapped before
index b24f3a4288662108d0aa67e99e0b4cc86df22d61..3b86cc10bc69aae00567b76d5f7b6ed77dff3b06 100644 (file)
 /* compatibility with old or broken OpenSSL versions */
 #include "openbsd-compat/openssl-compat.h"
 
-#ifdef USE_BUILTIN_RIJNDAEL
-#include "rijndael.h"
-#define AES_KEY rijndael_ctx
-#define AES_BLOCK_SIZE 16
-#define AES_encrypt(a, b, c) rijndael_encrypt(c, a, b)
-#define AES_set_encrypt_key(a, b, c) rijndael_set_key(c, (char *)a, b, 1)
-#else
+#ifndef USE_BUILTIN_RIJNDAEL
 #include <openssl/aes.h>
 #endif
 
index ac87de57308cb2fcf468becdb090bf5308636e84..2ce7f66c0477c6f634ce6aa16c87c4309133c582 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.c,v 1.178 2007/02/20 10:25:14 djm Exp $ */
+/* $OpenBSD: clientloop.c,v 1.181 2007/08/15 08:14:46 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -290,19 +290,29 @@ client_x11_get_proto(const char *display, const char *xauth_path,
                                        generated = 1;
                        }
                }
-               snprintf(cmd, sizeof(cmd),
-                   "%s %s%s list %s 2>" _PATH_DEVNULL,
-                   xauth_path,
-                   generated ? "-f " : "" ,
-                   generated ? xauthfile : "",
-                   display);
-               debug2("x11_get_proto: %s", cmd);
-               f = popen(cmd, "r");
-               if (f && fgets(line, sizeof(line), f) &&
-                   sscanf(line, "%*s %511s %511s", proto, data) == 2)
-                       got_data = 1;
-               if (f)
-                       pclose(f);
+
+               /*
+                * When in untrusted mode, we read the cookie only if it was
+                * successfully generated as an untrusted one in the step
+                * above.
+                */
+               if (trusted || generated) {
+                       snprintf(cmd, sizeof(cmd),
+                           "%s %s%s list %s 2>" _PATH_DEVNULL,
+                           xauth_path,
+                           generated ? "-f " : "" ,
+                           generated ? xauthfile : "",
+                           display);
+                       debug2("x11_get_proto: %s", cmd);
+                       f = popen(cmd, "r");
+                       if (f && fgets(line, sizeof(line), f) &&
+                           sscanf(line, "%*s %511s %511s", proto, data) == 2)
+                               got_data = 1;
+                       if (f)
+                               pclose(f);
+               } else
+                       error("Warning: untrusted X11 forwarding setup failed: "
+                           "xauth key data not generated");
        }
 
        if (do_unlink) {
@@ -974,7 +984,7 @@ process_cmdline(void)
        cmd = s = read_passphrase("\r\nssh> ", RP_ECHO);
        if (s == NULL)
                goto out;
-       while (*s && isspace(*s))
+       while (isspace(*s))
                s++;
        if (*s == '-')
                s++;    /* Skip cmdline '-', if any */
@@ -1021,9 +1031,8 @@ process_cmdline(void)
                goto out;
        }
 
-       s++;
-       while (*s && isspace(*s))
-               s++;
+       while (isspace(*++s))
+               ;
 
        if (delete) {
                cancel_port = 0;
@@ -1831,6 +1840,50 @@ client_request_agent(const char *request_type, int rchan)
        return c;
 }
 
+int
+client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun)
+{
+       Channel *c;
+       int fd;
+
+       if (tun_mode == SSH_TUNMODE_NO)
+               return 0;
+
+       if (!compat20) {
+               error("Tunnel forwarding is not support for protocol 1");
+               return -1;
+       }
+
+       debug("Requesting tun unit %d in mode %d", local_tun, tun_mode);
+
+       /* Open local tunnel device */
+       if ((fd = tun_open(local_tun, tun_mode)) == -1) {
+               error("Tunnel device open failed.");
+               return -1;
+       }
+
+       c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
+           CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
+       c->datagram = 1;
+
+#if defined(SSH_TUN_FILTER)
+       if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
+               channel_register_filter(c->self, sys_tun_infilter,
+                   sys_tun_outfilter);
+#endif
+
+       packet_start(SSH2_MSG_CHANNEL_OPEN);
+       packet_put_cstring("tun@openssh.com");
+       packet_put_int(c->self);
+       packet_put_int(c->local_window_max);
+       packet_put_int(c->local_maxpacket);
+       packet_put_int(tun_mode);
+       packet_put_int(remote_tun);
+       packet_send();
+
+       return 0;
+}
+
 /* XXXX move to generic input handler */
 static void
 client_input_channel_open(int type, u_int32_t seq, void *ctxt)
index 0be32b460d1d51d2f5a88440efc286cf5cf594af..afc49993509810897cc4d8b0f9a7235910bdfb34 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: clientloop.h,v 1.16 2006/03/25 22:22:42 djm Exp $ */
+/* $OpenBSD: clientloop.h,v 1.17 2007/08/07 07:32:53 djm Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -44,6 +44,7 @@ void   client_x11_get_proto(const char *, const char *, u_int,
 void    client_global_request_reply_fwd(int, u_int32_t, void *);
 void    client_session2_setup(int, int, int, const char *, struct termios *,
            int, Buffer *, char **, dispatch_fn *);
+int     client_request_tun_fwd(int, int, int);
 
 /* Multiplexing protocol version */
 #define SSHMUX_VER                     1
index 2188d91d7f764ea4bd88d89af46f5bf54baece10..afe47d0a350507a40728a27833d3593840f4c9eb 100644 (file)
@@ -94,9 +94,12 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
        CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
        GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
        case $GCC_VER in
-               1.*) ;;
-               2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
-               2.*) ;;
+               1.*) no_attrib_nonnull=1 ;;
+               2.8* | 2.9*)
+                    CFLAGS="$CFLAGS -Wsign-compare"
+                    no_attrib_nonnull=1
+                    ;;
+               2.*) no_attrib_nonnull=1 ;;
                3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
                4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
                *) ;;
@@ -115,6 +118,10 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
        fi
 fi
 
+if test "x$no_attrib_nonnull" != "x1" ; then
+       AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
+fi
+
 AC_ARG_WITH(rpath,
        [  --without-rpath         Disable auto-added -R linker paths],
        [
@@ -198,6 +205,7 @@ AC_CHECK_HEADERS( \
        netgroup.h \
        pam/pam_appl.h \
        paths.h \
+       poll.h \
        pty.h \
        readpassphrase.h \
        rpc/types.h \
@@ -229,6 +237,7 @@ AC_CHECK_HEADERS( \
        time.h \
        tmpdir.h \
        ttyent.h \
+       ucred.h \
        unistd.h \
        usersec.h \
        util.h \
@@ -793,6 +802,11 @@ mips-sony-bsd|mips-sony-newsos4)
        AC_DEFINE(DISABLE_LASTLOG)
        AC_DEFINE(SSHD_ACQUIRES_CTTY)
        enable_etc_default_login=no     # has incompatible /etc/default/login
+       case "$host" in
+       *-*-nto-qnx6*)
+               AC_DEFINE(DISABLE_FD_PASSING)
+               ;;
+       esac
        ;;
 
 *-*-ultrix*)
@@ -1272,8 +1286,7 @@ AC_ARG_WITH(tcp-wrappers,
                                        CPPFLAGS="-I${withval} ${CPPFLAGS}"
                                fi
                        fi
-                       LIBWRAP="-lwrap"
-                       LIBS="$LIBWRAP $LIBS"
+                       LIBS="-lwrap $LIBS"
                        AC_MSG_CHECKING(for libwrap)
                        AC_TRY_LINK(
                                [
@@ -1289,7 +1302,7 @@ AC_ARG_WITH(tcp-wrappers,
                                        AC_DEFINE(LIBWRAP, 1,
                                                [Define if you want
                                                TCP Wrappers support])
-                                       AC_SUBST(LIBWRAP)
+                                       SSHDLIBS="$SSHDLIBS -lwrap"
                                        TCPW_MSG="yes"
                                ],
                                [
@@ -1404,6 +1417,7 @@ AC_CHECK_FUNCS( \
        getnameinfo \
        getopt \
        getpeereid \
+       getpeerucred \
        _getpty \
        getrlimit \
        getttyent \
@@ -1422,6 +1436,7 @@ AC_CHECK_FUNCS( \
        ogetaddrinfo \
        openlog_r \
        openpty \
+       poll \
        prctl \
        pstat \
        readpassphrase \
@@ -1455,6 +1470,7 @@ AC_CHECK_FUNCS( \
        strtonum \
        strtoll \
        strtoul \
+       swap32 \
        sysconf \
        tcgetpgrp \
        truncate \
@@ -1527,6 +1543,14 @@ AC_CHECK_DECLS(writev, , , [
 #include <unistd.h>
        ])
 
+AC_CHECK_DECLS(MAXSYMLINKS, , , [
+#include <sys/param.h>
+       ])
+
+AC_CHECK_DECLS(offsetof, , , [
+#include <stddef.h>
+       ])
+
 AC_CHECK_FUNCS(setresuid, [
        dnl Some platorms have setresuid that isn't implemented, test for this
        AC_MSG_CHECKING(if setresuid seems to work)
@@ -1652,7 +1676,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
 
 # Check for missing getpeereid (or equiv) support
 NO_PEERCHECK=""
-if test "x$ac_cv_func_getpeereid" != "xyes" ; then
+if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
        AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
        AC_TRY_COMPILE(
                [#include <sys/types.h>
@@ -2142,7 +2166,12 @@ fi
 # Search for SHA256 support in libc and/or OpenSSL
 AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
 
-AC_CHECK_LIB(iaf, ia_openinfo)
+saved_LIBS="$LIBS"
+AC_CHECK_LIB(iaf, ia_openinfo, [
+       LIBS="$LIBS -liaf"
+       AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"])
+])
+LIBS="$saved_LIBS"
 
 ### Configure cryptographic random number support
 
@@ -2192,7 +2221,7 @@ AC_ARG_WITH(pam,
 
                        PAM_MSG="yes"
 
-                       LIBPAM="-lpam"
+                       SSHDLIBS="$SSHDLIBS -lpam"
                        AC_DEFINE(USE_PAM, 1,
                                [Define if you want to enable PAM support])
 
@@ -2202,11 +2231,10 @@ AC_ARG_WITH(pam,
                                        # libdl already in LIBS
                                        ;;
                                *)
-                                       LIBPAM="$LIBPAM -ldl"
+                                       SSHDLIBS="$SSHDLIBS -ldl"
                                        ;;
                                esac
                        fi
-                       AC_SUBST(LIBPAM)
                fi
        ]
 )
@@ -3315,25 +3343,43 @@ int main()
                        [#include <arpa/nameser.h>])
        ])
 
+AC_MSG_CHECKING(if struct __res_state _res is an extern)
+AC_LINK_IFELSE([
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+extern struct __res_state _res;
+int main() { return 0; }
+               ],
+               [AC_MSG_RESULT(yes)
+                AC_DEFINE(HAVE__RES_EXTERN, 1,
+                   [Define if you have struct __res_state _res as an extern])
+               ],
+               [ AC_MSG_RESULT(no) ]
+)
+
 # Check whether user wants SELinux support
 SELINUX_MSG="no"
 LIBSELINUX=""
 AC_ARG_WITH(selinux,
        [  --with-selinux   Enable SELinux support],
        [ if test "x$withval" != "xno" ; then
+               save_LIBS="$LIBS"
                AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
                SELINUX_MSG="yes"
                AC_CHECK_HEADER([selinux/selinux.h], ,
                    AC_MSG_ERROR(SELinux support requires selinux.h header))
                AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
                    AC_MSG_ERROR(SELinux support requires libselinux library))
-               save_LIBS="$LIBS"
-               LIBS="$LIBS $LIBSELINUX"
+               SSHDLIBS="$SSHDLIBS $LIBSELINUX"
                AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
                LIBS="$save_LIBS"
        fi ]
 )
-AC_SUBST(LIBSELINUX)
 
 # Check whether user wants Kerberos 5 support
 KRB5_MSG="no"
@@ -4245,7 +4291,10 @@ echo "          Compiler: ${CC}"
 echo "    Compiler flags: ${CFLAGS}"
 echo "Preprocessor flags: ${CPPFLAGS}"
 echo "      Linker flags: ${LDFLAGS}"
-echo "         Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
+echo "         Libraries: ${LIBS}"
+if test ! -z "${SSHDLIBS}"; then
+echo "         +for sshd: ${SSHDLIBS}"
+fi
 
 echo ""
 
@@ -4271,12 +4320,12 @@ if test ! -z "$RAND_HELPER_CMDHASH" ; then
 fi
 
 if test ! -z "$NO_PEERCHECK" ; then
-       echo "WARNING: the operating system that you are using does not "
-       echo "appear to support either the getpeereid() API nor the "
-       echo "SO_PEERCRED getsockopt() option. These facilities are used to "
-       echo "enforce security checks to prevent unauthorised connections to "
-       echo "ssh-agent. Their absence increases the risk that a malicious "
-       echo "user can connect to your agent. "
+       echo "WARNING: the operating system that you are using does not"
+       echo "appear to support getpeereid(), getpeerucred() or the"
+       echo "SO_PEERCRED getsockopt() option. These facilities are used to"
+       echo "enforce security checks to prevent unauthorised connections to"
+       echo "ssh-agent. Their absence increases the risk that a malicious"
+       echo "user can connect to your agent."
        echo ""
 fi
 
index c0710b11b94db6d9837fa5eae03c500257fd209b..21ed8039a9f210674173d712fb3ac40c27c19a29 100644 (file)
@@ -68,7 +68,7 @@ enum
 # endif
 #endif
 
-#ifndef MAXSYMLINKS
+#if defined(HAVE_DECL_MAXSYMLINKS) && HAVE_DECL_MAXSYMLINKS == 0
 # define MAXSYMLINKS 5
 #endif
 
@@ -318,6 +318,10 @@ struct winsize {
 
 /* Paths */
 
+#ifndef _PATH_BSHELL
+# define _PATH_BSHELL "/bin/sh"
+#endif
+
 #ifdef USER_PATH
 # ifdef _PATH_STDPATH
 #  undef _PATH_STDPATH
@@ -443,6 +447,10 @@ struct winsize {
 # define __bounded__(x, y, z)
 #endif
 
+#if !defined(HAVE_ATTRIBUTE__NONNULL__) && !defined(__nonnull__)
+# define __nonnull__(x)
+#endif
+
 /* *-*-nto-qnx doesn't define this macro in the system headers */
 #ifdef MISSING_HOWMANY
 # define howmany(x,y)  (((x)+((y)-1))/(y))
@@ -481,7 +489,7 @@ struct winsize {
         (struct cmsghdr *)NULL)
 #endif /* CMSG_FIRSTHDR */
 
-#ifndef offsetof
+#if defined(HAVE_DECL_OFFSETOF) && HAVE_DECL_OFFSETOF == 0
 # define offsetof(type, member) ((size_t) &((type *)0)->member)
 #endif
 
@@ -690,7 +698,8 @@ struct winsize {
 # define CUSTOM_SYS_AUTH_PASSWD 1
 #endif
 
-#ifdef HAVE_LIBIAF
+#if defined(HAVE_LIBIAF) && defined(HAVE_SET_ID) && !defined(BROKEN_LIBIAF)
+# define USE_LIBIAF
 # define CUSTOM_SYS_AUTH_PASSWD 1
 #endif
 
index 4a7bd4783a928611a8c4467def114591e3522d23..92cd09ad08a45c0d7e38336b4ae8346d186e259e 100644 (file)
@@ -1,7 +1,7 @@
-/* $OpenBSD: gss-genr.c,v 1.17 2006/08/29 12:02:30 dtucker Exp $ */
+/* $OpenBSD: gss-genr.c,v 1.19 2007/06/12 11:56:15 dtucker Exp $ */
 
 /*
- * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved.
+ * Copyright (c) 2001-2007 Simon Wilkinson. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -392,9 +392,6 @@ ssh_gssapi_import_name(Gssctxt *ctx, const char *host)
 OM_uint32
 ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
 {
-       if (ctx == NULL) 
-               return -1;
-
        if ((ctx->major = gss_get_mic(&ctx->minor, ctx->context,
            GSS_C_QOP_DEFAULT, buffer, hash)))
                ssh_gssapi_error(ctx);
@@ -403,16 +400,17 @@ ssh_gssapi_sign(Gssctxt *ctx, gss_buffer_t buffer, gss_buffer_t hash)
 }
 
 /* Priviledged when used by server */
+/* Moved here from gss-serv.c because called by kexgss_client(). */
 OM_uint32
 ssh_gssapi_checkmic(Gssctxt *ctx, gss_buffer_t gssbuf, gss_buffer_t gssmic)
 {
-       if (ctx == NULL)
-               return -1;
+       if (ctx == NULL)
+               return -1;
 
-       ctx->major = gss_verify_mic(&ctx->minor, ctx->context,
-           gssbuf, gssmic, NULL);
+       ctx->major = gss_verify_mic(&ctx->minor, ctx->context,
+           gssbuf, gssmic, NULL);
 
-       return (ctx->major);
+       return (ctx->major);
 }
 
 void
index 39184d72055583e99e3527c3055ab8e7e6683417..a7a1eab20dd2410bc1ba3ec8d5a5858625d65cfc 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: gss-serv.c,v 1.20 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: gss-serv.c,v 1.21 2007/06/12 08:20:00 djm Exp $ */
 
 /*
  * Copyright (c) 2001-2006 Simon Wilkinson. All rights reserved.
@@ -29,6 +29,7 @@
 #ifdef GSSAPI
 
 #include <sys/types.h>
+#include <sys/param.h>
 
 #include <stdarg.h>
 #include <string.h>
@@ -128,22 +129,14 @@ ssh_gssapi_supported_oids(gss_OID_set *oidset)
        gss_release_oid_set(&min_status, &supported);
 }
 
-OM_uint32
-ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
-{
-       if (*ctx)
-               ssh_gssapi_delete_ctx(ctx);
-       ssh_gssapi_build_ctx(ctx);
-       ssh_gssapi_set_oid(*ctx, oid);
-       return (ssh_gssapi_acquire_cred(*ctx));
-}
-
-/* Acquire credentials for a server running on the current host.
+/*
+ * Acquire credentials for a server running on the current host.
  * Requires that the context structure contains a valid OID
  */
 
 /* Returns a GSSAPI error code */
-OM_uint32
+/* Privileged (called from ssh_gssapi_server_ctx) */
+static OM_uint32
 ssh_gssapi_acquire_cred(Gssctxt *ctx)
 {
        OM_uint32 status;
@@ -179,6 +172,17 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx)
 }
 
 
+/* Privileged */
+OM_uint32
+ssh_gssapi_server_ctx(Gssctxt **ctx, gss_OID oid)
+{
+       if (*ctx)
+               ssh_gssapi_delete_ctx(ctx);
+       ssh_gssapi_build_ctx(ctx);
+       ssh_gssapi_set_oid(*ctx, oid);
+       return (ssh_gssapi_acquire_cred(*ctx));
+}
+
 /* Wrapper around accept_sec_context
  * Requires that the context contains:
  *    oid
index 967fcc26c84b385840f34428ef5bdcb06fe31586..9fcf1b023287c0965f0263086da78085cc666aee 100644 (file)
@@ -49,7 +49,7 @@
 #ifdef HAVE_NEXT
 # include <libc.h>
 #endif
-#ifdef HAVE_PATHS
+#ifdef HAVE_PATHS_H
 # include <paths.h>
 #endif
 
index ea5d9acfecebfb456234a34bf422d39f1746c996..d0c3265c6b7a565291e83019745b76179cdf10bd 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: kex.c,v 1.77 2007/01/21 01:41:54 stevesk Exp $ */
+/* $OpenBSD: kex.c,v 1.79 2007/06/05 06:52:37 djm Exp $ */
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
  *
@@ -91,7 +91,7 @@ static char **
 kex_buf2prop(Buffer *raw, int *first_kex_follows)
 {
        Buffer b;
-       int i;
+       u_int i;
        char **proposal;
 
        proposal = xcalloc(PROPOSAL_MAX, sizeof(char *));
@@ -112,7 +112,7 @@ kex_buf2prop(Buffer *raw, int *first_kex_follows)
                *first_kex_follows = i;
        debug2("kex_parse_kexinit: first_kex_follows %d ", i);
        i = buffer_get_int(&b);
-       debug2("kex_parse_kexinit: reserved %d ", i);
+       debug2("kex_parse_kexinit: reserved %u ", i);
        buffer_free(&b);
        return proposal;
 }
@@ -127,6 +127,7 @@ kex_prop_free(char **proposal)
        xfree(proposal);
 }
 
+/* ARGSUSED */
 static void
 kex_protocol_error(int type, u_int32_t seq, void *ctxt)
 {
@@ -198,6 +199,7 @@ kex_send_kexinit(Kex *kex)
        kex->flags |= KEX_INIT_SENT;
 }
 
+/* ARGSUSED */
 void
 kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
 {
@@ -262,7 +264,8 @@ choose_enc(Enc *enc, char *client, char *server)
 {
        char *name = match_list(client, server, NULL);
        if (name == NULL)
-               fatal("no matching cipher found: client %s server %s", client, server);
+               fatal("no matching cipher found: client %s server %s",
+                   client, server);
        if ((enc->cipher = cipher_by_name(name)) == NULL)
                fatal("matching cipher is not supported: %s", name);
        enc->name = name;
@@ -278,8 +281,9 @@ choose_mac(Mac *mac, char *client, char *server)
 {
        char *name = match_list(client, server, NULL);
        if (name == NULL)
-               fatal("no matching mac found: client %s server %s", client, server);
-       if (mac_init(mac, name) < 0)
+               fatal("no matching mac found: client %s server %s",
+                   client, server);
+       if (mac_setup(mac, name) < 0)
                fatal("unsupported mac %s", name);
        /* truncate the key */
        if (datafellows & SSH_BUG_HMAC)
@@ -312,7 +316,7 @@ choose_kex(Kex *k, char *client, char *server)
 {
        k->name = match_list(client, server, NULL);
        if (k->name == NULL)
-               fatal("no kex alg");
+               fatal("Unable to negotiate a key exchange method");
        if (strcmp(k->name, KEX_DH1) == 0) {
                k->kex_type = KEX_DH_GRP1_SHA1;
                k->evp_md = EVP_sha1();
@@ -406,7 +410,8 @@ kex_choose_conf(Kex *kex)
        for (mode = 0; mode < MODE_MAX; mode++) {
                newkeys = xcalloc(1, sizeof(*newkeys));
                kex->newkeys[mode] = newkeys;
-               ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN);
+               ctos = (!kex->server && mode == MODE_OUT) ||
+                   (kex->server && mode == MODE_IN);
                nenc  = ctos ? PROPOSAL_ENC_ALGS_CTOS  : PROPOSAL_ENC_ALGS_STOC;
                nmac  = ctos ? PROPOSAL_MAC_ALGS_CTOS  : PROPOSAL_MAC_ALGS_STOC;
                ncomp = ctos ? PROPOSAL_COMP_ALGS_CTOS : PROPOSAL_COMP_ALGS_STOC;
index c024402af2b94a3354ceca5496d35481726cf1df..39c28c8c38e039467eaf94d0bfe28ad25d00767d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: kex.h,v 1.44 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: kex.h,v 1.46 2007/06/07 19:37:34 pvalchev Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Markus Friedl.  All rights reserved.
@@ -28,6 +28,7 @@
 
 #include <signal.h>
 #include <openssl/evp.h>
+#include <openssl/hmac.h>
 
 #define        KEX_DH1                 "diffie-hellman-group1-sha1"
 #define        KEX_DH14                "diffie-hellman-group14-sha1"
@@ -89,10 +90,13 @@ struct Enc {
 struct Mac {
        char    *name;
        int     enabled;
-       const EVP_MD    *md;
        u_int   mac_len;
        u_char  *key;
        u_int   key_len;
+       int     type;
+       const EVP_MD    *evp_md;
+       HMAC_CTX        evp_ctx;
+       struct umac_ctx *umac_ctx;
 };
 struct Comp {
        int     type;
index 5563608ec44c461760da4afe6eca1526a19e5ef1..06b15d65c1617a74f33b32881ef587e91889031e 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: key.c,v 1.68 2006/11/06 21:25:28 markus Exp $ */
+/* $OpenBSD: key.c,v 1.69 2007/07/12 05:48:05 ray Exp $ */
 /*
  * read_bignum():
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -170,9 +170,7 @@ key_equal(const Key *a, const Key *b)
                    BN_cmp(a->dsa->pub_key, b->dsa->pub_key) == 0;
        default:
                fatal("key_equal: bad key type %d", a->type);
-               break;
        }
-       return 0;
 }
 
 u_char*
index 7f8867482d95e55d9cd6ff471cf504163c31d775..fae5b043f3e55701a9ca1d8a99aa9791e2513bff 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.39 2006/08/18 09:13:25 deraadt Exp $ */
+/* $OpenBSD: log.c,v 1.40 2007/05/17 07:50:31 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -44,6 +44,7 @@
 #include <string.h>
 #include <syslog.h>
 #include <unistd.h>
+#include <errno.h>
 #if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H)
 # include <vis.h>
 #endif
@@ -313,6 +314,7 @@ do_log(LogLevel level, const char *fmt, va_list args)
        char fmtbuf[MSGBUFSIZ];
        char *txt = NULL;
        int pri = LOG_INFO;
+       int saved_errno = errno;
 
        if (level > log_level)
                return;
@@ -373,4 +375,5 @@ do_log(LogLevel level, const char *fmt, va_list args)
                closelog();
 #endif
        }
+       errno = saved_errno;
 }
index d6eaf460154e115756cff1d685c40bfec1e7b77c..7ad1457873eb4e1c0e4662a1110ae5054865259c 100644 (file)
@@ -1,6 +1,9 @@
 #!/usr/bin/awk
 #
+# $Id$
+#
 # Version history:
+#  v4+ Adapted for OpenSSH Portable (see cvs Id and history)
 #  v3, I put the program under a proper license
 #      Dan Nelson <dnelson@allantgroup.com> added .An, .Aq and fixed a typo
 #  v2, fixed to work on GNU awk --posix and MacOS X
@@ -135,6 +138,12 @@ function add(str) {
        nospace=0
     }
     if(match(words[w],"^Dd$")) {
+      if(match(words[w+1],"^\\$Mdocdate:")) {
+        w++;
+        if(match(words[w+4],"^\\$$")) {
+          words[w+4] = ""
+        }
+      }
       date=wtail()
       next
     } else if(match(words[w],"^Dt$")) {
@@ -157,6 +166,7 @@ function add(str) {
       refissue=""
       refdate=""
       refopt=""
+      refreport=""
       reference=1
       next
     } else if(match(words[w],"^Re$")) {
@@ -168,9 +178,14 @@ function add(str) {
       }
       if(nrefauthors>1)
        add(" and ")
-      add(refauthors[0] ", \\fI" reftitle "\\fP")
+      if(nrefauthors>0)
+        add(refauthors[0] ", ")
+      add("\\fI" reftitle "\\fP")
       if(length(refissue))
        add(", " refissue)
+      if(length(refreport)) {
+       add(", " refreport)
+      }
       if(length(refdate))
        add(", " refdate)
       if(length(refopt))
@@ -187,6 +202,7 @@ function add(str) {
       if(match(words[w],"^%N$")) { refissue=wtail() }
       if(match(words[w],"^%D$")) { refdate=wtail() }
       if(match(words[w],"^%O$")) { refopt=wtail() }
+      if(match(words[w],"^%R$")) { refreport=wtail() }
     } else if(match(words[w],"^Nm$")) {
       if(synopsis) {
        add(".br")
index 0ceae2024c39487d8b4a95521433ff11a0946db6..92eeeb6a543c36ad675e950dac615bd670e14d1c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.90 2007/02/19 10:45:58 dtucker Exp $ */
+/* $OpenBSD: monitor.c,v 1.91 2007/05/17 20:52:13 djm Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -437,6 +437,7 @@ monitor_child_postauth(struct monitor *pmonitor)
        monitor_set_child_handler(pmonitor->m_pid);
        signal(SIGHUP, &monitor_child_handler);
        signal(SIGTERM, &monitor_child_handler);
+       signal(SIGINT, &monitor_child_handler);
 
        if (compat20) {
                mon_dispatch = mon_dispatch_postauth20;
index 9f448664598fa11c5cfbdbe73fd6fd0ccd6efa10..97715e4516a63c5d6b5b34c7cdebd0f1e882131a 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.55 2007/02/19 10:45:58 dtucker Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.57 2007/06/07 19:37:34 pvalchev Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos@citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -476,8 +476,8 @@ mm_newkeys_from_blob(u_char *blob, int blen)
 
        /* Mac structure */
        mac->name = buffer_get_string(&b, NULL);
-       if (mac->name == NULL || mac_init(mac, mac->name) == -1)
-               fatal("%s: can not init mac %s", __func__, mac->name);
+       if (mac->name == NULL || mac_setup(mac, mac->name) == -1)
+               fatal("%s: can not setup mac %s", __func__, mac->name);
        mac->enabled = buffer_get_int(&b);
        mac->key = buffer_get_string(&b, &len);
        if (len > mac->key_len)
index f56ec503a5610a5e4ca6b049f230318484667270..46bd6dfd2baa0311ad8170f68d3df2960acdba33 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: myproposal.h,v 1.21 2006/03/25 22:22:43 djm Exp $ */
+/* $OpenBSD: myproposal.h,v 1.22 2007/06/07 19:37:34 pvalchev Exp $ */
 
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
@@ -49,7 +49,7 @@
 #define KEX_ENCRYPT_INCLUDE_NONE KEX_DEFAULT_ENCRYPT \
        ",none"
 #define        KEX_DEFAULT_MAC \
-       "hmac-md5,hmac-sha1,hmac-ripemd160," \
+       "hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160," \
        "hmac-ripemd160@openssh.com," \
        "hmac-sha1-96,hmac-md5-96"
 #define        KEX_DEFAULT_COMP        "none,zlib@openssh.com,zlib"
index bdae8b637f47f26c49ca95ca04f961628b075723..5f7e677e5cdf3e75fc73d3b6c462346aae4ec572 100644 (file)
@@ -37,6 +37,28 @@ getpeereid(int s, uid_t *euid, gid_t *gid)
 
        return (0);
 }
+#elif defined(HAVE_GETPEERUCRED)
+
+#ifdef HAVE_UCRED_H
+# include <ucred.h>
+#endif
+
+int
+getpeereid(int s, uid_t *euid, gid_t *gid)
+{
+       ucred_t *ucred = NULL;
+
+       if (getpeerucred(s, &ucred) == -1)
+               return (-1);
+       if ((*euid = ucred_geteuid(ucred)) == -1)
+               return (-1);
+       if ((*gid = ucred_getrgid(ucred)) == -1)
+               return (-1);
+
+       ucred_free(ucred);
+
+       return (0);
+}
 #else
 int
 getpeereid(int s, uid_t *euid, gid_t *gid)
index 07231d005f77394979fba9a2a44495bafc2ac76b..80af3f5425287724d3439fc12242a1e6fd613862 100644 (file)
@@ -67,13 +67,9 @@ extern int h_errno;
 #endif
 #define _THREAD_PRIVATE(a,b,c) (c)
 
-/* to avoid conflicts where a platform already has _res */
-#ifdef _res
-# undef _res
-#endif
-#define _res   _compat_res
-
+#ifndef HAVE__RES_EXTERN
 struct __res_state _res;
+#endif
 
 /* Necessary functions and macros */
 
index ce83043d939bdc20ff90f03d45c51be618dca57d..0723e98deb456c0fa7547998528f50cddf84ecdf 100644 (file)
@@ -241,7 +241,7 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg)
 
        /*
         * Don't perform checks for root account (PermitRootLogin controls
-        * logins via ssh) or if running as non-root user (since
+        * logins via ssh) or if running as non-root user (since
         * loginrestrictions will always fail due to insufficient privilege).
         */
        if (pw->pw_uid == 0 || geteuid() != 0) {
index 14899321fe4869f40444a42f8beaaac19b69751b..d8636bb398e107da73820616002f014d07d5445c 100644 (file)
@@ -98,7 +98,7 @@ shadow_pw(struct passwd *pw)
                pw_password = spw->sp_pwdp;
 # endif
 
-#if defined(HAVE_LIBIAF)  &&  !defined(BROKEN_LIBIAF)
+#ifdef USE_LIBIAF
        return(get_iaf_password(pw));
 #endif
 
index 4239d0e964e5f9f658bfeed13db524061426389d..322ffc2b17f6d9c2eec19a17d80468d67ba3083a 100644 (file)
 #endif
 #include <errno.h>
 #include <stdarg.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
 #include "log.h"
 
-void *xmmap(size_t size)
+void *
+xmmap(size_t size)
 {
 #ifdef HAVE_MMAP
        void *address;
index b466fa016b315e691513939bacfdb09b7ae4c6e7..36656baf4d08671bf601353b88f77a8b8195f4b0 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: packet.c,v 1.145 2006/09/19 21:14:08 markus Exp $ */
+/* $OpenBSD: packet.c,v 1.148 2007/06/07 19:37:34 pvalchev Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -629,7 +629,7 @@ set_newkeys(int mode)
                enc  = &newkeys[mode]->enc;
                mac  = &newkeys[mode]->mac;
                comp = &newkeys[mode]->comp;
-               memset(mac->key, 0, mac->key_len);
+               mac_clear(mac);
                xfree(enc->name);
                xfree(enc->iv);
                xfree(enc->key);
@@ -644,14 +644,15 @@ set_newkeys(int mode)
        enc  = &newkeys[mode]->enc;
        mac  = &newkeys[mode]->mac;
        comp = &newkeys[mode]->comp;
-       if (mac->md != NULL)
+       if (mac_init(mac) == 0)
                mac->enabled = 1;
        DBG(debug("cipher_init_context: %d", mode));
        cipher_init(cc, enc->cipher, enc->key, enc->key_len,
            enc->iv, enc->block_size, crypt_type);
        /* Deleting the keys does not gain extra security */
        /* memset(enc->iv,  0, enc->block_size);
-          memset(enc->key, 0, enc->key_len); */
+          memset(enc->key, 0, enc->key_len);
+          memset(mac->key, 0, mac->key_len); */
        if ((comp->type == COMP_ZLIB ||
            (comp->type == COMP_DELAYED && after_authentication)) &&
            comp->enabled == 0) {
@@ -1235,7 +1236,6 @@ packet_read_poll_seqnr(u_int32_t *seqnr_p)
                                logit("Received disconnect from %s: %.400s",
                                    get_remote_ipaddr(), msg);
                                cleanup_exit(255);
-                               xfree(msg);
                                break;
                        default:
                                if (type)
index a0adcb520caffa4cf59dfbe6e79f4c80710b39e8..81e4f7bf7808b38de7809c81cec0e5130dae8161 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.161 2007/01/21 01:45:35 stevesk Exp $ */
+/* $OpenBSD: readconf.c,v 1.162 2007/03/20 03:56:12 tedu Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1315,7 +1315,7 @@ parse_forward(Forward *fwd, const char *fwdspec)
        cp = p = xstrdup(fwdspec);
 
        /* skip leading spaces */
-       while (*cp && isspace(*cp))
+       while (isspace(*cp))
                cp++;
 
        for (i = 0; i < 4; ++i)
index 4751ea295ff2fb6a00e7c08fa459bb5fd4a91817..36dae05fd5a8c908b59fd02a7c5ab7fff451b22e 100644 (file)
@@ -32,6 +32,7 @@
 #include <openssl/x509.h>
 
 #include <stdarg.h>
+#include <string.h>
 
 #include <opensc/opensc.h>
 #include <opensc/pkcs15.h>
index c325fc3f12e0edcf716e03255f9968ed97ae8eb1..0e1c9675fd07493a4e52d2ef75925087d8b6e330 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.156 2007/01/22 13:06:21 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.160 2007/08/06 19:16:06 sobrado Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -96,6 +96,9 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#if defined(HAVE_STRNVIS) && defined(HAVE_VIS_H)
+#include <vis.h>
+#endif
 
 #include "xmalloc.h"
 #include "atomicio.h"
@@ -582,7 +585,7 @@ source(int argc, char **argv)
        off_t i, amt, statbytes;
        size_t result;
        int fd = -1, haderr, indx;
-       char *last, *name, buf[16384];
+       char *last, *name, buf[2048], encname[MAXPATHLEN];
        int len;
 
        for (indx = 0; indx < argc; ++indx) {
@@ -591,17 +594,17 @@ source(int argc, char **argv)
                len = strlen(name);
                while (len > 1 && name[len-1] == '/')
                        name[--len] = '\0';
+               if ((fd = open(name, O_RDONLY|O_NONBLOCK, 0)) < 0)
+                       goto syserr;
                if (strchr(name, '\n') != NULL) {
-                       run_err("%s: skipping, filename contains a newline",
-                           name);
-                       goto next;
+                       strnvis(encname, name, sizeof(encname), VIS_NL);
+                       name = encname;
                }
-               if ((fd = open(name, O_RDONLY, 0)) < 0)
-                       goto syserr;
                if (fstat(fd, &stb) < 0) {
 syserr:                        run_err("%s: %s", name, strerror(errno));
                        goto next;
                }
+               unset_nonblock(fd);
                switch (stb.st_mode & S_IFMT) {
                case S_IFREG:
                        break;
@@ -1021,7 +1024,8 @@ bad:                      run_err("%s: %s", np, strerror(errno));
                        wrerr = YES;
                        wrerrno = errno;
                }
-               if (wrerr == NO && ftruncate(ofd, size) != 0) {
+               if (wrerr == NO && (!exists || S_ISREG(stb.st_mode)) &&
+                   ftruncate(ofd, size) != 0) {
                        run_err("%s: truncate: %s", np, strerror(errno));
                        wrerr = DISPLAYED;
                }
@@ -1116,7 +1120,7 @@ usage(void)
        (void) fprintf(stderr,
            "usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n"
            "           [-l limit] [-o ssh_option] [-P port] [-S program]\n"
-           "           [[user@]host1:]file1 [...] [[user@]host2:]file2\n");
+           "           [[user@]host1:]file1 ... [[user@]host2:]file2\n");
        exit(1);
 }
 
index efed3dabb1a00e1caf2716d7801b6c84f6738e0c..4ba6604142c700940db2a8d8783a2e82661960b3 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.c,v 1.170 2007/03/01 10:28:02 dtucker Exp $ */
+/* $OpenBSD: servconf.c,v 1.172 2007/04/23 10:15:39 dtucker Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -688,7 +688,6 @@ match_cfg_line(char **condition, int line, const char *user, const char *host,
                                debug("connection from %.100s matched 'Host "
                                    "%.100s' at line %d", host, arg, line);
                } else if (strcasecmp(attrib, "address") == 0) {
-                       debug("address '%s' arg '%s'", address, arg);
                        if (!address) {
                                result = 0;
                                continue;
@@ -1532,8 +1531,4 @@ parse_server_config(ServerOptions *options, const char *filename, Buffer *conf,
        if (bad_options > 0)
                fatal("%s: terminating, %d bad configuration options",
                    filename, bad_options);
-
-       /* challenge-response is implemented via keyboard interactive */
-       if (options->challenge_response_authentication == 1)
-               options->kbd_interactive_authentication = 1;
 }
index 6e936b79fc951cdf1ce5394100a6c1992ee422f0..c9b9552c8ff869c007d42c5041ae186ac06f7884 100644 (file)
@@ -1480,7 +1480,7 @@ do_setusercontext(struct passwd *pw)
 # ifdef USE_PAM
                if (options.use_pam) {
                        do_pam_session();
-                       do_pam_setcred(0);
+                       do_pam_setcred(use_privsep);
                }
 # endif /* USE_PAM */
                if (setusercontext(lc, pw, pw->pw_uid,
@@ -1522,7 +1522,7 @@ do_setusercontext(struct passwd *pw)
                 */
                if (options.use_pam) {
                        do_pam_session();
-                       do_pam_setcred(0);
+                       do_pam_setcred(use_privsep);
                }
 # endif /* USE_PAM */
 # if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY)
@@ -1531,11 +1531,11 @@ do_setusercontext(struct passwd *pw)
 # ifdef _AIX
                aix_usrinfo(pw);
 # endif /* _AIX */
-#if defined(HAVE_LIBIAF)  &&  !defined(BROKEN_LIBIAF)
+#ifdef USE_LIBIAF
                if (set_id(pw->pw_name) != 0) {
                        exit(1);
                }
-#endif /* HAVE_LIBIAF  && !BROKEN_LIBIAF */
+#endif /* USE_LIBIAF */
                /* Permanently switch to the desired uid. */
                permanently_set_uid(pw);
 #endif
@@ -2703,8 +2703,19 @@ do_cleanup(Authctxt *authctxt)
                return;
        called = 1;
 
-       if (authctxt == NULL || !authctxt->authenticated)
+       if (authctxt == NULL)
                return;
+
+#ifdef USE_PAM
+       if (options.use_pam) {
+               sshpam_cleanup();
+               sshpam_thread_cleanup();
+       }
+#endif
+
+       if (!authctxt->authenticated)
+               return;
+
 #ifdef KRB5
        if (options.kerberos_ticket_cleanup &&
            authctxt->krb5_ctx)
@@ -2716,13 +2727,6 @@ do_cleanup(Authctxt *authctxt)
                ssh_gssapi_cleanup_creds();
 #endif
 
-#ifdef USE_PAM
-       if (options.use_pam) {
-               sshpam_cleanup();
-               sshpam_thread_cleanup();
-       }
-#endif
-
        /* remove agent socket */
        auth_sock_cleanup_proc(authctxt->pw);
 
index a3a867c33b70e7a191c1608eb862f11b7ed34988..c3d5e5a757d9409a4e6289c8c43841ab44f2c6da 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-agent.c,v 1.154 2007/02/28 00:55:30 dtucker Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.155 2007/03/19 12:16:42 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -120,6 +120,7 @@ int max_fd = 0;
 
 /* pid of shell == parent of agent */
 pid_t parent_pid = -1;
+u_int parent_alive_interval = 0;
 
 /* pathname and directory for AUTH_SOCKET */
 char socket_name[MAXPATHLEN];
@@ -421,10 +422,11 @@ process_remove_all_identities(SocketEntry *e, int version)
        buffer_put_char(&e->output, SSH_AGENT_SUCCESS);
 }
 
-static void
+/* removes expired keys and returns number of seconds until the next expiry */
+static u_int
 reaper(void)
 {
-       u_int now = time(NULL);
+       u_int deadline = 0, now = time(NULL);
        Identity *id, *nxt;
        int version;
        Idtab *tab;
@@ -433,14 +435,22 @@ reaper(void)
                tab = idtab_lookup(version);
                for (id = TAILQ_FIRST(&tab->idlist); id; id = nxt) {
                        nxt = TAILQ_NEXT(id, next);
-                       if (id->death != 0 && now >= id->death) {
+                       if (id->death == 0)
+                               continue;
+                       if (now >= id->death) {
                                debug("expiring key '%s'", id->comment);
                                TAILQ_REMOVE(&tab->idlist, id, next);
                                free_identity(id);
                                tab->nentries--;
-                       }
+                       } else
+                               deadline = (deadline == 0) ? id->death :
+                                   MIN(deadline, id->death);
                }
        }
+       if (deadline == 0 || deadline <= now)
+               return 0;
+       else
+               return (deadline - now);
 }
 
 static void
@@ -826,10 +836,12 @@ new_socket(sock_type type, int fd)
 }
 
 static int
-prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp)
+prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp,
+    struct timeval **tvpp)
 {
-       u_int i, sz;
+       u_int i, sz, deadline;
        int n = 0;
+       static struct timeval tv;
 
        for (i = 0; i < sockets_alloc; i++) {
                switch (sockets[i].type) {
@@ -873,6 +885,17 @@ prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl, u_int *nallocp)
                        break;
                }
        }
+       deadline = reaper();
+       if (parent_alive_interval != 0)
+               deadline = (deadline == 0) ? parent_alive_interval :
+                   MIN(deadline, parent_alive_interval);
+       if (deadline == 0) {
+               *tvpp = NULL;
+       } else {
+               tv.tv_sec = deadline;
+               tv.tv_usec = 0;
+               *tvpp = &tv;
+       }
        return (1);
 }
 
@@ -980,19 +1003,14 @@ cleanup_handler(int sig)
        _exit(2);
 }
 
-/*ARGSUSED*/
 static void
-check_parent_exists(int sig)
+check_parent_exists(void)
 {
-       int save_errno = errno;
-
        if (parent_pid != -1 && kill(parent_pid, 0) < 0) {
                /* printf("Parent has died - Authentication agent exiting.\n"); */
-               cleanup_handler(sig); /* safe */
+               cleanup_socket();
+               _exit(2);
        }
-       mysignal(SIGALRM, check_parent_exists);
-       alarm(10);
-       errno = save_errno;
 }
 
 static void
@@ -1027,7 +1045,7 @@ main(int ac, char **av)
        extern char *optarg;
        pid_t pid;
        char pidstrbuf[1 + 3 * sizeof pid];
-       struct timeval tv;
+       struct timeval *tvp = NULL;
 
        /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
        sanitise_stdfd();
@@ -1228,10 +1246,8 @@ main(int ac, char **av)
 
 skip:
        new_socket(AUTH_SOCKET, sock);
-       if (ac > 0) {
-               mysignal(SIGALRM, check_parent_exists);
-               alarm(10);
-       }
+       if (ac > 0)
+               parent_alive_interval = 10;
        idtab_init();
        if (!d_flag)
                signal(SIGINT, SIG_IGN);
@@ -1241,12 +1257,12 @@ skip:
        nalloc = 0;
 
        while (1) {
-               tv.tv_sec = 10;
-               tv.tv_usec = 0;
-               prepare_select(&readsetp, &writesetp, &max_fd, &nalloc);
-               result = select(max_fd + 1, readsetp, writesetp, NULL, &tv);
+               prepare_select(&readsetp, &writesetp, &max_fd, &nalloc, &tvp);
+               result = select(max_fd + 1, readsetp, writesetp, NULL, tvp);
                saved_errno = errno;
-               reaper();       /* remove expired keys */
+               if (parent_alive_interval != 0)
+                       check_parent_exists();
+               (void) reaper();        /* remove expired keys */
                if (result < 0) {
                        if (saved_errno == EINTR)
                                continue;
index 0546fe56d431d68053e358bd141bdb0f6d179f73..794e670f1c4528356cfde93221ff4278db810bde 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-gss.h,v 1.9 2006/08/18 14:40:34 djm Exp $ */
+/* $OpenBSD: ssh-gss.h,v 1.10 2007/06/12 08:20:00 djm Exp $ */
 /*
  * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
  *
@@ -120,7 +120,6 @@ void ssh_gssapi_supported_oids(gss_OID_set *);
 ssh_gssapi_mech *ssh_gssapi_get_ctype(Gssctxt *);
 
 OM_uint32 ssh_gssapi_import_name(Gssctxt *, const char *);
-OM_uint32 ssh_gssapi_acquire_cred(Gssctxt *);
 OM_uint32 ssh_gssapi_init_ctx(Gssctxt *, int,
     gss_buffer_desc *, gss_buffer_desc *, OM_uint32 *);
 OM_uint32 ssh_gssapi_accept_ctx(Gssctxt *,
@@ -131,7 +130,6 @@ char *ssh_gssapi_last_error(Gssctxt *, OM_uint32 *, OM_uint32 *);
 void ssh_gssapi_build_ctx(Gssctxt **);
 void ssh_gssapi_delete_ctx(Gssctxt **);
 OM_uint32 ssh_gssapi_sign(Gssctxt *, gss_buffer_t, gss_buffer_t);
-OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
 void ssh_gssapi_buildmic(Buffer *, const char *, const char *, const char *);
 int ssh_gssapi_check_mechanism(Gssctxt **, gss_OID, const char *);
 
@@ -143,6 +141,7 @@ char *ssh_gssapi_client_mechanisms(const char *host);
 char *ssh_gssapi_kex_mechs(gss_OID_set, ssh_gssapi_check_fn *, const char *);
 gss_OID ssh_gssapi_id_kex(Gssctxt *, char *, int);
 int ssh_gssapi_server_check_mech(Gssctxt **,gss_OID, const char *);
+OM_uint32 ssh_gssapi_server_ctx(Gssctxt **, gss_OID);
 int ssh_gssapi_userok(char *name);
 OM_uint32 ssh_gssapi_checkmic(Gssctxt *, gss_buffer_t, gss_buffer_t);
 void ssh_gssapi_do_child(char ***, u_int *);
index 4cdcb7a43d95d0d28ab6e67b6a940ec49243f843..814bcb66e9760f855db653af85d5ff03523990c1 100644 (file)
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-keysign.8,v 1.8 2006/02/24 20:22:16 jmc Exp $
+.\" $OpenBSD: ssh-keysign.8,v 1.9 2007/05/31 19:20:16 jmc Exp $
 .\"
 .\" Copyright (c) 2002 Markus Friedl.  All rights reserved.
 .\"
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 24, 2002
+.Dd $Mdocdate: June 5 2007 $
 .Dt SSH-KEYSIGN 8
 .Os
 .Sh NAME
index 8520c3a62ee573396ddf36ee86bfb925a7f259f2..8b1c4b4f47bf034f52ce117dceaebd24daa3b361 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <stdarg.h>
 #include <stddef.h>
+#include <string.h>
 
 #include <netinet/in.h>
 #include <arpa/inet.h>
index b87ab417165c325742e72bd7f494ba82c8dce363..1bf6b5e1c7af9592393935242cd0901213d88caa 100644 (file)
@@ -34,8 +34,8 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $OpenBSD: ssh.1,v 1.266 2006/12/11 21:25:46 markus Exp $
-.Dd September 25, 1999
+.\" $OpenBSD: ssh.1,v 1.270 2007/06/12 13:43:55 jmc Exp $
+.Dd $Mdocdate: June 12 2007 $
 .Dt SSH 1
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .Nd OpenSSH SSH client (remote login program)
 .Sh SYNOPSIS
 .Nm ssh
-.Op Fl 1246AaCfgkMNnqsTtVvXxY
+.Op Fl 1246AaCfgKkMNnqsTtVvXxY
 .Op Fl b Ar bind_address
 .Op Fl c Ar cipher_spec
 .Oo Fl D\ \&
@@ -315,6 +315,9 @@ It is possible to have multiple
 .Fl i
 options (and multiple identities specified in
 configuration files).
+.It Fl K
+Enables GSSAPI-based authentication and forwarding (delegation) of GSSAPI
+credentials to the server.
 .It Fl k
 Disables forwarding (delegation) of GSSAPI credentials to the server.
 .It Fl L Xo
@@ -674,7 +677,7 @@ Both protocols support similar authentication methods,
 but protocol 2 is preferred since
 it provides additional mechanisms for confidentiality
 (the traffic is encrypted using AES, 3DES, Blowfish, CAST128, or Arcfour)
-and integrity (hmac-md5, hmac-sha1, hmac-ripemd160).
+and integrity (hmac-md5, hmac-sha1, umac-64, hmac-ripemd160).
 Protocol 1 lacks a strong mechanism for ensuring the
 integrity of the connection.
 .Pp
index c9a2664a496d8d327b2a7640742c9a4758f3fd55..ec97e35f70e2577894236688ae0219b743302bad 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.295 2007/01/03 03:01:40 stevesk Exp $ */
+/* $OpenBSD: ssh.c,v 1.301 2007/08/07 07:32:53 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -185,7 +185,7 @@ static void
 usage(void)
 {
        fprintf(stderr,
-"usage: ssh [-1246AaCfgkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]\n"
+"usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]\n"
 "           [-D [bind_address:]port] [-e escape_char] [-F configfile]\n"
 "           [-i identity_file] [-L [bind_address:]port:host:hostport]\n"
 "           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n"
@@ -272,7 +272,7 @@ main(int ac, char **av)
 
  again:
        while ((opt = getopt(ac, av,
-           "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:L:MNO:PR:S:TVw:XY")) != -1) {
+           "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) {
                switch (opt) {
                case '1':
                        options.protocol = SSH_PROTO_1;
@@ -326,6 +326,10 @@ main(int ac, char **av)
                case 'k':
                        options.gss_deleg_creds = 0;
                        break;
+               case 'K':
+                       options.gss_authentication = 1;
+                       options.gss_deleg_creds = 1;
+                       break;
                case 'i':
                        if (stat(optarg, &st) < 0) {
                                fprintf(stderr, "Warning: Identity file %s "
@@ -884,6 +888,17 @@ ssh_init_forwarding(void)
                                    "forwarding.");
                }
        }
+
+       /* Initiate tunnel forwarding. */
+       if (options.tun_open != SSH_TUNMODE_NO) {
+               if (client_request_tun_fwd(options.tun_open,
+                   options.tun_local, options.tun_remote) == -1) {
+                       if (options.exit_on_forward_failure)
+                               fatal("Could not request tunnel forwarding.");
+                       else
+                               error("Could not request tunnel forwarding.");
+               }
+       }                       
 }
 
 static void
@@ -1146,38 +1161,6 @@ ssh_session2_setup(int id, void *arg)
                packet_send();
        }
 
-       if (options.tun_open != SSH_TUNMODE_NO) {
-               Channel *c;
-               int fd;
-
-               debug("Requesting tun.");
-               if ((fd = tun_open(options.tun_local,
-                   options.tun_open)) >= 0) {
-                       if(options.hpn_disabled)
-                               c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
-                                   CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
-                                   0, "tun", 1);
-                       else
-                               c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
-                                   options.hpn_buffer_size, CHAN_TCP_PACKET_DEFAULT,
-                                   0, "tun", 1);
-                       c->datagram = 1;
-#if defined(SSH_TUN_FILTER)
-                       if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
-                               channel_register_filter(c->self, sys_tun_infilter,
-                                   sys_tun_outfilter);
-#endif
-                       packet_start(SSH2_MSG_CHANNEL_OPEN);
-                       packet_put_cstring("tun@openssh.com");
-                       packet_put_int(c->self);
-                       packet_put_int(c->local_window_max);
-                       packet_put_int(c->local_maxpacket);
-                       packet_put_int(options.tun_open);
-                       packet_put_int(options.tun_remote);
-                       packet_send();
-               }
-       }
-
        client_session2_setup(id, tty_flag, subsystem_flag, getenv("TERM"),
            NULL, fileno(stdin), &command, environ, &ssh_subsystem_reply);
 
@@ -1304,7 +1287,6 @@ ssh_session2(void)
 
        /* XXX should be pre-session */
        ssh_init_forwarding();
-       ssh_control_listener();
 
        if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN))
                id = ssh_session2_open();
@@ -1314,6 +1296,9 @@ ssh_session2(void)
            options.permit_local_command)
                ssh_local_cmd(options.local_command);
 
+       /* Start listening for multiplex clients */
+       ssh_control_listener();
+
        /* If requested, let ssh continue in the background. */
        if (fork_after_authentication_flag)
                if (daemon(1, 1) < 0)
@@ -1410,7 +1395,7 @@ static void
 control_client(const char *path)
 {
        struct sockaddr_un addr;
-       int i, r, fd, sock, exitval, num_env, addr_len;
+       int i, r, fd, sock, exitval[2], num_env, addr_len;
        Buffer m;
        char *term;
        extern char **environ;
@@ -1570,29 +1555,44 @@ control_client(const char *path)
        if (tty_flag)
                enter_raw_mode();
 
-       /* Stick around until the controlee closes the client_fd */
-       exitval = 0;
-       for (;!control_client_terminate;) {
-               r = read(sock, &exitval, sizeof(exitval));
+       /*
+        * Stick around until the controlee closes the client_fd.
+        * Before it does, it is expected to write this process' exit
+        * value (one int). This process must read the value and wait for
+        * the closure of the client_fd; if this one closes early, the 
+        * multiplex master will terminate early too (possibly losing data).
+        */
+       exitval[0] = 0;
+       for (i = 0; !control_client_terminate && i < (int)sizeof(exitval);) {
+               r = read(sock, (char *)exitval + i, sizeof(exitval) - i);
                if (r == 0) {
                        debug2("Received EOF from master");
                        break;
                }
-               if (r > 0)
-                       debug2("Received exit status from master %d", exitval);
-               if (r == -1 && errno != EINTR)
+               if (r == -1) {
+                       if (errno == EINTR)
+                               continue;
                        fatal("%s: read %s", __func__, strerror(errno));
+               }
+               i += r;
        }
 
-       if (control_client_terminate)
-               debug2("Exiting on signal %d", control_client_terminate);
-
        close(sock);
-
        leave_raw_mode();
+       if (i > (int)sizeof(int))
+               fatal("%s: master returned too much data (%d > %lu)",
+                   __func__, i, sizeof(int));
+       if (control_client_terminate) {
+               debug2("Exiting on signal %d", control_client_terminate);
+               exitval[0] = 255;
+       } else if (i < (int)sizeof(int)) {
+               debug2("Control master terminated unexpectedly");
+               exitval[0] = 255;
+       } else
+               debug2("Received exit status from master %d", exitval[0]);
 
        if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET)
-               fprintf(stderr, "Connection to master closed.\r\n");
+               fprintf(stderr, "Shared connection to %s closed.\r\n", host);
 
-       exit(exitval);
+       exit(exitval[0]);
 }
index 723fbe911b44f02f0b07b10df88e8c5e7bf3719f..873acdfc793320f2356f8e1c8bbbc4da33d51306 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: ssh_config,v 1.22 2006/05/29 12:56:33 dtucker Exp $
+#      $OpenBSD: ssh_config,v 1.23 2007/06/08 04:40:40 pvalchev Exp $
 
 # This is the ssh client system-wide configuration file.  See
 # ssh_config(5) for more information.  This file provides defaults for
@@ -40,6 +40,7 @@
 #   Protocol 2,1
 #   Cipher 3des
 #   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
+#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
 #   EscapeChar ~
 #   Tunnel no
 #   TunnelDevice any:any
index f6808142d3c4baaec41cc81290e2dab140edf754..34d815e421e49f1b5e71780916cc12e0c477f535 100644 (file)
@@ -34,8 +34,8 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $OpenBSD: ssh_config.5,v 1.98 2007/01/10 13:23:22 jmc Exp $
-.Dd September 25, 1999
+.\" $OpenBSD: ssh_config.5,v 1.102 2007/08/15 12:13:41 stevesk Exp $
+.Dd $Mdocdate: August 15 2007 $
 .Dt SSH_CONFIG 5
 .Os
 .Sh NAME
@@ -393,7 +393,7 @@ data).
 Specifies whether
 .Xr ssh 1
 should terminate the connection if it cannot set up all requested
-dynamic, local, and remote port forwardings.
+dynamic, tunnel, local, and remote port forwardings.
 The argument must be
 .Dq yes
 or
@@ -664,7 +664,10 @@ The MAC algorithm is used in protocol version 2
 for data integrity protection.
 Multiple algorithms must be comma-separated.
 The default is:
-.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
+.Bd -literal -offset indent
+hmac-md5,hmac-sha1,umac-64@openssh.com,
+hmac-ripemd160,hmac-sha1-96,hmac-md5-96
+.Ed
 .It Cm NoHostAuthenticationForLocalhost
 This option can be used if the home directory is shared across machines.
 In this case localhost will refer to a different machine on each of
index 4a18b0582bc021e231913a3589b6b1a440b3c594..16401c63f1fdc0df0f8b77f78124430d1e0471aa 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.162 2006/08/30 00:06:51 dtucker Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.164 2007/05/17 23:53:41 jolan Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -31,6 +31,7 @@
 #include <sys/stat.h>
 
 #include <errno.h>
+#include <netdb.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdarg.h>
@@ -1510,7 +1511,7 @@ userauth_hostbased(Authctxt *authctxt)
        Sensitive *sensitive = authctxt->sensitive;
        Buffer b;
        u_char *signature, *blob;
-       char *chost, *pkalg, *p;
+       char *chost, *pkalg, *p, myname[NI_MAXHOST];
        const char *service;
        u_int blen, slen;
        int ok, i, len, found = 0;
@@ -1534,7 +1535,16 @@ userauth_hostbased(Authctxt *authctxt)
                return 0;
        }
        /* figure out a name for the client host */
-       p = get_local_name(packet_get_connection_in());
+       p = NULL;
+       if (packet_connection_is_on_socket())
+               p = get_local_name(packet_get_connection_in());
+       if (p == NULL) {
+               if (gethostname(myname, sizeof(myname)) == -1) {
+                       verbose("userauth_hostbased: gethostname: %s", 
+                           strerror(errno));
+               } else
+                       p = xstrdup(myname);
+       }
        if (p == NULL) {
                error("userauth_hostbased: cannot get local ipaddr/name");
                key_free(private);
index 522279ee351d4594db1033ae8746c59035510f46..12c2cefec6b7e4d6c9db7b38ca0a1c0185a8433d 100644 (file)
@@ -34,8 +34,8 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $OpenBSD: sshd.8,v 1.234 2006/08/21 08:15:57 dtucker Exp $
-.Dd September 25, 1999
+.\" $OpenBSD: sshd.8,v 1.237 2007/06/07 19:37:34 pvalchev Exp $
+.Dd $Mdocdate: August 16 2007 $
 .Dt SSHD 8
 .Os
 .Sh NAME
 .Nm
 (OpenSSH Daemon) is the daemon program for
 .Xr ssh 1 .
-Together these programs replace rlogin and rsh, and
-provide secure encrypted communications between two untrusted hosts
+Together these programs replace
+.Xr rlogin 1
+and
+.Xr rsh 1 ,
+and provide secure encrypted communications between two untrusted hosts
 over an insecure network.
 .Pp
 .Nm
@@ -117,7 +120,7 @@ Maximum is 3.
 When this option is specified,
 .Nm
 will send the output to the standard error instead of the system log.
-.It Fl f Ar configuration_file
+.It Fl f Ar config_file
 Specifies the name of the configuration file.
 The default is
 .Pa /etc/ssh/sshd_config .
@@ -273,7 +276,7 @@ The client selects the encryption algorithm
 to use from those offered by the server.
 Additionally, session integrity is provided
 through a cryptographic message authentication code
-(hmac-sha1 or hmac-md5).
+(hmac-md5, hmac-sha1, umac-64 or hmac-ripemd160).
 .Pp
 Finally, the server and the client enter an authentication dialog.
 The client tries to authenticate itself using
@@ -299,8 +302,9 @@ on Tru64,
 a leading
 .Ql \&*LOCKED\&*
 on FreeBSD and a leading
-.Ql \&!!
-on Linux).  If there is a requirement to disable password authentication
+.Ql \&!
+on most Linuxes).
+If there is a requirement to disable password authentication
 for the account while allowing still public-key, then the passwd field
 should be set to something other than these values (eg
 .Ql NP
@@ -758,15 +762,6 @@ This file is used in exactly the same way as
 but allows host-based authentication without permitting login with
 rlogin/rsh.
 .Pp
-.It /etc/ssh/ssh_known_hosts
-Systemwide list of known host keys.
-This file should be prepared by the
-system administrator to contain the public host keys of all machines in the
-organization.
-The format of this file is described above.
-This file should be writable only by root/the owner and
-should be world-readable.
-.Pp
 .It /etc/ssh/ssh_host_key
 .It /etc/ssh/ssh_host_dsa_key
 .It /etc/ssh/ssh_host_rsa_key
@@ -790,6 +785,15 @@ the user so their contents can be copied to known hosts files.
 These files are created using
 .Xr ssh-keygen 1 .
 .Pp
+.It /etc/ssh/ssh_known_hosts
+Systemwide list of known host keys.
+This file should be prepared by the
+system administrator to contain the public host keys of all machines in the
+organization.
+The format of this file is described above.
+This file should be writable only by root/the owner and
+should be world-readable.
+.Pp
 .It /etc/ssh/sshd_config
 Contains configuration data for
 .Nm sshd .
@@ -826,6 +830,7 @@ The content of this file is not sensitive; it can be world-readable.
 .Xr ssh-add 1 ,
 .Xr ssh-agent 1 ,
 .Xr ssh-keygen 1 ,
+.Xr ssh-keyscan 1 ,
 .Xr chroot 2 ,
 .Xr hosts_access 5 ,
 .Xr login.conf 5 ,
index f4da90023349850b858c575e85a7f73534554620..4954d5ccbe4f91e76ea4fd865cbeeb2cac067251 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.349 2007/02/21 11:00:05 dtucker Exp $ */
+/* $OpenBSD: sshd.c,v 1.351 2007/05/22 10:18:52 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1432,6 +1432,10 @@ main(int ac, char **av)
        /* Fill in default values for those options not explicitly set. */
        fill_default_server_options(&options);
 
+       /* challenge-response is implemented via keyboard interactive */
+       if (options.challenge_response_authentication)
+               options.kbd_interactive_authentication = 1;
+
        /* set default channel AF */
        channel_set_af(options.address_family);
 
index 3f98f92679113418c1d51037a93ff1d4f84a66ed..37f49b89193bdd63449e573dc21b814272943f01 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: sshd_config,v 1.74 2006/07/19 13:07:10 dtucker Exp $
+#      $OpenBSD: sshd_config,v 1.75 2007/03/19 01:01:29 djm Exp $
 
 # This is the sshd server system-wide configuration file.  See
 # sshd_config(5) for more information.
 # default value.
 
 #Port 22
-#Protocol 2,1
 #AddressFamily any
 #ListenAddress 0.0.0.0
 #ListenAddress ::
 
+# Disable legacy (protocol version 1) support in the server for new
+# installations. In future the default will change to require explicit
+# activation of protocol 1
+Protocol 2
+
 # HostKey for protocol version 1
 #HostKey /etc/ssh/ssh_host_key
 # HostKeys for protocol version 2
index a1c0f6f001a740e406d1ca745ab67400d53d5eda..15af4a817480f9a02c0e4f14d5487c896ae0b93d 100644 (file)
@@ -34,8 +34,8 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $OpenBSD: sshd_config.5,v 1.74 2007/03/01 16:19:33 jmc Exp $
-.Dd September 25, 1999
+.\" $OpenBSD: sshd_config.5,v 1.77 2007/06/08 07:48:09 jmc Exp $
+.Dd $Mdocdate: June 11 2007 $
 .Dt SSHD_CONFIG 5
 .Os
 .Sh NAME
@@ -528,7 +528,10 @@ The MAC algorithm is used in protocol version 2
 for data integrity protection.
 Multiple algorithms must be comma-separated.
 The default is:
-.Dq hmac-md5,hmac-sha1,hmac-ripemd160,hmac-sha1-96,hmac-md5-96 .
+.Bd -literal -offset indent
+hmac-md5,hmac-sha1,umac-64@openssh.com,
+hmac-ripemd160,hmac-sha1-96,hmac-md5-96
+.Ed
 .It Cm Match
 Introduces a conditional block.
 If all of the criteria on the
index 97aa98ff66c8980489648d009ed9b1b8d2e54f72..7084760272e0a4ed3098d3ccd2fe4cad45321454 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: version.h,v 1.49 2007/03/06 10:13:14 djm Exp $ */
+/* $OpenBSD: version.h,v 1.50 2007/08/15 08:16:49 markus Exp $ */
 
 #ifdef GSI
 #define GSI_VERSION    " GSI"
@@ -18,9 +18,9 @@
 #define MGLUE_VERSION  ""
 #endif
 
-#define NCSA_VERSION   " NCSA_GSSAPI_20070314"
+#define NCSA_VERSION   " NCSA_GSSAPI_20070911"
 
-#define SSH_VERSION    "OpenSSH_4.6"
+#define SSH_VERSION    "OpenSSH_4.7"
 
 #define SSH_PORTABLE   "p1"
 #define SSH_HPN         "-hpn12v17"
This page took 0.168124 seconds and 5 git commands to generate.