From: Kurt Zeilenga Date: Mon, 2 Dec 2002 04:19:01 +0000 (+0000) Subject: ITS#2218: fix empty values w/ spaces X-Git-Tag: NO_SLAP_OP_BLOCKS~745 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b215a1039b7d96d5bab46beb362033514bfef233;p=openldap ITS#2218: fix empty values w/ spaces --- diff --git a/libraries/libldif/line64.c b/libraries/libldif/line64.c index 3f16c95d60..9160588e69 100644 --- a/libraries/libldif/line64.c +++ b/libraries/libldif/line64.c @@ -119,11 +119,11 @@ ldif_parse_line( value = ""; vlen = 0; goto done; - } - - if ( *s == '<' ) { + + } else if ( *s == '<' ) { s++; url = 1; + } else if ( *s == ':' ) { /* base 64 encoded value */ s++; @@ -142,20 +142,19 @@ ldif_parse_line( } *d = '\0'; - /* if no value is present, error out */ - if ( *s == '\0' ) { - ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, - "ldif_parse_line: %s missing %svalue\n", type, - url ? "URL " : b64 ? "base64 " : "" ); - value = NULL; - vlen = 0; - goto done; - } - if ( b64 ) { char *byte = s; - value = s; + if ( *s == '\0' ) { + /* no value is present, error out */ + ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, + "ldif_parse_line: %s missing base64 value\n", type ); + value = NULL; + vlen = 0; + goto done; + } + + byte = value = s; for ( p = s, vlen = 0; p < d; p += 4, vlen += 3 ) { int i; @@ -199,6 +198,15 @@ ldif_parse_line( s[ vlen ] = '\0'; } else if ( url ) { + if ( *s == '\0' ) { + /* no value is present, error out */ + ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug, + "ldif_parse_line: %s missing URL value\n", type ); + value = NULL; + vlen = 0; + goto done; + } + if( ldif_fetch_url( s, &value, &vlen ) ) { ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug, "ldif_parse_line: %s: URL \"%s\" fetch failed\n",