From 14a9a85973738178bd0b630b8ead765f0e28b606 Mon Sep 17 00:00:00 2001 From: djm Date: Tue, 29 Aug 2000 00:33:50 +0000 Subject: [PATCH] - More OpenBSD updates: - deraadt@cvs.openbsd.org 2000/08/24 15:46:59 [scp.c] off_t in sink, to fix files > 2GB, i think, test is still running ;-) - deraadt@cvs.openbsd.org 2000/08/25 10:10:06 [session.c] Wall - markus@cvs.openbsd.org 2000/08/26 04:33:43 [compat.c] ssh.com-2.3.0 - markus@cvs.openbsd.org 2000/08/27 12:18:05 [compat.c] compatibility with future ssh.com versions - deraadt@cvs.openbsd.org 2000/08/27 21:50:55 [auth-krb4.c session.c ssh-add.c sshconnect.c uidswap.c] print uid/gid as unsigned - markus@cvs.openbsd.org 2000/08/28 13:51:00 [ssh.c] enable -n and -f for ssh2 - markus@cvs.openbsd.org 2000/08/28 14:19:53 [ssh.c] allow combination of -N and -f - markus@cvs.openbsd.org 2000/08/28 14:20:56 [util.c] util.c - markus@cvs.openbsd.org 2000/08/28 14:22:02 [util.c] undo - markus@cvs.openbsd.org 2000/08/28 14:23:38 [util.c] don't complain if setting NONBLOCK fails with ENODEV --- ChangeLog | 31 +++++++++++++++++++++++++++++++ acconfig.h | 1 + auth-krb4.c | 4 ++-- compat.c | 5 +++-- configure.in | 14 +++++++++++++- defines.h | 5 +++++ scp.c | 5 +++-- session.c | 8 ++++---- ssh-add.c | 5 +++-- ssh-agent.1 | 2 +- ssh.c | 22 +++++++++++++--------- sshconnect.c | 8 ++++---- uidswap.c | 12 ++++++------ util.c | 6 ++++-- 14 files changed, 93 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 19e8ca3b..79bdcd50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,37 @@ - (djm) Fix ^C ignored issue on Solaris. Diagnosis from Gert Doering , John Horne and Garrick James + - More OpenBSD updates: + - deraadt@cvs.openbsd.org 2000/08/24 15:46:59 + [scp.c] + off_t in sink, to fix files > 2GB, i think, test is still running ;-) + - deraadt@cvs.openbsd.org 2000/08/25 10:10:06 + [session.c] + Wall + - markus@cvs.openbsd.org 2000/08/26 04:33:43 + [compat.c] + ssh.com-2.3.0 + - markus@cvs.openbsd.org 2000/08/27 12:18:05 + [compat.c] + compatibility with future ssh.com versions + - deraadt@cvs.openbsd.org 2000/08/27 21:50:55 + [auth-krb4.c session.c ssh-add.c sshconnect.c uidswap.c] + print uid/gid as unsigned + - markus@cvs.openbsd.org 2000/08/28 13:51:00 + [ssh.c] + enable -n and -f for ssh2 + - markus@cvs.openbsd.org 2000/08/28 14:19:53 + [ssh.c] + allow combination of -N and -f + - markus@cvs.openbsd.org 2000/08/28 14:20:56 + [util.c] + util.c + - markus@cvs.openbsd.org 2000/08/28 14:22:02 + [util.c] + undo + - markus@cvs.openbsd.org 2000/08/28 14:23:38 + [util.c] + don't complain if setting NONBLOCK fails with ENODEV 20000823 - (djm) Define USE_PIPES to avoid socketpair problems on HPUX 10 and SunOS 4 diff --git a/acconfig.h b/acconfig.h index eeee4eaf..c16ec2bf 100644 --- a/acconfig.h +++ b/acconfig.h @@ -203,6 +203,7 @@ #undef MAIL_DIRECTORY /* Data types */ +#undef HAVE_U_INT #undef HAVE_INTXX_T #undef HAVE_U_INTXX_T #undef HAVE_UINTXX_T diff --git a/auth-krb4.c b/auth-krb4.c index ae2b2a3d..8715dc0d 100644 --- a/auth-krb4.c +++ b/auth-krb4.c @@ -9,7 +9,7 @@ #include "ssh.h" #include "servconf.h" -RCSID("$OpenBSD: auth-krb4.c,v 1.16 2000/08/02 17:27:04 provos Exp $"); +RCSID("$OpenBSD: auth-krb4.c,v 1.17 2000/08/28 03:50:54 deraadt Exp $"); #ifdef KRB4 char *ticket = NULL; @@ -154,7 +154,7 @@ krb4_init(uid_t uid) if (lstat("/ticket", &st) != -1) tkt_root = "/ticket/"; #endif /* AFS */ - snprintf(ticket, MAXPATHLEN, "%s%d_%d", tkt_root, uid, getpid()); + snprintf(ticket, MAXPATHLEN, "%s%u_%d", tkt_root, uid, getpid()); (void) krb_set_tkt_string(ticket); } /* Register ticket cleanup in case of fatal error. */ diff --git a/compat.c b/compat.c index 595a0a37..5d3940ab 100644 --- a/compat.c +++ b/compat.c @@ -28,7 +28,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: compat.c,v 1.19 2000/07/09 01:27:32 ho Exp $"); +RCSID("$OpenBSD: compat.c,v 1.21 2000/08/27 18:18:04 markus Exp $"); #include "ssh.h" #include "packet.h" @@ -61,11 +61,12 @@ compat_datafellows(const char *version) char *version; int bugs; } check[] = { - {"2.2.0", SSH_BUG_HMAC|SSH_COMPAT_SESSIONID_ENCODING}, {"2.1.0", SSH_BUG_SIGBLOB|SSH_BUG_HMAC}, {"2.0.1", SSH_BUG_SIGBLOB|SSH_BUG_HMAC|SSH_BUG_PUBKEYAUTH|SSH_BUG_X11FWD}, + {"2.", SSH_BUG_HMAC|SSH_COMPAT_SESSIONID_ENCODING}, {NULL, 0} }; + /* process table, return first match */ for (i = 0; check[i].version; i++) { len = strlen(check[i].version); if (strlen(version) >= len && diff --git a/configure.in b/configure.in index 02287b80..824ff5c0 100644 --- a/configure.in +++ b/configure.in @@ -465,6 +465,19 @@ AC_CHECK_SIZEOF(long int, 4) AC_CHECK_SIZEOF(long long int, 8) # More checks for data types +AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ + AC_TRY_COMPILE( + [ #include ], + [ u_int a; a = 1;], + [ ac_cv_have_u_int="yes" ], + [ ac_cv_have_u_int="no" ] + ) +]) +if test "x$ac_cv_have_u_int" = "xyes" ; then + AC_DEFINE(HAVE_U_INT) + have_u_int=1 +fi + AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [ AC_TRY_COMPILE( [ #include ], @@ -491,7 +504,6 @@ if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then have_u_intxx_t=1 fi - if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ test "x$ac_cv_header_sys_bitypes_h" = "xyes") then diff --git a/defines.h b/defines.h index 1fe74a92..6bbb5166 100644 --- a/defines.h +++ b/defines.h @@ -102,6 +102,11 @@ enum /* If sys/types.h does not supply intXX_t, supply them ourselves */ /* (or die trying) */ + +#ifndef HAVE_U_INT +typedef unsigned int u_int; +#endif + #ifndef HAVE_INTXX_T # if (SIZEOF_CHAR == 1) typedef char int8_t; diff --git a/scp.c b/scp.c index d2e4224b..5a5d0f46 100644 --- a/scp.c +++ b/scp.c @@ -47,7 +47,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: scp.c,v 1.35 2000/08/19 02:50:07 deraadt Exp $"); +RCSID("$OpenBSD: scp.c,v 1.36 2000/08/24 21:46:59 deraadt Exp $"); #include "ssh.h" #include "xmalloc.h" @@ -680,7 +680,8 @@ sink(argc, argv) BUF *bp; off_t i, j; int amt, count, exists, first, mask, mode, ofd, omode; - int setimes, size, targisdir, wrerrno = 0; + off_t size; + int setimes, targisdir, wrerrno = 0; char ch, *cp, *np, *targ, *why, *vect[1], buf[2048]; struct utimbuf ut; int dummy_usec; diff --git a/session.c b/session.c index 82096c3a..4a77eef6 100644 --- a/session.c +++ b/session.c @@ -8,7 +8,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: session.c,v 1.29 2000/08/21 16:23:31 millert Exp $"); +RCSID("$OpenBSD: session.c,v 1.31 2000/08/28 03:50:54 deraadt Exp $"); #include "xmalloc.h" #include "ssh.h" @@ -1014,7 +1014,7 @@ do_child(const char *command, struct passwd * pw, const char *term, #endif /* HAVE_OSF_SIA */ if (getuid() != pw->pw_uid || geteuid() != pw->pw_uid) - fatal("Failed to set uids to %d.", (int) pw->pw_uid); + fatal("Failed to set uids to %u.", (u_int) pw->pw_uid); } /* * Get the shell from the password data. An empty shell field is @@ -1229,7 +1229,7 @@ do_child(const char *command, struct passwd * pw, const char *term, if (screen != NULL) fprintf(stderr, "Adding %.*s/unix%s %s %s\n", - screen-display, display, + (int)(screen-display), display, screen, auth_proto, auth_data); } snprintf(cmd, sizeof cmd, "%s -q -", @@ -1240,7 +1240,7 @@ do_child(const char *command, struct passwd * pw, const char *term, auth_proto, auth_data); if (screen != NULL) fprintf(f, "add %.*s/unix%s %s %s\n", - screen-display, display, + (int)(screen-display), display, screen, auth_proto, auth_data); pclose(f); } else { diff --git a/ssh-add.c b/ssh-add.c index a51f477a..e24a94d7 100644 --- a/ssh-add.c +++ b/ssh-add.c @@ -10,7 +10,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh-add.c,v 1.19 2000/08/19 21:34:43 markus Exp $"); +RCSID("$OpenBSD: ssh-add.c,v 1.20 2000/08/28 03:50:54 deraadt Exp $"); #include #include @@ -260,7 +260,8 @@ main(int argc, char **argv) if (no_files) { pw = getpwuid(getuid()); if (!pw) { - fprintf(stderr, "No user found with uid %d\n", (int) getuid()); + fprintf(stderr, "No user found with uid %u\n", + (u_int)getuid()); ssh_close_authentication_connection(ac); exit(1); } diff --git a/ssh-agent.1 b/ssh-agent.1 index 0aa1ecf4..3de67ebf 100644 --- a/ssh-agent.1 +++ b/ssh-agent.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ssh-agent.1,v 1.14 2000/08/19 21:34:43 markus Exp $ +.\" $OpenBSD: ssh-agent.1,v 1.15 2000/08/25 16:16:15 deraadt Exp $ .\" .\" -*- nroff -*- .\" diff --git a/ssh.c b/ssh.c index 39512c5f..71d8f96f 100644 --- a/ssh.c +++ b/ssh.c @@ -11,7 +11,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.61 2000/08/20 18:42:40 millert Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.63 2000/08/28 20:19:52 markus Exp $"); #include #include @@ -461,7 +461,7 @@ main(int ac, char **av) } /* Cannot fork to background if no command. */ - if (fork_after_authentication_flag && buffer_len(&command) == 0) + if (fork_after_authentication_flag && buffer_len(&command) == 0 && !no_shell_flag) fatal("Cannot fork into background without a command to execute."); /* Allocate a tty by default if no command specified. */ @@ -959,21 +959,25 @@ ssh_session2(void) int window, packetmax, id; int in, out, err; - /* If requested, let ssh continue in the background. */ - if (fork_after_authentication_flag) - if (daemon(1, 1) < 0) - fatal("daemon() failed: %.200s", strerror(errno)); - - in = dup(STDIN_FILENO); + if (stdin_null_flag) { + in = open("/dev/null", O_RDONLY); + } else { + in = dup(STDIN_FILENO); + } out = dup(STDOUT_FILENO); err = dup(STDERR_FILENO); if (in < 0 || out < 0 || err < 0) - fatal("dump in/out/err failed"); + fatal("dup() in/out/err failed"); /* should be pre-session */ init_local_fwd(); + /* If requested, let ssh continue in the background. */ + if (fork_after_authentication_flag) + if (daemon(1, 1) < 0) + fatal("daemon() failed: %.200s", strerror(errno)); + window = 32*1024; if (tty_flag) { packetmax = window/8; diff --git a/sshconnect.c b/sshconnect.c index 79b6856d..21eff6c6 100644 --- a/sshconnect.c +++ b/sshconnect.c @@ -8,7 +8,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: sshconnect.c,v 1.76 2000/06/17 20:30:10 markus Exp $"); +RCSID("$OpenBSD: sshconnect.c,v 1.77 2000/08/28 03:50:54 deraadt Exp $"); #include #include @@ -193,8 +193,8 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, int gaierr; struct linger linger; - debug("ssh_connect: getuid %d geteuid %d anon %d", - (int) getuid(), (int) geteuid(), anonymous); + debug("ssh_connect: getuid %u geteuid %u anon %d", + (u_int) getuid(), (u_int) geteuid(), anonymous); /* Get default port if port has not been set. */ if (port == 0) { @@ -669,7 +669,7 @@ ssh_login(int host_key_valid, RSA *own_host_key, const char *orighost, /* Get local user name. Use it as server user if no user name was given. */ pw = getpwuid(original_real_uid); if (!pw) - fatal("User id %d not found from user database.", original_real_uid); + fatal("User id %u not found from user database.", original_real_uid); local_user = xstrdup(pw->pw_name); server_user = options.user ? options.user : local_user; diff --git a/uidswap.c b/uidswap.c index 7745a976..96ff931e 100644 --- a/uidswap.c +++ b/uidswap.c @@ -7,7 +7,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: uidswap.c,v 1.7 2000/06/20 01:39:45 markus Exp $"); +RCSID("$OpenBSD: uidswap.c,v 1.8 2000/08/28 03:50:54 deraadt Exp $"); #include "ssh.h" #include "uidswap.h" @@ -47,15 +47,15 @@ temporarily_use_uid(uid_t uid) /* Set the effective uid to the given (unprivileged) uid. */ if (seteuid(uid) == -1) - debug("seteuid %d: %.100s", (int) uid, strerror(errno)); + debug("seteuid %u: %.100s", (u_int) uid, strerror(errno)); #else /* SAVED_IDS_WORK_WITH_SETUID */ /* Propagate the privileged uid to all of our uids. */ if (setuid(geteuid()) < 0) - debug("setuid %d: %.100s", (int) geteuid(), strerror(errno)); + debug("setuid %u: %.100s", (u_int) geteuid(), strerror(errno)); /* Set the effective uid to the given (unprivileged) uid. */ if (seteuid(uid) == -1) - debug("seteuid %d: %.100s", (int) uid, strerror(errno)); + debug("seteuid %u: %.100s", (u_int) uid, strerror(errno)); #endif /* SAVED_IDS_WORK_WITH_SETEUID */ } @@ -68,7 +68,7 @@ restore_uid() #ifdef SAVED_IDS_WORK_WITH_SETEUID /* Set the effective uid back to the saved uid. */ if (seteuid(saved_euid) < 0) - debug("seteuid %d: %.100s", (int) saved_euid, strerror(errno)); + debug("seteuid %u: %.100s", (u_int) saved_euid, strerror(errno)); #else /* SAVED_IDS_WORK_WITH_SETEUID */ /* * We are unable to restore the real uid to its unprivileged value. @@ -95,5 +95,5 @@ permanently_set_uid(uid_t uid) #endif /* WITH_IRIX_AUDIT */ if (setuid(uid) < 0) - debug("setuid %d: %.100s", (int) uid, strerror(errno)); + debug("setuid %u: %.100s", (u_int) uid, strerror(errno)); } diff --git a/util.c b/util.c index 3b221924..16c8c507 100644 --- a/util.c +++ b/util.c @@ -1,5 +1,5 @@ #include "includes.h" -RCSID("$OpenBSD: util.c,v 1.1 2000/08/01 19:01:42 provos Exp $"); +RCSID("$OpenBSD: util.c,v 1.4 2000/08/28 20:23:37 markus Exp $"); #include "ssh.h" @@ -37,7 +37,9 @@ set_nonblock(int fd) debug("fd %d setting O_NONBLOCK", fd); val |= O_NONBLOCK; if (fcntl(fd, F_SETFL, val) == -1) - error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno)); + if (errno != ENODEV) + error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", + fd, strerror(errno)); } /* Characters considered whitespace in strsep calls. */ -- 2.45.1