]> git.sur5r.net Git - openldap/commitdiff
be liberal: accept empty oid lists
authorPierangelo Masarati <ando@openldap.org>
Fri, 15 Jul 2005 00:46:30 +0000 (00:46 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 15 Jul 2005 00:46:30 +0000 (00:46 +0000)
libraries/libldap/schema.c

index 6c76569b79149d0db1fd9ddb37a7e935e692a669..de380c52009d7d9b2d8fa1d580ef0eacb95f1a85 100644 (file)
@@ -1312,6 +1312,11 @@ parse_oids(const char **sp, int *code, const int allow_quoted)
                     ( allow_quoted && kind == TK_QDSTRING ) ) {
                        res[pos++] = sval;
                        res[pos] = NULL;
+               } else if ( kind == TK_RIGHTPAREN ) {
+                       /* FIXME: be liberal in what we accept... */
+                       parse_whsp(sp);
+                       LDAP_FREE(res);
+                       return NULL;
                } else {
                        *code = LDAP_SCHERR_UNEXPTOKEN;
                        LDAP_FREE(sval);
@@ -1924,7 +1929,7 @@ ldap_str2matchingruleuse( LDAP_CONST char * s,
                                mru->mru_applies_oids = parse_oids(&ss,
                                                             code,
                                                             flags);
-                               if ( !mru->mru_applies_oids ) {
+                               if ( !mru->mru_applies_oids && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_matchingruleuse_free(mru);
                                        return NULL;
@@ -2520,7 +2525,7 @@ ldap_str2objectclass( LDAP_CONST char * s,
                                oc->oc_sup_oids = parse_oids(&ss,
                                                             code,
                                                             flags);
-                               if ( !oc->oc_sup_oids ) {
+                               if ( !oc->oc_sup_oids && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_objectclass_free(oc);
                                        return NULL;
@@ -2568,7 +2573,7 @@ ldap_str2objectclass( LDAP_CONST char * s,
                                }
                                seen_must = 1;
                                oc->oc_at_oids_must = parse_oids(&ss,code,0);
-                               if ( !oc->oc_at_oids_must ) {
+                               if ( !oc->oc_at_oids_must && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_objectclass_free(oc);
                                        return NULL;
@@ -2584,7 +2589,7 @@ ldap_str2objectclass( LDAP_CONST char * s,
                                }
                                seen_may = 1;
                                oc->oc_at_oids_may = parse_oids(&ss,code,0);
-                               if ( !oc->oc_at_oids_may ) {
+                               if ( !oc->oc_at_oids_may && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_objectclass_free(oc);
                                        return NULL;
@@ -2809,7 +2814,7 @@ ldap_str2contentrule( LDAP_CONST char * s,
                                }
                                seen_must = 1;
                                cr->cr_at_oids_must = parse_oids(&ss,code,0);
-                               if ( !cr->cr_at_oids_must ) {
+                               if ( !cr->cr_at_oids_must && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_contentrule_free(cr);
                                        return NULL;
@@ -2825,7 +2830,7 @@ ldap_str2contentrule( LDAP_CONST char * s,
                                }
                                seen_may = 1;
                                cr->cr_at_oids_may = parse_oids(&ss,code,0);
-                               if ( !cr->cr_at_oids_may ) {
+                               if ( !cr->cr_at_oids_may && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_contentrule_free(cr);
                                        return NULL;
@@ -2841,7 +2846,7 @@ ldap_str2contentrule( LDAP_CONST char * s,
                                }
                                seen_not = 1;
                                cr->cr_at_oids_not = parse_oids(&ss,code,0);
-                               if ( !cr->cr_at_oids_not ) {
+                               if ( !cr->cr_at_oids_not && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_contentrule_free(cr);
                                        return NULL;
@@ -3211,7 +3216,7 @@ ldap_str2nameform( LDAP_CONST char * s,
                                }
                                seen_must = 1;
                                nf->nf_at_oids_must = parse_oids(&ss,code,0);
-                               if ( !nf->nf_at_oids_must ) {
+                               if ( !nf->nf_at_oids_must && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_nameform_free(nf);
                                        return NULL;
@@ -3227,7 +3232,7 @@ ldap_str2nameform( LDAP_CONST char * s,
                                }
                                seen_may = 1;
                                nf->nf_at_oids_may = parse_oids(&ss,code,0);
-                               if ( !nf->nf_at_oids_may ) {
+                               if ( !nf->nf_at_oids_may && *code != LDAP_SUCCESS ) {
                                        *errp = ss;
                                        ldap_nameform_free(nf);
                                        return NULL;