]> git.cameronkatri.com Git - pw-darwin.git/blobdiff - pw/pw_user.c
There is no reason to disallow setting the password or account expiry
[pw-darwin.git] / pw / pw_user.c
index 38f21cee61a23c3b3542a5eacc67b00bad0e4334..4d7e7ce4d3a49ba06dd76e898b39b6a48eb2662a 100644 (file)
@@ -200,7 +200,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
                        strlcpy(dbuf, cnf->home, sizeof(dbuf));
                        p = dbuf;
                        if (stat(dbuf, &st) == -1) {
-                               while ((p = strchr(++p, '/')) != NULL) {
+                               while ((p = strchr(p + 1, '/')) != NULL) {
                                        *p = '\0';
                                        if (stat(dbuf, &st) == -1) {
                                                if (mkdir(dbuf, _DEF_DIRMODE) == -1)
@@ -425,7 +425,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
                        }
 
                        grp = GETGRNAM(a_name->val);
-                       if (*grp->gr_mem == NULL)
+                       if (grp != NULL && *grp->gr_mem == NULL)
                                delgrent(GETGRNAM(a_name->val));
                        SETGRENT();
                        while ((grp = GETGRENT()) != NULL) {
@@ -513,8 +513,6 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
                                time_t          now = time(NULL);
                                time_t          expire = parse_date(now, arg->val);
 
-                               if (now == expire)
-                                       errx(EX_DATAERR, "invalid password change date `%s'", arg->val);
                                if (pwd->pw_change != expire) {
                                        pwd->pw_change = expire;
                                        edited = 1;
@@ -533,8 +531,6 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
                                time_t          now = time(NULL);
                                time_t          expire = parse_date(now, arg->val);
 
-                               if (now == expire)
-                                       errx(EX_DATAERR, "invalid account expiry date `%s'", arg->val);
                                if (pwd->pw_expire != expire) {
                                        pwd->pw_expire = expire;
                                        edited = 1;