gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge-plugin-ldapextauth/include LdapExtAuthPlugin.cla


From: cbayle
Subject: [Gforge-commits] gforge-plugin-ldapextauth/include LdapExtAuthPlugin.class, 1.3, 1.4
Date: Fri, 29 Oct 2004 17:57:20 -0500

Update of /cvsroot/gforge/gforge-plugin-ldapextauth/include
In directory db.perdue.net:/tmp/cvs-serv18124/include

Modified Files:
        LdapExtAuthPlugin.class 
Log Message:
Added AD support


Index: LdapExtAuthPlugin.class
===================================================================
RCS file: 
/cvsroot/gforge/gforge-plugin-ldapextauth/include/LdapExtAuthPlugin.class,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- LdapExtAuthPlugin.class     30 Sep 2004 03:17:39 -0000      1.3
+++ LdapExtAuthPlugin.class     29 Oct 2004 22:57:17 -0000      1.4
@@ -3,6 +3,7 @@
  * Copyright 2003 Roland Mas <address@hidden>
  * Copyright 2004 Roland Mas <address@hidden> 
  *                The Gforge Group, LLC <http://gforgegroup.com/>
+ * Copyright 2004 Christian Bayle <address@hidden> 
  *
  * This file is not part of Gforge
  *
@@ -45,6 +46,9 @@
                if ($ldap_port) {
                        $this->ldap_port = $ldap_port ;
                }
+               if ($ldap_kind) {
+                       $this->ldap_kind = $ldap_kind ;
+               }
        }
        
        function CallHook ($hookname, $params) {
@@ -70,7 +74,7 @@
                global $feedback,$Language;
        
                if (!$this->ldap_conn) {
-                       echo "ldap_connect ($this->ldap_server, 
$this->ldap_port);";
+                       //echo "ldap_connect ($this->ldap_server, 
$this->ldap_port);";
                        $this->ldap_conn = ldap_connect ($this->ldap_server,
                                                         $this->ldap_port);
                }
@@ -82,7 +86,7 @@
                $u = user_get_object_by_name ($loginname) ;
                if ($u) {
                        // User exists in DB
-                       if (ldap_bind($this->ldap_conn, $dn, $passwd)) {
+                       if (@ldap_bind($this->ldap_conn, $dn, $passwd)) {
                                // Password from form is valid in LDAP
                                if (session_login_valid_dbonly ($loginname, 
$passwd, false)) {
                                        // Also according to DB
@@ -105,7 +109,11 @@
                        if (ldap_bind($this->ldap_conn, $dn, $passwd)) {
                                // User authenticated
                                // Now get her info
-                               $res = ldap_read ($this->ldap_conn, $dn, 
"objectclass=*") ;
+                               if ($this->ldap_kind=="AD"){
+                                       $res = ldap_search ($this->ldap_conn, 
$this->base_dn, "sAMAccountName=".$loginname) ;
+                               } else {
+                                       $res = ldap_read ($this->ldap_conn, 
$dn, "objectclass=*") ;
+                               }
                                $info = ldap_get_entries 
($this->ldap_conn,$res);
                                $ldapentry = $info[0] ;
                                
@@ -172,6 +180,9 @@
                                if ($mappedinfo['ccode']) {
                                        $ccode = $mappedinfo['ccode'] ;
                                }
+                               if ($mappedinfo['themeid']) {
+                                       $theme_id = $mappedinfo['themeid'] ;
+                               }
 
                                if (!$u->create 
($unix_name,$firstname,$lastname,$password1,$password2,$email,
                                            
$mail_site,$mail_va,$language_id,$timezone,$jabber_address,$jabber_only,$theme_id,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]