summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2002-06-12 16:57:14 +0000
committerBen Lindstrom <mouring@eviladmin.org>2002-06-12 16:57:14 +0000
commit837461bf9a8f71b96a522bf6f51d6fdcb5b2a8cd (patch)
tree8d9133b0e60ad650bf440158bb742a8af7f5c06f
parentda394cae048e9106ad4f280c91e37ab0df2f1f97 (diff)
downloadopenssh-git-837461bf9a8f71b96a522bf6f51d6fdcb5b2a8cd.tar.gz
- (bal) Build noop setgroups() for cygwin to clean up code (For other
platforms without the setgroups() requirement, you MUST define SETGROUPS_NOOP in the configure.ac) Based on patch by vinschen@redhat.com
-rw-r--r--ChangeLog5
-rw-r--r--acconfig.h5
-rw-r--r--configure.ac11
-rw-r--r--openbsd-compat/bsd-misc.c13
-rw-r--r--openbsd-compat/bsd-misc.h7
-rw-r--r--sshd.c2
-rw-r--r--uidswap.c4
7 files changed, 32 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index d651601d..014950c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
- markus@cvs.openbsd.org 2002/06/12 01:09:52
[ssh.c]
ssh_connect returns 0 on success
+ - (bal) Build noop setgroups() for cygwin to clean up code (For other
+ platforms without the setgroups() requirement, you MUST define
+ SETGROUPS_NOOP in the configure.ac) Based on patch by vinschen@redhat.com
20020611
- (bal) ssh-agent.c RCSD fix (|unexpand already done)
@@ -918,4 +921,4 @@
- (stevesk) entropy.c: typo in debug message
- (djm) ssh-keygen -i needs seeded RNG; report from markus@
-$Id: ChangeLog,v 1.2213 2002/06/12 16:11:12 mouring Exp $
+$Id: ChangeLog,v 1.2214 2002/06/12 16:57:14 mouring Exp $
diff --git a/acconfig.h b/acconfig.h
index bbe50162..713b094d 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
-/* $Id: acconfig.h,v 1.137 2002/05/13 03:15:43 djm Exp $ */
+/* $Id: acconfig.h,v 1.138 2002/06/12 16:57:15 mouring Exp $ */
#ifndef _CONFIG_H
#define _CONFIG_H
@@ -12,6 +12,9 @@
/* supported by bsd-setproctitle.c */
#undef SPT_TYPE
+/* setgroups() NOOP allowed */
+#undef SETGROUPS_NOOP
+
/* SCO workaround */
#undef BROKEN_SYS_TERMIO_H
diff --git a/configure.ac b/configure.ac
index 59d61fd6..450e49d2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-# $Id: configure.ac,v 1.65 2002/06/07 14:37:00 mouring Exp $
+# $Id: configure.ac,v 1.66 2002/06/12 16:57:15 mouring Exp $
AC_INIT
AC_CONFIG_SRCDIR([ssh.c])
@@ -85,6 +85,7 @@ case "$host" in
AC_DEFINE(IPV4_DEFAULT)
AC_DEFINE(IP_TOS_IS_BROKEN)
AC_DEFINE(NO_X11_UNIX_SOCKETS)
+ AC_DEFINE(SETGROUPS_NOOP)
;;
*-*-dgux*)
AC_DEFINE(IP_TOS_IS_BROKEN)
@@ -569,10 +570,10 @@ AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
inet_ntop innetgr login_getcapbool md5_crypt memmove \
mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
- setenv seteuid setlogin setproctitle setresgid setreuid setrlimit \
- setsid setvbuf sigaction sigvec snprintf socketpair strerror \
- strlcat strlcpy strmode strsep sysconf tcgetpgrp truncate utimes \
- vhangup vsnprintf waitpid __b64_ntop _getpty)
+ setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
+ setrlimit setsid setvbuf sigaction sigvec snprintf socketpair \
+ strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp truncate \
+ utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
dnl IRIX and Solaris 2.5.1 have dirname() in libgen
AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index 237f9393..680375ce 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -24,7 +24,7 @@
#include "includes.h"
-RCSID("$Id: bsd-misc.c,v 1.6 2002/05/08 02:51:32 tim Exp $");
+RCSID("$Id: bsd-misc.c,v 1.7 2002/06/12 16:57:15 mouring Exp $");
char *get_progname(char *argv0)
{
@@ -118,3 +118,14 @@ int truncate (const char *path, off_t length)
}
#endif /* HAVE_TRUNCATE */
+#if !defined(HAVE_SETGROUPS) && defined(SETGROUPS_NOOP)
+/*
+ * Cygwin setgroups should be a noop.
+ */
+int
+setgroups(size_t size, const git_t *list)
+{
+ return 0;
+}
+#endif
+
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index 9475a294..aff23173 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* $Id: bsd-misc.h,v 1.4 2002/05/08 02:51:32 tim Exp $ */
+/* $Id: bsd-misc.h,v 1.5 2002/06/12 16:57:15 mouring Exp $ */
#ifndef _BSD_MISC_H
#define _BSD_MISC_H
@@ -76,4 +76,9 @@ int utimes(char *filename, struct timeval *tvp);
int truncate (const char *path, off_t length);
#endif /* HAVE_TRUNCATE */
+#if !defined(HAVE_SETGROUPS) && defined(SETGROUPS_NOOP)
+int setgroups(size_t size, const git_t *list);
+#endif
+
+
#endif /* _BSD_MISC_H */
diff --git a/sshd.c b/sshd.c
index 705d4768..9ac43a88 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1018,7 +1018,6 @@ main(int ac, char **av)
if (test_flag)
exit(0);
-#ifndef HAVE_CYGWIN
/*
* Clear out any supplemental groups we may have inherited. This
* prevents inadvertent creation of files with bad modes (in the
@@ -1028,7 +1027,6 @@ main(int ac, char **av)
*/
if (setgroups(0, NULL) < 0)
debug("setgroups() failed: %.200s", strerror(errno));
-#endif /* !HAVE_CYGWIN */
/* Initialize the log (it is reinitialized below in case we forked). */
if (debug_flag && !inetd_flag)
diff --git a/uidswap.c b/uidswap.c
index 9377ca4b..0a772c7b 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -80,11 +80,9 @@ temporarily_use_uid(struct passwd *pw)
if (user_groupslen < 0)
fatal("getgroups: %.100s", strerror(errno));
}
-#ifndef HAVE_CYGWIN
/* Set the effective uid to the given (unprivileged) uid. */
if (setgroups(user_groupslen, user_groups) < 0)
fatal("setgroups: %.100s", strerror(errno));
-#endif /* !HAVE_CYGWIN */
#ifndef SAVED_IDS_WORK_WITH_SETEUID
/* Propagate the privileged gid to all of our gids. */
if (setgid(getegid()) < 0)
@@ -130,10 +128,8 @@ restore_uid(void)
setgid(getgid());
#endif /* SAVED_IDS_WORK_WITH_SETEUID */
-#ifndef HAVE_CYGWIN
if (setgroups(saved_egroupslen, saved_egroups) < 0)
fatal("setgroups: %.100s", strerror(errno));
-#endif /* !HAVE_CYGWIN */
temporarily_use_uid_effective = 0;
}