r78422 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78421‎ | r78422 | r78423 >
Date:00:37, 15 December 2010
Author:laner
Status:deferred
Tags:
Comment:
Adding more debug statements for memberOf
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -204,12 +204,16 @@
205205 *
206206 * @access private
207207 */
208 - function connect() {
 208+ function connect( $domain='' ) {
209209 global $wgLDAPServerNames;
210210 global $wgLDAPPort;
211211 global $wgLDAPEncryptionType;
212212 global $wgLDAPOptions;
213213
 214+ if ( $domain == '' ) {
 215+ $domain = $_SESSION['wsDomain'];
 216+ }
 217+
214218 $this->printDebug( "Entering Connect", NONSENSITIVE );
215219
216220 if ( !function_exists( 'ldap_connect' ) ) {
@@ -218,8 +222,8 @@
219223 }
220224
221225 // If the admin didn't set an encryption type, we default to tls
222 - if ( isset( $wgLDAPEncryptionType[$_SESSION['wsDomain']] ) ) {
223 - $encryptionType = $wgLDAPEncryptionType[$_SESSION['wsDomain']];
 226+ if ( isset( $wgLDAPEncryptionType[$domain] ) ) {
 227+ $encryptionType = $wgLDAPEncryptionType[$domain];
224228 } else {
225229 $encryptionType = "tls";
226230 }
@@ -244,12 +248,12 @@
245249 // Make a space separated list of server strings with the ldap:// or ldaps://
246250 // string added.
247251 $servers = "";
248 - $tmpservers = $wgLDAPServerNames[$_SESSION['wsDomain']];
 252+ $tmpservers = $wgLDAPServerNames[$domain];
249253 $tok = strtok( $tmpservers, " " );
250254 while ( $tok ) {
251 - if ( isset( $wgLDAPPort[$_SESSION['wsDomain']] ) ) {
252 - $this->printDebug( "Using non-standard port: " . $wgLDAPPort[$_SESSION['wsDomain']], SENSITIVE );
253 - $servers = $servers . " " . $serverpre . $tok . ":" . $wgLDAPPort[$_SESSION['wsDomain']];
 255+ if ( isset( $wgLDAPPort[$domain] ) ) {
 256+ $this->printDebug( "Using non-standard port: " . $wgLDAPPort[$domain], SENSITIVE );
 257+ $servers = $servers . " " . $serverpre . $tok . ":" . $wgLDAPPort[$domain];
254258 } else {
255259 $servers = $servers . " " . $serverpre . $tok;
256260 }
@@ -264,8 +268,8 @@
265269 ldap_set_option( $this->ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3 );
266270 ldap_set_option( $this->ldapconn, LDAP_OPT_REFERRALS, 0 );
267271
268 - if ( isset( $wgLDAPOptions[$_SESSION['wsDomain']] ) ) {
269 - $options = $wgLDAPOptions[$_SESSION['wsDomain']];
 272+ if ( isset( $wgLDAPOptions[$domain] ) ) {
 273+ $options = $wgLDAPOptions[$domain];
270274 foreach ( $options as $key => $value ) {
271275 if ( !ldap_set_option( $this->ldapconn, constant( $key ), $value ) ) {
272276 $this->printDebug( "Can't set option to LDAP! Option code and value: " . $key . "=" . $value, 1 );
@@ -1376,8 +1380,11 @@
13771381 }
13781382 }
13791383 }
 1384+ $this->printDebug( "Got the following groups:", SENSITIVE, $groups["dn"] );
13801385
13811386 $this->userLDAPGroups = $groups;
 1387+ } else {
 1388+ $this->printDebug( "memberOf attribute isn't set:", NONSENSITIVE );
13821389 }
13831390 } else {
13841391 $this->printDebug( "Searching for the groups", NONSENSITIVE );

Status & tagging log