diff options
author | joe <joe@FreeBSD.org> | 2001-11-19 07:39:47 +0800 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-11-19 07:39:47 +0800 |
commit | 33df8221d7d1f97541d076d0a26f96b18cbde146 (patch) | |
tree | 4ec4da1f184b84a83c2ae377bf64fb4999c70170 | |
parent | ce56bb629b60e449baf6e56aaccdcc899c480919 (diff) | |
download | freebsd-ports-gnome-33df8221d7d1f97541d076d0a26f96b18cbde146.tar.gz freebsd-ports-gnome-33df8221d7d1f97541d076d0a26f96b18cbde146.tar.zst freebsd-ports-gnome-33df8221d7d1f97541d076d0a26f96b18cbde146.zip |
Allow lists of users to be read in from an external file by allowing
a filename to be used in place of a username in any of the rules.
A filename should be preceeded with a '!' character to mark it as
such, and is assumed relative to $CVSROOT/CVSROOT if it is a relative
path.
-rwxr-xr-x | CVSROOT/cvs_acls.pl | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/CVSROOT/cvs_acls.pl b/CVSROOT/cvs_acls.pl index fdd99779039e..a4046867d8b2 100755 --- a/CVSROOT/cvs_acls.pl +++ b/CVSROOT/cvs_acls.pl @@ -63,13 +63,20 @@ # group|grpname1|joe,fred,bob # group|grpname2|pete,:grpname1,simon # group|grpname2|sid,:grpname2,mike +# group|anothergroup|!filename/containing/listofusers # # The group name can be used in any place a user name could be used in # an avail or unavail line. Just precede the group name with a ':' # character. In the example above you'll note that you can define a # group more than once. Each definition overrides the previous one, # but can include itself to add to it. - +# +# In place of a username in any of the above rules, you can specify +# a group name preceeded with a ':' character, or a filename preceeded +# with a '!' character. In the case of a file it is assumed relative to +# $CVSROOT/CVSROOT/ unless it started witha leading '/'. All blank lines +# and comments are ignored, and the remaining lines are treated as one +# username per line. use strict; @@ -207,8 +214,23 @@ sub expand_users { next; } # Add the specified group to the membership. - foreach my $u (split /,/, $GROUPS{$m}) { - $members{$u} = 1; + foreach (split /,/, $GROUPS{$m}) { + $members{$_} = 1; + } + } elsif ($m =~ s/\!//) { + $m = "$CVSROOT/CVSROOT/$m" if $m !~ /^\//; + if (open USERLIST, $m) { + while (<USERLIST>) { + chomp; + s/\s*(#.*)?$//; + next if /^$/; + + $members{$_} = 1; + } + close USERLIST; + } else { + warn "Can't open user file $m " . + "defined in $cfg::AVAIL_FILE.\n"; } } else { $members{$m} = 1; |