diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-01-31 17:57:48 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-01-31 17:57:48 +0000 |
commit | 3038557649ae04860213ab264ff0f647103e5083 (patch) | |
tree | 129ac6598e5dc72b75062249ce7b78725c85c388 /loginutils/sulogin.c | |
parent | 87be316149604ca18613acb1a776ea4ea9f07929 (diff) | |
download | busybox-w32-3038557649ae04860213ab264ff0f647103e5083.tar.gz busybox-w32-3038557649ae04860213ab264ff0f647103e5083.tar.bz2 busybox-w32-3038557649ae04860213ab264ff0f647103e5083.zip |
- bzero -> memset
text data bss dec hex filename
1652855 14444 1215616 2882915 2bfd63 busybox.oorig.gcc-3.3
1652823 14444 1215616 2882883 2bfd43 busybox.gcc-3.3
1603655 14412 1215552 2833619 2b3cd3 busybox.oorig.gcc-3.4
1603655 14412 1215552 2833619 2b3cd3 busybox.gcc-3.4
1609755 14508 1215744 2840007 2b55c7 busybox.oorig.gcc-4.0
1609755 14508 1215744 2840007 2b55c7 busybox.gcc-4.0
1590495 13516 1215392 2819403 2b054b busybox.oorig.gcc-4.1-HEAD
1590495 13516 1215392 2819403 2b054b busybox.gcc-4.1-HEAD
1589079 13036 1213248 2815363 2af583 busybox.oorig.gcc-4.2-HEAD
1589079 13036 1213248 2815363 2af583 busybox.gcc-4.2-HEAD
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 434683299..cecfa905a 100644 --- a/loginutils/sulogin.c +++ b/loginutils/sulogin.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include "busybox.h" | 17 | #include "busybox.h" |
18 | 18 | ||
19 | 19 | ||
20 | // sulogin defines | ||
21 | #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ | 20 | #define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \ |
22 | "(or type Control-D for normal startup):" | 21 | "(or type Control-D for normal startup):" |
23 | 22 | ||
@@ -41,7 +40,7 @@ static const char * const forbid[] = { | |||
41 | 40 | ||
42 | 41 | ||
43 | 42 | ||
44 | static void catchalarm(int junk) | 43 | static void catchalarm(int ATTRIBUTE_UNUSED junk) |
45 | { | 44 | { |
46 | exit(EXIT_FAILURE); | 45 | exit(EXIT_FAILURE); |
47 | } | 46 | } |
@@ -59,9 +58,9 @@ extern int sulogin_main(int argc, char **argv) | |||
59 | struct passwd pwent; | 58 | struct passwd pwent; |
60 | struct passwd *pwd; | 59 | struct passwd *pwd; |
61 | const char * const *p; | 60 | const char * const *p; |
62 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 61 | #if ENABLE_FEATURE_SHADOWPASSWDS |
63 | struct spwd *spwd = NULL; | 62 | struct spwd *spwd = NULL; |
64 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 63 | #endif |
65 | 64 | ||
66 | openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); | 65 | openlog("sulogin", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH); |
67 | if (argc > 1) { | 66 | if (argc > 1) { |
@@ -114,7 +113,7 @@ extern int sulogin_main(int argc, char **argv) | |||
114 | bb_error_msg_and_die("No password entry for `root'\n"); | 113 | bb_error_msg_and_die("No password entry for `root'\n"); |
115 | } | 114 | } |
116 | pwent = *pwd; | 115 | pwent = *pwd; |
117 | #ifdef CONFIG_FEATURE_SHADOWPASSWDS | 116 | #if ENABLE_FEATURE_SHADOWPASSWDS |
118 | spwd = NULL; | 117 | spwd = NULL; |
119 | if (pwd && ((strcmp(pwd->pw_passwd, "x") == 0) | 118 | if (pwd && ((strcmp(pwd->pw_passwd, "x") == 0) |
120 | || (strcmp(pwd->pw_passwd, "*") == 0))) { | 119 | || (strcmp(pwd->pw_passwd, "*") == 0))) { |
@@ -124,7 +123,7 @@ extern int sulogin_main(int argc, char **argv) | |||
124 | pwent.pw_passwd = spwd->sp_pwdp; | 123 | pwent.pw_passwd = spwd->sp_pwdp; |
125 | } | 124 | } |
126 | } | 125 | } |
127 | #endif /* CONFIG_FEATURE_SHADOWPASSWDS */ | 126 | #endif |
128 | while (1) { | 127 | while (1) { |
129 | cp = bb_askpass(timeout, SULOGIN_PROMPT); | 128 | cp = bb_askpass(timeout, SULOGIN_PROMPT); |
130 | if (!cp || !*cp) { | 129 | if (!cp || !*cp) { |
@@ -134,7 +133,7 @@ extern int sulogin_main(int argc, char **argv) | |||
134 | exit(EXIT_SUCCESS); | 133 | exit(EXIT_SUCCESS); |
135 | } else { | 134 | } else { |
136 | safe_strncpy(pass, cp, sizeof(pass)); | 135 | safe_strncpy(pass, cp, sizeof(pass)); |
137 | bzero(cp, strlen(cp)); | 136 | memset(cp, 0, strlen(cp)); |
138 | } | 137 | } |
139 | if (strcmp(pw_encrypt(pass, pwent.pw_passwd), pwent.pw_passwd) == 0) { | 138 | if (strcmp(pw_encrypt(pass, pwent.pw_passwd), pwent.pw_passwd) == 0) { |
140 | break; | 139 | break; |
@@ -144,13 +143,13 @@ extern int sulogin_main(int argc, char **argv) | |||
144 | fflush(stdout); | 143 | fflush(stdout); |
145 | syslog(LOG_WARNING, "Incorrect root password\n"); | 144 | syslog(LOG_WARNING, "Incorrect root password\n"); |
146 | } | 145 | } |
147 | bzero(pass, strlen(pass)); | 146 | memset(pass, 0, strlen(pass)); |
148 | signal(SIGALRM, SIG_DFL); | 147 | signal(SIGALRM, SIG_DFL); |
149 | puts("Entering System Maintenance Mode\n"); | 148 | puts("Entering System Maintenance Mode\n"); |
150 | fflush(stdout); | 149 | fflush(stdout); |
151 | syslog(LOG_INFO, "System Maintenance Mode\n"); | 150 | syslog(LOG_INFO, "System Maintenance Mode\n"); |
152 | 151 | ||
153 | #ifdef CONFIG_SELINUX | 152 | #if ENABLE_SELINUX |
154 | renew_current_security_context(); | 153 | renew_current_security_context(); |
155 | #endif | 154 | #endif |
156 | 155 | ||