]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Remove dead code
authorAlejandro Colomar <alx@kernel.org>
Wed, 21 Dec 2022 16:43:31 +0000 (17:43 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 22 Dec 2022 10:44:36 +0000 (11:44 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/sulogin.c

index ba4644d2fa8c95844828bbc0ed884bf4ac4028d0..ddb0d451f2a8c2df2c444f73f0fb3f247ed411e7 100644 (file)
@@ -51,13 +51,6 @@ static void catch_signals (unused int sig)
        _exit (1);
 }
 
-/*
- * syslogd is usually not running at the time when sulogin is typically
- * called, cluttering the screen with unnecessary messages. Suggested by
- * Ivan Nejgebauer <ian@unsux.ns.ac.yu>.  --marekm
- */
-#undef USE_SYSLOG
-
  /*ARGSUSED*/ int main (int argc, char **argv)
 {
 #ifndef USE_PAM
@@ -80,9 +73,6 @@ static void catch_signals (unused int sig)
        (void) bindtextdomain (PACKAGE, LOCALEDIR);
        (void) textdomain (PACKAGE);
 
-#ifdef USE_SYSLOG
-       OPENLOG ("sulogin");
-#endif
        initenv ();
        if (argc > 1) {
                close (0);
@@ -93,34 +83,19 @@ static void catch_signals (unused int sig)
                        dup (0);
                        dup (0);
                } else {
-#ifdef USE_SYSLOG
-                       SYSLOG (LOG_WARN, "cannot open %s\n", argv[1]);
-                       closelog ();
-#endif
                        exit (1);
                }
        }
        if (access (PASSWD_FILE, F_OK) == -1) { /* must be a password file! */
                (void) puts (_("No password file"));
-#ifdef USE_SYSLOG
-               SYSLOG (LOG_WARN, "No password file\n");
-               closelog ();
-#endif
                exit (1);
        }
 #if !defined(DEBUG) && defined(SULOGIN_ONLY_INIT)
        if (getppid () != 1) {  /* parent must be INIT */
-#ifdef USE_SYSLOG
-               SYSLOG (LOG_WARN, "Pid == %d, not 1\n", getppid ());
-               closelog ();
-#endif
                exit (1);
        }
 #endif
        if ((isatty (0) == 0) || (isatty (1) == 0) || (isatty (2) == 0)) {
-#ifdef USE_SYSLOG
-               closelog ();
-#endif
                exit (1);       /* must be a terminal */
        }
        /* If we were init, we need to start a new session */
@@ -159,10 +134,6 @@ static void catch_signals (unused int sig)
                         * Fail secure
                         */
                        (void) puts (_("No password entry for 'root'"));
-#ifdef USE_SYSLOG
-                       SYSLOG (LOG_WARN, "No password entry for 'root'\n");
-                       closelog ();
-#endif
                        exit (1);
                }
 
@@ -184,10 +155,6 @@ static void catch_signals (unused int sig)
                 */
                if ((NULL == cp) || ('\0' == *cp)) {
                        erase_pass (cp);
-#ifdef USE_SYSLOG
-                       SYSLOG (LOG_INFO, "Normal startup\n");
-                       closelog ();
-#endif
                        (void) puts ("");
 #ifdef TELINIT
                        execl (PATH_TELINIT, "telinit", RUNLEVEL, (char *) 0);
@@ -201,9 +168,6 @@ static void catch_signals (unused int sig)
                        break;  /* ... encrypted passwords matched */
                }
 
-#ifdef USE_SYSLOG
-               SYSLOG (LOG_WARN, "Incorrect root password\n");
-#endif
                sleep (2);
                (void) puts (_("Login incorrect"));
        }
@@ -213,13 +177,7 @@ static void catch_signals (unused int sig)
        environ = newenvp;      /* make new environment active */
 
        (void) puts (_("Entering System Maintenance Mode"));
-#ifdef USE_SYSLOG
-       SYSLOG (LOG_INFO, "System Maintenance Mode\n");
-#endif
 
-#ifdef USE_SYSLOG
-       closelog ();
-#endif
        /* exec the shell finally. */
        err = shell (pwent.pw_shell, (char *) 0, environ);