/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2014 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
int
ldap_parse_ldif_record_x(
struct berval *rbuf,
- int linenum,
+ unsigned long linenum,
LDIFRecord *lr,
const char *errstr,
unsigned int flags,
}
if ( ( rc = ldif_parse_line2( line, lr->lr_btype+i, lr->lr_vals+i, &freev ) ) < 0 ) {
- fprintf( stderr, _("%s: invalid format (line %d) entry: \"%s\"\n"),
+ fprintf( stderr, _("%s: invalid format (line %lu) entry: \"%s\"\n"),
errstr, linenum+i, dn == NULL ? "" : dn );
rc = LDAP_PARAM_ERROR;
goto leave;
if ( lr->lr_vals[i].bv_len != version1.bv_len || strncmp( lr->lr_vals[i].bv_val, version1.bv_val, version1.bv_len ) != 0 )
{
fprintf( stderr,
- _("%s: invalid version %s, line %d (ignored)\n"),
+ _("%s: invalid version %s, line %lu (ignored)\n"),
errstr, lr->lr_vals[i].bv_val, linenum );
}
version++;
rc = parse_ldif_control( lr->lr_vals+i, &pctrls );
if (rc != 0) {
fprintf( stderr,
- _("%s: Error processing %s line, line %d: %s\n"),
+ _("%s: Error processing %s line, line %lu: %s\n"),
errstr, BV_CONTROL.bv_val, linenum+i, ldap_err2string(rc) );
}
}
if ( i>= lr->lr_lines ) {
short_input:
fprintf( stderr,
- _("%s: Expecting more input after %s line, line %d\n"),
+ _("%s: Expecting more input after %s line, line %lu\n"),
errstr, lr->lr_btype[i-1].bv_val, linenum+i );
rc = LDAP_PARAM_ERROR;
if ( ++icnt != lr->lr_vals[i].bv_len ) {
fprintf( stderr, _("%s: illegal trailing space after"
- " \"%s: %s\" trimmed (line %d, entry \"%s\")\n"),
+ " \"%s: %s\" trimmed (line %lu, entry \"%s\")\n"),
errstr, BV_CHANGETYPE.bv_val, lr->lr_vals[i].bv_val, linenum+i, dn );
lr->lr_vals[i].bv_val[icnt] = '\0';
}
if ( flags & LDIF_ENTRIES_ONLY ) {
if ( !( BV_CASEMATCH( lr->lr_vals+i, &BV_ADDCT )) ) {
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
- _("%s: skipping LDIF record beginning at line %d: "
+ _("%s: skipping LDIF record beginning at line %lu: "
"changetype '%.*s' found but entries only was requested\n"),
errstr, linenum,
(int)lr->lr_vals[i].bv_len,
goto short_input;
if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_NEWRDN )) {
fprintf( stderr, _("%s: expecting \"%s:\" but saw"
- " \"%s:\" (line %d, entry \"%s\")\n"),
+ " \"%s:\" (line %lu, entry \"%s\")\n"),
errstr, BV_NEWRDN.bv_val, lr->lr_btype[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
goto short_input;
if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_DELETEOLDRDN )) {
fprintf( stderr, _("%s: expecting \"%s:\" but saw"
- " \"%s:\" (line %d, entry \"%s\")\n"),
+ " \"%s:\" (line %lu, entry \"%s\")\n"),
errstr, BV_DELETEOLDRDN.bv_val, lr->lr_btype[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
if ( i < lr->lr_lines ) {
if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_NEWSUP )) {
fprintf( stderr, _("%s: expecting \"%s:\" but saw"
- " \"%s:\" (line %d, entry \"%s\")\n"),
+ " \"%s:\" (line %lu, entry \"%s\")\n"),
errstr, BV_NEWSUP.bv_val, lr->lr_btype[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
got_all = delete_entry = 1;
} else {
fprintf( stderr,
- _("%s: unknown %s \"%s\" (line %d, entry \"%s\")\n"),
+ _("%s: unknown %s \"%s\" (line %lu, entry \"%s\")\n"),
errstr, BV_CHANGETYPE.bv_val, lr->lr_vals[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
there must be no changetype, and the flag LDIF_DEFAULT_ADD must be set */
if ( flags & LDIF_ENTRIES_ONLY ) {
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
- _("%s: skipping LDIF record beginning at line %d: "
+ _("%s: skipping LDIF record beginning at line %lu: "
"no changetype found but entries only was requested and "
"the default setting for missing changetype is modify\n"),
errstr, linenum );
if ( got_all ) {
if ( i < lr->lr_lines ) {
fprintf( stderr,
- _("%s: extra lines at end (line %d, entry \"%s\")\n"),
+ _("%s: extra lines at end (line %lu, entry \"%s\")\n"),
errstr, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
for (j=i+1; j<lr->lr_lines; j++) {
if ( !lr->lr_btype[j].bv_val ) {
fprintf( stderr,
- _("%s: missing attributeDescription (line %d, entry \"%s\")\n"),
+ _("%s: missing attributeDescription (line %lu, entry \"%s\")\n"),
errstr, linenum+j, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
if ( BV_CASEMATCH( lr->lr_btype+i, &BV_DN )) {
fprintf( stderr, _("%s: attributeDescription \"%s\":"
" (possible missing newline"
- " after line %d, entry \"%s\"?)\n"),
+ " after line %lu, entry \"%s\"?)\n"),
errstr, lr->lr_btype[i].bv_val, linenum+i - 1, dn );
}
if ( !BV_CASEMATCH( lr->lr_btype+i, &bv )) {
if ( ++icnt != lr->lr_vals[i].bv_len ) {
fprintf( stderr, _("%s: illegal trailing space after"
- " \"%s: %s\" trimmed (line %d, entry \"%s\")\n"),
+ " \"%s: %s\" trimmed (line %lu, entry \"%s\")\n"),
errstr, type, lr->lr_vals[i].bv_val, linenum+i, dn );
lr->lr_vals[i].bv_val[icnt] = '\0';
}
nmods--;
} else { /* no modify op: invalid LDIF */
fprintf( stderr, _("%s: modify operation type is missing at"
- " line %d, entry \"%s\"\n"),
+ " line %lu, entry \"%s\"\n"),
errstr, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
} else {
if ( !BV_CASEMATCH( lr->lr_btype+i, &bv )) {
fprintf( stderr, _("%s: wrong attributeType at"
- " line %d, entry \"%s\"\n"),
+ " line %lu, entry \"%s\"\n"),
errstr, linenum+i, dn );
rc = LDAP_PARAM_ERROR;
goto leave;
int
ldap_parse_ldif_record(
struct berval *rbuf,
- int linenum,
+ unsigned long linenum,
LDIFRecord *lr,
const char *errstr,
unsigned int flags )