[ I had previously written: ]
> >
> > I set up all lists here with a listname-request alias to simplify things
> > for users since we have multiple Mj servers. Some list owners, despite
> > my urging to the contrary, choose to archive list traffic in a single
> > file, which, by convention, matches the list name. This combination
> > results in requests to listname-request of the form:
> >
> > get listname
> >
> > Unfortunately, the code in do_get() grabs "listname" and determines that
> > it's a valid list name, and attempts to grab a third token for the file
> > name (bug #1):
> >
> > local($list) = shift;
> > local($clean_list);
> > if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
> > && defined($deflist)) {
> >
> > The expression that should squawk about there not being a file name
> > present doesn't detect that fact due to the local declaration (bug #2):
> >
> > (local($filename) = shift) || &squawk("get: which file?");
> >
> > and silently proceeds to pass a directory to lopen() because
> > valid_filename() only checks that the pathname exists (bug #3) and the
> > *directory* does exist.
> >
> > Bug #2 exists in several places but is easy enough to fix. In the
> > process I discovered some inconsistency in the use of $sm in squawk()
> > messages and even some messages that referenced the wrong command (bug
> > #4).
> >
> > Bug #1 is a bit of a sticky wicket. I chose to adopt the policy that
> > if the -l option is specified (a default list) then a list name must
> > *not* be specified in the request, reasoning that requests sent to a
> > specific list-request alias shouldn't be specifying other lists anyway,
> > non-list-specific requests not withstanding. Note that this policy
> > changes mkdigest syntax which previously always required the listname to
> > be specified in the request, even when -l was specified. The downside is
> > that it enforces the difference in request syntax between requests sent
> > to the general majordomo alias and the list-request alias. Does anyone
> > object vehemently to that dichotomy? While it's possible to examine the
> > number of operands and decide if the listname might be present, that's
> > not reliable when there can be a variable number of operands, e.g.:
> >
> > subscribe user@host.domain.com (Joe User)
> > subscribe alist user@host.domain.com
> >
> > Anyway, here are my patches. If the fix for #1 causes too much of a
> > change in the request semantics for you, let's hear your counter-
> > proposal:
>
> Even though the only responses seemed to be positive or at least not
> opposed, I didn't really like it, so here's a replacement patch that's
> less of a change. The main difference is that it looks at the number of
> arguments before deciding to use the -l option list: if there are enough
> arguments, it peeks at the first one to see if it's a list name. This
> can still lead to some ambiguity when a variable number of arguments is
> allowed, but that's consistent with the old behavior. If there aren't
> enough, then it doesn't eat the first one as a list name just because it
> happens to be an existing list. Of course, if -l isn't used to invoke
> majordomo, then the first argument must be a list name, just like
> before.
Sigh. Seems that the previous patch(es) aren't liked too well by Perl 4.
It has a thing about assigning to @_, or rather, it just doesn't do that.
This patch completely replaces the previous submissions and applies to
an unpatched 1.94.4:
--- majordomo.orig Wed Aug 27 09:55:29 1997
+++ majordomo Tue Dec 23 21:00:44 1997
@@ -237,22 +237,15 @@
# figure out what list we are trying to subscribe to
# and check to see if the list is valid
local($sm) = "subscribe";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?");# set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
+ local($list, $clean_list, @args) = &get_listname($sm, 1, @_);
# figure out who's trying to subscribe, and check that it's a valid address
- local($subscriber) = join(" ", @_);
+ local($subscriber) = join(" ", @args);
if ($subscriber eq "") {
$subscriber = $reply_to;
}
if (! &valid_addr($subscriber, $clean_list)) {
- &squawk("subscribe: invalid address '$subscriber'");
+ &squawk("$sm: invalid address '$subscriber'");
return 0;
}
@@ -288,8 +281,8 @@
# subscriber is the person making the request
if ($approved
|| ($sub_policy =~ /auto/i &&
- &check_and_request("subscribe", $clean_list,
- $subscriber, "check_only")) # I don't think this check is doing the right thing. Chan 95/10/19
+ # I don't think this check is doing the right thing. Chan 95/10/19
+ &check_and_request($sm, $clean_list, $subscriber, "check_only"))
|| (($sub_policy !~ /closed/ )
&& &addr_match($reply_to, $subscriber,
(&cf_ck_bool($clean_list,"mungedomain") ? 2 : undef)))
@@ -330,62 +323,50 @@
}
&lclose(LIST) || &abort("Error closing $listdir/$clean_list: $!");
} else {
- &check_and_request("subscribe", $clean_list, $subscriber);
+ &check_and_request($sm, $clean_list, $subscriber);
}
} else {
- &squawk("subscribe: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
}
sub do_unsubscribe_all {
local(@parts) = @_;
+ local($list);
opendir(RD_DIR, $listdir) || &abort("opendir failed $!");
- @lists = readdir(RD_DIR);
+ @lists = grep(!/[^-\w]/, readdir(RD_DIR)); # skip non-list files (*.info, etc.)
closedir(RD_DIR);
$quietnonmember=1;
- foreach (sort @lists) {
- $list = $_;
- $list =~ /[^-_0-9a-zA-Z]/ && next; # skip non-list files (*.info, etc.)
-
+ foreach $list (sort @lists) {
print REPLY "Doing 'unsubscribe $list ", join(' ', @parts), "'.\n"
if $DEBUG;
- unshift(@parts, $list);
- &do_unsubscribe(@parts);
- shift(@parts);
+ &do_unsubscribe($list, @parts);
}
}
sub do_unsubscribe {
+ if ($_[0] =~ /^\*$/) {
+ shift;
+ &do_unsubscribe_all(@_);
+ return 0;
+ }
local($match_count) = 0;
local($match_length);
# figure out what list we are trying to unsubscribe from
# and check to see if the list is valid
local($sm) = "unsubscribe";
- local($list) = shift;
- local($clean_list);
-
- if ($list =~ /^\*$/) {
- &do_unsubscribe_all(@_);
- return 0;
- }
-
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
+ local($list, $clean_list, @args) = &get_listname($sm, 1, @_);
# figure out who's trying to unsubscribe, and check it's a valid address
- local($subscriber) = join(" ", @_);
+ local($subscriber) = join(" ", @args);
if ($subscriber eq "") {
$subscriber = $reply_to;
}
if (! &valid_addr($subscriber)) {
- &squawk("unsubscribe: invalid address '$subscriber'");
+ &squawk("$sm: invalid address '$subscriber'");
return 0;
}
@@ -417,8 +398,7 @@
# unsubscribe themselves without the owner's approval).
if ($approved
|| ($config_opts{$clean_list,"unsubscribe_policy"} eq "auto" &&
- &check_and_request("unsubscribe", $clean_list,
- $subscriber, "check_only"))
+ &check_and_request($sm, $clean_list, $subscriber, "check_only"))
|| (($config_opts{$clean_list,"unsubscribe_policy"} ne "closed" )
&& &addr_match($reply_to, $subscriber,
(&cf_ck_bool($clean_list,"mungedomain") ? 2 : undef)))) {
@@ -443,7 +423,7 @@
$match_count++;
$match_length = length;
if ($match_count != 1) {
- &squawk("unsubscribe: '$subscriber' matches multiple list members.");
+ &squawk("$sm: '$subscriber' matches multiple list members.");
last;
}
}
@@ -488,10 +468,10 @@
&lclose(LIST);
} else {
print STDERR "do_unsubscribe: authorization failed, calling check_and_request.\n" if $DEBUG;
- &check_and_request("unsubscribe", $clean_list, $subscriber);
+ &check_and_request($sm, $clean_list, $subscriber);
}
} else {
- &squawk("unsubscribe: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
}
@@ -512,21 +492,14 @@
sub do_approve {
# Check to see we've got all the arguments
- (local($passwd) = shift) || &squawk("approve: needs passwd");
- (local($cmd) = shift) || &squawk("approve: which command?");
+ local($sm) = "approve";
+ local($passwd, $cmd);
+ ($passwd = shift) || &squawk("$sm: needs passwd");
+ ($cmd = shift) || &squawk("$sm: which command?");
$cmd =~ tr/A-Z/a-z/; # downcase the command
# Check to see if the list is valid or use default list.
# and check to see if we've got a valid list
- local($sm) = "approve";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
+ local($list, $clean_list, @args) = &get_listname($sm, -1, @_);
if ($clean_list ne "") {
# get the config info for the command
@@ -538,11 +511,13 @@
# The password is valid, so set "approved" and do the request
$approved = 1;
if ($cmd eq "subscribe") {
- (local($subscriber) = join(" ",@_)) || &squawk("approve: who?");
+ local($subscriber);
+ ($subscriber = join(" ",@args)) || &squawk("$sm: who?");
&log("approve PASSWORD subscribe $clean_list $subscriber");
&do_subscribe($clean_list, $subscriber);
} elsif ($cmd eq "unsubscribe") {
- (local($subscriber) = join(" ",@_)) || &squawk("approve: who?");
+ local($subscriber);
+ ($subscriber = join(" ",@args)) || &squawk("$sm: who?");
&log("approve PASSWORD unsubscribe $clean_list $subscriber");
&do_unsubscribe($clean_list, $subscriber);
} elsif ($cmd eq "get"
@@ -551,18 +526,18 @@
|| $cmd eq "intro"
|| $cmd eq "who"
|| $cmd eq "which") {
- &log("approve PASSWORD $cmd $clean_list " . join(" ", @_));
+ &log("approve PASSWORD $cmd $clean_list " . join(" ", @args));
$sub = "do_$cmd";
- &$sub($clean_list, @_);
+ &$sub($clean_list, @args);
} else {
# you can only approve the above
- &squawk("approve: invalid command '$cmd'");
+ &squawk("$sm: invalid command '$cmd'");
}
} else {
- &squawk("approve: invalid list or password.");
+ &squawk("$sm: invalid list or password.");
}
} else {
- &squawk("approve: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
}
@@ -570,20 +545,12 @@
# check to see that we've got all the arguments
# and check to see if we've got a valid list
local($sm) = "passwd";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
+ local($list, $clean_list, $passwd, $new_passwd) = &get_listname($sm, 2, @_);
+ &squawk("$sm: need old password") unless $passwd;
+ &squawk("$sm: need new password") unless $new_passwd;
- (local($passwd) = shift) || &squawk("passwd: need old password");
- (local($new_passwd) = shift)|| &squawk("passwd: need new password");
if ($clean_list eq "") {
- &squawk("passwd: invalid list '$list'");
+ &squawk("$sm: invalid list '$list'");
return;
}
# We've got a valid list; now see if the old password is valid
@@ -594,7 +561,7 @@
if (&valid_passwd($listdir, $clean_list, $passwd)) {
# The old password is correct, so make sure the new one isn't null
if ($new_passwd eq "") {
- &squawk("passwd: null 'new_passwd'.");
+ &squawk("$sm: null 'new_passwd'.");
return;
}
# The new password is valid, too, so write it.
@@ -677,16 +644,8 @@
# Make sure we've got the right arguments
# and check to see if we've got a valid list
local($sm) = "who";
- local($list) = shift;
- local($clean_list);
- local($counter) = 0; # count the whos in whoville.
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
+ local($list, $clean_list) = &get_listname($sm, 0, @_);
+ local($counter) = 0;
# Check to see that the list is valid
if ($clean_list ne "") {
@@ -732,15 +691,7 @@
# Make sure we've got the arguments we need
# and Check that the list is OK
local($sm) = "info";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
+ local($list, $clean_list) = &get_listname($sm, 0, @_);
if ($clean_list ne "") {
# The list is OK, so give the info, or a message that none is available
@@ -769,7 +720,7 @@
print REPLY "#### No info available for $clean_list.\n";
}
} else {
- &squawk("info: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
&log("info $clean_list");
}
@@ -778,17 +729,9 @@
# Check to make sure we've got the right arguments
# and Check that the list is valid
local($sm) = "newinfo";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
+ local($list, $clean_list, $passwd) = &get_listname($sm, 1, @_);
+ &squawk("$sm: needs password") unless $passwd;
- (local($passwd) = shift) || &squawk("newinfo: needs password");
if ($clean_list ne "") {
&get_config($listdir, $clean_list) if !&cf_ck_bool($clean_list, '', 1);
# The list is valid, so check the password
@@ -818,7 +761,7 @@
&abort("Can't write $listdir/$clean_list.info: $!");
}
} else {
- &squawk("newinfo: invalid password.");
+ &squawk("$sm: invalid password.");
&log("FAILED newinfo $clean_list PASSWORD");
while (<>) {
$_ = &chop_nl($_);
@@ -828,7 +771,7 @@
}
}
} else {
- &squawk("newinfo: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
while (<>) {
$_ = &chop_nl($_);
if ($_ eq "EOF") {
@@ -842,14 +785,8 @@
# Make sure we've got the arguments we need
# and Check that the list is OK
local($sm) = "intro";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
+ local($list, $clean_list) = &get_listname($sm, 0, @_);
+
if ($clean_list ne "") {
# The list is OK, so give the intro, or a message that none is available
# get configuration info
@@ -876,7 +813,7 @@
print REPLY "#### No intro available for $clean_list.\n";
}
} else {
- &squawk("intro: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
&log("intro $clean_list");
}
@@ -884,15 +821,9 @@
# Check to make sure we've got the right arguments
# and Check that the list is valid
local($sm) = "newintro";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
- (local($passwd) = shift) || &squawk("newintro: needs password");
+ local($list, $clean_list, $passwd) = &get_listname($sm, 1, @_);
+ &squawk("$sm: needs password") unless $passwd;
+
if ($clean_list ne "") {
&get_config($listdir, $clean_list) if !&cf_ck_bool($clean_list, '', 1);
# The list is valid, so check the password
@@ -917,7 +848,7 @@
&abort("Can't write $listdir/$clean_list.intro: $!");
}
} else {
- &squawk("newintro: invalid password.");
+ &squawk("$sm: invalid password.");
&log("FAILED newintro $clean_list PASSWORD");
while (<>) {
$_ = &chop_nl($_);
@@ -927,7 +858,7 @@
}
}
} else {
- &squawk("newintro: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
while (<>) {
$_ = &chop_nl($_);
if ($_ eq "EOF") {
@@ -940,16 +871,9 @@
# Check to make sure we've got the right arguments
# and Check that the list is valid
local($sm) = "config";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
+ local($list, $clean_list, $passwd) = &get_listname($sm, 1, @_);
+ &squawk("$sm: needs password") unless $passwd;
- (local($passwd) = shift) || &squawk("config: needs password");
if ($clean_list ne "") {
# The list is valid, parse the config file
&set_lock("$listdir/$clean_list.config.LOCK") ||
@@ -974,12 +898,12 @@
print REPLY "#### No config available for $clean_list.\n";
}
} else {
- &squawk("config: invalid password.");
+ &squawk("$sm: invalid password.");
&log("FAILED config $clean_list PASSWORD");
}
&free_lock("$listdir/$clean_list.config.LOCK");
} else {
- &squawk("config: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
&log("config $clean_list");
}
@@ -988,16 +912,9 @@
# Check to make sure we've got the right arguments
# and Check that the list is valid
local($sm) = "newconfig";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
+ local($list, $clean_list, $passwd) = &get_listname($sm, 1, @_);
+ &squawk("$sm: needs password") unless $passwd;
- (local($passwd) = shift) || &squawk("newconfig: needs password");
if ($clean_list ne "") {
# The list is valid, parse the config file
&set_lock("$listdir/$clean_list.config.LOCK") ||
@@ -1052,7 +969,7 @@
&abort("Can't write $listdir/$clean_list.config: $!");
}
} else {
- &squawk("newconfig: invalid password.");
+ &squawk("$sm: invalid password.");
&log("FAILED newconfig $clean_list PASSWORD");
while (<>) {
$_ = &chop_nl($_);
@@ -1064,7 +981,7 @@
&free_lock("$listdir/$clean_list.config.LOCK");
} else {
- &squawk("newconfig: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
while (<>) {
$_ = &chop_nl($_);
if ($_ eq "EOF") {
@@ -1078,16 +995,9 @@
# Check to make sure we've got the right arguments
# and Check that the list is valid
local($sm) = "writeconfig";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
+ local($list, $clean_list, $passwd) = &get_listname($sm, 1, @_);
+ &squawk("$sm: needs password") unless $passwd;
- (local($passwd) = shift) || &squawk("writeconfig: needs password");
if ($clean_list ne "") {
# The list is valid, parse the config file
&set_lock("$listdir/$clean_list.config.LOCK") ||
@@ -1102,30 +1012,31 @@
print REPLY "wrote new config for list $clean_list.\n";
&log("writeconfig $clean_list PASSWORD");
} else {
- &squawk("writeconfig: invalid password.");
+ &squawk("$sm: invalid password.");
&log("FAILED writeconfig $clean_list PASSWORD");
}
&free_lock("$listdir/$clean_list.config.LOCK");
} else {
- &squawk("writeconfig: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
}
sub do_mkdigest {
# Check to make sure we've got the right arguments
- (local($list) = shift) || &squawk("config: which list?");
+ local($list, $clean_list, @args) = &get_listname($sm, -1, @_);
# We allow the specification of the outgoing alias for the digest so
# that list owners can change it to be something secret, but we have to
# remain backwards compatible, so we allow 2 or 3 args.
local($list_outgoing);
- if ($#_ == 1) { # Called with 2 or 3 args, one already shifted off
- $list_outgoing = shift;
+ if ($#args == 1) { # Called with 2 or 3 args, one already shifted off
+ $list_outgoing = shift @args;
}
else {
$list_outgoing = "$list-outgoing";
}
- (local($passwd) = shift) || &squawk("config: needs password");
+ local($passwd);
+ ($passwd = shift @args) || &squawk("$sm: needs password");
local(@digest_errors) = ();
# Check that the list is valid
local($clean_list) = &valid_list($listdir, $list);
@@ -1157,11 +1068,11 @@
}
}
} else {
- &squawk("mkdigest: invalid password.");
+ &squawk("$sm: invalid password.");
&log("FAILED mkdigest $clean_list PASSWORD");
}
} else {
- &squawk("mkdigest: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
}
@@ -1256,17 +1167,8 @@
# Make sure we've got the arguments we need
# and Check that the list is OK
local($sm) = "get";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
-
- (local($filename) = shift) || &squawk("get: which file?");
+ local($list, $clean_list, $filename) = &get_listname($sm, 1, @_);
+ &squawk("$sm: which file?") unless $filename;
if ($clean_list ne "") {
# The list is valid, so now check make sure that it's not a private
@@ -1325,10 +1227,10 @@
}
}
} else {
- &squawk("get: invalid file '$filename' for list '$clean_list'.");
+ &squawk("$sm: invalid file '$filename' for list '$clean_list'.");
}
} else {
- &squawk("get: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
&log("get $clean_list $filename");
}
@@ -1337,15 +1239,7 @@
# Make sure we've got the arguments we need
# and Check that the list is OK
local($sm) = "index";
- local($list) = shift;
- local($clean_list);
- if ( ((!$list) || ! ($clean_list = &valid_list($listdir, $list)))
- && defined($deflist)) {
- unshift(@_,$list) ; # Not a list name, put it back.
- $list=$deflist || &squawk("$sm: which list?"); # set the list to deflist
- $clean_list = &valid_list($listdir, $list);
- }
-
+ local($list, $clean_list) = &get_listname($sm, 0, @_);
if ($clean_list ne "") {
&get_config($listdir, $clean_list)
@@ -1384,19 +1278,19 @@
}
unless (close INDEX) {
&bitch("Index command $index_command failed.\n$! $?");
- &squawk("index: index command failed");
+ &squawk("$sm: index command failed");
}
}
else {
&bitch("Cannot chdir to $filedir/$clean_list$filedir_suffix to build index\n$!");
- &squawk("index: index command failed");
+ &squawk("$sm: index command failed");
}
} else {
print REPLY "#### No files available for $clean_list.\n";
}
}
} else {
- &squawk("index: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
}
&log("index $list");
chdir("$homedir");
@@ -1410,7 +1304,7 @@
local($listrequest) = " or to \"<list>-request\@$whereami\".\n";
$listrequest .= "\nThe <list> parameter is only optional if the ";
$listrequest .= "message is sent to an address\nof the form ";
- $listrequest .= "\"<list>-request\@$whereami\".\n";
+ $listrequest .= "\"<list>-request\@$whereami\".";
$listrequest = "." unless $majordomo_request;
@@ -1937,7 +1831,7 @@
local($addr) = &valid_addr($subscriber);
if ($addr =~ /\s/ && $addr !~ /[!%\@:]/) {
# yup, looks like a LISTSERV-style request to me.
- &squawk("subscribe: LISTSERV-style request failed");
+ &squawk("$request: LISTSERV-style request failed");
print REPLY <<"EOM";
This looks like a BITNET LISTSERV style '$request' request, because
the part after the list name doesn't look like an email address; it looks
@@ -1972,4 +1866,35 @@
}
+# Extracts the list name from the argument list to the do_* functions
+# or uses the default list name, depending on invocation options and
+# available arguments. Returns the raw list name, the validated list
+# name, and the remaining argument list.
+
+sub get_listname {
+ local($request, $required, @args) = @_;
+ local($raw_list, $clean_list);
+
+ if (defined($deflist)) { # -l option specified
+ if (scalar(@args) <= $required) { # minimal arguments, use default list
+ if ( !( ($raw_list = $deflist)
+ && ($clean_list = &valid_list($listdir, $raw_list)) ) ) {
+ $raw_list = shift(@args) || &squawk("$request: which list?");
+ $clean_list = &valid_list($listdir, $raw_list);
+ }
+ }
+ elsif ( !( ($raw_list = shift(@args))
+ && ($clean_list = &valid_list($listdir, $raw_list)) ) ) {
+ unshift(@args, $raw_list); # Not a list name, put it back.
+ $raw_list = $deflist || &squawk("$request: which list?");
+ $clean_list = &valid_list($listdir, $raw_list);
+ }
+ }
+ else {
+ $raw_list = shift(@args);
+ $clean_list = &valid_list($listdir, $raw_list);
+ }
+
+ return ($raw_list, $clean_list, @args);
+}
--- majordomo.pl.orig Wed Aug 27 09:58:53 1997
+++ majordomo.pl Wed Dec 17 08:13:04 1997
@@ -673,7 +688,7 @@
} else {
$clean_filename = $taint_filename;
}
- if (! -e "$directory/$list$suffix/$clean_filename") {
+ if (! -f "$directory/$list$suffix/$clean_filename") {
return undef;
}
return "$directory/$list$suffix/$clean_filename";
--
Dave Wolfe
|
|