]> andersk Git - openssh.git/commitdiff
- (bal) Build noop setgroups() for cygwin to clean up code (For other
authormouring <mouring>
Wed, 12 Jun 2002 16:57:14 +0000 (16:57 +0000)
committermouring <mouring>
Wed, 12 Jun 2002 16:57:14 +0000 (16:57 +0000)
   platforms without the setgroups() requirement, you MUST define
   SETGROUPS_NOOP in the configure.ac) Based on patch by vinschen@redhat.com

ChangeLog
acconfig.h
configure.ac
openbsd-compat/bsd-misc.c
openbsd-compat/bsd-misc.h
sshd.c
uidswap.c

index 3a5e05263442e30fe6efd59cf97c1e96de66b49f..820a266e30c1fb237fc5d9e1f12b841fad0a241f 100644 (file)
--- 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)
index afc3db91b7cd287d8ccbf6d4e96de1a45586bf18..96585331716b9065983431a10e56245dce39ed39 100644 (file)
@@ -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
 
index ea1d8ccc9757e233ade8a34bcee020987726bbf8..b7b132683631d28f0510c8b15a61776bb9afc13f 100644 (file)
@@ -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)] ,[
index dae90122b0137955cb28d6c7b43adbaad7362de9..a90658ba51673b3b0683c98b4fc068a1d7b8b12c 100644 (file)
@@ -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 
+
index 5872a5b6f84d08453440b2891b5b73acaee86c5e..d374bd70a756ede73810f41e700dc31135718562 100644 (file)
@@ -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 705d4768b77ef753b9dd054274910e7d56815e09..9ac43a882a1a127daaa0cabec1bc00971b0e871e 100644 (file)
--- 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)
index 9377ca4b16a2272ed38291eae5abbba278edb740..0a772c7b33a8388063cd6c324b556459720b7069 100644 (file)
--- 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;
 }
 
This page took 0.068991 seconds and 5 git commands to generate.