Great Circle Associates Majordomo-Workers
(January 1997)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: restrict_post use consistency
From: Dave Wolfe <dwolfe @ risc . sps . mot . com>
Date: Wed, 8 Jan 1997 15:36:35 -0600 (CST)
To: cwilson @ slurp . neu . sgi . com (Chan Wilson)
Cc: majordomo-workers @ greatcircle . com (Majordomo developer's mailing list)
Reply-to: Dave Wolfe <david_wolfe @ risc . sps . mot . com>

Here's the patches for consistent use of restrict_post and updates to
the comments in the list config file for 1.94.2:

--- config_parse.pl.orig	Mon Dec 23 09:03:24 1996
+++ config_parse.pl	Wed Jan  8 15:08:48 1997
@@ -146,41 +146,53 @@
 # The text is wrapped and filled on output.
 %comments = (
 'get_access',
-"One of three values: open, list, closed.  Open allows anyone
-access to this command.  List allows only list members access,
-while closed completely disables the command for everyone.",
+"One of three values: open, list, closed. Open allows anyone
+access to this command and closed completely disables the
+command for everyone. List allows only list members access,
+or if restrict_post is defined, only the addresses in those
+files are allowed access.",
 
 'index_access',
-"One of three values: open, list, closed.  Open allows anyone
-access to this command.  List allows only list members access,
-while closed completely disables the command for everyone.",
+"One of three values: open, list, closed. Open allows anyone
+access to this command and closed completely disables the
+command for everyone. List allows only list members access,
+or if restrict_post is defined, only the addresses in those
+files are allowed access.",
 
 'who_access',
-"One of three values: open, list, closed.  Open allows anyone
-access to this command.  List allows only list members access,
-while closed completely disables the command for everyone.",
+"One of three values: open, list, closed. Open allows anyone
+access to this command and closed completely disables the
+command for everyone. List allows only list members access,
+or if restrict_post is defined, only the addresses in those
+files are allowed access.",
 
 'which_access',
-"One of three values: open, list, closed.  Open allows anyone
-access to this command.  List allows only list members access,
-while closed completely disables the command for everyone.",
+"One of three values: open, list, closed. Open allows anyone
+access to this command and closed completely disables the
+command for everyone. List allows only list members access,
+or if restrict_post is defined, only the addresses in those
+files are allowed access.",
 
 'info_access',
-"One of three values: open, list, closed.  Open allows anyone
-access to this command.  List allows only list members access,
-while closed completely disables the command for everyone.",
+"One of three values: open, list, closed. Open allows anyone
+access to this command and closed completely disables the
+command for everyone. List allows only list members access,
+or if restrict_post is defined, only the addresses in those
+files are allowed access.",
 
 'intro_access',
-"One of three values: open, list, closed.  Open allows anyone
-access to this command.  List allows only list members access,
-while closed completely disables the command for everyone.",
+"One of three values: open, list, closed. Open allows anyone
+access to this command and closed completely disables the
+command for everyone. List allows only list members access,
+or if restrict_post is defined, only the addresses in those
+files are allowed access.",
 
 'advertise',
 "If the requestor email address matches one of these
 regexps, then the list will be listed
 in the output of a lists command.
 Failure to match any regexp excludes the list from
-the output. The regexps under noadvertise overide these regexps.",
+the output. The regexps under noadvertise override these regexps.",
 				
 'comments',
 "Comment string that will be retained across config file rewrites.",
@@ -207,7 +219,7 @@
 subscribe requests to the list.  Adding '+confirm', ie,
 'open+confirm', will cause majordomo to send a reply back to the
 subscriber which includes a authentication number which must be sent
-back in with another subscribe commad.",
+back in with another subscribe command.",
 
 'unsubscribe_policy', 
 "One of three values: open, closed, auto.  Open allows people to
@@ -287,11 +299,15 @@
 This is the value of the reply-to header for digest lists.",
 
 'restrict_post',
-"If defined only address listed in one of the files (colon or
-space separated) can post to the mailing list. This is less useful than
-it seems it should be since there is no way to create these files if you
-do not have access to the machine running resend. This mechanism will
-be replaced in a future version of majordomo/resend.",
+"If defined, only addresses listed in these files (colon or
+space separated) can post to the mailing list. By default,
+these files are relative to the lists directory. These files
+are also checked when get_access, index_access, info_access,
+intro_access, which_access, or who_access is set to 'list'.
+This is less useful than it seems it should be since there
+is no way to create these files if you do not have access to
+the machine running resend. This mechanism will be replaced
+in a future version of majordomo/resend.",
 
 'resend_host',
 "The host name that is appended to all address
@@ -1087,7 +1103,7 @@
 	local($list) = @_;
 	local(@files) = ();
 	
