summaryrefslogtreecommitdiffstats
path: root/usr.sbin/adduser
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1997-03-09 12:21:45 +0000
committerwosch <wosch@FreeBSD.org>1997-03-09 12:21:45 +0000
commit01b8721dc82dd688e63a96a5d4488a7b53b3bad4 (patch)
treefa8ca35b887410cdc87c16e6a33ee23bfbb86eb0 /usr.sbin/adduser
parent871486be75b13a1f6684e8d27e111eaa6e4a12e7 (diff)
downloadFreeBSD-src-01b8721dc82dd688e63a96a5d4488a7b53b3bad4.zip
FreeBSD-src-01b8721dc82dd688e63a96a5d4488a7b53b3bad4.tar.gz
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 'usr.sbin/adduser')
-rw-r--r--usr.sbin/adduser/adduser.perl10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/adduser/adduser.perl b/usr.sbin/adduser/adduser.perl
index 0a77087..800694f 100644
--- a/usr.sbin/adduser/adduser.perl
+++ b/usr.sbin/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;
OpenPOWER on IntegriCloud