Entry *e = str2entry( buf );
struct berval bvtext;
+ /*
+ * Initialize text buffer
+ */
bvtext.bv_len = textlen;
bvtext.bv_val = textbuf;
+ bvtext.bv_val[0] = '\0';
if( e == NULL ) {
fprintf( stderr, "%s: could not parse entry (line=%d)\n",
if( sc == NULL ) {
struct berval vals[2];
- /* int ret = */
- structural_class( oc->a_vals, vals,
+ rc = structural_class( oc->a_vals, vals,
NULL, &text, textbuf, textlen );
- if( vals[0].bv_len == 0 ) {
- fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
- progname, e->e_dn, lineno, text );
+ if( rc != LDAP_SUCCESS ) {
+ fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
+ progname, e->e_dn, lineno, rc, text );
rc = EXIT_FAILURE;
entry_free( e );
if( continuemode ) continue;
rc = entry_schema_check( be, e, NULL, &text, textbuf, textlen );
if( rc != LDAP_SUCCESS ) {
- fprintf( stderr, "%s: dn=\"%s\" (line=%d): %s\n",
- progname, e->e_dn, lineno, text );
+ fprintf( stderr, "%s: dn=\"%s\" (line=%d): (%d) %s\n",
+ progname, e->e_dn, lineno, rc, text );
rc = EXIT_FAILURE;
entry_free( e );
if( continuemode ) continue;
if ( SLAP_LASTMOD(be) ) {
struct tm *ltm;
time_t now = slap_get_time();
- char uuidbuf[40];
- struct berval vals[2];
+ char uuidbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE ];
+ struct berval vals[ 2 ];
struct berval name, timestamp, csn;
- char timebuf[22];
- char csnbuf[64];
+ char timebuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+ char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
ltm = gmtime(&now);
lutil_gentime( timebuf, sizeof(timebuf), ltm );
if( attr_find( e->e_attrs, slap_schema.si_ad_creatorsName )
== NULL )
{
- ber_dupbv( &vals[0], &name );
+ vals[0] = name;
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
attr_merge( e, slap_schema.si_ad_creatorsName, vals);
if( attr_find( e->e_attrs, slap_schema.si_ad_modifiersName )
== NULL )
{
- ber_dupbv( &vals[0], &name );
+ vals[0] = name;
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
attr_merge( e, slap_schema.si_ad_modifiersName, vals);
if( attr_find( e->e_attrs, slap_schema.si_ad_createTimestamp )
== NULL )
{
- ber_dupbv( &vals[0], ×tamp );
+ vals[0] = timestamp;
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
attr_merge( e, slap_schema.si_ad_createTimestamp, vals );
if( attr_find( e->e_attrs, slap_schema.si_ad_modifyTimestamp )
== NULL )
{
- ber_dupbv( &vals[0], ×tamp );
+ vals[0] = timestamp;
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
attr_merge( e, slap_schema.si_ad_modifyTimestamp, vals );
if( attr_find( e->e_attrs, slap_schema.si_ad_entryCSN )
== NULL )
{
- ber_dupbv( &vals[0], &csn );
+ vals[0] = csn;
vals[1].bv_len = 0;
vals[1].bv_val = NULL;
attr_merge( e, slap_schema.si_ad_entryCSN, vals );