From b7afac2b834674e20f303c3a03b4ac7bb283695e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 11 Mar 2006 04:03:12 +0000 Subject: r14198: Update Samba4 to current lorikeet-heimdal. Andrew Bartlett (This used to be commit 97a0a0e2fa6784e5fc5278f7a15b385ddcb6a3b3) --- source4/heimdal/lib/asn1/parse.y | 79 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) (limited to 'source4/heimdal/lib/asn1/parse.y') diff --git a/source4/heimdal/lib/asn1/parse.y b/source4/heimdal/lib/asn1/parse.y index 51dc51ed88..2238478284 100644 --- a/source4/heimdal/lib/asn1/parse.y +++ b/source4/heimdal/lib/asn1/parse.y @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -/* $Id: parse.y,v 1.25 2005/08/23 10:52:31 lha Exp $ */ +/* $Id: parse.y,v 1.27 2005/12/14 09:44:36 lha Exp $ */ %{ #ifdef HAVE_CONFIG_H @@ -45,9 +45,10 @@ #include "gen_locl.h" #include "der.h" -RCSID("$Id: parse.y,v 1.25 2005/08/23 10:52:31 lha Exp $"); +RCSID("$Id: parse.y,v 1.27 2005/12/14 09:44:36 lha Exp $"); static Type *new_type (Typetype t); +static struct constraint_spec *new_constraint_spec(enum ctype); static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype); void yyerror (const char *); static struct objid *new_objid(const char *label, int value); @@ -73,6 +74,7 @@ struct string_list { struct string_list *sl; struct tagtype tag; struct memhead *members; + struct constraint_spec *constraint_spec; } %token kw_ABSENT @@ -183,6 +185,7 @@ struct string_list { %type BitStringType %type BooleanType %type ChoiceType +%type ConstrainedType %type EnumeratedType %type IntegerType %type NullType @@ -215,6 +218,12 @@ struct string_list { %type referencenames +%type Constraint +%type ConstraintSpec +%type GeneralConstraint +%type ContentsConstraint +%type UserDefinedConstraint + %start ModuleDefinition %% @@ -300,6 +309,7 @@ TypeAssignment : IDENTIFIER EEQUAL Type Type : BuiltinType | ReferencedType + | ConstrainedType ; BuiltinType : BitStringType @@ -507,6 +517,63 @@ UsefulType : kw_GeneralizedTime } ; +ConstrainedType : Type Constraint + { + /* if (Constraint.type == contentConstrant) { + assert(Constraint.u.constraint.type == octetstring|bitstring-w/o-NamedBitList); // remember to check type reference too + if (Constraint.u.constraint.type) { + assert((Constraint.u.constraint.type.length % 8) == 0); + } + } + if (Constraint.u.constraint.encoding) { + type == der-oid|ber-oid + } + */ + } + ; + + +Constraint : '(' ConstraintSpec ')' + { + $$ = $2; + } + +ConstraintSpec : GeneralConstraint + +GeneralConstraint: ContentsConstraint + | UserDefinedConstraint + ; + +ContentsConstraint: kw_CONTAINING Type + { + $$ = new_constraint_spec(CT_CONTENTS); + $$->u.content.type = $2; + $$->u.content.encoding = NULL; + } + | kw_ENCODED kw_BY Value + { + if ($3->type != objectidentifiervalue) + error_message("Non-OID used in ENCODED BY constraint"); + $$ = new_constraint_spec(CT_CONTENTS); + $$->u.content.type = NULL; + $$->u.content.encoding = $3; + } + | kw_CONTAINING Type kw_ENCODED kw_BY Value + { + if ($5->type != objectidentifiervalue) + error_message("Non-OID used in ENCODED BY constraint"); + $$ = new_constraint_spec(CT_CONTENTS); + $$->u.content.type = $2; + $$->u.content.encoding = $5; + } + ; + +UserDefinedConstraint: kw_CONSTRAINED kw_BY '{' '}' + { + $$ = new_constraint_spec(CT_USER); + } + ; + TaggedType : Tag tagenv Type { $$ = new_type(TTag); @@ -861,6 +928,14 @@ new_type (Typetype tt) return t; } +static struct constraint_spec * +new_constraint_spec(enum ctype ct) +{ + struct constraint_spec *c = ecalloc(1, sizeof(*c)); + c->ctype = ct; + return c; +} + static void fix_labels2(Type *t, const char *prefix); static void fix_labels1(struct memhead *members, const char *prefix) { -- cgit