From fbd884a80d35bad7d69410096e3ab186783dd038 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 27 Feb 2001 08:39:07 +1100 Subject: [PATCH] - (djm) Fix up POSIX saved uid support. Report from Mark Miller - (djm) Search for -lcrypt on FreeBSD too --- ChangeLog | 5 ++++- acconfig.h | 4 ++-- configure.in | 11 +++++++---- entropy.c | 6 +++++- uidswap.c | 4 ++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 012952c2a..8d59f4b97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +20010227 + - (djm) + 20010226 - (bal) Applied shutdown() patch for sftp.c by Corinna Vinschen @@ -4141,4 +4144,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.826 2001/02/26 20:38:53 mouring Exp $ +$Id: ChangeLog,v 1.827 2001/02/26 21:39:08 djm Exp $ diff --git a/acconfig.h b/acconfig.h index 5617d8317..a43435868 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,4 +1,4 @@ -/* $Id: acconfig.h,v 1.104 2001/02/26 09:49:59 djm Exp $ */ +/* $Id: acconfig.h,v 1.105 2001/02/26 21:39:07 djm Exp $ */ #ifndef _CONFIG_H #define _CONFIG_H @@ -297,7 +297,7 @@ #undef NO_X11_UNIX_SOCKETS /* Needed for SCO and NeXT */ -#undef SAVED_IDS_WORK_WITH_SETEUID +#undef BROKEN_SAVED_UIDS @BOTTOM@ diff --git a/configure.in b/configure.in index 7f571bbdf..c79ae381e 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.254 2001/02/26 09:49:59 djm Exp $ +# $Id: configure.in,v 1.255 2001/02/26 21:39:07 djm Exp $ AC_INIT(ssh.c) @@ -144,6 +144,9 @@ mips-sony-bsd|mips-sony-newsos4) *-*-netbsd*) need_dash_r=1 ;; +*-*-freebsd*) + check_for_libcrypt_later=1 + ;; *-next-*) conf_lastlog_location="/usr/adm/lastlog" conf_utmp_location=/etc/utmp @@ -152,7 +155,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(HAVE_NEXT) AC_DEFINE(BROKEN_REALPATH) AC_DEFINE(USE_PIPES) - AC_DEFINE(SAVED_IDS_WORK_WITH_SETEUID) + AC_DEFINE(BROKEN_SAVED_UIDS) CPPFLAGS="$CPPFLAGS -I/usr/local/include" CFLAGS="$CFLAGS" ;; @@ -239,7 +242,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(HAVE_SCO_PROTECTED_PW) AC_DEFINE(DISABLE_SHADOW) AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) - AC_DEFINE(SAVED_IDS_WORK_WITH_SETEUID) + AC_DEFINE(BROKEN_SAVED_UIDS) AC_CHECK_FUNCS(getluid setluid) ;; *-*-sco3.2v5*) @@ -254,7 +257,7 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(HAVE_SCO_PROTECTED_PW) AC_DEFINE(DISABLE_SHADOW) AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) - AC_DEFINE(SAVED_IDS_WORK_WITH_SETEUID) + AC_DEFINE(BROKEN_SAVED_UIDS) AC_CHECK_FUNCS(getluid setluid) ;; *-dec-osf*) diff --git a/entropy.c b/entropy.c index daff1e64a..9743e598b 100644 --- a/entropy.c +++ b/entropy.c @@ -39,7 +39,7 @@ #include "pathnames.h" #include "log.h" -RCSID("$Id: entropy.c,v 1.30 2001/02/26 09:49:59 djm Exp $"); +RCSID("$Id: entropy.c,v 1.31 2001/02/26 21:39:07 djm Exp $"); #ifndef offsetof # define offsetof(type, member) ((size_t) &((type *)0)->member) @@ -63,6 +63,10 @@ RCSID("$Id: entropy.c,v 1.30 2001/02/26 09:49:59 djm Exp $"); # define RUSAGE_CHILDREN 0 #endif +#if defined(_POSIX_SAVED_IDS) && !defined(BROKEN_SAVED_UIDS) +# define SAVED_IDS_WORK_WITH_SETEUID +#endif + #if defined(EGD_SOCKET) || defined(RANDOM_POOL) #ifdef EGD_SOCKET diff --git a/uidswap.c b/uidswap.c index 8b7f535be..bdfa484fc 100644 --- a/uidswap.c +++ b/uidswap.c @@ -26,13 +26,13 @@ RCSID("$OpenBSD: uidswap.c,v 1.13 2001/01/21 19:06:01 markus Exp $"); * POSIX saved uids or not. */ -#ifdef _POSIX_SAVED_IDS +#if defined(_POSIX_SAVED_IDS) && !defined(BROKEN_SAVED_UIDS) /* Lets assume that posix saved ids also work with seteuid, even though that is not part of the posix specification. */ #define SAVED_IDS_WORK_WITH_SETEUID /* Saved effective uid. */ static uid_t saved_euid = 0; -#endif /* _POSIX_SAVED_IDS */ +#endif /* * Temporarily changes to the given uid. If the effective user