From aca75d949ebab1f60acecf88ab78eae932e4d3fb Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 16 Feb 2001 01:12:41 +0000 Subject: [PATCH] - (djm) Set "login ID" on systems with setluid. Only enabled for SCO OpenServer for now. Based on patch from svaughan --- ChangeLog | 2 ++ configure.in | 3 ++- session.c | 7 ++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85e8a330..540943b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,8 @@ - (djm) USE_PIPES for a few more sysv platforms - (djm) Cleanup configure.in a little - (djm) Ask users to check config.log when we can't find necessary libs + - (djm) Set "login ID" on systems with setluid. Only enabled for SCO + OpenServer for now. Based on patch from svaughan 20010215 - (djm) Move PAM session setup back to before setuid to user. Fixes diff --git a/configure.in b/configure.in index b10cad48..0f54364d 100644 --- a/configure.in +++ b/configure.in @@ -236,6 +236,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_CHECK_FUNCS(getluid setluid) ;; *-*-sco3.2v5*) CPPFLAGS="$CPPFLAGS -I/usr/local/include" @@ -249,9 +250,9 @@ mips-sony-bsd|mips-sony-newsos4) AC_DEFINE(HAVE_SCO_PROTECTED_PW) AC_DEFINE(DISABLE_SHADOW) AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) + AC_CHECK_FUNCS(getluid setluid) ;; *-dec-osf*) -# This is untested if test ! -z "USE_SIA" ; then AC_MSG_CHECKING(for Digital Unix Security Integration Architecture) if test -f /etc/sia/matrix.conf; then diff --git a/session.c b/session.c index 8f3ee834..47ef8b9c 100644 --- a/session.c +++ b/session.c @@ -881,7 +881,6 @@ void do_pam_environment(char ***env, int *envsize) } #endif /* USE_PAM */ - #ifdef HAVE_CYGWIN void copy_environment(char ***env, int *envsize) { @@ -1118,6 +1117,12 @@ do_child(const char *command, struct passwd * pw, const char *term, } #endif /* HAVE_OSF_SIA */ +#if defined(HAVE_GETLUID) && defined(HAVE_SETLUID) + /* Sets login uid for accounting */ + if (getluid() == -1 && setluid(pw->pw_uid) == -1) + error("setluid: %s", strerror(errno)); +#endif /* defined(HAVE_GETLUID) && defined(HAVE_SETLUID) */ + #ifdef HAVE_CYGWIN if (is_winnt) #endif -- 2.45.2