summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-11-24 10:09:13 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-11-24 10:09:13 +1100
commitd995712383c043c4f9d8ca52363e6e1df128dc72 (patch)
treeb621adc47831c9f85723c1a70d24f49d6ba33b15
parent9e0ff7afc894da2b5a9e5bfd334cf4a821acf0ae (diff)
downloadopenssh-git-d995712383c043c4f9d8ca52363e6e1df128dc72.tar.gz
- (dtucker) [platform.c session.c] Move the getluid call out of session.c and
into the platform-specific code Only affects SCO, tested by and ok tim@.
-rw-r--r--ChangeLog4
-rw-r--r--platform.c10
-rw-r--r--session.c6
3 files changed, 13 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index bb8332f4..62c9c666 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+20101124
+ - (dtucker) [platform.c session.c] Move the getluid call out of session.c and
+ into the platform-specific code Only affects SCO, tested by and ok tim@.
+
20101122
- (dtucker) Bug #1840: fix warning when configuring --with-ssl-engine, patch
from vapier at gentoo org.
diff --git a/platform.c b/platform.c
index f57c2eab..60b87a6a 100644
--- a/platform.c
+++ b/platform.c
@@ -1,4 +1,4 @@
-/* $Id: platform.c,v 1.16 2010/11/07 07:05:54 dtucker Exp $ */
+/* $Id: platform.c,v 1.17 2010/11/23 23:09:13 dtucker Exp $ */
/*
* Copyright (c) 2006 Darren Tucker. All rights reserved.
@@ -115,6 +115,14 @@ platform_setusercontext(struct passwd *pw)
}
}
# endif /* USE_PAM */
+
+#if !defined(HAVE_LOGIN_CAP) && defined(HAVE_GETLUID) && defined(HAVE_SETLUID)
+ if (getuid() == 0 || geteuid() == 0) {
+ /* Sets login uid for accounting */
+ if (getluid() == -1 && setluid(pw->pw_uid) == -1)
+ error("setluid: %s", strerror(errno));
+ }
+#endif
}
/*
diff --git a/session.c b/session.c
index 8c6022bf..3758f0fd 100644
--- a/session.c
+++ b/session.c
@@ -1481,12 +1481,6 @@ do_setusercontext(struct passwd *pw)
exit(1);
}
#else
-# 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) */
-
if (setlogin(pw->pw_name) < 0)
error("setlogin failed: %s", strerror(errno));
if (setgid(pw->pw_gid) < 0) {