X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldap%2Fadd.c;h=699503aca8e25093a511afa326f6c733a8de9b66;hb=8b954144d612e78da4c8c815007717fc9781cab6;hp=7c906d27000abefa437f9e0124d4ecc60deca61b;hpb=fbba83b20f3a645b2dc19b8ec4a0026f71f5b15c;p=openldap diff --git a/servers/slapd/back-ldap/add.c b/servers/slapd/back-ldap/add.c index 7c906d2700..699503aca8 100644 --- a/servers/slapd/back-ldap/add.c +++ b/servers/slapd/back-ldap/add.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1999-2003 The OpenLDAP Foundation. + * Copyright 1999-2004 The OpenLDAP Foundation. * Portions Copyright 2000-2003 Pierangelo Masarati. * Portions Copyright 1999-2003 Howard Chu. * All rights reserved. @@ -42,11 +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; -#ifdef LDAP_BACK_PROXY_AUTHZ + int isupdate; LDAPControl **ctrls = NULL; +#ifdef LDAP_BACK_PROXY_AUTHZ int rc = LDAP_SUCCESS; #endif /* LDAP_BACK_PROXY_AUTHZ */ @@ -68,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; @@ -86,10 +87,12 @@ ldap_back_add( attrs = (LDAPMod **)ch_malloc(sizeof(LDAPMod *)*i); #ifdef ENABLE_REWRITE - dc.ctx = "addDnAttr"; + dc.ctx = "addAttrDN"; #endif + + isupdate = be_shadow_update( op ); for (i=0, a=op->oq_add.rs_e->e_attrs; a; a=a->a_next) { - if ( a->a_desc->ad_type->sat_no_user_mod ) { + if ( !isupdate && a->a_desc->ad_type->sat_no_user_mod ) { continue; } @@ -125,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 ) { @@ -133,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: