- (dtucker) [acconfig.h configure.ac uidswap.c] Bug #645: Check for

setres[ug]id() present but not implemented (eg some Linux/glibc
   combinations).
This commit is contained in:
Darren Tucker 2003-12-17 18:53:26 +11:00
parent 8975ddf11b
commit e937be36c3
4 changed files with 38 additions and 5 deletions

View File

@ -33,6 +33,9 @@
[dh.c] [dh.c]
use <= instead of < in dh_estimate; ok provos/hshoexer; use <= instead of < in dh_estimate; ok provos/hshoexer;
do not return < DH_GRP_MIN do not return < DH_GRP_MIN
- (dtucker) [acconfig.h configure.ac uidswap.c] Bug #645: Check for
setres[ug]id() present but not implemented (eg some Linux/glibc
combinations).
20031209 20031209
- (dtucker) OpenBSD CVS Sync - (dtucker) OpenBSD CVS Sync
@ -1602,4 +1605,4 @@
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
Report from murple@murple.net, diagnosis from dtucker@zip.com.au Report from murple@murple.net, diagnosis from dtucker@zip.com.au
$Id: ChangeLog,v 1.3147 2003/12/17 05:33:53 djm Exp $ $Id: ChangeLog,v 1.3148 2003/12/17 07:53:26 dtucker Exp $

View File

@ -1,4 +1,4 @@
/* $Id: acconfig.h,v 1.168 2003/10/15 06:57:57 dtucker Exp $ */ /* $Id: acconfig.h,v 1.169 2003/12/17 07:53:26 dtucker Exp $ */
/* /*
* Copyright (c) 1999-2003 Damien Miller. All rights reserved. * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@ -41,6 +41,12 @@
/* Define if your setregid() is broken */ /* Define if your setregid() is broken */
#undef BROKEN_SETREGID #undef BROKEN_SETREGID
/* Define if your setresuid() is broken */
#undef BROKEN_SETRESUID
/* Define if your setresgid() is broken */
#undef BROKEN_SETRESGID
/* Define to a Set Process Title type if your system is */ /* Define to a Set Process Title type if your system is */
/* supported by bsd-setproctitle.c */ /* supported by bsd-setproctitle.c */
#undef SPT_TYPE #undef SPT_TYPE

View File

@ -1,4 +1,4 @@
# $Id: configure.ac,v 1.176 2003/12/08 20:35:59 tim Exp $ # $Id: configure.ac,v 1.177 2003/12/17 07:53:26 dtucker Exp $
AC_INIT AC_INIT
AC_CONFIG_SRCDIR([ssh.c]) AC_CONFIG_SRCDIR([ssh.c])
@ -780,6 +780,30 @@ AC_CHECK_DECL(tcsendbreak,
[#include <termios.h>] [#include <termios.h>]
) )
dnl Some platorms have setresuid that isn't implemented
AC_MSG_CHECKING(if setresuid seems to work)
AC_TRY_RUN([
#include <stdlib.h>
#include <errno.h>
int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(BROKEN_SETRESUID),
AC_MSG_RESULT(not implemented)]
)
dnl Some platorms have setresgid that isn't implemented
AC_MSG_CHECKING(if setresgid seems to work)
AC_TRY_RUN([
#include <stdlib.h>
#include <errno.h>
int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
],
[AC_MSG_RESULT(yes)],
[AC_DEFINE(BROKEN_SETRESGID)
AC_MSG_RESULT(not implemented)]
)
dnl Checks for time functions dnl Checks for time functions
AC_CHECK_FUNCS(gettimeofday time) AC_CHECK_FUNCS(gettimeofday time)
dnl Checks for utmp functions dnl Checks for utmp functions

View File

@ -151,7 +151,7 @@ permanently_set_uid(struct passwd *pw)
debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
(u_int)pw->pw_gid); (u_int)pw->pw_gid);
#if defined(HAVE_SETRESGID) #if defined(HAVE_SETRESGID) && !defined(BROKEN_SETRESGID)
if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0) if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0)
fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
#elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID) #elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID)
@ -164,7 +164,7 @@ permanently_set_uid(struct passwd *pw)
fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
#endif #endif
#if defined(HAVE_SETRESUID) #if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID)
if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0) if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
#elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) #elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID)