]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9556 Send INVALID_SYNTAX for invalid schema elements
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 15 Nov 2021 14:42:04 +0000 (14:42 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 15 Dec 2021 18:39:46 +0000 (18:39 +0000)
servers/slapd/bconfig.c
tests/scripts/test051-config-undo

index d10c2232be67b8e8749eb85af7235d51fcefa7b5..9fabfbc411aa75fbd019c5616fdeb5fb77d06b6e 100644 (file)
@@ -2105,7 +2105,10 @@ config_generic(ConfigArgs *c) {
                                }
                                /* else prev is NULL, append to end of global list */
                        }
-                       if(parse_oc(c, &oc, prev)) return(1);
+                       if ( parse_oc( c, &oc, prev ) ) {
+                               c->reply.err = LDAP_INVALID_SYNTAX;
+                               return(1);
+                       }
                        if (!cfn->c_oc_head || !c->valx) cfn->c_oc_head = oc;
                        if (cfn->c_oc_tail == prev) cfn->c_oc_tail = oc;
                        }
@@ -2138,7 +2141,10 @@ config_generic(ConfigArgs *c) {
                                }
                                /* else prev is NULL, append to end of global list */
                        }
-                       if(parse_at(c, &at, prev)) return(1);
+                       if ( parse_at( c, &at, prev ) ) {
+                               c->reply.err = LDAP_INVALID_SYNTAX;
+                               return(1);
+                       }
                        if (!cfn->c_at_head || !c->valx) cfn->c_at_head = at;
                        if (cfn->c_at_tail == prev) cfn->c_at_tail = at;
                        }
@@ -2171,7 +2177,10 @@ config_generic(ConfigArgs *c) {
                                }
                                /* else prev is NULL, append to end of global list */
                        }
-                       if ( parse_syn( c, &syn, prev ) ) return(1);
+                       if ( parse_syn( c, &syn, prev ) ) {
+                               c->reply.err = LDAP_INVALID_SYNTAX;
+                               return(1);
+                       }
                        if ( !cfn->c_syn_head || !c->valx ) cfn->c_syn_head = syn;
                        if ( cfn->c_syn_tail == prev ) cfn->c_syn_tail = syn;
                        }
@@ -2182,7 +2191,10 @@ config_generic(ConfigArgs *c) {
 
                        if ( c->op == LDAP_MOD_ADD && c->ca_private && cfn != c->ca_private )
                                cfn = c->ca_private;
-                       if(parse_cr(c, &cr)) return(1);
+                       if( parse_cr( c, &cr ) ) {
+                               c->reply.err = LDAP_INVALID_SYNTAX;
+                               return(1);
+                       }
                        if (!cfn->c_cr_head) cfn->c_cr_head = cr;
                        cfn->c_cr_tail = cr;
                        }
index c749ccb279f91283db0959a448bd8b2d3cef8527..fb9d868c462e44f0f19ed18a2098492cc989b21a 100755 (executable)
@@ -72,7 +72,7 @@ olcObjectClasses: ( rawr )
 -
 EOF
 RC=$?
-if test $RC != 80 ; then
+if test $RC != 21 ; then
        echo "invalid objectclass modify allowed ($RC)"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit 1
@@ -87,7 +87,7 @@ olcAttributeTypes: ( rawr )
 -
 EOF
 RC=$?
-if test $RC != 80 ; then
+if test $RC != 21 ; then
        echo "invalid attributeType modify allowed ($RC)"
        test $KILLSERVERS != no && kill -HUP $KILLPIDS
        exit 1