summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pw_group.c
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2004-01-11 18:28:08 +0000
committeriedowse <iedowse@FreeBSD.org>2004-01-11 18:28:08 +0000
commit94e2d83c186d4afb92d60f40368db9f892fd7bcc (patch)
tree64915f17da25aadaec343a44b5be3a90afa35f25 /usr.sbin/pw/pw_group.c
parent7cefb3fd899f3524b428658034b0b4afe67e6b03 (diff)
downloadFreeBSD-src-94e2d83c186d4afb92d60f40368db9f892fd7bcc.zip
FreeBSD-src-94e2d83c186d4afb92d60f40368db9f892fd7bcc.tar.gz
Add a `-H <fd>' option that is like `-h <fd>', but accepts an already
encrypted password on the specified file descriptor. PR: bin/22033 MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/pw/pw_group.c')
-rw-r--r--usr.sbin/pw/pw_group.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/pw/pw_group.c b/usr.sbin/pw/pw_group.c
index c9af998..1c63a11 100644
--- a/usr.sbin/pw/pw_group.c
+++ b/usr.sbin/pw/pw_group.c
@@ -158,11 +158,13 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
* software.
*/
- if ((arg = getarg(args, 'h')) != NULL) {
+ if ((arg = getarg(args, 'h')) != NULL ||
+ (arg = getarg(args, 'H')) != NULL) {
if (strcmp(arg->val, "-") == 0)
grp->gr_passwd = "*"; /* No access */
else {
int fd = atoi(arg->val);
+ int precrypt = (arg->ch == 'H');
int b;
int istty = isatty(fd);
struct termios t;
@@ -196,7 +198,12 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args)
*p = '\0';
if (!*line)
errx(EX_DATAERR, "empty password read on file descriptor %d", fd);
- grp->gr_passwd = pw_pwcrypt(line);
+ if (precrypt) {
+ if (strchr(line, ':') != NULL)
+ return EX_DATAERR;
+ grp->gr_passwd = line;
+ } else
+ grp->gr_passwd = pw_pwcrypt(line);
}
}
OpenPOWER on IntegriCloud