Only write to shadow file is shadow passwords are enabled. Patch by magicfox modified...
authorGlenn L McGrath <bug1@ihug.co.nz>
Wed, 15 Sep 2004 02:39:09 +0000 (02:39 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Wed, 15 Sep 2004 02:39:09 +0000 (02:39 -0000)
loginutils/passwd.c

index 400ddb9a565e30c1baaefd9a2bfe6103b68cc343..9c4b4ddfb17fab9a53cacb4be916f5fef048ab7d 100644 (file)
@@ -38,7 +38,6 @@ extern int update_passwd(const struct passwd *pw, char *crypt_pw)
        char buffer[80];
        char username[32];
        char *pw_rest;
-       int has_shadow = 0;
        int mask;
        int continued;
        FILE *fp;
@@ -46,12 +45,12 @@ extern int update_passwd(const struct passwd *pw, char *crypt_pw)
        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);
        }