summaryrefslogtreecommitdiff
path: root/usr.sbin/user/user.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-11-29 09:42:39 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-11-29 09:42:39 +0000
commitf60f4e1ee937cc4923bffdad10b075b0e5038007 (patch)
treee1cfdf84516f3fff54500ee23757bbb01f24fe87 /usr.sbin/user/user.c
parent1fd678dbf11f20d49fd1a02f58dfb28f4508e4a6 (diff)
Correct a bit test introduced in user.c rev 1.111 that made it impossible
to set a password hash with usermod if an additional flag was specified. ok mestre@ tom@ jung@
Diffstat (limited to 'usr.sbin/user/user.c')
-rw-r--r--usr.sbin/user/user.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c
index 41b6d23d40c..ceb5d73e8d6 100644
--- a/usr.sbin/user/user.c
+++ b/usr.sbin/user/user.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.113 2016/11/29 03:59:31 jsg Exp $ */
+/* $OpenBSD: user.c,v 1.114 2016/11/29 09:42:38 jsg Exp $ */
/* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
/*
@@ -1350,7 +1350,8 @@ moduser(char *login_name, char *newlogin, user_t *up)
errx(EXIT_FAILURE, "No such user `%s'", login_name);
}
if (up != NULL) {
- if ((*pwp->pw_passwd != '\0') && (up->u_flags &~ F_PASSWORD)) {
+ if ((*pwp->pw_passwd != '\0') &&
+ (up->u_flags & F_PASSWORD) == 0) {
up->u_flags |= F_PASSWORD;
memsave(&up->u_password, pwp->pw_passwd,
strlen(pwp->pw_passwd));