]> git.sur5r.net Git - openldap/commitdiff
more ITS#4503 cleanup
authorPierangelo Masarati <ando@openldap.org>
Tue, 25 Apr 2006 19:30:48 +0000 (19:30 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 25 Apr 2006 19:30:48 +0000 (19:30 +0000)
servers/slapd/back-ldif/ldif.c
servers/slapd/ldapsync.c
servers/slapd/overlays/retcode.c
servers/slapd/syncrepl.c

index dc1d88757ec6d7812a7663b3b4118c81ec09f076..3cd9bcb78a1002ea599ea72ca6bd44494e559d89 100644 (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;
index cc1ed8705468df15f5d7fc9f0cdd8c4ed3095684..7d9b9cf20e76bc1f7319cfdaa262973f8787c4c1 100644 (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;
index 44a1b709c0d4999fa8c8731c45440f52039c0dd3..add5a75235424f3a1ae2099f76f7a9846f7b8446 100644 (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 );
index b8f9a743297d40dd486c54815d7fedf4e1f6102c..0e20fa7707d6320624cd155a7c79d24a558d93c7 100644 (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 );