]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - chpass/chpass.c
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.9.0
[pw-darwin.git] / chpass / chpass.c
index ad6b9850370dcedfbf0641ec894f3c155d3c2533..9f9be5335a682376d0d8063669fbae7f20d45670 100644 (file)
@@ -217,7 +217,12 @@ main(int argc, char *argv[])
                pw_fini();
                if (pw == NULL)
                        err(1, "edit()");
-               if (pw_equal(old_pw, pw))
+               /* 
+                * pw_equal does not check for crypted passwords, so we
+                * should do it explicitly
+                */
+               if (pw_equal(old_pw, pw) && 
+                   strcmp(old_pw->pw_passwd, pw->pw_passwd) == 0)
                        errx(0, "user information unchanged");
        }
 
@@ -236,8 +241,11 @@ main(int argc, char *argv[])
 #ifdef YP
        case _PWF_NIS:
                ypclnt = ypclnt_new(yp_domain, "passwd.byname", yp_host);
-               if (ypclnt == NULL ||
-                   ypclnt_connect(ypclnt) == -1 ||
+               if (ypclnt == NULL) {
+                       warnx("ypclnt_new failed");
+                       exit(1);
+               }
+               if (ypclnt_connect(ypclnt) == -1 ||
                    ypclnt_passwd(ypclnt, pw, password) == -1) {
                        warnx("%s", ypclnt->error);
                        ypclnt_free(ypclnt);