static void set_filesize_limit(int blocks);
-int get_algo(char *a)
+static int get_algo(char *a)
{
int x = 1; /* standard: MD5 */
}
-extern int update_passwd(const struct passwd *pw, char *crypt_pw)
+static int update_passwd(const struct passwd *pw, char *crypt_pw)
{
char filename[1024];
char buf[1025];
char buffer[80];
char username[32];
char *pw_rest;
- int has_shadow = 0;
int mask;
int continued;
FILE *fp;
struct stat sb;
struct flock lock;
+#ifdef CONFIG_FEATURE_SHADOWPASSWDS
if (access(bb_path_shadow_file, F_OK) == 0) {
- has_shadow = 1;
- }
- if (has_shadow) {
snprintf(filename, sizeof filename, "%s", bb_path_shadow_file);
- } else {
+ } else
+#endif
+ {
snprintf(filename, sizeof filename, "%s", bb_path_passwd_file);
}
int uflg = 0; /* -u - unlock account */
int dflg = 0; /* -d - delete password */
const struct passwd *pw;
- unsigned short ruid;
#ifdef CONFIG_FEATURE_SHADOWPASSWDS
const struct spwd *sp;
bb_show_usage();
}
}
- ruid = getuid();
- pw = (struct passwd *) getpwuid(ruid);
- if (!pw) {
- bb_error_msg_and_die("Cannot determine your user name.");
- }
- myname = (char *) bb_xstrdup(pw->pw_name);
+ myname = (char *) bb_xstrdup(my_getpwuid(NULL, getuid(), -1));
+ /* exits on error */
if (optind < argc) {
name = argv[optind];
} else {
time_t start, now;
if (!amroot && crypt_passwd[0]) {
- if (!(clear = getpass("Old password:"))) {
+ if (!(clear = bb_askpass(0, "Old password:"))) {
/* return -1; */
return 1;
}
} else {
orig[0] = '\0';
}
- if (! (cp=getpass("Enter the new password (minimum of 5, maximum of 8 characters)\n"
+ if (! (cp=bb_askpass(0, "Enter the new password (minimum of 5, maximum of 8 characters)\n"
"Please use a combination of upper and lower case letters and numbers.\n"
"Enter new password: ")))
{
return 1;
}
}
- if (!(cp = getpass("Re-enter new password: "))) {
+ if (!(cp = bb_askpass(0, "Re-enter new password: "))) {
bzero(orig, sizeof orig);
/* return -1; */
return 1;