more ITS#4503 cleanup

This commit is contained in:
Pierangelo Masarati 2006-04-25 19:30:48 +00:00
parent 004b69d070
commit 95b29919a3
4 changed files with 13 additions and 5 deletions

View File

@ -420,6 +420,8 @@ static int r_enum_tree(enumCookie *ck, struct berval *path,
if ( ptr ) {
itmp.bv_len = ptr - itmp.bv_val;
ber_dupbv( &bvl->num, &itmp );
/* FIXME: handle error? */
assert( itmp.bv_val[ 0 ] != '-' );
bvl->inum = strtoul( itmp.bv_val, NULL, 0 );
itmp.bv_val[0] = '\0';
bvl->off = itmp.bv_val - bvl->bv.bv_val;

View File

@ -114,6 +114,9 @@ slap_parse_sync_cookie(
return -1;
}
if ( rid_ptr[ STRLENOF( "rid=" ) ] == '-' ) {
return -1;
}
cookie->rid = strtoul( &rid_ptr[ STRLENOF( "rid=" ) ], &next, 10 );
if ( next == &rid_ptr[ STRLENOF( "rid=" ) ] || ( next[ 0 ] != ',' && next[ 0 ] != '\0' ) ) {
return -1;

View File

@ -531,7 +531,7 @@ retcode_entry_response( Operation *op, SlapReply *rs, BackendInfo *bi, Entry *e
/* sleep time */
a = attr_find( e->e_attrs, ad_errSleepTime );
if ( a != NULL ) {
if ( a != NULL && a->a_nvals[ 0 ].bv_val[ 0 ] != '-' ) {
int sleepTime;
sleepTime = strtoul( a->a_nvals[ 0 ].bv_val, &next, 0 );

View File

@ -2983,8 +2983,11 @@ parse_syncrepl_line(
} else if ( strchr( val, ':' ) != NULL ) {
char *next, *ptr = val;
unsigned dd, hh, mm, ss;
/* NOTE: the test for ptr[ 0 ] == '-'
* should go before the call to strtoul() */
dd = strtoul( ptr, &next, 10 );
if ( next == ptr || next[0] != ':' ) {
if ( ptr[ 0 ] == '-' || next == ptr || next[0] != ':' ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse days", val );
@ -2993,7 +2996,7 @@ parse_syncrepl_line(
}
ptr = next + 1;
hh = strtoul( ptr, &next, 10 );
if ( next == ptr || next[0] != ':' || hh > 24 ) {
if ( ptr[ 0 ] == '-' || next == ptr || next[0] != ':' || hh > 24 ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse hours", val );
@ -3002,7 +3005,7 @@ parse_syncrepl_line(
}
ptr = next + 1;
mm = strtoul( ptr, &next, 10 );
if ( next == ptr || next[0] != ':' || mm > 60 ) {
if ( ptr[ 0 ] == '-' || next == ptr || next[0] != ':' || mm > 60 ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse minutes", val );
@ -3011,7 +3014,7 @@ parse_syncrepl_line(
}
ptr = next + 1;
ss = strtoul( ptr, &next, 10 );
if ( next == ptr || next[0] != '\0' || ss > 60 ) {
if ( ptr[ 0 ] == '-' || next == ptr || next[0] != '\0' || ss > 60 ) {
snprintf( c->msg, sizeof( c->msg ),
"Error: parse_syncrepl_line: "
"invalid interval \"%s\", unable to parse seconds", val );