struct berval *res)
{
char *ptr, *sep, *end;
+ struct berval bv;
assert( dn != NULL );
assert( !BER_BVISNULL( dn ) );
}
strcpy(ptr, LDIF);
#if IX_FSL != IX_DNL
- ptr = res->bv_val;
- while( ptr=strchr(ptr, IX_DNL) ) {
+ bv = *res;
+ while ( ptr = ber_bvchr( &bv, IX_DNL ) ) {
*ptr++ = IX_FSL;
- ptr = strchr(ptr, IX_DNR);
- if ( ptr )
- *ptr++ = IX_FSR;
- else
+ assert( ( ptr - bv.bv_val ) <= bv.bv_len );
+ bv.bv_len -= ( ptr - bv.bv_val );
+ bv.bv_val = ptr;
+ ptr = ber_bvchr( &bv, IX_DNR );
+ if ( !ptr )
break;
+ *ptr++ = IX_FSR;
+ assert( ( ptr - bv.bv_val ) <= bv.bv_len );
+ bv.bv_len -= ( ptr - bv.bv_val );
+ bv.bv_val = ptr;
}
#endif
}
int entry_length;
char * entry_as_string;
- openres = open(path->bv_val, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR | S_IWUSR);
+ openres = open(path->bv_val, O_WRONLY|O_CREAT|O_TRUNC, S_IREAD | S_IWRITE);
if(openres == -1) {
if(errno == ENOENT)
rs = LDAP_NO_SUCH_OBJECT;
bvl = ch_malloc( sizeof(bvlist) );
ber_dupbv( &bvl->bv, &fname );
BER_BVZERO( &bvl->num );
- itmp.bv_val = strchr( bvl->bv.bv_val, IX_FSL );
+ itmp.bv_val = ber_bvchr( &bvl->bv, IX_FSL );
if ( itmp.bv_val ) {
char *ptr;
itmp.bv_val++;
- ptr = strchr( itmp.bv_val, IX_FSR );
+ itmp.bv_len = bvl->bv.bv_len
+ - ( itmp.bv_val - bvl->bv.bv_val );
+ ptr = ber_bvchr( &itmp, IX_FSR );
if ( ptr ) {
itmp.bv_len = ptr - itmp.bv_val;
ber_dupbv( &bvl->num, &itmp );
char textbuf[SLAP_TEXT_BUFLEN];
Debug( LDAP_DEBUG_TRACE, "ldif_back_add: \"%s\"\n", dn.bv_val, 0, 0);
- slap_add_opattrs( op, &rs->sr_text, textbuf, sizeof( textbuf ), 1 );
+
+ rs->sr_err = slap_add_opattrs( op,
+ &rs->sr_text, textbuf, sizeof( textbuf ), 1 );
+ if ( rs->sr_err != LDAP_SUCCESS ) goto send_res;
rs->sr_err = entry_schema_check(op, e, NULL, 0,
&rs->sr_text, textbuf, sizeof( textbuf ) );