summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/dump.c16
-rw-r--r--loginutils/passwd.c33
-rw-r--r--loginutils/sulogin.c17
-rw-r--r--util-linux/fdisk.c4
4 files changed, 29 insertions, 41 deletions
diff --git a/libbb/dump.c b/libbb/dump.c
index 7d92308..09db246 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -5,19 +5,7 @@
* Copyright (c) 1989
* The Regents of the University of California. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*
* Original copyright notice is retained at the end of this file.
*/
@@ -398,7 +386,7 @@ static u_char *get(void)
}
return ((u_char *) NULL);
}
- bzero((char *) curp + nread, need);
+ memset((char *) curp + nread, 0, need);
eaddress = address + nread;
return (curp);
}
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
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 886b269..0514b89 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -1342,7 +1342,7 @@ xbsd_write_bootstrap (void)
bcopy (d, &dl, sizeof (struct xbsd_disklabel));
/* The disklabel will be overwritten by 0's from bootxx anyway */
- bzero (d, sizeof (struct xbsd_disklabel));
+ memset (d, 0, sizeof (struct xbsd_disklabel));
snprintf (path, sizeof(path), "%s/boot%s", bootdir, dkbasename);
if (!xbsd_get_bootstrap (path, &disklabelbuffer[xbsd_dlabel.d_secsize],
@@ -1457,7 +1457,7 @@ xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d) {
struct xbsd_partition *pp;
get_geometry ();
- bzero (d, sizeof (struct xbsd_disklabel));
+ memset (d, 0, sizeof (struct xbsd_disklabel));
d -> d_magic = BSD_DISKMAGIC;