X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldap%2Fadd.c;h=699503aca8e25093a511afa326f6c733a8de9b66;hb=8b954144d612e78da4c8c815007717fc9781cab6;hp=3aff8df61e19042e34e679833dfcefc8c82ac632;hpb=cb3d538ea337bb226d108a07cdf6d3734b2bb5b5;p=openldap diff --git a/servers/slapd/back-ldap/add.c b/servers/slapd/back-ldap/add.c index 3aff8df61e..699503aca8 100644 --- a/servers/slapd/back-ldap/add.c +++ b/servers/slapd/back-ldap/add.c @@ -42,12 +42,12 @@ ldap_back_add( Attribute *a; LDAPMod **attrs; struct berval mapped; - struct berval mdn = { 0, NULL }; + struct berval mdn = BER_BVNULL; ber_int_t msgid; dncookie dc; - int update; -#ifdef LDAP_BACK_PROXY_AUTHZ + int isupdate; LDAPControl **ctrls = NULL; +#ifdef LDAP_BACK_PROXY_AUTHZ int rc = LDAP_SUCCESS; #endif /* LDAP_BACK_PROXY_AUTHZ */ @@ -69,7 +69,7 @@ ldap_back_add( #ifdef ENABLE_REWRITE dc.conn = op->o_conn; dc.rs = rs; - dc.ctx = "addDn"; + dc.ctx = "addDN"; #else dc.tofrom = 1; dc.normalized = 0; @@ -87,12 +87,12 @@ ldap_back_add( attrs = (LDAPMod **)ch_malloc(sizeof(LDAPMod *)*i); #ifdef ENABLE_REWRITE - dc.ctx = "addDnAttr"; + dc.ctx = "addAttrDN"; #endif - update = op->o_bd->be_update_ndn.bv_len; + isupdate = be_shadow_update( op ); for (i=0, a=op->oq_add.rs_e->e_attrs; a; a=a->a_next) { - if ( !update && a->a_desc->ad_type->sat_no_user_mod ) { + if ( !isupdate && a->a_desc->ad_type->sat_no_user_mod ) { continue; } @@ -128,6 +128,7 @@ ldap_back_add( } attrs[i] = NULL; + ctrls = op->o_ctrls; #ifdef LDAP_BACK_PROXY_AUTHZ rc = ldap_back_proxy_authz_ctrl( lc, op, rs, &ctrls ); if ( rc != LDAP_SUCCESS ) { @@ -136,12 +137,7 @@ ldap_back_add( #endif /* LDAP_BACK_PROXY_AUTHZ */ rs->sr_err = ldap_add_ext(lc->ld, mdn.bv_val, attrs, -#ifdef LDAP_BACK_PROXY_AUTHZ - ctrls, -#else /* ! LDAP_BACK_PROXY_AUTHZ */ - op->o_ctrls, -#endif /* ! LDAP_BACK_PROXY_AUTHZ */ - NULL, &msgid); + ctrls, NULL, &msgid); #ifdef LDAP_BACK_PROXY_AUTHZ cleanup: