r78238 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78237‎ | r78238 | r78239 >
Date:08:59, 12 December 2010
Author:laner
Status:deferred
Tags:
Comment:
Making the username lowercase in a better location
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -708,7 +708,7 @@
709709
710710 $this->email = $user->getEmail();
711711 $this->realname = $user->getRealName();
712 - $username = $user->getName();
 712+ $username = strtolower( $user->getName() );
713713
714714 $pass = $this->getPasswordHash( $password );
715715
@@ -722,7 +722,7 @@
723723 if ( isset( $wgLDAPWriteLocation[$_SESSION['wsDomain']] ) ) {
724724 $this->printDebug( "wgLDAPWriteLocation is set, using that", NONSENSITIVE );
725725 $this->userdn = $wgLDAPSearchAttributes[$_SESSION['wsDomain']] . "=" .
726 - strtolower( $username ) . "," . $wgLDAPWriteLocation[$_SESSION['wsDomain']];
 726+ $username . "," . $wgLDAPWriteLocation[$_SESSION['wsDomain']];
727727 } else {
728728 $this->printDebug( "wgLDAPWriteLocation is not set, failing", NONSENSITIVE );
729729 // getSearchString will bind, but will not unbind
@@ -750,7 +750,12 @@
751751 $values["objectclass"] = array( "inetorgperson" );
752752
753753 # Let other extensions modify the user object before creation
754 - wfRunHooks( 'LDAPSetCreationValues', array( $this, &$values ) );
 754+ wfRunHooks( 'LDAPSetCreationValues', array( $this, &$values, &$result ) );
 755+ if ( ! $result ) {
 756+ $this->printDebug( "Failed to add user because LDAPSetCreationValues returned false", NONSENSITIVE );
 757+ @ldap_unbind();
 758+ return false;
 759+ }
755760
756761 if ( isset ( $wgLDAPAuthAttribute[$_SESSION['wsDomain']] ) ) {
757762 $values[$wgLDAPAuthAttribute[$_SESSION['wsDomain']]] = "true";

Status & tagging log