From: John C. <joh...@ua...> - 2004-06-04 15:25:11
|
Reini, Here is a patch for WikiUserNew that removes the partial request recieved errors. Basically, I just moved the options before the bind call. I also copied the options routine from the checkPass function to the userExits function, because it looked like you had changed one and not the other. Now, I don't think this is related to the LDAP code, but phpWiki is crashing php/apache as soon as you log in now. Logging in as the admin user works fine, but if you log in as a normal user (ldap on my system) I crash apache and get 'document contains no data'. If I comment out the $this->_level = WIKIAUTH_USER; I'm ok, but unauthenticated, so it really looks like I'm exiting the LDAP code ok, but I don't know where to start looking from there ;-) I had this code working last week ok, but the current version crashes. Any suggestions? John Cole Index: lib/WikiUserNew.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/WikiUserNew.php,v retrieving revision 1.86 diff -u -r1.86 WikiUserNew.php --- lib/WikiUserNew.php 3 Jun 2004 18:06:29 -0000 1.86 +++ lib/WikiUserNew.php 4 Jun 2004 15:18:05 -0000 @@ -1949,6 +1949,13 @@ } if ($ldap = ldap_connect(LDAP_AUTH_HOST)) { // must be a valid LDAP server! + if (!empty($LDAP_SET_OPTION)) { + foreach ($LDAP_SET_OPTION as $key => $value) { + if (is_string($key) and defined($key)) + $key = constant($key); + ldap_set_option($ldap,$key,$value); + } + } if (defined('LDAP_AUTH_USER')) if (defined('LDAP_AUTH_PASSWORD')) // Windows Active Directory Server is strict @@ -1957,13 +1964,6 @@ $r = @ldap_bind($ldap,LDAP_AUTH_USER); else $r = @ldap_bind($ldap); // this is an anonymous bind - if (!empty($LDAP_SET_OPTION)) { - foreach ($LDAP_SET_OPTION as $key => $value) { - if (is_string($key) and defined($key)) - $key = constant($key); - ldap_set_option($ldap,$key,$value); - } - } // Need to set the right root search information. see ../index.php $st_search = defined('LDAP_SEARCH_FIELD') ? LDAP_SEARCH_FIELD."=$userid" @@ -2000,6 +2000,14 @@ return WIKIAUTH_FORBIDDEN; } if ($ldap = ldap_connect(LDAP_AUTH_HOST)) { // must be a valid LDAP server! + if (!empty($LDAP_SET_OPTION)) { + foreach ($LDAP_SET_OPTION as $key => $value) { + if (is_string($key) and defined($key)) + $key = constant($key); + ldap_set_option($ldap,$key,$value); + } + } + if (defined('LDAP_AUTH_USER')) if (defined('LDAP_AUTH_PASSWORD')) // Windows Active Directory Server is strict @@ -2008,11 +2016,7 @@ $r = @ldap_bind($ldap,LDAP_AUTH_USER); else $r = @ldap_bind($ldap); // this is an anonymous bind - if (!empty($LDAP_SET_OPTION)) { - foreach ($LDAP_SET_OPTION as $key => $value) { - ldap_set_option($ldap,$key,$value); - } - } + // Need to set the right root search information. see ../index.php $st_search = defined('LDAP_SEARCH_FIELD') ? LDAP_SEARCH_FIELD."=$userid" |