LDAP_USERNAME_POSTFIX necessary / #6197

ldap_bind does not work with only a username given, a complete LDAP DN is necessary. We have LDAP "usernames" in the form uid=username,ou=acounts,o=organization.

LDAP auth works with the following patches:

from conf.inc.php

diff -ru streber.orig/conf/conf.inc.php streber/conf/conf.inc.php
--- streber.orig/conf/conf.inc.php      2007-07-30 02:32:06.000000000 +0200
+++ streber/conf/conf.inc.php   2008-01-08 18:00:29.403750199 +0100
@@ -364,9 +364,10 @@
        /**
        * LDAP Settings
        */
-       'LDAP' => false,
-       'LDAP_USERNAME_PREFIX' =>'',
-       'LDAP_SERVER' => '',
+       'LDAP' => true,
+       'LDAP_USERNAME_PREFIX' => 'uid=',
+       'LDAP_USERNAME_POSTFIX' => ',ou=accounts,o=organization',
+       'LDAP_SERVER' => 'ldap-hm',

        /**
        * Reply on comment prefix

from class_auth.inc.php

diff -ru streber.orig/std/class_auth.inc.php streber/std/class_auth.inc.php
--- streber.orig/std/class_auth.inc.php 2007-07-30 00:27:16.000000000 +0200
+++ streber/std/class_auth.inc.php      2008-01-08 18:00:55.359982446 +0100
@@ -194,7 +194,7 @@
                        return false;
                }

-               if(!$ldapbind = ldap_bind($ldapconn, confGet('LDAP_USERNAME_PREFIX').$name, $password)){
+               if(!$ldapbind = ldap_bind($ldapconn, confGet('LDAP_USERNAME_PREFIX').$name.confGet('LDAP_USERNAME_POSTFIX'), $password)){
                        log_message("login failed, bind to ldap server failed.", LOG_MESSAGE_LOGIN_FAILURE);
                        return false;
                }