summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 15:09:53 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-06-07 15:09:53 +0000
commit926db19a96ef2f0029e6f3d6bd6c1d5c5e7aeca3 (patch)
tree092aef05bff37f5b8f1d7d0cc964d06744b9a2ed /pw/pw_user.c
parent5d2f6aa9d7d2747fbb459bfc07370a4e4c6b289c (diff)
downloadpw-darwin-926db19a96ef2f0029e6f3d6bd6c1d5c5e7aeca3.tar.gz
pw-darwin-926db19a96ef2f0029e6f3d6bd6c1d5c5e7aeca3.tar.zst
pw-darwin-926db19a96ef2f0029e6f3d6bd6c1d5c5e7aeca3.zip
Handle dryrun (-N) via global pwconf
Diffstat (limited to 'pw/pw_user.c')
-rw-r--r--pw/pw_user.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index d69f56b..fac4d25 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -620,7 +620,7 @@ pw_user(int mode, struct cargs * args)
/*
* Special case: -N only displays & exits
*/
- if (getarg(args, 'N') != NULL)
+ if (conf.dryrun)
return print_user(pwd,
getarg(args, 'P') != NULL,
getarg(args, '7') != NULL);
@@ -872,9 +872,7 @@ pw_gidpolicy(struct cargs * args, char *nam, gid_t prefer)
snprintf(tmp, sizeof(tmp), "%u", prefer);
addarg(&grpargs, 'g', tmp);
}
- if (getarg(args, 'N'))
- {
- addarg(&grpargs, 'N', NULL);
+ if (conf.dryrun) {
addarg(&grpargs, 'q', NULL);
gid = pw_group(M_NEXT, &grpargs);
}
@@ -1035,7 +1033,7 @@ pw_password(struct userconf * cnf, struct cargs * args, char const * user)
* We give this information back to the user
*/
if (getarg(args, 'h') == NULL && getarg(args, 'H') == NULL &&
- getarg(args, 'N') == NULL) {
+ !conf.dryrun) {
if (isatty(STDOUT_FILENO))
printf("Password for '%s' is: ", user);
printf("%s\n", pwbuf);