-        @files = split (/[:\t\n]+/, $list);
+        @files = split (/[:\s]+/, $list);
 	foreach (@files) {
 	    # add listdir if no leading /
 	    #
--- majordomo.pl.orig2	Wed Jan  8 13:44:34 1997
+++ majordomo.pl	Wed Jan  8 14:54:00 1997
@@ -707,27 +707,30 @@
 
 sub main'is_list_member {
     local($subscriber, $listdir, $clean_list) = @_;
-    local($matches);
+    local($matches) = 0;
     local(*LIST);
     local($_);
 
     print STDERR "is_list_member: enter\n" if $DEBUG;
 
-    open(LIST, "$listdir/$clean_list")
-	|| &main'abort("Can't read $listdir/$clean_list: $!"); #'"";
-
-    print STDERR "is_list_member: checking $listdir/$clean_list for $subscriber\n"
-	  if $DEBUG; 
-
-    while (<LIST>) {
-	if (&main'addr_match($subscriber, $_, 
-	   (&main'cf_ck_bool($clean_list,"mungedomain") ? 2 : undef))) {
-	    $matches++;
+    $clean_list = "$listdir/$clean_list" if $listdir;
+    print STDERR "is_list_member: checking $clean_list for $subscriber\n"
+	if $DEBUG; 
+    if (open(LIST, $clean_list)) {
+	while (<LIST>) {
+	    if (&main'addr_match($subscriber, $_, 
+	       (&main'cf_ck_bool($clean_list,"mungedomain") ? 2 : undef))) {
+		$matches++;
+		last;
+	    }
 	}
+	close(LIST);
+    }
+    else {
+	&main'bitch("Can't read $clean_list: $!"); #'"";
     }
-    close(LIST);
 
-    print STDERR "is_list_member: exit\n" if $DEBUG;
+    print STDERR "is_list_member: exit $matches\n" if $DEBUG;
 
     return($matches);
 }
@@ -791,8 +794,8 @@
 
     $total = 0;
     foreach $list (@lists) {
-        next unless (-e "$listdir/$list");
-        $total += &main'is_list_member($subscriber, $listdir, $list);
+	$list = "$listdir/$list" unless ($list =~ m|^/|);
+	$total += &main'is_list_member($subscriber, "", $list);
     }
     print STDERR "access_check: exit\n" if $DEBUG;
     return $total;
--- resend.orig2	Wed Jan  1 15:18:52 1997
+++ resend	Wed Jan  8 14:54:38 1997
@@ -542,45 +542,18 @@
     #  [[[ Scary, I just realized that !@$#% is almost valid perl... ]]]
     local(@files) = split (/[:\s]+/, $opt_I);
  
-  RESTRICT:
     foreach $file (@files) {
 	# add $listdir if not explicitly set.
 	#
-	$file = "$listdir/$file" if ($file !~ /^\//);
+	$file = "$listdir/$file" unless ($file =~ m|^/|);
 
-        open ($file, "$file") 
-	    || do {
-		&bitch("Majordomo couldn't open the restrict_post file\n" .
-		       "\"$file\" \n for the list \"$opt_l\".\nThis should be fixed.");
-		next RESTRICT;
-	    };
-	
-	# Check the from address.  To Quote:
-	#   "Note that this is not guaranteed to contribute to the readability of your program. "
+	# Return a null message if the sender (from the From: or
+	# Reply-To: headers) is found
 	#
-	@output = grep (
-			&addr_match($from, $_, 
-				    (&main'cf_ck_bool($opt_l,"mungedomain")  #';
-				     ? 2
-				     : undef)), <$file>);
-	
-	if ( $#output != -1 ) {					# found a match.
-	    close ($file);					# tidy up
-	    return ();
-	}
-
-	seek( $file, 0, 0 );					# rewind
-
-	# No match, so check the reply-to address if set.
-	#
-	if ( defined($reply_to) 
-	    && $reply_to ne $from) {				# ie, don't bother if reply-to == from
-	    @output = grep (&addr_match($reply_to, $_), <$file>);
-	}	    
-
-	close ($file);
-
-	return if ( $#output != -1 );
+	return "" if &is_list_member($from, "", $file) ||
+	    (defined $reply_to	&&
+	    $reply_to ne $from	&&
+	    &is_list_member($reply_to, "", $file));
     }
 
     # We only get here if nothing matches.

-- 
 Dave Wolfe

Indexed By Date Previous: Re: MAJORDOMO ABORT (fwd)
From: Brock Rozen <brozen@webdreams.com>
Next: Re: More musings on a general access restriction mechanism
From: Rob Jenson <robjen@spotch.com>
Indexed By Thread Previous: Re: getopts.pl missing in 1.94.1 distribution
From: Norbert Bollow <nb@pobox.com>
Next: Small fix for Makefile
From: Dave Wolfe <dwolfe@risc.sps.mot.com>

Google
 
Search Internet Search www.greatcircle.com