diff options
Diffstat (limited to 'loginutils/sulogin.c')
-rw-r--r-- | loginutils/sulogin.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c index 4346832..cecfa90 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c @@ -17,7 +17,6 @@ #include "busybox.h" -// sulogin defines #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ "(or type Control-D for normal startup):" @@ -41,7 +40,7 @@ static const char * const forbid[] = { -static void catchalarm(int junk) +static void catchalarm(int ATTRIBUTE_UNUSED junk) { exit(EXIT_FAILURE); } @@ -59,9 +58,9 @@ extern int sulogin_main(int argc, char **argv) struct passwd pwent; struct passwd *pwd; const char * const *p; -#ifdef CONFIG_FEATURE_SHADOWPASSWDS +#if ENABLE_FEATURE_SHADOWPASSWDS struct spwd *spwd = NULL; -#endif /* CONFIG_FEATURE_SHADOWPASSWDS */ +#endif openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); if (argc > 1) { @@ -114,7 +113,7 @@ extern int sulogin_main(int argc, char **argv) bb_error_msg_and_die("No password entry for `root'\n"); } pwent = *pwd; -#ifdef CONFIG_FEATURE_SHADOWPASSWDS +#if ENABLE_FEATURE_SHADOWPASSWDS spwd = NULL; if (pwd && ((strcmp(pwd->pw_passwd, "x") == 0) || (strcmp(pwd->pw_passwd, "*") == 0))) { @@ -124,7 +123,7 @@ extern int sulogin_main(int argc, char **argv) pwent.pw_passwd = spwd->sp_pwdp; } } -#endif /* CONFIG_FEATURE_SHADOWPASSWDS */ +#endif while (1) { cp = bb_askpass(timeout, SULOGIN_PROMPT); if (!cp || !*cp) { @@ -134,7 +133,7 @@ extern int sulogin_main(int argc, char **argv) exit(EXIT_SUCCESS); } else { safe_strncpy(pass, cp, sizeof(pass)); - bzero(cp, strlen(cp)); + memset(cp, 0, strlen(cp)); } if (strcmp(pw_encrypt(pass, pwent.pw_passwd), pwent.pw_passwd) == 0) { break; @@ -144,13 +143,13 @@ extern int sulogin_main(int argc, char **argv) fflush(stdout); syslog(LOG_WARNING, "Incorrect root password\n"); } - bzero(pass, strlen(pass)); + memset(pass, 0, strlen(pass)); signal(SIGALRM, SIG_DFL); puts("Entering System Maintenance Mode\n"); fflush(stdout); syslog(LOG_INFO, "System Maintenance Mode\n"); -#ifdef CONFIG_SELINUX +#if ENABLE_SELINUX renew_current_security_context(); #endif |