summaryrefslogtreecommitdiffstats
path: root/adduser/adduser.perl
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
commit1dcdda3901810597907e1bf2a099eec819625024 (patch)
treec8d5f9b07833359e58c34d2a25fb65cf41b590c1 /adduser/adduser.perl
parent566fde9a97295a8ff61d53fc180be4b3b95edaea (diff)
downloadpw-darwin-1dcdda3901810597907e1bf2a099eec819625024.tar.gz
pw-darwin-1dcdda3901810597907e1bf2a099eec819625024.tar.zst
pw-darwin-1dcdda3901810597907e1bf2a099eec819625024.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/adduser.perl')
-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;