r112471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112470‎ | r112471 | r112472 >
Date:05:27, 27 February 2012
Author:laner
Status:ok
Tags:
Comment:
Seems getCanonicalName is used to also check page names, which causes nastiness when anons click redlinks. I want to stab our authentication code for reusing this function in this way. This fix works around an error by only connecting to LDAP if the user is also using a valid name. That said, this is a major issue all around. When a user is logged in, if they click a red link it's going to cause an LDAP lookup unless memcache is being used and there is a key hit, and that's stupid.
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -1156,7 +1156,7 @@
11571157 $key = wfMemcKey( 'ldapauthentication', 'canonicalname', $username );
11581158 $canonicalname = $username;
11591159 if ( $username != '' ) {
1160 - $this->printDebug( "Username isn't empty.", NONSENSITIVE );
 1160+ $this->printDebug( "Username is: $username", NONSENSITIVE );
11611161 if ( $this->getConf( 'LowercaseUsernameScheme' ) ) {
11621162 $canonicalname = strtolower( $canonicalname );
11631163 } else {
@@ -1169,7 +1169,7 @@
11701170 return $userInfo["canonicalname"];
11711171 }
11721172 } else {
1173 - if ( $this->connect() ) {
 1173+ if ( $this->validDomain( $this->getSessionDomain() ) && $this->connect() ) {
11741174 // Try to pull the username from LDAP. In the case of straight binds,
11751175 // try to fetch the username by search before bind.
11761176 $this->userdn = $this->getUserDN( $username, true );

Status & tagging log