]> git.sur5r.net Git - openldap/commitdiff
make lutil_uuidstr_from_normalized() return the length of the string
authorPierangelo Masarati <ando@openldap.org>
Fri, 17 Aug 2007 15:08:47 +0000 (15:08 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 17 Aug 2007 15:08:47 +0000 (15:08 +0000)
libraries/liblutil/uuid.c
servers/slapd/overlays/pcache.c
servers/slapd/syncrepl.c

index dce2ee923da18681b78e70b5bc03ae26cdbac816..b5d4f6e68ae6d0fd962524bab9649535fb1bcefa 100644 (file)
@@ -418,7 +418,7 @@ lutil_uuidstr_from_normalized(
        }
 
        if ( buflen > 36 ) buf[36] = '\0';
-       return 0;
+       return 36;
 }
 
 #ifdef TEST
index a2852eee0c772577a64da91595ca6ff4c4140ff0..b81843e39d3d7b91cd134cc3298162265d737c5d 100644 (file)
@@ -3442,10 +3442,14 @@ pcache_parse_query_delete(
                                goto decoding_error;
                        }
 
-                       lutil_uuidstr_from_normalized(
+                       rc = lutil_uuidstr_from_normalized(
                                bv.bv_val, bv.bv_len,
                                uuidbuf, sizeof( uuidbuf ) );
-                       ber_str2bv( uuidbuf, 36, 1, uuid );
+                       if ( rc == -1 ) {
+                               goto decoding_error;
+                       }
+                       ber_str2bv( uuidbuf, rc, 1, uuid );
+                       rc = LDAP_SUCCESS;
 
                } else {
                        tag = ber_skip_tag( ber, &len );
index b1be2447aa57a7c17488ec674aed47a903eb76b4..3f8e620c15495295fb37dee655c69d8d9ec1e002 100644 (file)
@@ -3110,7 +3110,7 @@ slap_uuidstr_from_normalized(
                normalized->bv_len, new->bv_val, new->bv_len + 1 );
 
 done:;
-       if ( rc != 0 ) {
+       if ( rc == -1 ) {
                if ( new != NULL ) {
                        if ( new->bv_val != NULL ) {
                                slap_sl_free( new->bv_val, ctx );
@@ -3121,6 +3121,9 @@ done:;
                        }
                }
                new = NULL;
+
+       } else {
+               new->bv_len = rc;
        }
 
        return new;