[ 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.
This patch completely replaces the previous submission and applies to
an unpatched 1.94.4:
--- majordomo.orig Wed Aug 27 09:55:29 1997
+++ majordomo Wed Nov 12 16:03:51 1997
@@ -237,14 +237,8 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
# figure out who's trying to subscribe, and check that it's a valid address
local($subscriber) = join(" ", @_);
@@ -252,7 +246,7 @@
$subscriber = $reply_to;
}
if (! &valid_addr($subscriber, $clean_list)) {
- &squawk("subscribe: invalid address '$subscriber'");
+ &squawk("$sm: invalid address '$subscriber'");
return 0;
}
@@ -288,8 +282,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,54 +324,43 @@
}
&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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
# figure out who's trying to unsubscribe, and check it's a valid address
local($subscriber) = join(" ", @_);
@@ -385,7 +368,7 @@
$subscriber = $reply_to;
}
if (! &valid_addr($subscriber)) {
- &squawk("unsubscribe: invalid address '$subscriber'");
+ &squawk("$sm: invalid address '$subscriber'");
return 0;
}
@@ -417,8 +400,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 +425,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 +470,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 +494,15 @@
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);
+ ($list, $clean_list, @_) = &get_listname($sm, -1, @_);
if ($clean_list ne "") {
# get the config info for the command
@@ -538,11 +514,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(" ",@_)) || &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(" ",@_)) || &squawk("$sm: who?");
&log("approve PASSWORD unsubscribe $clean_list $subscriber");
&do_unsubscribe($clean_list, $subscriber);
} elsif ($cmd eq "get"
@@ -556,13 +534,13 @@
&$sub($clean_list, @_);
} 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 +548,14 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 2, @_);
-
- (local($passwd) = shift) || &squawk("passwd: need old password");
- (local($new_passwd) = shift)|| &squawk("passwd: need new password");
+ local($passwd, $new_passwd);
+ ($passwd = shift) || &squawk("$sm: need old password");
+ ($new_passwd = shift) || &squawk("$sm: 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 +566,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 +649,9 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 0, @_);
+ local($counter) = 0;
# Check to see that the list is valid
if ($clean_list ne "") {
@@ -732,15 +697,8 @@
# 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);
+ ($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 +727,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 +736,11 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
-
- (local($passwd) = shift) || &squawk("newinfo: needs password");
+ local($passwd);
+ ($passwd = shift) || &squawk("$sm: 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 +770,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 +780,7 @@
}
}
} else {
- &squawk("newinfo: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
while (<>) {
$_ = &chop_nl($_);
if ($_ eq "EOF") {
@@ -842,14 +794,9 @@
# 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);
+ ($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 +823,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 +831,11 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
+
+ local($passwd);
+ ($passwd = shift) || &squawk("$sm: 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
@@ -917,7 +860,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 +870,7 @@
}
}
} else {
- &squawk("newintro: unknown list '$list'.");
+ &squawk("$sm: unknown list '$list'.");
while (<>) {
$_ = &chop_nl($_);
if ($_ eq "EOF") {
@@ -940,16 +883,11 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
- (local($passwd) = shift) || &squawk("config: needs password");
+ local($passwd);
+ ($passwd = shift) || &squawk("$sm: needs password");
if ($clean_list ne "") {
# The list is valid, parse the config file
&set_lock("$listdir/$clean_list.config.LOCK") ||
@@ -974,12 +912,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 +926,11 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
- (local($passwd) = shift) || &squawk("newconfig: needs password");
+ local($passwd);
+ ($passwd = shift) || &squawk("$sm: needs password");
if ($clean_list ne "") {
# The list is valid, parse the config file
&set_lock("$listdir/$clean_list.config.LOCK") ||
@@ -1052,7 +985,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 +997,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 +1011,11 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
- (local($passwd) = shift) || &squawk("writeconfig: needs password");
+ local($passwd);
+ ($passwd = shift) || &squawk("$sm: needs password");
if ($clean_list ne "") {
# The list is valid, parse the config file
&set_lock("$listdir/$clean_list.config.LOCK") ||
@@ -1102,18 +1030,19 @@
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);
+ ($list, $clean_list, @_) = &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
@@ -1125,7 +1054,8 @@
else {
$list_outgoing = "$list-outgoing";
}
- (local($passwd) = shift) || &squawk("config: needs password");
+ local($passwd);
+ ($passwd = shift) || &squawk("$sm: needs password");
local(@digest_errors) = ();
# Check that the list is valid
local($clean_list) = &valid_list($listdir, $list);
@@ -1157,11 +1087,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 +1186,11 @@
# 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($list, $clean_list);
+ ($list, $clean_list, @_) = &get_listname($sm, 1, @_);
-
- (local($filename) = shift) || &squawk("get: which file?");
+ local($filename);
+ ($filename = shift) || &squawk("$sm: which file?");
if ($clean_list ne "") {
# The list is valid, so now check make sure that it's not a private
@@ -1325,10 +1249,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 +1261,8 @@
# 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);
+ ($list, $clean_list, @_) = &get_listname($sm, 0, @_);
if ($clean_list ne "") {
&get_config($listdir, $clean_list)
@@ -1384,19 +1301,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 +1327,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 +1854,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 +1889,36 @@
}
+# 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) = shift;
+ local($required) = shift;
+ local($raw_list, $clean_list);
+
+ if (defined($deflist)) { # -l option specified
+ if (scalar(@_) <= $required) { # minimal arguments, use default list
+ if ( !( ($raw_list = $deflist)
+ && ($clean_list = &valid_list($listdir, $raw_list)) ) ) {
+ $raw_list = shift || &squawk("$request: which list?");
+ $clean_list = &valid_list($listdir, $raw_list);
+ }
+ }
+ elsif ( !( ($raw_list = shift)
+ && ($clean_list = &valid_list($listdir, $raw_list)) ) ) {
+ unshift(@_, $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;
+ $clean_list = &valid_list($listdir, $raw_list);
+ }
+
+ return ($raw_list, $clean_list, @_);
+}
--- majordomo.pl.orig Wed Aug 27 09:58:53 1997
+++ majordomo.pl Tue Nov 4 10:00:20 1997
@@ -673,7 +673,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
References:
|
|