From: Ondřej Kuzník Date: Mon, 15 Nov 2021 14:42:04 +0000 (+0000) Subject: ITS#9556 Send INVALID_SYNTAX for invalid schema elements X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fbd4f9abdd33b8c443a00fc23c1ad44148975d5c;p=thirdparty%2Fopenldap.git ITS#9556 Send INVALID_SYNTAX for invalid schema elements --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index d10c2232be..9fabfbc411 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -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; } diff --git a/tests/scripts/test051-config-undo b/tests/scripts/test051-config-undo index c749ccb279..fb9d868c46 100755 --- a/tests/scripts/test051-config-undo +++ b/tests/scripts/test051-config-undo @@ -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