]> git.sur5r.net Git - openldap/commitdiff
Fix attribute description checks
authorKurt Zeilenga <kurt@openldap.org>
Fri, 4 Jan 2002 00:45:05 +0000 (00:45 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 4 Jan 2002 00:45:05 +0000 (00:45 +0000)
libraries/libldap/filter.c

index 6e46dfbe0545b266e1bda7ac3d4039d48951e962..1cf825822862b9baef8360db0f7c7eb378d1f0aa 100644 (file)
@@ -117,7 +117,7 @@ static int ldap_is_desc ( const char *str )
        return 0;
 
 options:
-       if( !LDAP_LDH( str[i] )) {
+       if( !LDAP_LDH( str[0] )) {
                return 0;
        }
        for( i=1; str[i]; i++ ) {
@@ -508,19 +508,16 @@ put_simple_filter(
        case '<':
                ftype = LDAP_FILTER_LE;
                *s = '\0';
-               if(! ldap_is_desc( str ) ) goto done;
                break;
 
        case '>':
                ftype = LDAP_FILTER_GE;
                *s = '\0';
-               if(! ldap_is_desc( str ) ) goto done;
                break;
 
        case '~':
                ftype = LDAP_FILTER_APPROX;
                *s = '\0';
-               if(! ldap_is_desc( str ) ) goto done;
                break;
 
        case ':':
@@ -535,11 +532,7 @@ put_simple_filter(
                        char *dn = strchr( str, ':' );
                        char *rule = NULL;
 
-                       if( dn == NULL ) {
-                               if(! ldap_is_desc( str ) ) goto done;
-
-                       } else {
-
+                       if( dn != NULL ) {
                                *dn++ = '\0';
                                rule = strchr( dn, ':' );
 
@@ -627,6 +620,8 @@ put_simple_filter(
                } break;
        }
 
+       if( !ldap_is_desc( str ) ) goto done;
+
        if ( ftype == LDAP_FILTER_PRESENT ) {
                rc = ber_printf( ber, "ts", ftype, str );