Thread:Extension talk:LDAP Authentication/Undefined Index: ws Domain error?/reply (4)

FIX (patch): --- /tmp/foobar	2011-11-14 11:35:23.000000000 +0100 +++ LdapAuthentication.php	2011-11-14 11:47:13.000000000 +0100 @@ -649,18 +649,22 @@ 		$retval = false; -		// Local domains need to be able to change passwords -		if ( ( isset( $wgLDAPUseLocal ) && $wgLDAPUseLocal ) && 'local' == $_SESSION['wsDomain'] ) { -			$retval = true; -		} +       if ( isset( $_SESSION['wsDomain'] ) ) { -		if ( isset( $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) && $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) { -			$retval = true; -		} +           // Local domains need to be able to change passwords +           if ( ( isset( $wgLDAPUseLocal ) && $wgLDAPUseLocal ) && 'local' == $_SESSION['wsDomain'] ) { +               $retval = true; +           } + +            if ( isset( $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) && $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) { +               $retval = true; +           } + +            if ( isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] ) { +               $retval = true; +           } -		if ( isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] ) { -			$retval = true; -		} +       } 		return $retval; }

BEFORE: function allowPasswordChange { global $wgLDAPUpdateLDAP, $wgLDAPMailPassword; global $wgLDAPUseLocal;

$this->printDebug( "Entering allowPasswordChange", NONSENSITIVE );

$retval = false;

// Local domains need to be able to change passwords if ( ( isset( $wgLDAPUseLocal ) && $wgLDAPUseLocal ) && 'local' == $_SESSION['wsDomain'] ) { $retval = true; }

if ( isset( $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) && $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) { $retval = true; }

if ( isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] ) { $retval = true; }

return $retval; }

AFTER: function allowPasswordChange { global $wgLDAPUpdateLDAP, $wgLDAPMailPassword; global $wgLDAPUseLocal;

$this->printDebug( "Entering allowPasswordChange", NONSENSITIVE );

$retval = false;

if ( isset( $_SESSION['wsDomain'] ) ) {

// Local domains need to be able to change passwords if ( ( isset( $wgLDAPUseLocal ) && $wgLDAPUseLocal ) && 'local' == $_SESSION['wsDomain'] ) { $retval = true; }

if ( isset( $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) && $wgLDAPUpdateLDAP[$_SESSION['wsDomain']] ) { $retval = true; }

if ( isset( $wgLDAPMailPassword[$_SESSION['wsDomain']] ) && $wgLDAPMailPassword[$_SESSION['wsDomain']] ) { $retval = true; }

}

return $retval; }

What I've done: $_SESSION['wsDomain'] is not defined, so check this first...

I didn't dig deeper and I don't know if wsDomain should be defined in the session. If it should be defined, then this is just a temporary workaround and not a permanently fix :)