mirror of git://anongit.mindrot.org/openssh.git
- (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
This commit is contained in:
parent
da394cae04
commit
837461bf9a
|
@ -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 $
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
11
configure.ac
11
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)] ,[
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
2
sshd.c
2
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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue