View | Details | Raw Unified | Return to bug 645 | Differences between
and this patch

Collapse All | Expand All

(-)acconfig.h (+6 lines)
Lines 41-46 Link Here
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 setreuid() is broken */
45
#undef BROKEN_SETRESUID
46
47
/* Define if your setregid() 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
(-)configure.ac (+24 lines)
Lines 775-780 AC_CHECK_DECL(tcsendbreak, Link Here
775
	[#include <termios.h>]
775
	[#include <termios.h>]
776
)
776
)
777
777
778
dnl Some platorms have setresuid that isn't implemented
779
AC_MSG_CHECKING(if setresuid seems to work)
780
AC_TRY_RUN([
781
#include <stdlib.h>
782
#include <errno.h>
783
int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
784
	],
785
	[AC_MSG_RESULT(yes)
786
	 AC_DEFINE(BROKEN_SETRESUID)],
787
	 AC_MSG_RESULT(not implemented)
788
)
789
790
dnl Some platorms have setresgid that isn't implemented
791
AC_MSG_CHECKING(if setresgid seems to work)
792
AC_TRY_RUN([
793
#include <stdlib.h>
794
#include <errno.h>
795
int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
796
	],
797
	[AC_MSG_RESULT(yes)
798
	 AC_DEFINE(HAVE_SETRESGID)],
799
	 AC_MSG_RESULT(not implemented)
800
)
801
778
dnl    Checks for time functions
802
dnl    Checks for time functions
779
AC_CHECK_FUNCS(gettimeofday time)
803
AC_CHECK_FUNCS(gettimeofday time)
780
dnl    Checks for utmp functions
804
dnl    Checks for utmp functions
(-)uidswap.c (-2 / +2 lines)
Lines 151-157 permanently_set_uid(struct passwd *pw) Link Here
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)
Lines 164-170 permanently_set_uid(struct passwd *pw) Link Here
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)

Return to bug 645