now webauth and webauth_create_allowed check, if webusers file exists

This commit is contained in:
io 2005-01-22 13:28:19 +00:00
parent 5cdad15a79
commit 9b501a222c

View file

@ -266,13 +266,7 @@ sub select_list {
# Check that they actually are lists ... # Check that they actually are lists ...
foreach $i (0 .. $#files) { foreach $i (0 .. $#files) {
if (-e "$LIST_DIR/$files[$i]/lock") { if (-e "$LIST_DIR/$files[$i]/lock") {
if (-e "$WEBUSERS_FILE") { $lists[$#lists + 1] = $files[$i] if (&webauth($files[$i]) == 0);
if (&webauth($files[$i]) == 0) {
$lists[$#lists + 1] = $files[$i];
}
} else {
$lists[$#lists + 1] = $files[$i];
}
} }
} }
@ -918,10 +912,13 @@ sub save_text {
sub webauth { sub webauth {
# Check if webusers file exists - if not, then access is granted
return 0 if (! -e "$WEBUSERS_FILE");
# Read authentication level from webusers file. Format of this file is # Read authentication level from webusers file. Format of this file is
# somewhat similar to the unix groups file # somewhat similar to the unix groups file
my($listname) = @_; my($listname) = @_;
open (USERS, "<$WEBUSERS_FILE") || die "Unable to read webusers file: $!"; open (USERS, "<$WEBUSERS_FILE") || die "Unable to read webusers file ($WEBUSERS_FILE): $!";
while(<USERS>) { while(<USERS>) {
if (/^($listname|ALL)\:/i) { if (/^($listname|ALL)\:/i) {
if (/(\:\s*|,\s+)((?:$ENV{'REMOTE_USER'})|(?:ALL))\s*(,|$)/) { if (/(\:\s*|,\s+)((?:$ENV{'REMOTE_USER'})|(?:ALL))\s*(,|$)/) {
@ -937,9 +934,12 @@ sub webauth {
sub webauth_create_allowed { sub webauth_create_allowed {
# Check if webusers file exists - if not, then access is granted
return 0 if (! -e "$WEBUSERS_FILE");
# Read create-permission from webusers file. # Read create-permission from webusers file.
# the special listname "ALLOW_CREATE" controls, who is allowed to do it # the special listname "ALLOW_CREATE" controls, who is allowed to do it
open (USERS, "<$WEBUSERS_FILE") || die "Unable to read webusers file: $!"; open (USERS, "<$WEBUSERS_FILE") || die "Unable to read webusers file ($WEBUSERS_FILE): $!";
while(<USERS>) { while(<USERS>) {
if (/^ALLOW_CREATE:/i) { if (/^ALLOW_CREATE:/i) {
if (/(\:\s*|,\s+)((?:$ENV{'REMOTE_USER'})|(?:ALL))\s*(,|$)/) { if (/(\:\s*|,\s+)((?:$ENV{'REMOTE_USER'})|(?:ALL))\s*(,|$)/) {