]> granicus.if.org Git - shadow/commitdiff
* src/login.c: Added parameter to check_nologin. This will help
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 20 Apr 2009 12:33:01 +0000 (12:33 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 20 Apr 2009 12:33:01 +0000 (12:33 +0000)
getting rid of the global pwent variable.

ChangeLog
src/login.c

index d0b9981749729cfb0cad5b7c731daae6a42c8d45..d62d70233a12bc70fec9f2b0dc29df6d80703146 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-20  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/login.c: Added parameter to check_nologin. This will help
+       getting rid of the global pwent variable.
+
 2009-04-20  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/login.c: Added comments.
index 152992cebae8c170f11bb6ffaadfd0cf6f746fc4..5bbcce1dc848d2deb8857f571f16f8907944692f 100644 (file)
@@ -134,7 +134,7 @@ static void process_flags (int, char *const *);
 static struct faillog faillog;
 
 static void bad_time_notify (void);
-static void check_nologin (void);
+static void check_nologin (bool login_to_root);
 #endif
 
 static void init_env (void);
@@ -205,7 +205,7 @@ static void bad_time_notify (void)
        (void) fflush (stdout);
 }
 
-static void check_nologin (void)
+static void check_nologin (bool login_to_root)
 {
        char *fname;
 
@@ -244,7 +244,7 @@ static void check_nologin (void)
                 * gets to login.
                 */
 
-               if (pwent.pw_uid != 0) {
+               if (!login_to_root) {
                        closelog ();
                        exit (0);
                }
@@ -1064,7 +1064,7 @@ int main (int argc, char **argv)
                exit (1);
        }
 
-       check_nologin ();
+       check_nologin (pwent.pw_uid == 0);
 #endif
 
        if (getenv ("IFS")) {   /* don't export user IFS ... */