/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * 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.
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 */
#ifdef ENABLE_REWRITE
dc.conn = op->o_conn;
dc.rs = rs;
- dc.ctx = "addDn";
+ dc.ctx = "addDN";
#else
dc.tofrom = 1;
dc.normalized = 0;
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;
}
}
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 ) {
#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: