diff options
author | Alex Feldman <alex@cvs.openbsd.org> | 1999-09-06 16:48:42 +0000 |
---|---|---|
committer | Alex Feldman <alex@cvs.openbsd.org> | 1999-09-06 16:48:42 +0000 |
commit | 8764fa9f5c1b71f98ee3377f5726c4888bb97188 (patch) | |
tree | 966cd27e1dc7c89743df2360645bf49e7ae6030d /usr.sbin/adduser | |
parent | de9cd12cb52a298fd65b64228fbe7968c12be4e7 (diff) |
Send password to encrypt(1) via stdin. millert@ ok
Diffstat (limited to 'usr.sbin/adduser')
-rw-r--r-- | usr.sbin/adduser/adduser.perl | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.sbin/adduser/adduser.perl b/usr.sbin/adduser/adduser.perl index 3fac715984d..b6c80903138 100644 --- a/usr.sbin/adduser/adduser.perl +++ b/usr.sbin/adduser/adduser.perl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# $OpenBSD: adduser.perl,v 1.18 1999/07/03 23:56:18 hugh Exp $ +# $OpenBSD: adduser.perl,v 1.19 1999/09/06 16:48:41 alex Exp $ # # Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. # All rights reserved. @@ -28,6 +28,8 @@ # # $From: adduser.perl,v 1.22 1996/12/07 21:25:12 ache Exp $ +use IPC::Open2; + ################ # main # @@ -936,10 +938,13 @@ sub encrypt { $args = "-b $salt"; } - $pass =~ s/(.)/\\$1/g; - - $crypt = `/usr/bin/encrypt $args -- $pass`; - chop $crypt; + open2(\*ENCRD, \*ENCWR, "/usr/bin/encrypt $args"); + print ENCWR "$pass\n"; + close ENCWR; + $crypt = <ENCRD>; + close ENCRD; + chomp $crypt; + die "encrypt failed" if (wait == -1 || $? != 0); return($crypt); } @@ -1447,7 +1452,7 @@ sub config_write { print C <<EOF; # -# $OpenBSD: adduser.perl,v 1.18 1999/07/03 23:56:18 hugh Exp $ +# $OpenBSD: adduser.perl,v 1.19 1999/09/06 16:48:41 alex Exp $ # $config - automatic generated by adduser(8) # # Note: adduser read *and* write this file. |