Commit 461db2de authored by Howard Chu's avatar Howard Chu
Browse files

ITS#7497 fix lineno overflow in ldif_read_record()

parent 8325ad2a
...@@ -73,7 +73,7 @@ static int ldapadd; ...@@ -73,7 +73,7 @@ static int ldapadd;
static char *rejfile = NULL; static char *rejfile = NULL;
static LDAP *ld = NULL; static LDAP *ld = NULL;
static int process_ldif_rec LDAP_P(( char *rbuf, int lineno )); static int process_ldif_rec LDAP_P(( char *rbuf, unsigned long lineno ));
static int domodify LDAP_P(( static int domodify LDAP_P((
const struct berval *dn, const struct berval *dn,
LDAPMod **pmods, LDAPMod **pmods,
...@@ -220,8 +220,8 @@ main( int argc, char **argv ) ...@@ -220,8 +220,8 @@ main( int argc, char **argv )
char *matched_msg, *error_msg; char *matched_msg, *error_msg;
int rc, retval, ldifrc; int rc, retval, ldifrc;
int len; int len;
int i = 0; int i = 0, lmax = 0;
int lineno, nextline = 0, lmax = 0; unsigned long lineno, nextline = 0;
LDAPControl c[1]; LDAPControl c[1];
prog = lutil_progname( "ldapmodify", argc, argv ); prog = lutil_progname( "ldapmodify", argc, argv );
...@@ -377,7 +377,7 @@ fail:; ...@@ -377,7 +377,7 @@ fail:;
static int static int
process_ldif_rec( char *rbuf, int linenum ) process_ldif_rec( char *rbuf, unsigned long linenum )
{ {
LDIFRecord lr; LDIFRecord lr;
int lrflags = ldapadd ? LDIF_DEFAULT_ADD : 0; int lrflags = ldapadd ? LDIF_DEFAULT_ADD : 0;
......
...@@ -2663,7 +2663,7 @@ ldap_ldif_record_done LDAP_P(( ...@@ -2663,7 +2663,7 @@ ldap_ldif_record_done LDAP_P((
LDAP_F( int ) LDAP_F( int )
ldap_parse_ldif_record LDAP_P(( ldap_parse_ldif_record LDAP_P((
struct berval *rbuf, struct berval *rbuf,
int linenum, unsigned long linenum,
LDIFRecord *lr, LDIFRecord *lr,
const char *errstr, const char *errstr,
unsigned int flags )); unsigned int flags ));
......
...@@ -323,7 +323,7 @@ LDAP_F ( int ) ldap_pvt_discard LDAP_P(( ...@@ -323,7 +323,7 @@ LDAP_F ( int ) ldap_pvt_discard LDAP_P((
LDAP_F( int ) LDAP_F( int )
ldap_parse_ldif_record_x LDAP_P(( ldap_parse_ldif_record_x LDAP_P((
struct berval *rbuf, struct berval *rbuf,
int linenum, unsigned long linenum,
struct ldifrecord *lr, struct ldifrecord *lr,
const char *errstr, const char *errstr,
unsigned int flags, unsigned int flags,
......
...@@ -105,7 +105,7 @@ ldif_close LDAP_P(( LDIFFP * )); ...@@ -105,7 +105,7 @@ ldif_close LDAP_P(( LDIFFP * ));
LDAP_LDIF_F( int ) LDAP_LDIF_F( int )
ldif_read_record LDAP_P(( ldif_read_record LDAP_P((
LDIFFP *fp, LDIFFP *fp,
int *lineno, unsigned long *lineno,
char **bufp, char **bufp,
int *buflen )); int *buflen ));
......
...@@ -814,7 +814,7 @@ ldif_close( ...@@ -814,7 +814,7 @@ ldif_close(
int int
ldif_read_record( ldif_read_record(
LDIFFP *lfp, LDIFFP *lfp,
int *lno, /* ptr to line number counter */ unsigned long *lno, /* ptr to line number counter */
char **bufp, /* ptr to malloced output buffer */ char **bufp, /* ptr to malloced output buffer */
int *buflenp ) /* ptr to length of *bufp */ int *buflenp ) /* ptr to length of *bufp */
{ {
......
...@@ -100,7 +100,7 @@ ldap_ldif_record_done( LDIFRecord *lr ) ...@@ -100,7 +100,7 @@ ldap_ldif_record_done( LDIFRecord *lr )
int int
ldap_parse_ldif_record_x( ldap_parse_ldif_record_x(
struct berval *rbuf, struct berval *rbuf,
int linenum, unsigned long linenum,
LDIFRecord *lr, LDIFRecord *lr,
const char *errstr, const char *errstr,
unsigned int flags, unsigned int flags,
...@@ -155,7 +155,7 @@ ldap_parse_ldif_record_x( ...@@ -155,7 +155,7 @@ ldap_parse_ldif_record_x(
} }
if ( ( rc = ldif_parse_line2( line, lr->lr_btype+i, lr->lr_vals+i, &freev ) ) < 0 ) { 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 ); errstr, linenum+i, dn == NULL ? "" : dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -175,7 +175,7 @@ ldap_parse_ldif_record_x( ...@@ -175,7 +175,7 @@ ldap_parse_ldif_record_x(
if ( lr->lr_vals[i].bv_len != version1.bv_len || strncmp( lr->lr_vals[i].bv_val, version1.bv_val, version1.bv_len ) != 0 ) 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, 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 ); errstr, lr->lr_vals[i].bv_val, linenum );
} }
version++; version++;
...@@ -215,7 +215,7 @@ ldap_parse_ldif_record_x( ...@@ -215,7 +215,7 @@ ldap_parse_ldif_record_x(
rc = parse_ldif_control( lr->lr_vals+i, &pctrls ); rc = parse_ldif_control( lr->lr_vals+i, &pctrls );
if (rc != 0) { if (rc != 0) {
fprintf( stderr, 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) ); errstr, BV_CONTROL.bv_val, linenum+i, ldap_err2string(rc) );
} }
} }
...@@ -223,7 +223,7 @@ ldap_parse_ldif_record_x( ...@@ -223,7 +223,7 @@ ldap_parse_ldif_record_x(
if ( i>= lr->lr_lines ) { if ( i>= lr->lr_lines ) {
short_input: short_input:
fprintf( stderr, 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 ); errstr, lr->lr_btype[i-1].bv_val, linenum+i );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
...@@ -244,7 +244,7 @@ short_input: ...@@ -244,7 +244,7 @@ short_input:
if ( ++icnt != lr->lr_vals[i].bv_len ) { if ( ++icnt != lr->lr_vals[i].bv_len ) {
fprintf( stderr, _("%s: illegal trailing space after" 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 ); errstr, BV_CHANGETYPE.bv_val, lr->lr_vals[i].bv_val, linenum+i, dn );
lr->lr_vals[i].bv_val[icnt] = '\0'; lr->lr_vals[i].bv_val[icnt] = '\0';
} }
...@@ -255,7 +255,7 @@ short_input: ...@@ -255,7 +255,7 @@ short_input:
if ( flags & LDIF_ENTRIES_ONLY ) { if ( flags & LDIF_ENTRIES_ONLY ) {
if ( !( BV_CASEMATCH( lr->lr_vals+i, &BV_ADDCT )) ) { if ( !( BV_CASEMATCH( lr->lr_vals+i, &BV_ADDCT )) ) {
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, 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"), "changetype '%.*s' found but entries only was requested\n"),
errstr, linenum, errstr, linenum,
(int)lr->lr_vals[i].bv_len, (int)lr->lr_vals[i].bv_len,
...@@ -279,7 +279,7 @@ short_input: ...@@ -279,7 +279,7 @@ short_input:
goto short_input; goto short_input;
if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_NEWRDN )) { if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_NEWRDN )) {
fprintf( stderr, _("%s: expecting \"%s:\" but saw" 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 ); errstr, BV_NEWRDN.bv_val, lr->lr_btype[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -290,7 +290,7 @@ short_input: ...@@ -290,7 +290,7 @@ short_input:
goto short_input; goto short_input;
if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_DELETEOLDRDN )) { if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_DELETEOLDRDN )) {
fprintf( stderr, _("%s: expecting \"%s:\" but saw" 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 ); errstr, BV_DELETEOLDRDN.bv_val, lr->lr_btype[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -300,7 +300,7 @@ short_input: ...@@ -300,7 +300,7 @@ short_input:
if ( i < lr->lr_lines ) { if ( i < lr->lr_lines ) {
if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_NEWSUP )) { if ( !BV_CASEMATCH( lr->lr_btype+i, &BV_NEWSUP )) {
fprintf( stderr, _("%s: expecting \"%s:\" but saw" 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 ); errstr, BV_NEWSUP.bv_val, lr->lr_btype[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -313,7 +313,7 @@ short_input: ...@@ -313,7 +313,7 @@ short_input:
got_all = delete_entry = 1; got_all = delete_entry = 1;
} else { } else {
fprintf( stderr, 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 ); errstr, BV_CHANGETYPE.bv_val, lr->lr_vals[i].bv_val, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -327,7 +327,7 @@ short_input: ...@@ -327,7 +327,7 @@ short_input:
there must be no changetype, and the flag LDIF_DEFAULT_ADD must be set */ there must be no changetype, and the flag LDIF_DEFAULT_ADD must be set */
if ( flags & LDIF_ENTRIES_ONLY ) { if ( flags & LDIF_ENTRIES_ONLY ) {
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, 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 " "no changetype found but entries only was requested and "
"the default setting for missing changetype is modify\n"), "the default setting for missing changetype is modify\n"),
errstr, linenum ); errstr, linenum );
...@@ -339,7 +339,7 @@ short_input: ...@@ -339,7 +339,7 @@ short_input:
if ( got_all ) { if ( got_all ) {
if ( i < lr->lr_lines ) { if ( i < lr->lr_lines ) {
fprintf( stderr, 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 ); errstr, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -358,7 +358,7 @@ short_input: ...@@ -358,7 +358,7 @@ short_input:
for (j=i+1; j<lr->lr_lines; j++) { for (j=i+1; j<lr->lr_lines; j++) {
if ( !lr->lr_btype[j].bv_val ) { if ( !lr->lr_btype[j].bv_val ) {
fprintf( stderr, fprintf( stderr,
_("%s: missing attributeDescription (line %d, entry \"%s\")\n"), _("%s: missing attributeDescription (line %lu, entry \"%s\")\n"),
errstr, linenum+j, dn ); errstr, linenum+j, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -400,7 +400,7 @@ short_input: ...@@ -400,7 +400,7 @@ short_input:
if ( BV_CASEMATCH( lr->lr_btype+i, &BV_DN )) { if ( BV_CASEMATCH( lr->lr_btype+i, &BV_DN )) {
fprintf( stderr, _("%s: attributeDescription \"%s\":" fprintf( stderr, _("%s: attributeDescription \"%s\":"
" (possible missing newline" " (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 ); errstr, lr->lr_btype[i].bv_val, linenum+i - 1, dn );
} }
if ( !BV_CASEMATCH( lr->lr_btype+i, &bv )) { if ( !BV_CASEMATCH( lr->lr_btype+i, &bv )) {
...@@ -434,7 +434,7 @@ short_input: ...@@ -434,7 +434,7 @@ short_input:
if ( ++icnt != lr->lr_vals[i].bv_len ) { if ( ++icnt != lr->lr_vals[i].bv_len ) {
fprintf( stderr, _("%s: illegal trailing space after" 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 ); errstr, type, lr->lr_vals[i].bv_val, linenum+i, dn );
lr->lr_vals[i].bv_val[icnt] = '\0'; lr->lr_vals[i].bv_val[icnt] = '\0';
} }
...@@ -465,7 +465,7 @@ short_input: ...@@ -465,7 +465,7 @@ short_input:
nmods--; nmods--;
} else { /* no modify op: invalid LDIF */ } else { /* no modify op: invalid LDIF */
fprintf( stderr, _("%s: modify operation type is missing at" fprintf( stderr, _("%s: modify operation type is missing at"
" line %d, entry \"%s\"\n"), " line %lu, entry \"%s\"\n"),
errstr, linenum+i, dn ); errstr, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -479,7 +479,7 @@ short_input: ...@@ -479,7 +479,7 @@ short_input:
} else { } else {
if ( !BV_CASEMATCH( lr->lr_btype+i, &bv )) { if ( !BV_CASEMATCH( lr->lr_btype+i, &bv )) {
fprintf( stderr, _("%s: wrong attributeType at" fprintf( stderr, _("%s: wrong attributeType at"
" line %d, entry \"%s\"\n"), " line %lu, entry \"%s\"\n"),
errstr, linenum+i, dn ); errstr, linenum+i, dn );
rc = LDAP_PARAM_ERROR; rc = LDAP_PARAM_ERROR;
goto leave; goto leave;
...@@ -564,7 +564,7 @@ leave: ...@@ -564,7 +564,7 @@ leave:
int int
ldap_parse_ldif_record( ldap_parse_ldif_record(
struct berval *rbuf, struct berval *rbuf,
int linenum, unsigned long linenum,
LDIFRecord *lr, LDIFRecord *lr,
const char *errstr, const char *errstr,
unsigned int flags ) unsigned int flags )
......
...@@ -539,7 +539,8 @@ read_baseObject( ...@@ -539,7 +539,8 @@ read_baseObject(
{ {
backsql_info *bi = (backsql_info *)be->be_private; backsql_info *bi = (backsql_info *)be->be_private;
LDIFFP *fp; LDIFFP *fp;
int rc = 0, lineno = 0, lmax = 0, ldifrc; int rc = 0, lmax = 0, ldifrc;
unsigned long lineno = 0;
char *buf = NULL; char *buf = NULL;
assert( fname != NULL ); assert( fname != NULL );
...@@ -571,7 +572,7 @@ read_baseObject( ...@@ -571,7 +572,7 @@ read_baseObject(
if( e == NULL ) { if( e == NULL ) {
fprintf( stderr, "back-sql baseObject: " fprintf( stderr, "back-sql baseObject: "
"could not parse entry (line=%d)\n", "could not parse entry (line=%lu)\n",
lineno ); lineno );
rc = LDAP_OTHER; rc = LDAP_OTHER;
break; break;
...@@ -581,7 +582,7 @@ read_baseObject( ...@@ -581,7 +582,7 @@ read_baseObject(
if ( !be_issuffix( be, &e->e_nname ) ) { if ( !be_issuffix( be, &e->e_nname ) ) {
fprintf( stderr, fprintf( stderr,
"back-sql: invalid baseObject - " "back-sql: invalid baseObject - "
"dn=\"%s\" (line=%d)\n", "dn=\"%s\" (line=%lu)\n",
e->e_name.bv_val, lineno ); e->e_name.bv_val, lineno );
entry_free( e ); entry_free( e );
rc = LDAP_OTHER; rc = LDAP_OTHER;
......
...@@ -401,7 +401,8 @@ int ...@@ -401,7 +401,8 @@ int
root_dse_read_file( const char *fname ) root_dse_read_file( const char *fname )
{ {
struct LDIFFP *fp; struct LDIFFP *fp;
int rc = 0, lineno = 0, lmax = 0, ldifrc; int rc = 0, lmax = 0, ldifrc;
unsigned long lineno = 0;
char *buf = NULL; char *buf = NULL;
if ( (fp = ldif_open( fname, "r" )) == NULL ) { if ( (fp = ldif_open( fname, "r" )) == NULL ) {
...@@ -427,7 +428,7 @@ root_dse_read_file( const char *fname ) ...@@ -427,7 +428,7 @@ root_dse_read_file( const char *fname )
if( e == NULL ) { if( e == NULL ) {
Debug( LDAP_DEBUG_ANY, "root_dse_read_file: " Debug( LDAP_DEBUG_ANY, "root_dse_read_file: "
"could not parse entry (file=\"%s\" line=%d)\n", "could not parse entry (file=\"%s\" line=%lu)\n",
fname, lineno, 0 ); fname, lineno, 0 );
rc = LDAP_OTHER; rc = LDAP_OTHER;
break; break;
...@@ -437,7 +438,7 @@ root_dse_read_file( const char *fname ) ...@@ -437,7 +438,7 @@ root_dse_read_file( const char *fname )
if( e->e_nname.bv_len ) { if( e->e_nname.bv_len ) {
Debug( LDAP_DEBUG_ANY, Debug( LDAP_DEBUG_ANY,
"root_dse_read_file: invalid rootDSE " "root_dse_read_file: invalid rootDSE "
"- dn=\"%s\" (file=\"%s\" line=%d)\n", "- dn=\"%s\" (file=\"%s\" line=%lu)\n",
e->e_dn, fname, lineno ); e->e_dn, fname, lineno );
entry_free( e ); entry_free( e );
rc = LDAP_OTHER; rc = LDAP_OTHER;
......
...@@ -44,14 +44,14 @@ static char csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ]; ...@@ -44,14 +44,14 @@ static char csnbuf[ LDAP_PVT_CSNSTR_BUFSIZE ];
typedef struct Erec { typedef struct Erec {
Entry *e; Entry *e;
int lineno; unsigned long lineno;
int nextline; unsigned long nextline;
} Erec; } Erec;
typedef struct Trec { typedef struct Trec {
Entry *e; Entry *e;
int lineno; unsigned long lineno;
int nextline; unsigned long nextline;
int rc; int rc;
int ready; int ready;
} Trec; } Trec;
...@@ -108,7 +108,7 @@ again: ...@@ -108,7 +108,7 @@ again:
0); 0);
if( e == NULL ) { if( e == NULL ) {
fprintf( stderr, "%s: could not parse entry (line=%d)\n", fprintf( stderr, "%s: could not parse entry (line=%lu)\n",
progname, erec->lineno ); progname, erec->lineno );
return -2; return -2;
} }
...@@ -117,7 +117,7 @@ again: ...@@ -117,7 +117,7 @@ again:
if( BER_BVISEMPTY( &e->e_nname ) && if( BER_BVISEMPTY( &e->e_nname ) &&
!BER_BVISEMPTY( be->be_nsuffix )) !BER_BVISEMPTY( be->be_nsuffix ))
{ {
fprintf( stderr, "%s: line %d: " fprintf( stderr, "%s: line %lu: "
"cannot add entry with empty dn=\"%s\"", "cannot add entry with empty dn=\"%s\"",
progname, erec->lineno, e->e_dn ); progname, erec->lineno, e->e_dn );
bd = select_backend( &e->e_nname, nosubordinates ); bd = select_backend( &e->e_nname, nosubordinates );
...@@ -144,7 +144,7 @@ again: ...@@ -144,7 +144,7 @@ again:
/* check backend */ /* check backend */
bd = select_backend( &e->e_nname, nosubordinates ); bd = select_backend( &e->e_nname, nosubordinates );
if ( bd != be ) { if ( bd != be ) {
fprintf( stderr, "%s: line %d: " fprintf( stderr, "%s: line %lu: "
"database #%d (%s) not configured to hold \"%s\"", "database #%d (%s) not configured to hold \"%s\"",
progname, erec->lineno, progname, erec->lineno,
dbnum, dbnum,
...@@ -432,7 +432,7 @@ slapadd( int argc, char **argv ) ...@@ -432,7 +432,7 @@ slapadd( int argc, char **argv )
id = be->be_entry_put( be, erec.e, &bvtext ); id = be->be_entry_put( be, erec.e, &bvtext );
if( id == NOID ) { if( id == NOID ) {
fprintf( stderr, "%s: could not add entry dn=\"%s\" " fprintf( stderr, "%s: could not add entry dn=\"%s\" "
"(line=%d): %s\n", progname, erec.e->e_dn, "(line=%lu): %s\n", progname, erec.e->e_dn,
erec.lineno, bvtext.bv_val ); erec.lineno, bvtext.bv_val );
rc = EXIT_FAILURE; rc = EXIT_FAILURE;
if( continuemode ) { if( continuemode ) {
......
...@@ -456,7 +456,7 @@ slap_tool_init( ...@@ -456,7 +456,7 @@ slap_tool_init(
} break; } break;
case 'j': /* jump to linenumber */ case 'j': /* jump to linenumber */
if ( lutil_atoi( &jumpline, optarg ) ) { if ( lutil_atoul( &jumpline, optarg ) ) {
usage( tool, progname ); usage( tool, progname );
} }
break; break;
......
...@@ -43,9 +43,9 @@ typedef struct tool_vars { ...@@ -43,9 +43,9 @@ typedef struct tool_vars {
int tv_continuemode; int tv_continuemode;
int tv_nosubordinates; int tv_nosubordinates;
int tv_dryrun; int tv_dryrun;
int tv_jumpline;
struct berval tv_sub_ndn;
int tv_scope; int tv_scope;
unsigned long tv_jumpline;
struct berval tv_sub_ndn;
Filter *tv_filter; Filter *tv_filter;
struct LDIFFP *tv_ldiffp; struct LDIFFP *tv_ldiffp;
struct berval tv_baseDN; struct berval tv_baseDN;
......
...@@ -56,8 +56,8 @@ slapmodify( int argc, char **argv ) ...@@ -56,8 +56,8 @@ slapmodify( int argc, char **argv )
OperationBuffer opbuf; OperationBuffer opbuf;
Operation *op; Operation *op;
int checkvals; int checkvals, ldifrc;
int lineno, nextline, ldifrc; unsigned long lineno, nextline;
int lmax; int lmax;
int rc = EXIT_SUCCESS; int rc = EXIT_SUCCESS;
...@@ -162,7 +162,7 @@ slapmodify( int argc, char **argv ) ...@@ -162,7 +162,7 @@ slapmodify( int argc, char **argv )
"slapmodify", LDIF_NO_CONTROLS ); "slapmodify", LDIF_NO_CONTROLS );
if ( local_rc != LDAP_SUCCESS ) { if ( local_rc != LDAP_SUCCESS ) {
fprintf( stderr, "%s: could not parse entry (line=%d)\n", fprintf( stderr, "%s: could not parse entry (line=%lu)\n",
progname, lineno ); progname, lineno );
rc = EXIT_FAILURE; rc = EXIT_FAILURE;
if( continuemode ) continue; if( continuemode ) continue;
...@@ -180,14 +180,14 @@ slapmodify( int argc, char **argv ) ...@@ -180,14 +180,14 @@ slapmodify( int argc, char **argv )
case LDAP_REQ_MODRDN: case LDAP_REQ_MODRDN:
case LDAP_REQ_DELETE: case LDAP_REQ_DELETE:
fprintf( stderr, "%s: request 0x%lx not supported (line=%d)\n", fprintf( stderr, "%s: request 0x%lx not supported (line=%lu)\n",
progname, (unsigned long)lr.lr_op, lineno ); progname, (unsigned long)lr.lr_op, lineno );
rc = EXIT_FAILURE; rc = EXIT_FAILURE;
if( continuemode ) continue; if( continuemode ) continue;
goto done; goto done;
default: default:
fprintf( stderr, "%s: unknown request 0x%lx (line=%d)\n",