X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fadd.c;h=9056e412ae07eda7200489ff8a0ff7b6f64df903;hb=e720c15c4d82d975bf9ce6e7e3a347264d8b0d8d;hp=896eae65ea9d97b4708197b67ee30a8d869a0146;hpb=474dfbc8fd75aed0376695ccc2f8c092a7a1bc6f;p=openldap diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 896eae65ea..9056e412ae 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2005 The OpenLDAP Foundation. + * Copyright 1998-2006 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,10 +214,9 @@ int fe_op_add( Operation *op, SlapReply *rs ) { int manageDSAit; - Modifications *modlist = op->ora_modlist; - Modifications **modtail = &modlist; + Modifications **modtail = &op->ora_modlist; int rc = 0; - BackendDB *op_be; + BackendDB *op_be; char textbuf[ SLAP_TEXT_BUFLEN ]; size_t textlen = sizeof( textbuf ); @@ -268,7 +267,7 @@ fe_op_add( Operation *op, SlapReply *rs ) goto done; } - rs->sr_err = slap_mods_obsolete_check( op, modlist, + rs->sr_err = slap_mods_obsolete_check( op, op->ora_modlist, &rs->sr_text, textbuf, textlen ); if ( rs->sr_err != LDAP_SUCCESS ) { @@ -287,7 +286,7 @@ fe_op_add( Operation *op, SlapReply *rs ) int repl_user = be_isupdate( op ); #ifndef SLAPD_MULTIMASTER if ( !SLAP_SHADOW(op->o_bd) || repl_user ) -#endif +#endif /* ! SLAPD_MULTIMASTER */ { int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn ); slap_callback cb = { NULL, slap_replog_cb, NULL, NULL }; @@ -295,7 +294,7 @@ fe_op_add( Operation *op, SlapReply *rs ) op->o_bd = op_be; if ( !update ) { - rs->sr_err = slap_mods_no_user_mod_check( op, modlist, + rs->sr_err = slap_mods_no_user_mod_check( op, op->ora_modlist, &rs->sr_text, textbuf, textlen ); if ( rs->sr_err != LDAP_SUCCESS ) { @@ -306,7 +305,7 @@ fe_op_add( Operation *op, SlapReply *rs ) if ( !repl_user ) { /* go to the last mod */ - for ( modtail = &modlist; + for ( modtail = &op->ora_modlist; *modtail != NULL; modtail = &(*modtail)->sml_next ) { @@ -317,7 +316,7 @@ fe_op_add( Operation *op, SlapReply *rs ) /* check for duplicate values */ rs->sr_err = slap_mods_no_repl_user_mod_check( op, - modlist, &rs->sr_text, textbuf, textlen ); + op->ora_modlist, &rs->sr_text, textbuf, textlen ); if ( rs->sr_err != LDAP_SUCCESS ) { send_ldap_result( op, rs ); goto done; @@ -333,7 +332,7 @@ fe_op_add( Operation *op, SlapReply *rs ) #ifdef SLAPD_MULTIMASTER if ( !repl_user ) -#endif +#endif /* SLAPD_MULTIMASTER */ { cb.sc_next = op->o_callback; op->o_callback = &cb; @@ -470,6 +469,7 @@ slap_mods2entry( snprintf( textbuf, textlen, "attribute '%s' provided more than once", mods->sml_desc->ad_cname.bv_val ); + *text = textbuf; return LDAP_TYPE_OR_VALUE_EXISTS; #endif } @@ -500,6 +500,7 @@ slap_mods2entry( snprintf( textbuf, textlen, "%s: value #%d provided more than once", mods->sml_desc->ad_cname.bv_val, j ); + *text = textbuf; return LDAP_TYPE_OR_VALUE_EXISTS; } else if ( rc != LDAP_SUCCESS ) { @@ -667,9 +668,9 @@ int slap_add_opattrs( ptr = ber_bvchr( &csn, '#' ); if ( ptr ) { timestamp.bv_len = ptr - csn.bv_val; - if ( timestamp.bv_len >= sizeof(timebuf) ) + if ( timestamp.bv_len >= sizeof(timebuf) ) /* ?!? */ timestamp.bv_len = sizeof(timebuf) - 1; - strncpy( timebuf, csn.bv_val, timestamp.bv_len ); + AC_MEMCPY( timebuf, csn.bv_val, timestamp.bv_len ); timebuf[timestamp.bv_len] = '\0'; } else { time_t now = slap_get_time(); @@ -733,7 +734,6 @@ int slap_add_opattrs( attr_merge_one( op->ora_e, slap_schema.si_ad_modifyTimestamp, ×tamp, NULL ); } - } return LDAP_SUCCESS; }