]> git.sur5r.net Git - openldap/blobdiff - tests/progs/ldif-filter.c
ITS#8292 Fix ldif-filter, drop workaround for bug
[openldap] / tests / progs / ldif-filter.c
index cf9d2573942415752c17ee7a5850110f0d572408..9425979d5fadb43884a4a307027e556a7996c8fb 100644 (file)
@@ -59,15 +59,21 @@ get_flags( const char *backend, const char *spec )
 {
        size_t len = strlen( backend );
        unsigned flags = DUMMY_FLAG;
-       const char *tmp;
+       const char *end, *tmp;
 
-       while ( '=' != *(spec += strncmp( spec, backend, len ) ? 0 : len) ) {
-               if ( (spec = strchr( spec, ',' )) == NULL ) {
+       for ( ;; spec = end + ( *end != '\0' )) {
+               if ( !*spec )
                        return 0;
+               end = spec + strcspn( spec, "," );
+               if ( !(tmp = memchr( spec, '=', end-spec )))
+                       break;
+               if ( tmp-spec == len && !memcmp( spec, backend, len )) {
+                       spec = tmp+1;
+                       break;
                }
-               ++spec;
        }
-       while ( *++spec && *spec != ',' ) {
+
+       for ( ; spec < end; spec++ ) {
                if ( (tmp = strchr( spec_options, *spec )) == NULL ) {
                        usage();
                }