Error with LDAP Windows 2003

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
Alonso
Posts: 5
Joined: Tue Aug 17, 2010 2:06 pm

Error with LDAP Windows 2003

Post by Alonso »

Hello, the problem is when I put an incorrect user on having pulsated on the button of login following messages appear


phpMyFAQ warning [2]: ldap_get_values() expects parameter 2 to be resource, boolean given in Ldap.php on line 215

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in Session.php on line 380

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 589

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 590

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 591

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 592

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 593

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 594

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in index.php on line 595


When I put a correct user it works correctly

Where the mistake takes place?


A greeting
Thorsten
Posts: 15565
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error with LDAP Windows 2003

Post by Thorsten »

Hi,

how does your LDAP config look like?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Alonso
Posts: 5
Joined: Tue Aug 17, 2010 2:06 pm

Re: Error with LDAP Windows 2003

Post by Alonso »

Hello, the configuration is

in ldap.php
<?php
$PMF_LDAP["ldap_server"] = 'dominio.local';
$PMF_LDAP["ldap_port"] = '389';
$PMF_LDAP["ldap_user"] = 'dominio\leeldap';
$PMF_LDAP["ldap_password"] = 'Password01';
$PMF_LDAP["ldap_base"] = 'DC=dominio,DC=local';

in constants_ldap.php

// Datamapping - in this example for an ADS
$PMF_LDAP['ldap_mapping'] = array (
'name' => 'cn',
'username' => 'samAccountName',
'mail' => 'mail');

// In a multi-domain environment, users may enter a prefix as domain, e.g. "DOMAIN\username"
// If possible, you should use the Microsoft Glocal Catalog as LDAP-Server, which comes
// with every ADS-Installation.
$PMF_LDAP['ldap_use_domain_prefix'] = false;

// LDAP-options to set
// refer to the documentation of ldap_set_option() for information on available options
$PMF_LDAP["ldap_options"] = array (
LDAP_OPT_PROTOCOL_VERSION => 3,
LDAP_OPT_REFERRALS => 0 );

The mistakes only take place in case of failure in the access.

Thanks.
Thorsten
Posts: 15565
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error with LDAP Windows 2003

Post by Thorsten »

Hi,

looks okay. Which version of phpMyFAQ do you use?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Alonso
Posts: 5
Joined: Tue Aug 17, 2010 2:06 pm

Re: Error with LDAP Windows 2003

Post by Alonso »

Hello,
The server is a Windows 2003 Server Standard with xampp and copy and paste the configuration from the applicationInformación de sistema

phpMyFAQ Version phpMyFAQ 2.6.7
Server Software Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
PHP Version PHP 5.3.1
Register Globals off
Safe Mode off
Open Basedir off
Database Server Mysql
Database Client Version 5.1.41
Database Server Version 5.1.41
Webserver Interface APACHE2HANDLER
PHP Extensions Core, bcmath, calendar, com_dotnet, ctype, date, ereg, filter, ftp, hash, iconv, json, mysqlnd, odbc, openssl, pcre, Reflection, session, SPL, standard, tokenizer, zlib, libxml, dom, bz2, SimpleXML, wddx, xml, xmlreader, xmlwriter, xsl, apache2handler, Phar, curl, mbstring, exif, fileinfo, gd, gettext, imap, ldap, mcrypt, mysql, mysqli, PDO, pdo_mysql, PDO_ODBC, pdo_sqlite, soap, sockets, SQLite, sqlite3, xmlrpc, zip, ming, pdf, mhash
Thorsten
Posts: 15565
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error with LDAP Windows 2003

Post by Thorsten »

Hi,

I checked the code and your information... looks like the LDAP base is wrong:
$PMF_LDAP["ldap_base"] = 'DC=dominio,DC=local';
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Alonso
Posts: 5
Joined: Tue Aug 17, 2010 2:06 pm

Re: Error with LDAP Windows 2003

Post by Alonso »

Hello,

the base is correct, only it fails when there put incorrect users that it shows the following thingonly it fails when they put on users incorrects

phpMyFAQ warning [2]: ldap_get_values() expects parameter 2 to be resource, boolean given in Ldap.php on line 215

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in Session.php on line 380

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 589

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 590

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 591

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 592

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 593

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 594

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 595




Or they put on incorrect passwords that this shows different



phpMyFAQ warning [2]: ldap_bind(): Unable to bind to server: Invalid credentials in Ldap.php on line 115

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in Session.php on line 380

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 589

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 590

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 591

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 592

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 593

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 594

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\caserfaq\inc\functions.php:173) in index.php on line 595


It seems to me that the translator that use is not very trustworthy, excuses my language



Thanks
Thorsten
Posts: 15565
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error with LDAP Windows 2003

Post by Thorsten »

Hi,

then try to change the user. Do you get any errors on the LDAP log?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
LemurTech
Posts: 2
Joined: Wed Oct 27, 2010 7:33 pm

Re: Error with LDAP Windows 2003

Post by LemurTech »

Alonso wrote:Hello, the problem is when I put an incorrect user on having pulsated on the button of login following messages appear


phpMyFAQ warning [2]: ldap_get_values() expects parameter 2 to be resource, boolean given in Ldap.php on line 215

phpMyFAQ warning [2]: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\faq\inc\functions.php:173) in Session.php on line 380

etc.
To restate the issue: You have configured for AD authentication. When you enter an incorrect user name, incorrect password, or NO username/password, you receive the above error.

The problem is that AD returns a Boolean 'false' for the PHP function, ldap_get_values, when AD is queried and there is no match. phpMyFAQ is not checking for this. The fix is simple. Find this in Ldap.php at about line 215...

Code: Select all

		
$values  = ldap_get_values($this->ds, $entryId, $fields[0]);
Insert before it, an error check:

Code: Select all

		
if ($entryId == false) {
	return;
	}
		
$values  = ldap_get_values($this->ds, $entryId, $fields[0]);
That should solve the problem!
Thorsten
Posts: 15565
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error with LDAP Windows 2003

Post by Thorsten »

Hi,

I'll add this fix for the next release. Thanks.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Thorsten
Posts: 15565
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error with LDAP Windows 2003

Post by Thorsten »

Hi,

this is already fixed in my repo. :-)

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply