summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/asn1
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-08-27 11:49:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:39 -0500
commit08730652fbf1c9f6d53378b1b094a2c5ddf2cf62 (patch)
tree077a628e42ccb9388e6ebbbe6ab068980b592554 /source4/heimdal/lib/asn1
parent02caf604be250e71b46619949cbbfa11543a3907 (diff)
downloadsamba-08730652fbf1c9f6d53378b1b094a2c5ddf2cf62.tar.gz
samba-08730652fbf1c9f6d53378b1b094a2c5ddf2cf62.tar.bz2
samba-08730652fbf1c9f6d53378b1b094a2c5ddf2cf62.zip
r9680: Update Heimdal to current lorikeet-heimdal (which was itself updated
to Heimdal CVS as of 2005-08-27). Andrew Bartlett (This used to be commit 913924a4997f5e14c503f87510cbd8e4bfd965a9)
Diffstat (limited to 'source4/heimdal/lib/asn1')
-rw-r--r--source4/heimdal/lib/asn1/gen.c12
-rw-r--r--source4/heimdal/lib/asn1/gen_decode.c214
-rw-r--r--source4/heimdal/lib/asn1/gen_encode.c139
-rw-r--r--source4/heimdal/lib/asn1/gen_length.c72
-rw-r--r--source4/heimdal/lib/asn1/gen_locl.h26
-rw-r--r--source4/heimdal/lib/asn1/k5.asn18
-rw-r--r--source4/heimdal/lib/asn1/main.c6
-rw-r--r--source4/heimdal/lib/asn1/parse.c6
-rw-r--r--source4/heimdal/lib/asn1/parse.y8
9 files changed, 271 insertions, 220 deletions
diff --git a/source4/heimdal/lib/asn1/gen.c b/source4/heimdal/lib/asn1/gen.c
index 1189a03ab1..aee1ee5b3f 100644
--- a/source4/heimdal/lib/asn1/gen.c
+++ b/source4/heimdal/lib/asn1/gen.c
@@ -33,7 +33,7 @@
#include "gen_locl.h"
-RCSID("$Id: gen.c,v 1.62 2005/07/19 18:46:50 lha Exp $");
+RCSID("$Id: gen.c,v 1.63 2005/08/23 10:49:16 lha Exp $");
FILE *headerfile, *codefile, *logfile;
@@ -41,7 +41,7 @@ FILE *headerfile, *codefile, *logfile;
static const char *orig_filename;
static char *header;
-static char *headerbase = STEM;
+static const char *headerbase = STEM;
/*
* list of all IMPORTs
@@ -77,9 +77,9 @@ init_generate (const char *filename, const char *base)
orig_filename = filename;
if (base != NULL) {
- asprintf(&headerbase, "%s", base);
+ headerbase = strdup(base);
if (headerbase == NULL)
- errx(1, "malloc");
+ errx(1, "strdup");
}
asprintf(&header, "%s.h", headerbase);
if (header == NULL)
@@ -349,7 +349,7 @@ space(int level)
fprintf(headerfile, " ");
}
-static char *
+static const char *
last_member_p(struct member *m)
{
struct member *n = ASN1_TAILQ_NEXT(m, members);
@@ -521,7 +521,7 @@ define_asn1 (int level, Type *t)
}
static void
-define_type (int level, char *name, Type *t, int typedefp, int preservep)
+define_type (int level, const char *name, Type *t, int typedefp, int preservep)
{
switch (t->type) {
case TType:
diff --git a/source4/heimdal/lib/asn1/gen_decode.c b/source4/heimdal/lib/asn1/gen_decode.c
index ff75113576..42ceb37e62 100644
--- a/source4/heimdal/lib/asn1/gen_decode.c
+++ b/source4/heimdal/lib/asn1/gen_decode.c
@@ -34,7 +34,7 @@
#include "gen_locl.h"
#include "lex.h"
-RCSID("$Id: gen_decode.c,v 1.27 2005/07/19 18:09:30 lha Exp $");
+RCSID("$Id: gen_decode.c,v 1.28 2005/08/23 11:51:25 lha Exp $");
static void
decode_primitive (const char *typename, const char *name, const char *forwstr)
@@ -198,7 +198,7 @@ find_tag (const Type *t,
static int
decode_type (const char *name, const Type *t, int optional,
- const char *forwstr)
+ const char *forwstr, const char *tmpstr)
{
switch (t->type) {
case TType: {
@@ -304,7 +304,7 @@ decode_type (const char *name, const Type *t, int optional,
name, m->gen_name);
if (s == NULL)
errx(1, "malloc");
- decode_type (s, m->type, m->optional, forwstr);
+ decode_type (s, m->type, m->optional, forwstr, m->gen_name);
free (s);
}
@@ -346,7 +346,7 @@ decode_type (const char *name, const Type *t, int optional,
"%s = calloc(1, sizeof(*%s));\n"
"if (%s == NULL) { e = ENOMEM; %s; }\n",
s, s, s, forwstr);
- decode_type (s, m->type, 0, forwstr);
+ decode_type (s, m->type, 0, forwstr, m->gen_name);
free (s);
fprintf(codefile, "members |= (1 << %d);\n", memno);
@@ -382,33 +382,45 @@ decode_type (const char *name, const Type *t, int optional,
case TSetOf:
case TSequenceOf: {
char *n;
+ char *sname;
fprintf (codefile,
"{\n"
- "size_t origlen = len;\n"
- "size_t oldret = ret;\n"
- "void *tmp;\n"
+ "size_t %s_origlen = len;\n"
+ "size_t %s_oldret = ret;\n"
+ "void *%s_tmp;\n"
"ret = 0;\n"
"(%s)->len = 0;\n"
"(%s)->val = NULL;\n"
- "while(ret < origlen) {\n"
- "tmp = realloc((%s)->val, "
+ "while(ret < %s_origlen) {\n"
+ "%s_tmp = realloc((%s)->val, "
" sizeof(*((%s)->val)) * ((%s)->len + 1));\n"
- "if (tmp == NULL) { %s; }\n"
+ "if (%s_tmp == NULL) { %s; }\n"
"(%s)->len++;\n"
- "(%s)->val = tmp;\n",
- name, name, name, name, name, forwstr, name, name);
+ "(%s)->val = %s_tmp;\n",
+ tmpstr, tmpstr, tmpstr,
+ name, name,
+ tmpstr, tmpstr,
+ name, name, name,
+ tmpstr,
+ forwstr, name, name,
+ tmpstr);
asprintf (&n, "&(%s)->val[(%s)->len-1]", name, name);
if (n == NULL)
errx(1, "malloc");
- decode_type (n, t->subtype, 0, forwstr);
+ asprintf (&sname, "%s_s_of", tmpstr);
+ if (sname == NULL)
+ errx(1, "malloc");
+ decode_type (n, t->subtype, 0, forwstr, sname);
fprintf (codefile,
- "len = origlen - ret;\n"
+ "len = %s_origlen - ret;\n"
"}\n"
- "ret += oldret;\n"
- "}\n");
+ "ret += %s_oldret;\n"
+ "}\n",
+ tmpstr, tmpstr);
free (n);
+ free (sname);
break;
}
case TGeneralizedTime:
@@ -418,17 +430,21 @@ decode_type (const char *name, const Type *t, int optional,
decode_primitive ("general_string", name, forwstr);
break;
case TTag:{
+ char *tname;
+
fprintf(codefile,
"{\n"
- "size_t tagdatalen, oldlen;\n");
+ "size_t %s_datalen, %s_oldlen;\n",
+ tmpstr, tmpstr);
if(dce_fix)
fprintf(codefile,
"int dce_fix;\n");
fprintf(codefile, "e = der_match_tag_and_length(p, len, %s, %s, %s, "
- "&tagdatalen, &l);\n",
+ "&%s_datalen, &l);\n",
classname(t->tag.tagclass),
is_primitive_type(t->subtype->type) ? "PRIM" : "CONS",
- valuename(t->tag.tagclass, t->tag.tagvalue));
+ valuename(t->tag.tagclass, t->tag.tagvalue),
+ tmpstr);
if(optional) {
fprintf(codefile,
"if(e) {\n"
@@ -442,32 +458,38 @@ decode_type (const char *name, const Type *t, int optional,
}
fprintf (codefile,
"p += l; len -= l; ret += l;\n"
- "oldlen = len;\n");
+ "%s_oldlen = len;\n",
+ tmpstr);
if(dce_fix)
fprintf (codefile,
- "if((dce_fix = _heim_fix_dce(tagdatalen, &len)) < 0)\n"
+ "if((dce_fix = _heim_fix_dce(%s_datalen, &len)) < 0)\n"
"{ e = ASN1_BAD_FORMAT; %s; }\n",
- forwstr);
+ tmpstr, forwstr);
else
fprintf(codefile,
- "if (tagdatalen > len) { e = ASN1_OVERRUN; %s; }\n"
- "len = tagdatalen;\n", forwstr);
- decode_type (name, t->subtype, 0, forwstr);
+ "if (%s_datalen > len) { e = ASN1_OVERRUN; %s; }\n"
+ "len = %s_datalen;\n", tmpstr, forwstr, tmpstr);
+ asprintf (&tname, "%s_Tag", tmpstr);
+ if (tname == NULL)
+ errx(1, "malloc");
+ decode_type (name, t->subtype, 0, forwstr, tname);
if(dce_fix)
fprintf(codefile,
"if(dce_fix){\n"
"e = der_match_tag_and_length (p, len, "
"(Der_class)0,(Der_type)0, UT_EndOfContent, "
- "&tagdatalen, &l);\n"
+ "&%s_datalen, &l);\n"
"if(e) %s;\np += l; len -= l; ret += l;\n"
- "} else \n", forwstr);
+ "} else \n", tmpstr, forwstr);
fprintf(codefile,
- "len = oldlen - tagdatalen;\n");
+ "len = %s_oldlen - %s_datalen;\n",
+ tmpstr, tmpstr);
if(optional)
fprintf(codefile,
"}\n");
fprintf(codefile,
"}\n");
+ free(tname);
break;
}
case TChoice: {
@@ -501,7 +523,7 @@ decode_type (const char *name, const Type *t, int optional,
name, m->gen_name);
if (s == NULL)
errx(1, "malloc");
- decode_type (s, m->type, m->optional, forwstr);
+ decode_type (s, m->type, m->optional, forwstr, m->gen_name);
fprintf(codefile,
"(%s)->element = %s;\n",
name, m->label);
@@ -573,71 +595,73 @@ decode_type (const char *name, const Type *t, int optional,
void
generate_type_decode (const Symbol *s)
{
- int preserve = preserve_type(s->name) ? TRUE : FALSE;
-
- fprintf (headerfile,
- "int "
- "decode_%s(const unsigned char *, size_t, %s *, size_t *);\n",
- s->gen_name, s->gen_name);
-
- fprintf (codefile, "int\n"
- "decode_%s(const unsigned char *p,"
- " size_t len, %s *data, size_t *size)\n"
- "{\n",
- s->gen_name, s->gen_name);
-
- switch (s->type->type) {
- case TInteger:
- case TBoolean:
- case TOctetString:
- case TOID:
- case TGeneralizedTime:
- case TGeneralString:
- case TUTF8String:
- case TPrintableString:
- case TIA5String:
- case TBMPString:
- case TUniversalString:
- case TUTCTime:
- case TNull:
- case TEnumerated:
- case TBitString:
- case TSequence:
- case TSequenceOf:
- case TSet:
- case TSetOf:
- case TTag:
- case TType:
- case TChoice:
- fprintf (codefile,
- "size_t ret = 0, reallen;\n"
- "size_t l;\n"
- "int e;\n");
- if (preserve)
- fprintf (codefile, "const unsigned char *begin = p;\n");
-
- fprintf (codefile, "\n");
- fprintf (codefile, "memset(data, 0, sizeof(*data));\n");
- fprintf (codefile, "reallen = 0;\n"); /* hack to avoid `unused variable' */
-
- decode_type ("data", s->type, 0, "goto fail");
- if (preserve)
+ int preserve = preserve_type(s->name) ? TRUE : FALSE;
+
+ fprintf (headerfile,
+ "int "
+ "decode_%s(const unsigned char *, size_t, %s *, size_t *);\n",
+ s->gen_name, s->gen_name);
+
+ fprintf (codefile, "int\n"
+ "decode_%s(const unsigned char *p,"
+ " size_t len, %s *data, size_t *size)\n"
+ "{\n",
+ s->gen_name, s->gen_name);
+
+ switch (s->type->type) {
+ case TInteger:
+ case TBoolean:
+ case TOctetString:
+ case TOID:
+ case TGeneralizedTime:
+ case TGeneralString:
+ case TUTF8String:
+ case TPrintableString:
+ case TIA5String:
+ case TBMPString:
+ case TUniversalString:
+ case TUTCTime:
+ case TNull:
+ case TEnumerated:
+ case TBitString:
+ case TSequence:
+ case TSequenceOf:
+ case TSet:
+ case TSetOf:
+ case TTag:
+ case TType:
+ case TChoice:
fprintf (codefile,
- "data->_save.data = calloc(1, ret);\n"
- "if (data->_save.data == NULL) { e = ENOMEM; goto fail; }\n"
- "data->_save.length = ret;\n"
- "memcpy(data->_save.data, begin, ret);\n");
- fprintf (codefile,
- "if(size) *size = ret;\n"
- "return 0;\n");
- fprintf (codefile,
- "fail:\n"
- "free_%s(data);\n"
- "return e;\n",
- s->gen_name);
- break;
- default:
- abort ();
- }
- fprintf (codefile, "}\n\n");
+ "size_t ret = 0, reallen;\n"
+ "size_t l;\n"
+ "int e;\n");
+ if (preserve)
+ fprintf (codefile, "const unsigned char *begin = p;\n");
+
+ fprintf (codefile, "\n");
+ fprintf (codefile, "memset(data, 0, sizeof(*data));\n"); /* hack to avoid `unused variable' */
+ fprintf (codefile, "reallen = 0;\n");
+
+ decode_type ("data", s->type, 0, "goto fail", "Top");
+ if (preserve)
+ fprintf (codefile,
+ "data->_save.data = calloc(1, ret);\n"
+ "if (data->_save.data == NULL) { \n"
+ "e = ENOMEM; goto fail; \n"
+ "}\n"
+ "data->_save.length = ret;\n"
+ "memcpy(data->_save.data, begin, ret);\n");
+ fprintf (codefile,
+ "if(size) *size = ret;\n"
+ "return 0;\n");
+ fprintf (codefile,
+ "fail:\n"
+ "free_%s(data);\n"
+ "return e;\n",
+ s->gen_name);
+ break;
+ default:
+ abort ();
+ }
+ fprintf (codefile, "}\n\n");
}
diff --git a/source4/heimdal/lib/asn1/gen_encode.c b/source4/heimdal/lib/asn1/gen_encode.c
index acd058c7dd..4099fbf643 100644
--- a/source4/heimdal/lib/asn1/gen_encode.c
+++ b/source4/heimdal/lib/asn1/gen_encode.c
@@ -33,7 +33,7 @@
#include "gen_locl.h"
-RCSID("$Id: gen_encode.c,v 1.18 2005/07/13 10:40:23 lha Exp $");
+RCSID("$Id: gen_encode.c,v 1.19 2005/08/23 11:52:16 lha Exp $");
static void
encode_primitive (const char *typename, const char *name)
@@ -62,7 +62,7 @@ valuename(Der_class class, int value)
static char s[32];
struct {
int value;
- char *s;
+ const char *s;
} *p, values[] = {
#define X(Y) { Y, #Y }
X(UT_BMPString),
@@ -105,7 +105,7 @@ valuename(Der_class class, int value)
}
static int
-encode_type (const char *name, const Type *t)
+encode_type (const char *name, const Type *t, const char *tmpstr)
{
int constructed = 1;
@@ -260,10 +260,10 @@ encode_type (const char *name, const Type *t)
else if(m->defval)
gen_compare_defval(s + 1, m->defval);
fprintf (codefile, "{\n");
- fprintf (codefile, "size_t oldret = ret;\n");
+ fprintf (codefile, "size_t %s_oldret = ret;\n", tmpstr);
fprintf (codefile, "ret = 0;\n");
- encode_type (s, m->type);
- fprintf (codefile, "ret += oldret;\n");
+ encode_type (s, m->type, m->gen_name);
+ fprintf (codefile, "ret += %s_oldret;\n", tmpstr);
fprintf (codefile, "}\n");
free (s);
}
@@ -333,20 +333,26 @@ encode_type (const char *name, const Type *t)
}
case TSequenceOf: {
char *n;
+ char *sname;
fprintf (codefile,
"for(i = (%s)->len - 1; i >= 0; --i) {\n"
- "size_t oldret = ret;\n"
+ "size_t %s_for_oldret = ret;\n"
"ret = 0;\n",
- name);
+ name, tmpstr);
asprintf (&n, "&(%s)->val[i]", name);
if (n == NULL)
errx(1, "malloc");
- encode_type (n, t->subtype);
+ asprintf (&sname, "%s_S_Of", tmpstr);
+ if (sname == NULL)
+ errx(1, "malloc");
+ encode_type (n, t->subtype, sname);
fprintf (codefile,
- "ret += oldret;\n"
- "}\n");
+ "ret += %s_for_oldret;\n"
+ "}\n",
+ tmpstr);
free (n);
+ free (sname);
break;
}
case TGeneralizedTime:
@@ -358,13 +364,19 @@ encode_type (const char *name, const Type *t)
constructed = 0;
break;
case TTag: {
- int c = encode_type (name, t->subtype);
+ char *tname;
+ int c;
+ asprintf (&tname, "%s_tag", tmpstr);
+ if (tname == NULL)
+ errx(1, "malloc");
+ c = encode_type (name, t->subtype, tname);
fprintf (codefile,
"e = der_put_length_and_tag (p, len, ret, %s, %s, %s, &l);\n"
"if (e) return e;\np -= l; len -= l; ret += l;\n\n",
classname(t->tag.tagclass),
c ? "CONS" : "PRIM",
valuename(t->tag.tagclass, t->tag.tagvalue));
+ free (tname);
break;
}
case TChoice:{
@@ -396,11 +408,10 @@ encode_type (const char *name, const Type *t)
errx(1, "malloc");
if (m->optional)
fprintf (codefile, "if(%s) {\n", s2);
- fprintf (codefile, "size_t oldret;\n");
- fprintf (codefile, "oldret = ret;\n");
+ fprintf (codefile, "size_t %s_oldret = ret;\n", tmpstr);
fprintf (codefile, "ret = 0;\n");
- constructed = encode_type (s2, m->type);
- fprintf (codefile, "ret += oldret;\n");
+ constructed = encode_type (s2, m->type, m->gen_name);
+ fprintf (codefile, "ret += %s_oldret;\n", tmpstr);
if(m->optional)
fprintf (codefile, "}\n");
fprintf(codefile, "break;\n");
@@ -469,53 +480,53 @@ encode_type (const char *name, const Type *t)
void
generate_type_encode (const Symbol *s)
{
- fprintf (headerfile,
- "int "
- "encode_%s(unsigned char *, size_t, const %s *, size_t *);\n",
- s->gen_name, s->gen_name);
-
- fprintf (codefile, "int\n"
- "encode_%s(unsigned char *p, size_t len,"
- " const %s *data, size_t *size)\n"
- "{\n",
- s->gen_name, s->gen_name);
-
- switch (s->type->type) {
- case TInteger:
- case TBoolean:
- case TOctetString:
- case TGeneralizedTime:
- case TGeneralString:
- case TUTCTime:
- case TUTF8String:
- case TPrintableString:
- case TIA5String:
- case TBMPString:
- case TUniversalString:
- case TNull:
- case TBitString:
- case TEnumerated:
- case TOID:
- case TSequence:
- case TSequenceOf:
- case TSet:
- case TSetOf:
- case TTag:
- case TType:
- case TChoice:
- fprintf (codefile,
- "size_t ret = 0;\n"
- "size_t l;\n"
- "int i, e;\n\n");
- fprintf(codefile, "i = 0;\n"); /* hack to avoid `unused variable' */
+ fprintf (headerfile,
+ "int "
+ "encode_%s(unsigned char *, size_t, const %s *, size_t *);\n",
+ s->gen_name, s->gen_name);
+
+ fprintf (codefile, "int\n"
+ "encode_%s(unsigned char *p, size_t len,"
+ " const %s *data, size_t *size)\n"
+ "{\n",
+ s->gen_name, s->gen_name);
+
+ switch (s->type->type) {
+ case TInteger:
+ case TBoolean:
+ case TOctetString:
+ case TGeneralizedTime:
+ case TGeneralString:
+ case TUTCTime:
+ case TUTF8String:
+ case TPrintableString:
+ case TIA5String:
+ case TBMPString:
+ case TUniversalString:
+ case TNull:
+ case TBitString:
+ case TEnumerated:
+ case TOID:
+ case TSequence:
+ case TSequenceOf:
+ case TSet:
+ case TSetOf:
+ case TTag:
+ case TType:
+ case TChoice:
+ fprintf (codefile,
+ "size_t ret = 0;\n"
+ "size_t l;\n"
+ "int i, e;\n\n");
+ fprintf(codefile, "i = 0;\n"); /* hack to avoid `unused variable' */
- encode_type("data", s->type);
-
- fprintf (codefile, "*size = ret;\n"
- "return 0;\n");
- break;
- default:
- abort ();
- }
- fprintf (codefile, "}\n\n");
+ encode_type("data", s->type, "Top");
+
+ fprintf (codefile, "*size = ret;\n"
+ "return 0;\n");
+ break;
+ default:
+ abort ();
+ }
+ fprintf (codefile, "}\n\n");
}
diff --git a/source4/heimdal/lib/asn1/gen_length.c b/source4/heimdal/lib/asn1/gen_length.c
index aed49e89c3..f3869fa5f2 100644
--- a/source4/heimdal/lib/asn1/gen_length.c
+++ b/source4/heimdal/lib/asn1/gen_length.c
@@ -33,7 +33,7 @@
#include "gen_locl.h"
-RCSID("$Id: gen_length.c,v 1.18 2005/07/19 18:01:59 lha Exp $");
+RCSID("$Id: gen_length.c,v 1.19 2005/08/23 11:51:41 lha Exp $");
static void
length_primitive (const char *typename,
@@ -59,7 +59,8 @@ length_tag(unsigned int tag)
static int
-length_type (const char *name, const Type *t, const char *variable)
+length_type (const char *name, const Type *t,
+ const char *variable, const char *tmpstr)
{
switch (t->type) {
case TType:
@@ -158,10 +159,10 @@ length_type (const char *name, const Type *t, const char *variable)
else if(m->defval)
gen_compare_defval(s + 1, m->defval);
fprintf (codefile, "{\n"
- "size_t oldret = %s;\n"
- "%s = 0;\n", variable, variable);
- length_type (s, m->type, "ret");
- fprintf (codefile, "ret += oldret;\n");
+ "size_t %s_oldret = %s;\n"
+ "%s = 0;\n", tmpstr, variable, variable);
+ length_type (s, m->type, "ret", m->gen_name);
+ fprintf (codefile, "ret += %s_oldret;\n", tmpstr);
fprintf (codefile, "}\n");
free (s);
if(t->type == TChoice)
@@ -183,29 +184,34 @@ length_type (const char *name, const Type *t, const char *variable)
case TSetOf:
case TSequenceOf: {
char *n;
+ char *sname;
fprintf (codefile,
"{\n"
- "int oldret = %s;\n"
+ "int %s_oldret = %s;\n"
"int i;\n"
"%s = 0;\n",
- variable, variable);
+ tmpstr, variable, variable);
fprintf (codefile, "for(i = (%s)->len - 1; i >= 0; --i){\n", name);
- fprintf (codefile, "int oldret = %s;\n"
- "%s = 0;\n", variable, variable);
+ fprintf (codefile, "int %s_for_oldret = %s;\n"
+ "%s = 0;\n", tmpstr, variable, variable);
asprintf (&n, "&(%s)->val[i]", name);
if (n == NULL)
errx(1, "malloc");
- length_type(n, t->subtype, variable);
- fprintf (codefile, "%s += oldret;\n",
- variable);
+ asprintf (&sname, "%s_S_Of", tmpstr);
+ if (sname == NULL)
+ errx(1, "malloc");
+ length_type(n, t->subtype, variable, sname);
+ fprintf (codefile, "%s += %s_for_oldret;\n",
+ variable, tmpstr);
fprintf (codefile, "}\n");
fprintf (codefile,
- "%s += oldret;\n"
- "}\n", variable);
+ "%s += %s_oldret;\n"
+ "}\n", variable, tmpstr);
free(n);
+ free(sname);
break;
}
case TGeneralizedTime:
@@ -235,11 +241,17 @@ length_type (const char *name, const Type *t, const char *variable)
case TNull:
fprintf (codefile, "/* NULL */\n");
break;
- case TTag:
- length_type (name, t->subtype, variable);
+ case TTag:{
+ char *tname;
+ asprintf(&tname, "%s_tag", tmpstr);
+ if (tname == NULL)
+ errx(1, "malloc");
+ length_type (name, t->subtype, variable, tname);
fprintf (codefile, "ret += %lu + length_len (ret);\n",
(unsigned long)length_tag(t->tag.tagvalue));
+ free(tname);
break;
+ }
case TOID:
length_primitive ("oid", name, variable);
break;
@@ -252,18 +264,18 @@ length_type (const char *name, const Type *t, const char *variable)
void
generate_type_length (const Symbol *s)
{
- fprintf (headerfile,
- "size_t length_%s(const %s *);\n",
- s->gen_name, s->gen_name);
-
- fprintf (codefile,
- "size_t\n"
- "length_%s(const %s *data)\n"
- "{\n"
- "size_t ret = 0;\n",
- s->gen_name, s->gen_name);
-
- length_type ("data", s->type, "ret");
- fprintf (codefile, "return ret;\n}\n\n");
+ fprintf (headerfile,
+ "size_t length_%s(const %s *);\n",
+ s->gen_name, s->gen_name);
+
+ fprintf (codefile,
+ "size_t\n"
+ "length_%s(const %s *data)\n"
+ "{\n"
+ "size_t ret = 0;\n",
+ s->gen_name, s->gen_name);
+
+ length_type ("data", s->type, "ret", "Top");
+ fprintf (codefile, "return ret;\n}\n\n");
}
diff --git a/source4/heimdal/lib/asn1/gen_locl.h b/source4/heimdal/lib/asn1/gen_locl.h
index a03097a68e..5a2ba85c7a 100644
--- a/source4/heimdal/lib/asn1/gen_locl.h
+++ b/source4/heimdal/lib/asn1/gen_locl.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-/* $Id: gen_locl.h,v 1.12 2005/07/12 06:27:30 lha Exp $ */
+/* $Id: gen_locl.h,v 1.13 2005/08/23 10:48:15 lha Exp $ */
#ifndef __GEN_LOCL_H__
#define __GEN_LOCL_H__
@@ -56,26 +56,26 @@
void generate_type (const Symbol *);
void generate_constant (const Symbol *);
-void generate_type_encode (const Symbol *s);
-void generate_type_decode (const Symbol *s);
-void generate_seq_type_decode (const Symbol *s);
-void generate_type_free (const Symbol *s);
-void generate_type_length (const Symbol *s);
-void generate_type_copy (const Symbol *s);
-void generate_type_maybe (const Symbol *s);
+void generate_type_encode (const Symbol *);
+void generate_type_decode (const Symbol *);
+void generate_seq_type_decode (const Symbol *);
+void generate_type_free (const Symbol *);
+void generate_type_length (const Symbol *);
+void generate_type_copy (const Symbol *);
+void generate_type_maybe (const Symbol *);
void generate_glue (const Type *, const char*);
const char *classname(Der_class);
-const char *valuename(Der_class class, int);
+const char *valuename(Der_class, int);
-void gen_compare_defval(const char *var, struct value *val);
-void gen_assign_defval(const char *var, struct value *val);
+void gen_compare_defval(const char *, struct value *);
+void gen_assign_defval(const char *, struct value *);
-void init_generate (const char *filename, const char *basename);
+void init_generate (const char *, const char *);
const char *get_filename (void);
void close_generate(void);
-void add_import(const char *module);
+void add_import(const char *);
int yyparse(void);
int preserve_type(const char *);
diff --git a/source4/heimdal/lib/asn1/k5.asn1 b/source4/heimdal/lib/asn1/k5.asn1
index dd49baf0ff..aa3e0b806d 100644
--- a/source4/heimdal/lib/asn1/k5.asn1
+++ b/source4/heimdal/lib/asn1/k5.asn1
@@ -1,4 +1,4 @@
--- $Id: k5.asn1,v 1.45 2005/07/13 05:29:49 lha Exp $
+-- $Id: k5.asn1,v 1.46 2005/08/22 19:09:25 lha Exp $
KERBEROS5 DEFINITIONS ::=
BEGIN
@@ -68,7 +68,11 @@ PADATA-TYPE ::= INTEGER {
KRB5-PADATA-TD-APP-DEFINED-ERROR(106), -- application specific
KRB5-PADATA-TD-REQ-NONCE(107), -- INTEGER
KRB5-PADATA-TD-REQ-SEQ(108), -- INTEGER
- KRB5-PADATA-PA-PAC-REQUEST(128) -- jbrezak@exchange.microsoft.com
+ KRB5-PADATA-PA-PAC-REQUEST(128), -- jbrezak@exchange.microsoft.com
+ KRB5-PADATA-PK-AS-09-BINDING(132) -- client send this to
+ -- tell KDC that is supports
+ -- the asCheckSum in the
+ -- PK-AS-REP
}
AUTHDATA-TYPE ::= INTEGER {
diff --git a/source4/heimdal/lib/asn1/main.c b/source4/heimdal/lib/asn1/main.c
index 088e8ebfa2..eec775f3ba 100644
--- a/source4/heimdal/lib/asn1/main.c
+++ b/source4/heimdal/lib/asn1/main.c
@@ -35,7 +35,7 @@
#include <getarg.h>
#include "lex.h"
-RCSID("$Id: main.c,v 1.14 2005/07/12 06:27:34 lha Exp $");
+RCSID("$Id: main.c,v 1.15 2005/08/23 10:50:12 lha Exp $");
extern FILE *yyin;
@@ -77,8 +77,8 @@ int
main(int argc, char **argv)
{
int ret;
- char *file;
- char *name = NULL;
+ const char *file;
+ const char *name = NULL;
int optidx = 0;
setprogname(argv[0]);
diff --git a/source4/heimdal/lib/asn1/parse.c b/source4/heimdal/lib/asn1/parse.c
index 83e8ccb8b5..858a669da1 100644
--- a/source4/heimdal/lib/asn1/parse.c
+++ b/source4/heimdal/lib/asn1/parse.c
@@ -247,11 +247,11 @@
#include "gen_locl.h"
#include "der.h"
-RCSID("$Id: parse.y,v 1.24 2005/07/12 06:27:35 lha Exp $");
+RCSID("$Id: parse.y,v 1.25 2005/08/23 10:52:31 lha Exp $");
static Type *new_type (Typetype t);
static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
-void yyerror (char *);
+void yyerror (const char *);
static struct objid *new_objid(const char *label, int value);
static void add_oid_to_tail(struct objid *, struct objid *);
static void fix_labels(Symbol *s);
@@ -2298,7 +2298,7 @@ yyreturn:
void
-yyerror (char *s)
+yyerror (const char *s)
{
error_message ("%s\n", s);
}
diff --git a/source4/heimdal/lib/asn1/parse.y b/source4/heimdal/lib/asn1/parse.y
index def2bc2498..51dc51ed88 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.24 2005/07/12 06:27:35 lha Exp $ */
+/* $Id: parse.y,v 1.25 2005/08/23 10:52:31 lha Exp $ */
%{
#ifdef HAVE_CONFIG_H
@@ -45,11 +45,11 @@
#include "gen_locl.h"
#include "der.h"
-RCSID("$Id: parse.y,v 1.24 2005/07/12 06:27:35 lha Exp $");
+RCSID("$Id: parse.y,v 1.25 2005/08/23 10:52:31 lha Exp $");
static Type *new_type (Typetype t);
static Type *new_tag(int tagclass, int tagvalue, int tagenv, Type *oldtype);
-void yyerror (char *);
+void yyerror (const char *);
static struct objid *new_objid(const char *label, int value);
static void add_oid_to_tail(struct objid *, struct objid *);
static void fix_labels(Symbol *s);
@@ -810,7 +810,7 @@ ObjectIdentifierValue: objid
%%
void
-yyerror (char *s)
+yyerror (const char *s)
{
error_message ("%s\n", s);
}