From ca1aed557b1fa81b3d11de1da32f0a00c5f5cff8 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 17 Aug 2007 15:08:47 +0000 Subject: [PATCH] make lutil_uuidstr_from_normalized() return the length of the string --- libraries/liblutil/uuid.c | 2 +- servers/slapd/overlays/pcache.c | 8 ++++++-- servers/slapd/syncrepl.c | 5 ++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libraries/liblutil/uuid.c b/libraries/liblutil/uuid.c index dce2ee923d..b5d4f6e68a 100644 --- a/libraries/liblutil/uuid.c +++ b/libraries/liblutil/uuid.c @@ -418,7 +418,7 @@ lutil_uuidstr_from_normalized( } if ( buflen > 36 ) buf[36] = '\0'; - return 0; + return 36; } #ifdef TEST diff --git a/servers/slapd/overlays/pcache.c b/servers/slapd/overlays/pcache.c index a2852eee0c..b81843e39d 100644 --- a/servers/slapd/overlays/pcache.c +++ b/servers/slapd/overlays/pcache.c @@ -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 ); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index b1be2447aa..3f8e620c15 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -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; -- 2.39.5