From d995712383c043c4f9d8ca52363e6e1df128dc72 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 24 Nov 2010 10:09:13 +1100 Subject: - (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@. --- platform.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'platform.c') 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 } /* -- cgit v1.2.1