Author: varkoly Date: Wed Aug 6 14:26:55 2008 New Revision: 49765 URL: http://svn.opensuse.org/viewcvs/yast?rev=49765&view=rev Log: including changes from rhafer considering the yast2-ldap-server make the count of amavisd processes variable Modified: trunk/mail/src/MailServerLDAP.pm trunk/mail/src/YaPI/MailServer.pm trunk/mail/src/mail-server_dialogs.ycp Modified: trunk/mail/src/MailServerLDAP.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/mail/src/MailServerLDAP.pm?rev=49765&r1=49764&r2=49765&view=diff ============================================================================== --- trunk/mail/src/MailServerLDAP.pm (original) +++ trunk/mail/src/MailServerLDAP.pm Wed Aug 6 14:26:55 2008 @@ -39,58 +39,29 @@ { my $ldapMap = YaPI::LdapServer->ReadDatabaseList(); # Now we configure the LDAP-Server to be able store the mail server configuration - my $schemas = YaPI::LdapServer->ReadSchemaIncludeList(); + my $schemas = YaPI::LdapServer->ReadSchemaList(); my $SCHEMA = join "",@{$schemas}; - if( $SCHEMA !~ /dnszone.schema/ ) + + if( $SCHEMA !~ /dnszone/ ) { - push @{$schemas},'/etc/openldap/schema/dnszone.schema'; + YaPI::LdapServer->AddSchema('/etc/openldap/schema/dnszone.schema'); } - if( $SCHEMA !~ /suse-mailserver.schema/ ) + if( $SCHEMA !~ /suse-mailserver/ ) { - push @{$schemas},'/etc/openldap/schema/suse-mailserver.schema'; - YaPI::LdapServer->WriteSchemaIncludeList($schemas); + YaPI::LdapServer->AddSchema('/etc/openldap/schema/suse-mailserver.schema'); } - my $indices = YaPI::LdapServer->ReadIndex($ldapMap->[0]); - my $SuSEMailClient = 0; - my $SuSEMailDomainMasquerading = 0; - my $suseTLSPerSitePeer= 0; - foreach my $index (@{$indices}) - { - if( $index->{attr} eq "SuSEMailClient,SUSEMailAcceptAddress,zoneName") - { - $SuSEMailClient = 1; - } - if( $index->{attr} eq "SuSEMailDomainMasquerading,relativeDomainName,suseMailDomainType") - { - $SuSEMailDomainMasquerading = 1; + + my $indices = YaPI::LdapServer->ReadIndex( $ldapMap->[2]->{'suffix'} ); + my @attrs = ( "SuSEMailClient", "SUSEMailAcceptAddress", "zoneName", + "SuSEMailDomainMasquerading", "relativeDomainName", "suseMailDomainType", + "suseTLSPerSitePeer", "SuSEMailTransportDestination" ); + foreach my $attr (@attrs){ + my $curindex; + if (! defined $indices->{$attr} ) { + $curindex->{'name'} = $attr; + $curindex->{'eq'} = 1; + YaPI::LdapServer->EditIndex($ldapMap->[2]->{'suffix'}, $curindex ); } - if( $index->{attr} eq "suseTLSPerSitePeer,SuSEMailTransportDestination") - { - $suseTLSPerSitePeer = 1; - } - } - if(!$SuSEMailClient) - { - YaPI::LdapServer->AddIndex($ldapMap->[0], - { "attr" => "SuSEMailClient,SUSEMailAcceptAddress,zoneName", - "param" => "eq" } - ); - } - if(!$SuSEMailDomainMasquerading) - { - YaPI::LdapServer->AddIndex($ldapMap->[0], - { "attr" => "SuSEMailDomainMasquerading,relativeDomainName,suseMailDomainType", - "param" => "eq" } - ); - } - if(!$suseTLSPerSitePeer) - { - YaPI::LdapServer->AddIndex($ldapMap->[0], - { "attr" => "suseTLSPerSitePeer,SuSEMailTransportDestination", - "param" => "eq" } - ); } - YaPI::LdapServer->RecreateIndex($ldapMap->[0]); - Service->Restart("ldap"); - return YaPI::LdapServer->ReadDatabase($ldapMap->[0]); + return YaPI::LdapServer->ReadDatabase($ldapMap->[2]->{'suffix'}); } Modified: trunk/mail/src/YaPI/MailServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/mail/src/YaPI/MailServer.pm?rev=49765&r1=49764&r2=49765&view=diff ============================================================================== --- trunk/mail/src/YaPI/MailServer.pm (original) +++ trunk/mail/src/YaPI/MailServer.pm Wed Aug 6 14:26:55 2008 @@ -56,9 +56,10 @@ my $proposal_valid = 0; ## - # Some global variables for cyrus-imapd -my $imapadm = "cyrus"; -my $imaphost = "localhost"; + # Some global variables +my $imapadm = "cyrus"; +my $imaphost = "localhost"; +my $aconf = "/etc/amavisd.conf"; ## # Write only, used during autoinstallation. @@ -1048,6 +1049,7 @@ 'RBLList' => [], 'AccessList' => [], 'VirusScanning' => 1, + 'VSCount' => 10 'SpamLearning' => 1 ); @@ -1094,6 +1096,7 @@ 'RBLList' => [], 'AccessList' => [], 'VirusScanning' => YaST::YCP::Boolean(0), + 'VSCount' => 10, 'SpamLearning' => YaST::YCP::Boolean(0) ); @@ -1169,8 +1172,28 @@ if( $smtp->[0]->{'options'}->{'content_filter'} eq 'smtp:[localhost]:10024' && $vscan ) { $MailPrevention{'VirusScanning'} = YaST::YCP::Boolean(1); + if( ! open(IN,$aconf) ) + { + return "Error: $!"; + } + my @ACONF = <IN>; + close(IN); + my $ismax = 0; + foreach ( @ACONF ) + { + s/\s+//g; + if ( /^\$max_servers=(\d+)/ ) + { + $MailPrevention{'VSCount'} = $1; + } + } + if( !$ismax ) + { + $MailPrevention{'VSCount'} = 2; + } } } + # make IMAP connection my $imap = new Net::IMAP($imaphost, Debug => 0); if( $imap ) @@ -1335,7 +1358,7 @@ SCR->Read('.mail.postfix.mastercf'); if( $MailPrevention->{'VirusScanning'} ) { - my $err = activate_virus_scanner(); + my $err = activate_virus_scanner($MailPrevention->{'VSCount'}); if( $err ne "" ) { return $self->SetError(summary => "activating virus scanner failed", @@ -1348,7 +1371,7 @@ SCR->Execute('.mail.postfix.mastercf.modifyService', { 'service' => 'smtp', 'command' => 'smtpd', - 'maxproc' => '5', + 'maxproc' => $MailPrevention->{'VSCount'}, 'options' => { 'content_filter' => 'smtp:[127.0.0.1]:10024' } } ); } else @@ -1356,7 +1379,7 @@ SCR->Execute('.mail.postfix.mastercf.addService', { 'service' => 'smtp', 'command' => 'smtpd', - 'maxproc' => '5', + 'maxproc' => $MailPrevention->{'VSCount'}, 'options' => { 'content_filter' => 'smtp:[127.0.0.1]:10024' } } ); } my $smtps = SCR->Execute('.mail.postfix.mastercf.findService', @@ -2805,9 +2828,9 @@ sub activate_virus_scanner { + my $VSCount = shift || 5; use File::Copy; - my $aconf = "/etc/amavisd.conf"; my $cconf = "/etc/clamd.conf"; my $clamsock = '/var/lib/clamav/clamd-socket'; my @CONF = (); @@ -2823,7 +2846,7 @@ my $ismax = 0; foreach my $l ( @ACONF ) { - $ismax = 1 if $l =~ s/^\$max_servers = \d+/\$max_servers = 5/; + $ismax = 1 if $l =~ s/^\$max_servers = \d+/\$max_servers = $VSCount/; $l =~ s/(.*)/# $1/ if $l =~ /bypass_virus_checks_acl.*=.*qw\( \./; if( $isclam || $l =~ /Clam Antivirus-clamd/ ) { @@ -2839,7 +2862,7 @@ } if( !$ismax ) { - push @CONF, '$max_servers = 5;' + push @CONF, '$max_servers = '.$VSCount; } if( ! open(OUT,">$aconf.new") ) { Modified: trunk/mail/src/mail-server_dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/mail/src/mail-server_dialogs.ycp?rev=49765&r1=49764&r2=49765&view=diff ============================================================================== --- trunk/mail/src/mail-server_dialogs.ycp (original) +++ trunk/mail/src/mail-server_dialogs.ycp Wed Aug 6 14:26:55 2008 @@ -660,7 +660,8 @@ list<string> RBLList = (list<string>) MailServer::MailPrevention["RBLList"]:[]; list