Undefined Index: ws Domain error?
Hi Im having problems with the Ldap login feature on my Wiki, it was working fine but now when i try to login with correct details it and try to go into the special pages it keeps saying "You must be logged in to access this page directly." Anyone know why this error of Undefined Index: ws Domain error is being shown at the top of the page? Is this something to do with my Ldap Plugin?
Subscript textSorry, forgot the debug log, its below ..................
2011-09-28 08:32:16 wikidb: 1.2e Entering validDomain 2011-09-28 08:32:16 wikidb: 1.2e User is not using a valid domain (). 2011-09-28 08:32:16 wikidb: 1.2e Setting domain as: invaliddomain 2011-09-28 08:32:16 wikidb: 1.2e Entering allowPasswordChange 2011-09-28 08:32:16 wikidb: 1.2e Entering modifyUITemplate 2011-09-28 08:32:32 wikidb: 1.2e Entering validDomain 2011-09-28 08:32:32 wikidb: 1.2e User is using a valid domain (hmrcmis). 2011-09-28 08:32:32 wikidb: 1.2e Setting domain as: hmrcmis 2011-09-28 08:32:32 wikidb: 1.2e Entering getCanonicalName 2011-09-28 08:32:32 wikidb: 1.2e Username isn't empty. 2011-09-28 08:32:32 wikidb: 1.2e Munged username: Cg10223 2011-09-28 08:32:32 wikidb: 1.2e Entering authenticate 2011-09-28 08:32:32 wikidb: 1.2e 2011-09-28 08:32:32 wikidb: 1.2e Entering Connect 2011-09-28 08:32:32 wikidb: 1.2e Using TLS or not using encryption. 2011-09-28 08:32:32 wikidb: 1.2e Using servers: ldap://11.111.111.11:111 2011-09-28 08:32:32 wikidb: 1.2e Connected successfully 2011-09-28 08:32:32 wikidb: 1.2e Entering getSearchString 2011-09-28 08:32:32 wikidb: 1.2e Doing a straight bind 2011-09-28 08:32:32 wikidb: 1.2e userdn is: Cg10223@hmrcmis.net 2011-09-28 08:32:32 wikidb: 1.2e 2011-09-28 08:32:32 wikidb: 1.2e Binding as the user 2011-09-28 08:32:32 wikidb: 1.2e Bound successfully 2011-09-28 08:32:32 wikidb: 1.2e Entering getUserDN 2011-09-28 08:32:32 wikidb: 1.2e Created a regular filter: (sAMAccountName=Cg10223) 2011-09-28 08:32:32 wikidb: 1.2e Entering getBaseDN 2011-09-28 08:32:32 wikidb: 1.2e basedn is not set for this type of entry, trying to get the default basedn. 2011-09-28 08:32:32 wikidb: 1.2e Entering getBaseDN 2011-09-28 08:32:32 wikidb: 1.2e basedn is ou=End User,dc=hmrcmis,dc=net 2011-09-28 08:32:32 wikidb: 1.2e Using base: ou=End User,dc=hmrcmis,dc=net 2011-09-28 08:32:32 wikidb: 1.2e Fetched username is not a string (check your hook code...). This message can be safely ignored if you do not have the SetUsernameAttributeFromLDAP hook defined. 2011-09-28 08:32:32 wikidb: 1.2e Pulled the user's DN: CN=CG10223,OU=NoRoamingProfile,OU=Relaxed,OU=Accounts,OU=End User,DC=hmrcmis,DC=net 2011-09-28 08:32:32 wikidb: 1.2e Entering getGroups 2011-09-28 08:32:32 wikidb: 1.2e Entering checkGroups 2011-09-28 08:32:32 wikidb: 1.2e Entering getPreferences 2011-09-28 08:32:32 wikidb: 1.2e Entering synchUsername 2011-09-28 08:32:32 wikidb: 1.2e Authentication passed 2011-09-28 08:32:32 wikidb: 1.2e Entering updateUser 2011-09-28 08:32:32 wikidb: 1.2e Entering allowPasswordChange
................................
This issue has cropped up before and is referenced throughout the archives. It looks like Ryan has been unable to reproduce the error. Here is the last entry I noticed on this topic from Archive 2: Extension_talk:LDAP_Authentication/Archive_2#Undefined_index:_wsDomain_error
This error happened to me, as well. It appears to be caused by an expired LDAP session. Even though the LDAP session timed out, wiki allows the user to stay logged in. So when the user tries to access "My Preferences", they will get the Undefined Index error. I eliminated the error by logging out and back in.
The solution should be to simply check for an active LDAP session, and force the user to log back in if it expired. It's not a fatal error, so I haven't had a chance to research it further than this.
I'm actually seeing the problem myself now as well. I'm having a hard time tracking down the issue. It's likely an issue in MediaWiki, but I'll also continue looking through the extension for this.
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 :)
That's the thing. wsDomain should be defined. I think I've partially fixed this issue in 1.18, but there's more places where wsDomain is somehow being undefined, or the session is being wiped out in some nasty way.
Hi, I am getting this error also on two MW 1.18 w/ LDAP 1.2e installations. While it doesn't seem to cause anything to fail, my users are frequently asking me to 'fix it'. Any thoughts on whether the patch above is appropriate for deployment? Is this an LDAP plugin issue? A MW 1.18 issue?
Thanks so much for an extension that has been used here for almost 8 years!
-Jonathan
FYI - getting the same error Environment - WAMP Latest versions of Mediawiki and LDAP Auth plugin
It happens the first time I visit the login page in a session. After that, no errors pop up until the browser is closed, regardless of if I log in or not. Have also tested from different PCs on the network, errors appear the first time the login page is accessed and then not again afterwards.
Thought that might help the troubleshooting.
- Daz
same error for me, some data: Env: Windows server 2008, IIS 7, MySQL, Mediawiki 1.18, Latest version of LDAP auth plugin
When I click the login page on a PC that has never entered the wiki this error appears:
PHP Notice: Undefined index: wsDomain in ...LdapAuthentication.php on line 663 ,on line 667 ,on line 449 ,on line 454 , on line 455
I've also seen that in my PC (where the login works) beside the "Log In" link my IP and "Talk for this IP Address" links appear. Those links don't appear on the PC that has problems when clicking the login link.
The only two PC that the wiki works in are the ones with this characteristics: -the users that first logged in are sysop -the users first logged in with local authentication, then switched to ldap authentication and it always worked fine
The ldap log says:
2012-01-25 20:39:43 wikidb: 1.2e Entering validDomain 2012-01-25 20:39:43 wikidb: 1.2e User is not using a valid domain (). 2012-01-25 20:39:43 wikidb: 1.2e Setting domain as: invaliddomain 2012-01-25 20:39:44 wikidb: 1.2e Entering allowPasswordChange 2012-01-25 20:39:44 wikidb: 1.2e Entering modifyUITemplate
i'm a newbie in Mediawiki, so I'm sorry if I stated something obvious ;)
-Ed
I've downloaded the trunk version of LdapAuthentication plugin and now it works!!!
Thank you Mediawiki developers.
I've found out in Mediawiki 1.18.1 that whenever I enter Special Pages the Special:Userlogin load() function is called and wgRequest doesn't have a wpDomain value so it calls $wgAuth->setDomain('invaliddomain'); each times.
I tried to logout/login and go directly to Special:Change Password (sorry for possible wrong name translations, I use french mediawiki version) the $_SESSION['wsDomain'] value isn't hardly resetted and it works fine that way.
I think it's a bug that should be reported but, I can't make sure that a bug for this has or hasn't been reported.
I bypassed the problem like this:
function setDomain( $domain ) {
if( (isset( $_SESSION['wsDomain'] ) && $this->validDomain( $_SESSION['wsDomain'] )) && !$this->validDomain( $domain ) )
return;
$this->printDebug( "Setting domain as: $domain", NONSENSITIVE );
$_SESSION['wsDomain'] = $domain;
}
litteraly, It doesn't change the session wsDomain value if there's already a valid domain active and the new $domain isn't a valid one.