summaryrefslogtreecommitdiffstats
path: root/pw
diff options
context:
space:
mode:
authorDavid Nugent <davidn@FreeBSD.org>2000-07-20 00:09:29 +0000
committerDavid Nugent <davidn@FreeBSD.org>2000-07-20 00:09:29 +0000
commit920b278577c3d0b2e84be2371da86184277e2a6c (patch)
tree5e86d00e66c4df662f582494379fb30af42ba2bd /pw
parent7bf2df11199f5b021d7ecc649d026b6646cdd302 (diff)
downloadpw-darwin-920b278577c3d0b2e84be2371da86184277e2a6c.tar.gz
pw-darwin-920b278577c3d0b2e84be2371da86184277e2a6c.tar.zst
pw-darwin-920b278577c3d0b2e84be2371da86184277e2a6c.zip
Fix another missed case where usermod would not set the "modified" flag:
-h - to set no password. But only mark modified if the account is not already locked (i.e. first char of crypt password field is '*'). PR: bin/19999
Diffstat (limited to 'pw')
-rw-r--r--pw/pw_user.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index e8a3b07..925c86c 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -587,9 +587,12 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args)
}
if ((arg = getarg(args, 'h')) != NULL) {
- if (strcmp(arg->val, "-") == 0)
- pwd->pw_passwd = "*"; /* No access */
- else {
+ if (strcmp(arg->val, "-") == 0) {
+ if (!pwd->pw_passwd || *pwd->pw_passwd != '*') {
+ pwd->pw_passwd = "*"; /* No access */
+ edited = 1;
+ }
+ } else {
int fd = atoi(arg->val);
int b;
int istty = isatty(fd);