Skip to Content.
Sympa Menu

devel - wwsympa smtp check patch

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Sergiy Zhuk <address@concealed>
  • To: address@concealed
  • Cc: address@concealed
  • Subject: wwsympa smtp check patch
  • Date: Mon, 22 Jan 2001 17:43:30 -0800 (PST)

hi

There are installations when mail lists share name space with the rest of
company's emails, i.e. you can't tell if address@concealed is a
personal email or a mailing list.
In that case you need to check if alias exists on you mail server before
allowing sympa to create a new list.
I've added a configuration option "list_check_smtp" to /etc/wwsympa.conf to
accomplish that.
The option's value is your smtp server name (e.g. smtp.bar.com).
If it's defined, then wwsympa will connect to the server and will check if
the new list user is trying to create is taken or not.
I should also probably check if
list-{subscribe,unsubscribe,owner,request,editor} are taken or not, but I
didn't do it for now since you can generally change these aliases to whatever
you want and forward them properly, e.g. instead of list-request, you can
probably create
list-admin: "|/home/sympa/bin/queue list-request"
If I'm right, it probably makes sense to make these names configurable
somewhere, so one could check them all...
Currently even w/o SMTP wwsympa allows you to create <list> and <list-owner>
which won't work in case you process bounces as list-owner.
Same is true for list-subscribe etc...

thanks

--
rgds,
serge
--- wws-lib.pl.orig Thu Jan 4 04:58:43 2001
+++ wws-lib.pl Mon Jan 22 17:20:31 2001
@@ -95,7 +95,8 @@
use_fast_cgi => 1,
wws_path => '--BINDIR--',
default_home => 'home',
- log_facility => ''
+ log_facility => '',
+ list_check_smtp => ''
);

my $conf = \%default_conf;

--- wwsympa.fcgi.orig Tue Jan 16 01:39:51 2001
+++ wwsympa.fcgi Mon Jan 22 17:16:22 2001
@@ -3296,9 +3296,32 @@
return 1;
}

+## check if the requested list exists already using smtp 'rcpt to'
+sub list_check_smtp
+{
+my $list = shift;
+my $conf;
+my $smtp;
+
+ &wwslog('debug', 'list_check_smtp(%s)',$in{'listname'});
+ return 0 if ! $wwsconf->{'list_check_smtp'};
+ use Net::SMTP;
+ if( $smtp = Net::SMTP->new($wwsconf->{'list_check_smtp'},
+ Hello => $wwsconf->{'list_check_smtp'},
+ Timeout => 300) )
+ {
+ $smtp->mail('<>');
+ $conf = $smtp->to($list);
+ $smtp->quit();
+ return $conf;
+ }
+ return -1;
+}

## create a liste using a list template.
sub do_create_list {
+my $res;
+
&wwslog('debug',
'do_create_list(%s,%s,%s)',$in{'listname'},$in{'subject'},$in{'template'});
unless ($in{'listname'}) {
&message('list_name_is_required');
@@ -3330,7 +3353,14 @@
return undef;
}

- if ( new List ($in{'listname'})) {
+ $res = list_check_smtp($in{'listname'});
+ if( $res < 0 )
+ {
+ &message('unable_to_check_list_using_smtp');
+ &do_log('err', "can't check list %.128s on
%.128s",$in{'listname'},$wwsconf->{'list_check_smtp'});
+ return undef;
+ }
+ if( $res || new List ($in{'listname'}) ) {
&message('list_already_exists');
&do_log('info', 'could not create already existing list %s for %s',
$in{'listname'},$param->{'user'}{'email'});
return undef;



Archive powered by MHonArc 2.6.19+.

Top of Page