* 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.
*/
}
return ((u_char *) NULL);
}
- bzero((char *) curp + nread, need);
+ memset((char *) curp + nread, 0, need);
eaddress = address + nread;
return (curp);
}
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
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, ':');
} else {
continued = 1;
}
- bzero(buffer, sizeof buffer);
+ memset(buffer, 0, sizeof buffer);
}
if (fflush(out_fp) || fsync(fileno(out_fp)) || fclose(out_fp)) {
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) {
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);
#else
cp = pw->pw_passwd;
np = name;
-#endif /* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
safe_strncpy(crypt_passwd, cp, sizeof(crypt_passwd));
if (!(dflg || lflg || uflg)) {
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';
}
"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) {
}
}
if (!(cp = bb_askpass(0, "Re-enter new password: "))) {
- bzero(orig, sizeof orig);
+ memset(orig, 0, sizeof orig);
/* return -1; */
return 1;
}
/* 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;
}
#include "busybox.h"
-// sulogin defines
#define SULOGIN_PROMPT "\nGive root password for system maintenance\n" \
"(or type Control-D for normal startup):"
-static void catchalarm(int junk)
+static void catchalarm(int ATTRIBUTE_UNUSED junk)
{
exit(EXIT_FAILURE);
}
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) {
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))) {
pwent.pw_passwd = spwd->sp_pwdp;
}
}
-#endif /* CONFIG_FEATURE_SHADOWPASSWDS */
+#endif
while (1) {
cp = bb_askpass(timeout, SULOGIN_PROMPT);
if (!cp || !*cp) {
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;
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
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],
struct xbsd_partition *pp;
get_geometry ();
- bzero (d, sizeof (struct xbsd_disklabel));
+ memset (d, 0, sizeof (struct xbsd_disklabel));
d -> d_magic = BSD_DISKMAGIC;