Skip to Content.
Sympa Menu

devel - smtp check patch for 3.3b4

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Sergiy Zhuk <address@concealed>
  • To: address@concealed
  • Subject: smtp check patch for 3.3b4
  • Date: Fri, 16 Nov 2001 17:32:45 -0800 (PST)

hi

Attached is a patch to allow sympa to check if the alias with the same name
as the list you're gonna create already exists on your smtp server.
It's robot specific, i.e. you can specify a different smtp server for every
virtual host you're running.
This is needed if you're running sympa or somehost.foo.org, but you handle
all your mail on a separate mail relay, so addresses look like address@concealed,
rather than address@concealed.
To use the feature, you should define the following options in sympa.conf
or in robots.conf:

list_check_smtp smtp.foo.bar
list_check_suffixes request,owner,unsubscribe

The first one is the name of your smtp relay, the second one is a
comma-separated list of admin suffixes you're using for sympa aliases, i.e.
list-request, list-owner etc...


I also have 2 questions:

1. why do you make passwords case insensitive ?

2. why do you hint password guessers by telling them the part of the
password they've entered was correct ?

- ## Uncomplete password
- if ($user->{'password'} =~ /$pwd/) {
- &error_message('uncomplete_passwd');
- &wwslog('info','do_login: uncomplete password for user %s',
$email)
- }else {
- if ($user->{'password'} =~ /^init/i) {
+ if ($user->{'password'} =~ /^init/i) {
&error_message('init_passwd');
- }
- &error_message('incorrect_passwd');
- &wwslog('info','authentication: incorrect password for user %s',
$e
- }
-
+ }
+ &error_message('incorrect_passwd');
+ &wwslog('info','authentication: incorrect password for user %s',
$emai

thanks

--
rgds,
serge
Index: wwsympa.fcgi
===================================================================
--- wwsympa.fcgi.orig 2001/11/17 01:06:09
+++ wwsympa.fcgi 2001/11/17 01:06:59
@@ -4039,9 +4041,51 @@
return 1;
}

+## check if the requested list exists already using smtp 'rcpt to'
+sub list_check_smtp
+{
+my $list = shift;
+my $conf = '';
+my $smtp;
+my @suf;
+my $domain;
+my $smtp_relay;
+my $suffixes;
+
+ $smtp_relay = $Conf{'robots'}{$robot}{'list_check_smtp'} ||
$Conf{'list_check_smtp'};
+ $suffixes = $Conf{'robots'}{$robot}{'list_check_suffixes'} ||
$Conf{'list_check_suffixes'};
+ return 0 if ! $smtp_relay || ! $suffixes;
+ $domain = $Conf{'robots'}{$robot}{'host'} || $Conf{'host'};
+ &wwslog('debug', 'list_check_smtp(%s)',$in{'listname'});
+ @suf = split(/,/,$suffixes);
+ return 0 if ! @suf;
+ for(@suf)
+ {
+ $_ = $list . "-$_\@" . $domain;
+ }
+ push @suf,"$list\@" . $domain;
+
+ use Net::SMTP;
+ if( $smtp = Net::SMTP->new($smtp_relay,
+ Hello => $smtp_relay,
+ Timeout => 300) )
+ {
+ $smtp->mail('<>');
+ for(@suf)
+ {
+ $conf = $smtp->to($_);
+ last if $conf;
+ }
+ $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'});

foreach my $arg ('listname','subject','template','info','topics') {
@@ -4059,12 +4103,19 @@
return 'create_list_request';
}

- if ( new List ($in{'listname'})) {
- &error_message('list_already_exists');
- &do_log('info', 'could not create already existing list %s for %s',
$in{'listname'},$param->{'user'}{'email'});
+ $res = list_check_smtp($in{'listname'});
+ if( $res < 0 )
+ {
+ &error_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'}) ) {
+ &error_message('list_already_exists');
+ &do_log('info', 'could not create already existing list %s for %s',
$in{'listname'},$param->{'user'}{'email'});
+ return undef;
+ }
+
unless ($param->{'user'}{'email'}) {
&error_message('no_user');
&wwslog('info','do_create_list_request: no user');
Index: Conf.pm
===================================================================
--- Conf.pm.orig 2001/11/17 01:06:09
+++ Conf.pm 2001/11/17 01:06:58
@@ -28,6 +30,7 @@
dark_color light_color text_color bg_color error_color
selected_color shaded_color
ldap_export_name ldap_export_host ldap_export_suffix
ldap_export_password
ldap_export_dnmanager ldap_export_connection_timeout
+ list_check_smtp list_check_suffixes
);
my %valid_options = ();
map { $valid_options{$_}++; } @valid_options;
@@ -297,7 +300,9 @@
bg_color => 1,
error_color => 1,
selected_color => 1,
- shaded_color => 1 );
+ shaded_color => 1,
+ list_check_smtp => 1,
+ list_check_suffixes => 1 );

unless (opendir DIR,'/home/sympa/etc' ) {
do_log('info','Unable to open directory /home/sympa/etc for virtual
robots config' );



Archive powered by MHonArc 2.6.19+.

Top of Page