diff options
author | jp161948 <none@none> | 2007-12-05 05:48:59 -0800 |
---|---|---|
committer | jp161948 <none@none> | 2007-12-05 05:48:59 -0800 |
commit | 743541abe0006f1be576e21a976c36fb2e87accc (patch) | |
tree | ec0b61e1ad2f7a1f4ce31a88d3e5adc03b9b13d5 /usr/src | |
parent | cfae96c24c7523c74c9efb583764b812b6b309c5 (diff) | |
download | illumos-gate-743541abe0006f1be576e21a976c36fb2e87accc.tar.gz |
6496972 misleading error message is printed if X11 forwarding setup fails
6504798 ssh fails for users when ngroups_max=32
6631713 ssh-socks5-proxy-connect is too greedy during initial negotiation
6635397 remove bsd-nextstep files from SunSSH
--HG--
rename : usr/src/cmd/ssh/include/bsd-nextstep.h => deleted_files/usr/src/cmd/ssh/include/bsd-nextstep.h
rename : usr/src/cmd/ssh/libopenbsd-compat/common/bsd-nextstep.c => deleted_files/usr/src/cmd/ssh/libopenbsd-compat/common/bsd-nextstep.c
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/ssh/include/bsd-nextstep.h | 70 | ||||
-rw-r--r-- | usr/src/cmd/ssh/include/config.h | 3 | ||||
-rw-r--r-- | usr/src/cmd/ssh/include/defines.h | 11 | ||||
-rw-r--r-- | usr/src/cmd/ssh/include/includes.h | 6 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libopenbsd-compat/Makefile.com | 1 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libopenbsd-compat/common/bsd-nextstep.c | 105 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat | 8 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libssh/common/llib-lssh | 1 | ||||
-rw-r--r-- | usr/src/cmd/ssh/libssh/common/uidswap.c | 14 | ||||
-rw-r--r-- | usr/src/cmd/ssh/ssh-socks5-proxy-connect/ssh-socks5-proxy-connect.c | 18 | ||||
-rw-r--r-- | usr/src/cmd/ssh/sshd/groupaccess.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/ssh/sshd/session.c | 5 |
12 files changed, 36 insertions, 210 deletions
diff --git a/usr/src/cmd/ssh/include/bsd-nextstep.h b/usr/src/cmd/ssh/include/bsd-nextstep.h deleted file mode 100644 index 4aa776ee6e..0000000000 --- a/usr/src/cmd/ssh/include/bsd-nextstep.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - */ - -#ifndef _BSD_NEXTSTEP_H -#define _BSD_NEXTSTEP_H - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef __cplusplus -extern "C" { -#endif - - -/* $Id: bsd-nextstep.h,v 1.6 2001/03/19 13:42:22 mouring Exp $ */ - -#ifdef HAVE_NEXT -#include <sys/dir.h> - -/* NGROUPS_MAX is behind -lposix. Use the BSD version which is NGROUPS */ -#undef NGROUPS_MAX -#define NGROUPS_MAX NGROUPS - -/* NeXT's readdir() is BSD (struct direct) not POSIX (struct dirent) */ -#define dirent direct - -/* Swap out NeXT's BSD wait() for a more POSIX complient one */ -pid_t posix_wait(int *status); -#define wait(a) posix_wait(a) - -/* #ifdef wrapped functions that need defining for clean compiling */ -pid_t getppid(void); -void vhangup(void); -int innetgr(const char *netgroup, const char *host, const char *user, - const char *domain); - -/* TERMCAP */ -int tcgetattr(int fd, struct termios *t); -int tcsetattr(int fd, int opt, const struct termios *t); -int tcsetpgrp(int fd, pid_t pgrp); -speed_t cfgetospeed(const struct termios *t); -speed_t cfgetispeed(const struct termios *t); -int cfsetospeed(struct termios *t, int speed); -int cfsetispeed(struct termios *t, int speed); -#endif /* HAVE_NEXT */ - -#ifdef __cplusplus -} -#endif - -#endif /* _BSD_NEXTSTEP_H */ diff --git a/usr/src/cmd/ssh/include/config.h b/usr/src/cmd/ssh/include/config.h index a2a524204b..8c76573868 100644 --- a/usr/src/cmd/ssh/include/config.h +++ b/usr/src/cmd/ssh/include/config.h @@ -82,9 +82,6 @@ extern "C" { /* Define if you have a broken realpath. */ /* #undef BROKEN_REALPATH */ -/* Define if you are on NeXT */ -/* #undef HAVE_NEXT */ - /* Define if you are on NEWS-OS */ /* #undef HAVE_NEWS4 */ diff --git a/usr/src/cmd/ssh/include/defines.h b/usr/src/cmd/ssh/include/defines.h index 4b8bbebed6..893cc902fc 100644 --- a/usr/src/cmd/ssh/include/defines.h +++ b/usr/src/cmd/ssh/include/defines.h @@ -78,11 +78,14 @@ enum # define STDERR_FILENO 2 #endif -#ifndef NGROUPS_MAX /* Disable groupaccess if NGROUP_MAX is not set */ -#ifdef NGROUPS -#define NGROUPS_MAX NGROUPS +/* Disable groupaccess if NGROUPS_UMAX, NGROUPS_MAX and NGROUPS are not set */ +#ifndef NGROUPS_UMAX +#ifdef NGROUPS_MAX +#define NGROUPS_UMAX NGROUPS_MAX +#elif defined(NGROUPS) +#define NGROUPS_UMAX NGROUPS #else -#define NGROUPS_MAX 0 +#define NGROUPS_UMAX 0 #endif #endif diff --git a/usr/src/cmd/ssh/include/includes.h b/usr/src/cmd/ssh/include/includes.h index 308b581e15..bc18be79c9 100644 --- a/usr/src/cmd/ssh/include/includes.h +++ b/usr/src/cmd/ssh/include/includes.h @@ -24,7 +24,7 @@ extern "C" { */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -79,9 +79,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #ifdef HAVE_MAILLOCK_H # include <maillock.h> /* For _PATH_MAILDIR */ #endif -#ifdef HAVE_NEXT -# include <libc.h> -#endif #include <unistd.h> /* For STDIN_FILENO, etc */ #include <termios.h> /* Struct winsize */ @@ -182,7 +179,6 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #include "version.h" #include "openbsd-compat.h" #include "bsd-cygwin_util.h" -#include "bsd-nextstep.h" #include "entropy.h" #include "g11n.h" diff --git a/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com b/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com index eb665e83da..a7bc022857 100644 --- a/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com +++ b/usr/src/cmd/ssh/libopenbsd-compat/Makefile.com @@ -35,7 +35,6 @@ OBJECTS = \ bsd-cygwin_util.o \ bsd-getpeereid.o \ bsd-misc.o \ - bsd-nextstep.o \ bsd-asprintf.o \ bsd-snprintf.o \ bsd-waitpid.o \ diff --git a/usr/src/cmd/ssh/libopenbsd-compat/common/bsd-nextstep.c b/usr/src/cmd/ssh/libopenbsd-compat/common/bsd-nextstep.c deleted file mode 100644 index 90d578be29..0000000000 --- a/usr/src/cmd/ssh/libopenbsd-compat/common/bsd-nextstep.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 "includes.h" - -RCSID("$Id: bsd-nextstep.c,v 1.4 2001/03/26 05:35:34 mouring Exp $"); - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifdef HAVE_NEXT -#include <errno.h> -#include <sys/wait.h> -#include "bsd-nextstep.h" - -pid_t -posix_wait(int *status) -{ - union wait statusp; - pid_t wait_pid; - - #undef wait /* Use NeXT's wait() function */ - wait_pid = wait(&statusp); - if (status) - *status = (int) statusp.w_status; - - return wait_pid; -} - -int -tcgetattr(int fd, struct termios *t) -{ - return (ioctl(fd, TIOCGETA, t)); -} - -int -tcsetattr(int fd, int opt, const struct termios *t) -{ - struct termios localterm; - - if (opt & TCSASOFT) { - localterm = *t; - localterm.c_cflag |= CIGNORE; - t = &localterm; - } - switch (opt & ~TCSASOFT) { - case TCSANOW: - return (ioctl(fd, TIOCSETA, t)); - case TCSADRAIN: - return (ioctl(fd, TIOCSETAW, t)); - case TCSAFLUSH: - return (ioctl(fd, TIOCSETAF, t)); - default: - errno = EINVAL; - return (-1); - } -} - -int tcsetpgrp(int fd, pid_t pgrp) -{ - return (ioctl(fd, TIOCSPGRP, &pgrp)); -} - -speed_t cfgetospeed(const struct termios *t) -{ - return (t->c_ospeed); -} - -speed_t cfgetispeed(const struct termios *t) -{ - return (t->c_ispeed); -} - -int -cfsetospeed(struct termios *t,int speed) -{ - t->c_ospeed = speed; - return (0); -} - -int -cfsetispeed(struct termios *t, int speed) -{ - t->c_ispeed = speed; - return (0); -} -#endif /* HAVE_NEXT */ diff --git a/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat b/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat index 16853ed734..bb8bf91220 100644 --- a/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat +++ b/usr/src/cmd/ssh/libopenbsd-compat/common/llib-lopenbsd-compat @@ -5,9 +5,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -22,7 +21,7 @@ * * CDDL HEADER END * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -36,7 +35,6 @@ #include <bsd-cygwin_util.h> #include <bsd-getpeereid.h> #include <bsd-misc.h> -#include <bsd-nextstep.h> #include <bsd-snprintf.h> #include <bsd-waitpid.h> #include <config.h> diff --git a/usr/src/cmd/ssh/libssh/common/llib-lssh b/usr/src/cmd/ssh/libssh/common/llib-lssh index ed817d9385..0af5f574b7 100644 --- a/usr/src/cmd/ssh/libssh/common/llib-lssh +++ b/usr/src/cmd/ssh/libssh/common/llib-lssh @@ -42,7 +42,6 @@ #include <bsd-cygwin_util.h> #include <bsd-getpeereid.h> #include <bsd-misc.h> -#include <bsd-nextstep.h> #include <bsd-snprintf.h> #include <bsd-waitpid.h> #include <bufaux.h> diff --git a/usr/src/cmd/ssh/libssh/common/uidswap.c b/usr/src/cmd/ssh/libssh/common/uidswap.c index 42868df057..31acab9341 100644 --- a/usr/src/cmd/ssh/libssh/common/uidswap.c +++ b/usr/src/cmd/ssh/libssh/common/uidswap.c @@ -1,8 +1,4 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ -/* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * All rights reserved @@ -14,6 +10,10 @@ * incompatible with the protocol description in the RFC file, it must be * called by a name other than "ssh" or "Secure Shell". */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #include "includes.h" RCSID("$OpenBSD: uidswap.c,v 1.23 2002/07/15 17:15:31 stevesk Exp $"); @@ -44,7 +44,7 @@ static gid_t saved_egid = 0; /* Saved effective uid. */ static int privileged = 0; static int temporarily_use_uid_effective = 0; -static gid_t saved_egroups[NGROUPS_MAX], user_groups[NGROUPS_MAX]; +static gid_t saved_egroups[NGROUPS_UMAX], user_groups[NGROUPS_UMAX]; static int saved_egroupslen = -1, user_groupslen = -1; /* @@ -74,7 +74,7 @@ temporarily_use_uid(struct passwd *pw) privileged = 1; temporarily_use_uid_effective = 1; - saved_egroupslen = getgroups(NGROUPS_MAX, saved_egroups); + saved_egroupslen = getgroups(NGROUPS_UMAX, saved_egroups); if (saved_egroupslen < 0) fatal("getgroups: %.100s", strerror(errno)); @@ -83,7 +83,7 @@ temporarily_use_uid(struct passwd *pw) if (initgroups(pw->pw_name, pw->pw_gid) < 0) fatal("initgroups: %s: %.100s", pw->pw_name, strerror(errno)); - user_groupslen = getgroups(NGROUPS_MAX, user_groups); + user_groupslen = getgroups(NGROUPS_UMAX, user_groups); if (user_groupslen < 0) fatal("getgroups: %.100s", strerror(errno)); } diff --git a/usr/src/cmd/ssh/ssh-socks5-proxy-connect/ssh-socks5-proxy-connect.c b/usr/src/cmd/ssh/ssh-socks5-proxy-connect/ssh-socks5-proxy-connect.c index d8ee2c54b8..131eb73fcc 100644 --- a/usr/src/cmd/ssh/ssh-socks5-proxy-connect/ssh-socks5-proxy-connect.c +++ b/usr/src/cmd/ssh/ssh-socks5-proxy-connect/ssh-socks5-proxy-connect.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,7 +18,7 @@ * * CDDL HEADER END * - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -159,7 +158,16 @@ send_request( exit(1); } - if (read(sockfd, &recv_buf, sizeof (recv_buf)) == -1) { + /* + * The maximum size of the protocol message we are waiting for is 10 + * bytes -- VER[1], REP[1], RSV[1], ATYP[1], BND.ADDR[4] and + * BND.PORT[2]; see RFC 1928, section "6. Replies" for more details. + * Everything else is already a part of the data we are supposed to + * deliver to the requester. We know that BND.ADDR is exactly 4 bytes + * since as you can see below, we accept only ATYP == 1 which specifies + * that the IPv4 address is in a binary format. + */ + if (read(sockfd, &recv_buf, 10) == -1) { perror("read"); exit(1); } diff --git a/usr/src/cmd/ssh/sshd/groupaccess.c b/usr/src/cmd/ssh/sshd/groupaccess.c index deed5fced7..728466112b 100644 --- a/usr/src/cmd/ssh/sshd/groupaccess.c +++ b/usr/src/cmd/ssh/sshd/groupaccess.c @@ -33,7 +33,7 @@ RCSID("$OpenBSD: groupaccess.c,v 1.5 2002/03/04 17:27:39 stevesk Exp $"); #include "log.h" static int ngroups; -static char *groups_byname[NGROUPS_MAX + 1]; /* +1 for base/primary group */ +static char *groups_byname[NGROUPS_UMAX + 1]; /* +1 for base/primary group */ /* * Initialize group access list for user with primary (base) and @@ -42,7 +42,7 @@ static char *groups_byname[NGROUPS_MAX + 1]; /* +1 for base/primary group */ int ga_init(const char *user, gid_t base) { - gid_t groups_bygid[NGROUPS_MAX + 1]; + gid_t groups_bygid[NGROUPS_UMAX + 1]; int i, j; struct group *gr; diff --git a/usr/src/cmd/ssh/sshd/session.c b/usr/src/cmd/ssh/sshd/session.c index 04b1c1f7e0..c73d6ef4e3 100644 --- a/usr/src/cmd/ssh/sshd/session.c +++ b/usr/src/cmd/ssh/sshd/session.c @@ -1859,6 +1859,7 @@ session_x11_req(Session *s) xfree(s->auth_data); s->auth_proto = NULL; s->auth_data = NULL; + return (success); } /* @@ -1870,7 +1871,7 @@ session_x11_req(Session *s) * means that we won't set XAUTHORITY variable in child's environment * and xauth(1) will use the default location for the authority file. */ - if (success && mkdtemp(xauthdir) != NULL) { + if (mkdtemp(xauthdir) != NULL) { s->auth_file = xmalloc(MAXPATHLEN); snprintf(s->auth_file, MAXPATHLEN, "%s/xauthfile", xauthdir); @@ -1909,7 +1910,7 @@ session_x11_req(Session *s) strerror(errno)); } - return success; + return (success); } static int |