summaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-01-31 17:57:48 +0000
committerBernhard Reutner-Fischer2006-01-31 17:57:48 +0000
commit3038557649ae04860213ab264ff0f647103e5083 (patch)
tree129ac6598e5dc72b75062249ce7b78725c85c388 /loginutils
parent87be316149604ca18613acb1a776ea4ea9f07929 (diff)
downloadbusybox-3038557649ae04860213ab264ff0f647103e5083.zip
busybox-3038557649ae04860213ab264ff0f647103e5083.tar.gz
- 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')
-rw-r--r--loginutils/passwd.c33
-rw-r--r--loginutils/sulogin.c17
2 files changed, 25 insertions, 25 deletions
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index d18cc1e..c6920ff 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -45,7 +45,7 @@ static int update_passwd(const struct passwd *pw, const char *crypt_pw)
struct stat sb;
struct flock lock;
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
if (access(bb_path_shadow_file, F_OK) == 0) {
snprintf(filename, sizeof filename, "%s", bb_path_shadow_file);
} else
@@ -93,8 +93,9 @@ static int update_passwd(const struct passwd *pw, const char *crypt_pw)
rewind(fp);
while (!feof(fp)) {
fgets(buffer, sizeof buffer, fp);
- if (!continued) { // Check to see if we're updating this line.
- if (strncmp(username, buffer, strlen(username)) == 0) { // we have a match.
+ if (!continued) { /* Check to see if we're updating this line. */
+ if (strncmp(username, buffer, strlen(username)) == 0) {
+ /* we have a match. */
pw_rest = strchr(buffer, ':');
*pw_rest++ = '\0';
pw_rest = strchr(pw_rest, ':');
@@ -110,7 +111,7 @@ static int update_passwd(const struct passwd *pw, const char *crypt_pw)
} else {
continued = 1;
}
- bzero(buffer, sizeof buffer);
+ memset(buffer, 0, sizeof buffer);
}
if (fflush(out_fp) || fsync(fileno(out_fp)) || fclose(out_fp)) {
@@ -145,9 +146,9 @@ extern int passwd_main(int argc, char **argv)
int dflg = 0; /* -d - delete password */
const struct passwd *pw;
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
const struct spwd *sp;
-#endif /* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
amroot = (getuid() == 0);
openlog("passwd", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
while ((flag = getopt(argc, argv, "a:dlu")) != EOF) {
@@ -186,7 +187,7 @@ extern int passwd_main(int argc, char **argv)
syslog(LOG_WARNING, "can't change pwd for `%s'", name);
bb_error_msg_and_die("Permission denied.\n");
}
-#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#if ENABLE_FEATURE_SHADOWPASSWDS
sp = getspnam(name);
if (!sp) {
sp = (struct spwd *) pwd_to_spwd(pw);
@@ -196,7 +197,7 @@ extern int passwd_main(int argc, char **argv)
#else
cp = pw->pw_passwd;
np = name;
-#endif /* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
if (!(dflg || lflg || uflg)) {
@@ -339,8 +340,8 @@ static int new_password(const struct passwd *pw, int amroot, int algo)
return 1;
}
safe_strncpy(orig, clear, sizeof(orig));
- bzero(clear, strlen(clear));
- bzero(cipher, strlen(cipher));
+ memset(clear, 0, strlen(clear));
+ memset(cipher, 0, strlen(cipher));
} else {
orig[0] = '\0';
}
@@ -348,12 +349,12 @@ static int new_password(const struct passwd *pw, int amroot, int algo)
"Please use a combination of upper and lower case letters and numbers.\n"
"Enter new password: ")))
{
- bzero(orig, sizeof orig);
+ memset(orig, 0, sizeof orig);
/* return -1; */
return 1;
}
safe_strncpy(pass, cp, sizeof(pass));
- bzero(cp, strlen(cp));
+ memset(cp, 0, strlen(cp));
/* if (!obscure(orig, pass, pw)) { */
if (obscure(orig, pass, pw)) {
if (amroot) {
@@ -364,7 +365,7 @@ static int new_password(const struct passwd *pw, int amroot, int algo)
}
}
if (!(cp = bb_askpass(0, "Re-enter new password: "))) {
- bzero(orig, sizeof orig);
+ memset(orig, 0, sizeof orig);
/* return -1; */
return 1;
}
@@ -373,14 +374,14 @@ static int new_password(const struct passwd *pw, int amroot, int algo)
/* return -1; */
return 1;
}
- bzero(cp, strlen(cp));
- bzero(orig, sizeof(orig));
+ memset(cp, 0, strlen(cp));
+ memset(orig, 0, sizeof(orig));
if (algo == 1) {
cp = pw_encrypt(pass, "$1$");
} else
cp = pw_encrypt(pass, crypt_make_salt());
- bzero(pass, sizeof pass);
+ memset(pass, 0, sizeof pass);
safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
return 0;
}
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