|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch php_ldap_do_modify.patch for LDAP related Bug #61853Patch version 2012-04-26 08:06 UTC Return to Bug #61853 | Download this patchThis 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++) {
|
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 13:00:01 2025 UTC |