diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-11-24 10:09:13 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-11-24 10:09:13 +1100 |
commit | d995712383c043c4f9d8ca52363e6e1df128dc72 (patch) | |
tree | b621adc47831c9f85723c1a70d24f49d6ba33b15 | |
parent | 9e0ff7afc894da2b5a9e5bfd334cf4a821acf0ae (diff) |
- (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-- | ChangeLog | 4 | ||||
-rw-r--r-- | platform.c | 10 | ||||
-rw-r--r-- | session.c | 6 |
3 files changed, 13 insertions, 7 deletions
@@ -1,3 +1,7 @@ | |||
1 | 20101124 | ||
2 | - (dtucker) [platform.c session.c] Move the getluid call out of session.c and | ||
3 | into the platform-specific code Only affects SCO, tested by and ok tim@. | ||
4 | |||
1 | 20101122 | 5 | 20101122 |
2 | - (dtucker) Bug #1840: fix warning when configuring --with-ssl-engine, patch | 6 | - (dtucker) Bug #1840: fix warning when configuring --with-ssl-engine, patch |
3 | from vapier at gentoo org. | 7 | from vapier at gentoo org. |
diff --git a/platform.c b/platform.c index f57c2eab3..60b87a6ae 100644 --- a/platform.c +++ b/platform.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: platform.c,v 1.16 2010/11/07 07:05:54 dtucker Exp $ */ | 1 | /* $Id: platform.c,v 1.17 2010/11/23 23:09:13 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2006 Darren Tucker. All rights reserved. | 4 | * Copyright (c) 2006 Darren Tucker. All rights reserved. |
@@ -115,6 +115,14 @@ platform_setusercontext(struct passwd *pw) | |||
115 | } | 115 | } |
116 | } | 116 | } |
117 | # endif /* USE_PAM */ | 117 | # endif /* USE_PAM */ |
118 | |||
119 | #if !defined(HAVE_LOGIN_CAP) && defined(HAVE_GETLUID) && defined(HAVE_SETLUID) | ||
120 | if (getuid() == 0 || geteuid() == 0) { | ||
121 | /* Sets login uid for accounting */ | ||
122 | if (getluid() == -1 && setluid(pw->pw_uid) == -1) | ||
123 | error("setluid: %s", strerror(errno)); | ||
124 | } | ||
125 | #endif | ||
118 | } | 126 | } |
119 | 127 | ||
120 | /* | 128 | /* |
@@ -1481,12 +1481,6 @@ do_setusercontext(struct passwd *pw) | |||
1481 | exit(1); | 1481 | exit(1); |
1482 | } | 1482 | } |
1483 | #else | 1483 | #else |
1484 | # if defined(HAVE_GETLUID) && defined(HAVE_SETLUID) | ||
1485 | /* Sets login uid for accounting */ | ||
1486 | if (getluid() == -1 && setluid(pw->pw_uid) == -1) | ||
1487 | error("setluid: %s", strerror(errno)); | ||
1488 | # endif /* defined(HAVE_GETLUID) && defined(HAVE_SETLUID) */ | ||
1489 | |||
1490 | if (setlogin(pw->pw_name) < 0) | 1484 | if (setlogin(pw->pw_name) < 0) |
1491 | error("setlogin failed: %s", strerror(errno)); | 1485 | error("setlogin failed: %s", strerror(errno)); |
1492 | if (setgid(pw->pw_gid) < 0) { | 1486 | if (setgid(pw->pw_gid) < 0) { |