summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--acconfig.h8
-rw-r--r--configure.ac26
-rw-r--r--uidswap.c4
4 files changed, 38 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c63b2aa2..f768edcb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -33,6 +33,9 @@
33 [dh.c] 33 [dh.c]
34 use <= instead of < in dh_estimate; ok provos/hshoexer; 34 use <= instead of < in dh_estimate; ok provos/hshoexer;
35 do not return < DH_GRP_MIN 35 do not return < DH_GRP_MIN
36 - (dtucker) [acconfig.h configure.ac uidswap.c] Bug #645: Check for
37 setres[ug]id() present but not implemented (eg some Linux/glibc
38 combinations).
36 39
3720031209 4020031209
38 - (dtucker) OpenBSD CVS Sync 41 - (dtucker) OpenBSD CVS Sync
@@ -1602,4 +1605,4 @@
1602 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 1605 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
1603 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 1606 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
1604 1607
1605$Id: ChangeLog,v 1.3147 2003/12/17 05:33:53 djm Exp $ 1608$Id: ChangeLog,v 1.3148 2003/12/17 07:53:26 dtucker Exp $
diff --git a/acconfig.h b/acconfig.h
index 80907f0dc..10ffd6bad 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,4 +1,4 @@
1/* $Id: acconfig.h,v 1.168 2003/10/15 06:57:57 dtucker Exp $ */ 1/* $Id: acconfig.h,v 1.169 2003/12/17 07:53:26 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved. 4 * Copyright (c) 1999-2003 Damien Miller. All rights reserved.
@@ -41,6 +41,12 @@
41/* Define if your setregid() is broken */ 41/* Define if your setregid() is broken */
42#undef BROKEN_SETREGID 42#undef BROKEN_SETREGID
43 43
44/* Define if your setresuid() is broken */
45#undef BROKEN_SETRESUID
46
47/* Define if your setresgid() is broken */
48#undef BROKEN_SETRESGID
49
44/* Define to a Set Process Title type if your system is */ 50/* Define to a Set Process Title type if your system is */
45/* supported by bsd-setproctitle.c */ 51/* supported by bsd-setproctitle.c */
46#undef SPT_TYPE 52#undef SPT_TYPE
diff --git a/configure.ac b/configure.ac
index e7249b9c9..50b43ae31 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
1# $Id: configure.ac,v 1.176 2003/12/08 20:35:59 tim Exp $ 1# $Id: configure.ac,v 1.177 2003/12/17 07:53:26 dtucker Exp $
2 2
3AC_INIT 3AC_INIT
4AC_CONFIG_SRCDIR([ssh.c]) 4AC_CONFIG_SRCDIR([ssh.c])
@@ -780,6 +780,30 @@ AC_CHECK_DECL(tcsendbreak,
780 [#include <termios.h>] 780 [#include <termios.h>]
781) 781)
782 782
783dnl Some platorms have setresuid that isn't implemented
784AC_MSG_CHECKING(if setresuid seems to work)
785AC_TRY_RUN([
786#include <stdlib.h>
787#include <errno.h>
788int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
789 ],
790 [AC_MSG_RESULT(yes)],
791 [AC_DEFINE(BROKEN_SETRESUID),
792 AC_MSG_RESULT(not implemented)]
793)
794
795dnl Some platorms have setresgid that isn't implemented
796AC_MSG_CHECKING(if setresgid seems to work)
797AC_TRY_RUN([
798#include <stdlib.h>
799#include <errno.h>
800int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
801 ],
802 [AC_MSG_RESULT(yes)],
803 [AC_DEFINE(BROKEN_SETRESGID)
804 AC_MSG_RESULT(not implemented)]
805)
806
783dnl Checks for time functions 807dnl Checks for time functions
784AC_CHECK_FUNCS(gettimeofday time) 808AC_CHECK_FUNCS(gettimeofday time)
785dnl Checks for utmp functions 809dnl Checks for utmp functions
diff --git a/uidswap.c b/uidswap.c
index a5f76fdcd..4cabaa444 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -151,7 +151,7 @@ permanently_set_uid(struct passwd *pw)
151 debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid, 151 debug("permanently_set_uid: %u/%u", (u_int)pw->pw_uid,
152 (u_int)pw->pw_gid); 152 (u_int)pw->pw_gid);
153 153
154#if defined(HAVE_SETRESGID) 154#if defined(HAVE_SETRESGID) && !defined(BROKEN_SETRESGID)
155 if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0) 155 if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) < 0)
156 fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); 156 fatal("setresgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
157#elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID) 157#elif defined(HAVE_SETREGID) && !defined(BROKEN_SETREGID)
@@ -164,7 +164,7 @@ permanently_set_uid(struct passwd *pw)
164 fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno)); 164 fatal("setgid %u: %.100s", (u_int)pw->pw_gid, strerror(errno));
165#endif 165#endif
166 166
167#if defined(HAVE_SETRESUID) 167#if defined(HAVE_SETRESUID) && !defined(BROKEN_SETRESUID)
168 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0) 168 if (setresuid(pw->pw_uid, pw->pw_uid, pw->pw_uid) < 0)
169 fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno)); 169 fatal("setresuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
170#elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID) 170#elif defined(HAVE_SETREUID) && !defined(BROKEN_SETREUID)