File postfix-SuSE-ldap.patch of Package postfix.import4251

diff -ruN postfix-SuSE-orig/ldap_aliases.cf postfix-SuSE/ldap_aliases.cf
--- postfix-SuSE-orig/ldap_aliases.cf	1970-01-01 01:00:00.000000000 +0100
+++ postfix-SuSE/ldap_aliases.cf	2011-01-17 10:43:12.000000000 +0100
@@ -0,0 +1,4 @@
+server_host = 127.0.0.1
+search_base = dc=mail,dc=net
+query_filter = (&(|(mail=%s)(mailAlternateAddress=%s))(objectClass=posixAccount))
+result_attribute = uid
diff -ruN postfix-SuSE-orig/SuSEconfig.postfix postfix-SuSE/SuSEconfig.postfix
--- postfix-SuSE-orig/SuSEconfig.postfix	2010-11-25 16:15:29.000000000 +0100
+++ postfix-SuSE/SuSEconfig.postfix	2011-01-17 11:39:32.000000000 +0100
@@ -231,6 +231,8 @@
     TMPDIR=$(mktemp -d /tmp/SuSEconfig.postfix.XXXXXX) || exit 1
     PCONF="/usr/sbin/postconf -c $TMPDIR"
 
+    # needed when for WITH_LDAP
+    export POSTFIX_WITH_LDAP
     # needed when for WITH_MYSQL
     export POSTFIX_WITH_MYSQL
     MCF_DIR=$TMPDIR
@@ -623,6 +625,11 @@
 my $mncf = "$ENV{MCF_DIR}/main.cf";
 my $line;
 
+my $with_ldap =
+    defined $ENV{POSTFIX_WITH_LDAP} ? $ENV{POSTFIX_WITH_LDAP} : "no";
+
+$with_ldap = lc($with_ldap);
+
 my $with_mysql =
     defined $ENV{POSTFIX_WITH_MYSQL} ? $ENV{POSTFIX_WITH_MYSQL} : "no";
 
@@ -634,10 +641,14 @@
     chomp;
 
 	if( /\#?(virtual_alias_maps\s=\s).*/ ) {
-	  if ($with_mysql ne "yes") {
-		$line = $1."hash:/etc/postfix/virtual";
-	  } else {
+          if ($with_mysql ne "yes" && $with_ldap ne "yes") {
+                $line = $1."hash:/etc/postfix/virtual";
+          } elsif ($with_ldap eq "yes" && $with_mysql ne "yes") {
+                $line = $1."hash:/etc/postfix/virtual ldap:/etc/postfix/ldap_aliases.cf";
+          } elsif ($with_mysql eq "yes" && $with_ldap ne "yes") {
 		$line = $1."hash:/etc/postfix/virtual mysql:/etc/postfix/mysql_virtual_alias_maps.cf";
+          } elsif ($with_mysql eq "yes" && $with_ldap eq "yes") {
+                $line = $1."hash:/etc/postfix/virtual ldap:/etc/postfix/ldap_aliases.cf mysql:/etc/postfix/mysql_virtual_alias_maps.cf";
 	  }
 	} elsif( /\#?(virtual_uid_maps\s=.*)/ ) {
 	  if ($with_mysql ne "yes") {
diff -ruN postfix-SuSE-orig/sysconfig.postfix postfix-SuSE/sysconfig.postfix
--- postfix-SuSE-orig/sysconfig.postfix	2010-07-06 16:57:01.000000000 +0200
+++ postfix-SuSE/sysconfig.postfix	2011-01-17 10:40:19.000000000 +0100
@@ -125,6 +125,15 @@
 ## Default:     no
 ## Config:      postfix
 #
+# Set this to yes, if SuSEconfig should activate ldap stuff in main.cf
+# This extends virtual_alias_maps with "ldap:/etc/postfix/ldap_aliases.cf"
+#
+POSTFIX_WITH_LDAP="no"
+
+## Type:        yesno
+## Default:     no
+## Config:      postfix
+#
 # Set this to yes, if SuSEconfig should activate mysql stuff in main.cf
 # and having 'mysql.sock' inside chroot jail
 # Note: When POSTFIX_CHROOT="yes" then 'mysql.sock' will be available