]> git.sur5r.net Git - openldap/commitdiff
ITS#2365 - preserve internal ber_tag as well as ber_ptr for rewinding.
authorHoward Chu <hyc@openldap.org>
Wed, 12 Mar 2003 02:33:53 +0000 (02:33 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 12 Mar 2003 02:33:53 +0000 (02:33 +0000)
libraries/liblber/decode.c

index 0f08f8c597ba156569b70f06860210b82f1b53ea..b0a5bd7a7e390cfcb725507b35e89d8cb55cebdf 100644 (file)
@@ -316,13 +316,12 @@ ber_get_stringbvl( bgbvr *b, ber_len_t *rlen )
        struct berval bv, *bvp = NULL;
 
        orig = b->ber->ber_ptr;
+       tag = b->ber->ber_tag;
 
-       tag = ber_first_element( b->ber, &len, &last );
-       if ( tag != LBER_DEFAULT ) {
+       if ( ber_first_element( b->ber, &len, &last ) != LBER_DEFAULT ) {
                for ( ; b->ber->ber_ptr < last; i++ )
                {
-                       tag = ber_skip_tag( b->ber, &len );
-                       if (tag == LBER_DEFAULT) break;
+                       if (ber_skip_tag( b->ber, &len ) == LBER_DEFAULT) break;
                        b->ber->ber_ptr += len;
                }
        }
@@ -366,6 +365,7 @@ ber_get_stringbvl( bgbvr *b, ber_len_t *rlen )
                break;
        }
        b->ber->ber_ptr = orig;
+       b->ber->ber_tag = tag;
        ber_skip_tag( b->ber, &len );
        
        for (n=0; n<i; n++)