php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61853
Patch patch_61853_and_61921.patch revision 2013-02-24 17:05 UTC by etienne at lamaisondebarbie dot ch
revision 2013-02-24 16:52 UTC by etienne at lamaisondebarbie dot ch
Patch php_ldap_do-ifdef.patch revision 2012-04-26 10:14 UTC by etienne at lamaisondebarbie dot ch
revision 2012-04-26 10:09 UTC by etienne at lamaisondebarbie dot ch
Patch php_ldap_do_modify.patch revision 2012-04-26 08:06 UTC by etienne at lamaisondebarbie dot ch
Patch php_ldap_do_search.patch revision 2012-04-25 20:52 UTC by etienne at lamaisondebarbie dot ch
revision 2012-04-25 20:38 UTC by etienne at lamaisondebarbie dot ch

Patch php_ldap_do_modify.patch for LDAP related Bug #61853

Patch version 2012-04-26 08:06 UTC

Return to Bug #61853 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: etienne@lamaisondebarbie.ch

--- ldap.orig.c	2012-04-26 10:03:23.216964900 +0200
+++ ldap.c	2012-04-26 09:57:11.363120871 +0200
@@ -1320,6 +1320,7 @@
 	ldap_linkdata *ld;
 	char *dn;
 	LDAPMod **ldap_mods;
+	LDAPControl **clientctrl = NULL, **serverctrl = NULL;
 	int i, j, num_attribs, num_values, dn_len;
 	int *num_berval;
 	char *attribute;
@@ -1403,20 +1404,37 @@
 	}
 	ldap_mods[num_attribs] = NULL;
 
+	if(LDAP_OPT_SUCCESS != ldap_get_option(ld->link, LDAP_OPT_CLIENT_CONTROLS, &clientctrl)) {
+		clientctrl = NULL;
+	}
+	if(LDAP_OPT_SUCCESS != ldap_get_option(ld->link, LDAP_OPT_SERVER_CONTROLS, &serverctrl)) {
+		serverctrl = NULL;
+	}
+
 /* check flag to see if do_mod was called to perform full add , gerrit thomson */
 	if (is_full_add == 1) {
-		if ((i = ldap_add_s(ld->link, dn, ldap_mods)) != LDAP_SUCCESS) {
+		if ((i = ldap_add_ext_s(ld->link, dn, ldap_mods, serverctrl, clientctrl)) != LDAP_SUCCESS) {
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Add: %s", ldap_err2string(i));
 			RETVAL_FALSE;
 		} else RETVAL_TRUE;
 	} else {
-		if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, NULL, NULL)) != LDAP_SUCCESS) {
+		if ((i = ldap_modify_ext_s(ld->link, dn, ldap_mods, serverctrl, clientctrl)) != LDAP_SUCCESS) {
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Modify: %s", ldap_err2string(i));
 			RETVAL_FALSE;
 		} else RETVAL_TRUE;	
 	}
 
 errexit:
+
+	if(serverctrl != NULL) {
+		ldap_controls_free(serverctrl);
+		serverctrl = NULL;
+	}
+	if(clientctrl != NULL) {
+		ldap_controls_free(clientctrl);
+		clientctrl = NULL;
+	}
+
 	for (i = 0; i < num_attribs; i++) {
 		efree(ldap_mods[i]->mod_type);
 		for (j = 0; j < num_berval[i]; j++) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 15:01:33 2024 UTC