summaryrefslogtreecommitdiffstats
path: root/adduser
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>1997-03-09 12:21:45 +0000
committerWolfram Schneider <wosch@FreeBSD.org>1997-03-09 12:21:45 +0000
commitfe9819cd8f05eb15ceb1beb198a1200dfda21886 (patch)
tree9c35d5225decb5678528456597f7daa3b2290abc /adduser
parent590d6095f555d91a4dac6c2d12e64b4033aef670 (diff)
downloadpw-darwin-fe9819cd8f05eb15ceb1beb198a1200dfda21886.tar.gz
pw-darwin-fe9819cd8f05eb15ceb1beb198a1200dfda21886.tar.zst
pw-darwin-fe9819cd8f05eb15ceb1beb198a1200dfda21886.zip
Support comments in password database (/etc/master.passwd).
Comments in group database (/etc/group) are currently not supported - adduser silently delete blank lines and comments.
Diffstat (limited to 'adduser')
-rw-r--r--adduser/adduser.perl10
1 files changed, 9 insertions, 1 deletions
diff --git a/adduser/adduser.perl b/adduser/adduser.perl
index 0a77087..800694f 100644
--- a/adduser/adduser.perl
+++ b/adduser/adduser.perl
@@ -24,7 +24,7 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
-# $Id$
+# $Id: adduser.perl,v 1.27 1997/02/22 16:01:18 peter Exp $
# read variables
@@ -245,6 +245,10 @@ sub passwd_read {
while(<P>) {
chop;
push(@passwd_backup, $_);
+ # ignore comments
+ next if /^\s*$/;
+ next if /^\s*#/;
+
($p_username, $pw, $p_uid, $p_gid, $sh) = (split(/:/, $_))[0..3,9];
print "$p_username already exists with uid: $username{$p_username}!\n"
@@ -272,6 +276,10 @@ sub group_read {
while(<G>) {
chop;
push(@group_backup, $_);
+ # ignore comments
+ next if /^\s*$/;
+ next if /^\s*#/;
+
($g_groupname, $pw, $g_gid, $memb) = (split(/:/, $_))[0..3];
$groupmembers{$g_gid} = $memb;