php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51019 Problems ldap_add when CN includes forward slash (/)
Submitted: 2010-02-11 15:55 UTC Modified: 2010-02-12 16:27 UTC
From: bruce dot bahlmann at lsiowa dot org Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 5.2.12 OS: Windows Vista Business
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bruce dot bahlmann at lsiowa dot org
New email:
PHP Version: OS:

 

 [2010-02-11 15:55 UTC] bruce dot bahlmann at lsiowa dot org
Description:
------------
There seems to be an issue with ldap_add when the cn and corresponding dn, include a forward slash (/). NOTE, ldap in this case is an active directory (AD) server. Ldap_add works fine when the cn doesn't include a forward slash, however, when the text does include it, I cannot get the ldap_add to work.

I've tried escaping the characters (using backslash) with no success. I've also tried equivalent characters, but same result - the ldap add doesn't run.

Interestingly, if one uses LDAP explorer, the entries which have forward slashes actually show a backward slash before the forward slash. If I use those tools, I can manually add ldap entries with a forward slash, just can't do it with php ldap library. I've attached the ldap_add calling script which provides a wrapper for creating a group on the ldap server.

Reproduce code:
---------------
---
From manual page: function.ldap-add#Parameters
---
function ldapcreateGroup($hash, $dn) {
	
	// Maintain handle on LDAP connection to limit unnecessary ldapOpen
	if (!isset($GLOBALS["static_ad"])) {
		@ldapOpen();
	}	
	
	// Add these fields to ensure proper group be added
	$hash['objectClass'][0] = "top";
	$hash['objectClass'][1] ="group";
	$hash['groupType']=(int)'-2147483646';
	$hash['objectcategory'] = 'CN=Group,CN=Schema,CN=Configuration,'.sdn;
	$hash["sAMAccountName"] = $hash['cn'];
	unset($hash['distinguishedname']);
	
	#print_r($hash);
	
	@ldap_add($GLOBALS["static_ad"],$dn,$hash);
	
	if(@ldap_error($GLOBALS["static_ad"]) == "Success") {
		return 1;
	} else {
		return 0;
	}
}

Expected result:
----------------
Short of not using forward slashes in the cn, which would take some time to change in all the various entries in AD, is there some possible way to get ldap_add to add these?

Or, is there some special preparations required to perform on the cn field that would allow me to use conventional ldap_add to correctly insert this entry?

Actual result:
--------------
none

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-12 16:27 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 20:01:31 2024 UTC