martin: server/kolab-webadmin/kolab-webadmin/php/admin/include auth.class.php, 1.4, 1.5 ldap.class.php, 1.9, 1.10
cvs at intevation.de
cvs at intevation.de
Tue Aug 3 09:07:07 CEST 2004
Author: martin
Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include
In directory doto:/tmp/cvs-serv10230/kolab-webadmin/php/admin/include
Modified Files:
auth.class.php ldap.class.php
Log Message:
Martin K.: Fix issue #254
Index: auth.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/auth.class.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- auth.class.php 19 Jul 2004 01:36:59 -0000 1.4
+++ auth.class.php 3 Aug 2004 07:07:05 -0000 1.5
@@ -57,14 +57,18 @@
// User not logged in, check login/password
if( isset( $_POST['username'] ) && isset( $_POST['password'] ) ) {
$dn = $ldap->dnForUid( $_POST['username'] );
+ if (!$dn) {
+ $dn = $ldap->dnForMail( $_POST['username'] ); // try mail attribute
+ }
if( $dn ) {
+ $auth_user = $ldap->uidForDn( $dn );
$bind_result = $ldap->bind( $dn, $_POST['password'] );
if( $bind_result ) {
// All OK!
$_SESSION['auth_dn'] = $dn;
- $_SESSION['auth_user'] = $_POST['username'];
+ $_SESSION['auth_user'] = $auth_user;
$_SESSION['auth_pw'] = $_POST['password'];
- $_SESSION['auth_group'] = $ldap->groupForUid($_POST['username']);
+ $_SESSION['auth_group'] = $ldap->groupForUid( $auth_user );
$_SESSION['remote_ip'] = $_SERVER['REMOTE_ADDR'];
return true;
} else {
@@ -155,4 +159,4 @@
buffer-file-coding-system: utf-8
End:
*/
-?>
\ No newline at end of file
+?>
Index: ldap.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/ldap.class.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ldap.class.php 19 Jul 2004 01:36:59 -0000 1.9
+++ ldap.class.php 3 Aug 2004 07:07:05 -0000 1.10
@@ -167,6 +167,19 @@
return false;
}
+ function dnForMail( $mail ) {
+ if( $this->search( $_SESSION['base_dn'],
+ '(&(objectclass=kInetOrgPerson)(mail='.$this->escape($mail).'))' ) ) {
+ $entry = $this->firstEntry();
+ if( $entry ) {
+ return ldap_get_dn( $this->connection, $entry );
+ }
+ } else {
+ echo _("Error searching for DN for Mail=$mail");
+ }
+ return false;
+ }
+
function groupForUid( $uid ) {
$group = false;
if( !$this->is_bound ) {
@@ -289,4 +302,4 @@
End:
vim:encoding=utf-8:
*/
-?>
\ No newline at end of file
+?>
More information about the commits
mailing list