summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/heimdal/lib')
-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
-rw-r--r--source4/heimdal/lib/gssapi/display_status.c14
-rw-r--r--source4/heimdal/lib/gssapi/external.c31
-rw-r--r--source4/heimdal/lib/hdb/hdb-protos.h359
-rw-r--r--source4/heimdal/lib/hdb/hdb.c14
-rw-r--r--source4/heimdal/lib/hdb/mkey.c5
-rw-r--r--source4/heimdal/lib/krb5/get_host_realm.c27
-rw-r--r--source4/heimdal/lib/krb5/krb5-private.h1
-rw-r--r--source4/heimdal/lib/krb5/krb5-protos.h23
-rw-r--r--source4/heimdal/lib/krb5/principal.c59
-rw-r--r--source4/heimdal/lib/roken/resolve.c6
-rw-r--r--source4/heimdal/lib/roken/setprogname.c6
-rw-r--r--source4/heimdal/lib/roken/strpool.c5
-rw-r--r--source4/heimdal/lib/vers/print_version.c (renamed from source4/heimdal/lib/roken/print_version.c)41
22 files changed, 768 insertions, 314 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);
}
diff --git a/source4/heimdal/lib/gssapi/display_status.c b/source4/heimdal/lib/gssapi/display_status.c
index 2c84628266..6e9456aa2e 100644
--- a/source4/heimdal/lib/gssapi/display_status.c
+++ b/source4/heimdal/lib/gssapi/display_status.c
@@ -33,12 +33,12 @@
#include "gssapi_locl.h"
-RCSID("$Id: display_status.c,v 1.12 2005/03/16 13:15:03 lha Exp $");
+RCSID("$Id: display_status.c,v 1.13 2005/08/23 08:30:55 lha Exp $");
-static char *
+static const char *
calling_error(OM_uint32 v)
{
- static char *msgs[] = {
+ static const char *msgs[] = {
NULL, /* 0 */
"A required input parameter could not be read.", /* */
"A required output parameter could not be written.", /* */
@@ -55,10 +55,10 @@ calling_error(OM_uint32 v)
return msgs[v];
}
-static char *
+static const char *
routine_error(OM_uint32 v)
{
- static char *msgs[] = {
+ static const char *msgs[] = {
NULL, /* 0 */
"An unsupported mechanism was requested",
"An invalid name was supplied",
@@ -91,10 +91,10 @@ routine_error(OM_uint32 v)
return msgs[v];
}
-static char *
+static const char *
supplementary_error(OM_uint32 v)
{
- static char *msgs[] = {
+ static const char *msgs[] = {
"normal completion",
"continuation call to routine required",
"duplicate per-message token detected",
diff --git a/source4/heimdal/lib/gssapi/external.c b/source4/heimdal/lib/gssapi/external.c
index f3e97181e6..f8c1d23f98 100644
--- a/source4/heimdal/lib/gssapi/external.c
+++ b/source4/heimdal/lib/gssapi/external.c
@@ -33,7 +33,7 @@
#include "gssapi_locl.h"
-RCSID("$Id: external.c,v 1.6 2003/09/08 15:34:19 lha Exp $");
+RCSID("$Id: external.c,v 1.7 2005/08/23 11:59:47 lha Exp $");
/*
* The implementation must reserve static storage for a
@@ -48,8 +48,7 @@ RCSID("$Id: external.c,v 1.6 2003/09/08 15:34:19 lha Exp $");
*/
static gss_OID_desc gss_c_nt_user_name_oid_desc =
-{10, (void *)"\x2a\x86\x48\x86\xf7\x12"
- "\x01\x02\x01\x01"};
+{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x01")};
gss_OID GSS_C_NT_USER_NAME = &gss_c_nt_user_name_oid_desc;
@@ -66,8 +65,7 @@ gss_OID GSS_C_NT_USER_NAME = &gss_c_nt_user_name_oid_desc;
*/
static gss_OID_desc gss_c_nt_machine_uid_name_oid_desc =
-{10, (void *)"\x2a\x86\x48\x86\xf7\x12"
- "\x01\x02\x01\x02"};
+{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x02")};
gss_OID GSS_C_NT_MACHINE_UID_NAME = &gss_c_nt_machine_uid_name_oid_desc;
@@ -84,8 +82,7 @@ gss_OID GSS_C_NT_MACHINE_UID_NAME = &gss_c_nt_machine_uid_name_oid_desc;
*/
static gss_OID_desc gss_c_nt_string_uid_name_oid_desc =
-{10, (void *)"\x2a\x86\x48\x86\xf7\x12"
- "\x01\x02\x01\x03"};
+{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x03")};
gss_OID GSS_C_NT_STRING_UID_NAME = &gss_c_nt_string_uid_name_oid_desc;
@@ -108,7 +105,7 @@ gss_OID GSS_C_NT_STRING_UID_NAME = &gss_c_nt_string_uid_name_oid_desc;
*/
static gss_OID_desc gss_c_nt_hostbased_service_x_oid_desc =
-{6, (void *)"\x2b\x06\x01\x05\x06\x02"};
+{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x02")};
gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &gss_c_nt_hostbased_service_x_oid_desc;
@@ -124,7 +121,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = &gss_c_nt_hostbased_service_x_oid_desc;
* to point to that gss_OID_desc.
*/
static gss_OID_desc gss_c_nt_hostbased_service_oid_desc =
-{10, (void *)"\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04"};
+{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")};
gss_OID GSS_C_NT_HOSTBASED_SERVICE = &gss_c_nt_hostbased_service_oid_desc;
@@ -140,7 +137,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE = &gss_c_nt_hostbased_service_oid_desc;
*/
static gss_OID_desc gss_c_nt_anonymous_oid_desc =
-{6, (void *)"\x2b\x06\01\x05\x06\x03"};
+{6, rk_UNCONST("\x2b\x06\01\x05\x06\x03")};
gss_OID GSS_C_NT_ANONYMOUS = &gss_c_nt_anonymous_oid_desc;
@@ -156,7 +153,7 @@ gss_OID GSS_C_NT_ANONYMOUS = &gss_c_nt_anonymous_oid_desc;
*/
static gss_OID_desc gss_c_nt_export_name_oid_desc =
-{6, (void *)"\x2b\x06\x01\x05\x06\x04"};
+{6, rk_UNCONST("\x2b\x06\x01\x05\x06\x04") };
gss_OID GSS_C_NT_EXPORT_NAME = &gss_c_nt_export_name_oid_desc;
@@ -168,7 +165,7 @@ gss_OID GSS_C_NT_EXPORT_NAME = &gss_c_nt_export_name_oid_desc;
*/
static gss_OID_desc gss_krb5_nt_principal_name_oid_desc =
-{10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
+{10, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01") };
gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = &gss_krb5_nt_principal_name_oid_desc;
@@ -219,12 +216,12 @@ gss_OID GSS_KRB5_NT_STRING_UID_NAME = &gss_c_nt_string_uid_name_oid_desc;
#if 0 /* This is the old OID */
static gss_OID_desc gss_krb5_mechanism_oid_desc =
-{5, (void *)"\x2b\x05\x01\x05\x02"};
+{5, rk_UNCONST("\x2b\x05\x01\x05\x02")};
#endif
static gss_OID_desc gss_krb5_mechanism_oid_desc =
-{9, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"};
+{9, rk_UNCONST("\x2a\x86\x48\x86\xf7\x12\x01\x02\x02") };
gss_OID GSS_KRB5_MECHANISM = &gss_krb5_mechanism_oid_desc;
@@ -236,7 +233,7 @@ gss_OID GSS_KRB5_MECHANISM = &gss_krb5_mechanism_oid_desc;
*/
static gss_OID_desc gss_spnego_mechanism_oid_desc =
-{6, (void *)"\x2b\x06\x01\x05\x05\x02"};
+{6, rk_UNCONST("\x2b\x06\x01\x05\x05\x02")};
gss_OID GSS_SPNEGO_MECHANISM = &gss_spnego_mechanism_oid_desc;
@@ -254,12 +251,12 @@ gss_OID GSS_SPNEGO_MECHANISM = &gss_spnego_mechanism_oid_desc;
*/
static gss_OID_desc gss_iakerb_proxy_mechanism_oid_desc =
-{7, (void *)"\x2b\x06\x01\x05\x05\x0a\x01"};
+{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x01")};
gss_OID GSS_IAKERB_PROXY_MECHANISM = &gss_iakerb_proxy_mechanism_oid_desc;
static gss_OID_desc gss_iakerb_min_msg_mechanism_oid_desc =
-{7, (void *)"\x2b\x06\x01\x05\x05\x0a\x02"};
+{7, rk_UNCONST("\x2b\x06\x01\x05\x05\x0a\x02") };
gss_OID GSS_IAKERB_MIN_MSG_MECHANISM = &gss_iakerb_min_msg_mechanism_oid_desc;
diff --git a/source4/heimdal/lib/hdb/hdb-protos.h b/source4/heimdal/lib/hdb/hdb-protos.h
index 799f013eba..56566b7fe4 100644
--- a/source4/heimdal/lib/hdb/hdb-protos.h
+++ b/source4/heimdal/lib/hdb/hdb-protos.h
@@ -8,6 +8,317 @@
extern "C" {
#endif
+unsigned
+HDBFlags2int (HDBFlags /*f*/);
+
+int
+copy_Event (
+ const Event */*from*/,
+ Event */*to*/);
+
+int
+copy_GENERATION (
+ const GENERATION */*from*/,
+ GENERATION */*to*/);
+
+int
+copy_HDBFlags (
+ const HDBFlags */*from*/,
+ HDBFlags */*to*/);
+
+int
+copy_HDB_Ext_Aliases (
+ const HDB_Ext_Aliases */*from*/,
+ HDB_Ext_Aliases */*to*/);
+
+int
+copy_HDB_Ext_Constrained_delegation_acl (
+ const HDB_Ext_Constrained_delegation_acl */*from*/,
+ HDB_Ext_Constrained_delegation_acl */*to*/);
+
+int
+copy_HDB_Ext_Lan_Manager_OWF (
+ const HDB_Ext_Lan_Manager_OWF */*from*/,
+ HDB_Ext_Lan_Manager_OWF */*to*/);
+
+int
+copy_HDB_Ext_PKINIT_acl (
+ const HDB_Ext_PKINIT_acl */*from*/,
+ HDB_Ext_PKINIT_acl */*to*/);
+
+int
+copy_HDB_Ext_PKINIT_certificate (
+ const HDB_Ext_PKINIT_certificate */*from*/,
+ HDB_Ext_PKINIT_certificate */*to*/);
+
+int
+copy_HDB_Ext_Password (
+ const HDB_Ext_Password */*from*/,
+ HDB_Ext_Password */*to*/);
+
+int
+copy_HDB_extension (
+ const HDB_extension */*from*/,
+ HDB_extension */*to*/);
+
+int
+copy_HDB_extensions (
+ const HDB_extensions */*from*/,
+ HDB_extensions */*to*/);
+
+int
+copy_Key (
+ const Key */*from*/,
+ Key */*to*/);
+
+int
+copy_Salt (
+ const Salt */*from*/,
+ Salt */*to*/);
+
+int
+copy_hdb_entry (
+ const hdb_entry */*from*/,
+ hdb_entry */*to*/);
+
+int
+decode_Event (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ Event */*data*/,
+ size_t */*size*/);
+
+int
+decode_GENERATION (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ GENERATION */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDBFlags (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDBFlags */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_Ext_Aliases (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_Ext_Aliases */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_Ext_Constrained_delegation_acl (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_Ext_Constrained_delegation_acl */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_Ext_Lan_Manager_OWF (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_Ext_Lan_Manager_OWF */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_Ext_PKINIT_acl (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_Ext_PKINIT_acl */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_Ext_PKINIT_certificate (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_Ext_PKINIT_certificate */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_Ext_Password (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_Ext_Password */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_extension (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_extension */*data*/,
+ size_t */*size*/);
+
+int
+decode_HDB_extensions (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ HDB_extensions */*data*/,
+ size_t */*size*/);
+
+int
+decode_Key (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ Key */*data*/,
+ size_t */*size*/);
+
+int
+decode_Salt (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ Salt */*data*/,
+ size_t */*size*/);
+
+int
+decode_hdb_entry (
+ const unsigned char */*p*/,
+ size_t /*len*/,
+ hdb_entry */*data*/,
+ size_t */*size*/);
+
+int
+encode_Event (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const Event */*data*/,
+ size_t */*size*/);
+
+int
+encode_GENERATION (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const GENERATION */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDBFlags (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDBFlags */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_Ext_Aliases (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_Ext_Aliases */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_Ext_Constrained_delegation_acl (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_Ext_Constrained_delegation_acl */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_Ext_Lan_Manager_OWF (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_Ext_Lan_Manager_OWF */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_Ext_PKINIT_acl (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_Ext_PKINIT_acl */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_Ext_PKINIT_certificate (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_Ext_PKINIT_certificate */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_Ext_Password (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_Ext_Password */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_extension (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_extension */*data*/,
+ size_t */*size*/);
+
+int
+encode_HDB_extensions (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const HDB_extensions */*data*/,
+ size_t */*size*/);
+
+int
+encode_Key (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const Key */*data*/,
+ size_t */*size*/);
+
+int
+encode_Salt (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const Salt */*data*/,
+ size_t */*size*/);
+
+int
+encode_hdb_entry (
+ unsigned char */*p*/,
+ size_t /*len*/,
+ const hdb_entry */*data*/,
+ size_t */*size*/);
+
+void
+free_Event (Event */*data*/);
+
+void
+free_GENERATION (GENERATION */*data*/);
+
+void
+free_HDBFlags (HDBFlags */*data*/);
+
+void
+free_HDB_Ext_Aliases (HDB_Ext_Aliases */*data*/);
+
+void
+free_HDB_Ext_Constrained_delegation_acl (HDB_Ext_Constrained_delegation_acl */*data*/);
+
+void
+free_HDB_Ext_Lan_Manager_OWF (HDB_Ext_Lan_Manager_OWF */*data*/);
+
+void
+free_HDB_Ext_PKINIT_acl (HDB_Ext_PKINIT_acl */*data*/);
+
+void
+free_HDB_Ext_PKINIT_certificate (HDB_Ext_PKINIT_certificate */*data*/);
+
+void
+free_HDB_Ext_Password (HDB_Ext_Password */*data*/);
+
+void
+free_HDB_extension (HDB_extension */*data*/);
+
+void
+free_HDB_extensions (HDB_extensions */*data*/);
+
+void
+free_Key (Key */*data*/);
+
+void
+free_Salt (Salt */*data*/);
+
+void
+free_hdb_entry (hdb_entry */*data*/);
+
krb5_error_code
hdb_add_master_key (
krb5_context /*context*/,
@@ -297,6 +608,54 @@ hdb_write_master_key (
const char */*filename*/,
hdb_master_key /*mkey*/);
+void
+initialize_hdb_error_table_r (struct et_list **/*list*/);
+
+HDBFlags
+int2HDBFlags (unsigned /*n*/);
+
+size_t
+length_Event (const Event */*data*/);
+
+size_t
+length_GENERATION (const GENERATION */*data*/);
+
+size_t
+length_HDBFlags (const HDBFlags */*data*/);
+
+size_t
+length_HDB_Ext_Aliases (const HDB_Ext_Aliases */*data*/);
+
+size_t
+length_HDB_Ext_Constrained_delegation_acl (const HDB_Ext_Constrained_delegation_acl */*data*/);
+
+size_t
+length_HDB_Ext_Lan_Manager_OWF (const HDB_Ext_Lan_Manager_OWF */*data*/);
+
+size_t
+length_HDB_Ext_PKINIT_acl (const HDB_Ext_PKINIT_acl */*data*/);
+
+size_t
+length_HDB_Ext_PKINIT_certificate (const HDB_Ext_PKINIT_certificate */*data*/);
+
+size_t
+length_HDB_Ext_Password (const HDB_Ext_Password */*data*/);
+
+size_t
+length_HDB_extension (const HDB_extension */*data*/);
+
+size_t
+length_HDB_extensions (const HDB_extensions */*data*/);
+
+size_t
+length_Key (const Key */*data*/);
+
+size_t
+length_Salt (const Salt */*data*/);
+
+size_t
+length_hdb_entry (const hdb_entry */*data*/);
+
#ifdef __cplusplus
}
#endif
diff --git a/source4/heimdal/lib/hdb/hdb.c b/source4/heimdal/lib/hdb/hdb.c
index 53c952927f..8233eb6ac7 100644
--- a/source4/heimdal/lib/hdb/hdb.c
+++ b/source4/heimdal/lib/hdb/hdb.c
@@ -33,7 +33,7 @@
#include "hdb_locl.h"
-RCSID("$Id: hdb.c,v 1.54 2005/05/29 18:12:28 lha Exp $");
+RCSID("$Id: hdb.c,v 1.55 2005/08/19 13:07:03 lha Exp $");
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
@@ -174,9 +174,14 @@ hdb_check_db_format(krb5_context context, HDB *db)
unsigned ver;
int foo;
+ ret = db->hdb_lock(context, db, HDB_RLOCK);
+ if (ret)
+ return ret;
+
tag.data = HDB_DB_FORMAT_ENTRY;
tag.length = strlen(tag.data);
ret = (*db->hdb__get)(context, db, tag, &version);
+ db->hdb_unlock(context, db);
if(ret)
return ret;
foo = sscanf(version.data, "%u", &ver);
@@ -200,12 +205,19 @@ hdb_init_db(krb5_context context, HDB *db)
if(ret != HDB_ERR_NOENTRY)
return ret;
+ ret = db->hdb_lock(context, db, HDB_WLOCK);
+ if (ret)
+ return ret;
+
tag.data = HDB_DB_FORMAT_ENTRY;
tag.length = strlen(tag.data);
snprintf(ver, sizeof(ver), "%u", HDB_DB_FORMAT);
version.data = ver;
version.length = strlen(version.data) + 1; /* zero terminated */
ret = (*db->hdb__put)(context, db, 0, tag, version);
+ ret = db->hdb_unlock(context, db);
+ if (ret)
+ return ret;
return ret;
}
diff --git a/source4/heimdal/lib/hdb/mkey.c b/source4/heimdal/lib/hdb/mkey.c
index 9e04dc6d8d..f12f73e809 100644
--- a/source4/heimdal/lib/hdb/mkey.c
+++ b/source4/heimdal/lib/hdb/mkey.c
@@ -36,7 +36,7 @@
#define O_BINARY 0
#endif
-RCSID("$Id: mkey.c,v 1.20 2005/08/10 08:41:03 lha Exp $");
+RCSID("$Id: mkey.c,v 1.21 2005/08/19 13:07:03 lha Exp $");
struct hdb_master_key_data {
krb5_keytab_entry keytab;
@@ -486,6 +486,9 @@ hdb_seal_key_mkey(krb5_context context, Key *k, hdb_master_key mkey)
krb5_data res;
hdb_master_key key;
+ if(k->mkvno != NULL)
+ return 0;
+
key = _hdb_find_master_key(k->mkvno, mkey);
if (key == NULL)
diff --git a/source4/heimdal/lib/krb5/get_host_realm.c b/source4/heimdal/lib/krb5/get_host_realm.c
index d9c5bd5dc1..feb01f0036 100644
--- a/source4/heimdal/lib/krb5/get_host_realm.c
+++ b/source4/heimdal/lib/krb5/get_host_realm.c
@@ -34,7 +34,7 @@
#include "krb5_locl.h"
#include <resolve.h>
-RCSID("$Id: get_host_realm.c,v 1.34 2005/04/19 18:52:51 lha Exp $");
+RCSID("$Id: get_host_realm.c,v 1.35 2005/08/23 08:14:02 lha Exp $");
/* To automagically find the correct realm of a host (without
* [domain_realm] in krb5.conf) add a text record for your domain with
@@ -94,30 +94,41 @@ dns_find_realm(krb5_context context,
const char *domain,
krb5_realm **realms)
{
- static char *default_labels[] = { "_kerberos", NULL };
+ static const char *default_labels[] = { "_kerberos", NULL };
char dom[MAXHOSTNAMELEN];
struct dns_reply *r;
- char **labels;
+ const char **labels;
+ char **config_labels;
int i, ret;
- labels = krb5_config_get_strings(context, NULL, "libdefaults",
- "dns_lookup_realm_labels", NULL);
- if(labels == NULL)
+ config_labels = krb5_config_get_strings(context, NULL, "libdefaults",
+ "dns_lookup_realm_labels", NULL);
+ if(config_labels != NULL)
+ labels = (const char **)config_labels;
+ else
labels = default_labels;
if(*domain == '.')
domain++;
for (i = 0; labels[i] != NULL; i++) {
ret = snprintf(dom, sizeof(dom), "%s.%s.", labels[i], domain);
- if(ret < 0 || ret >= sizeof(dom))
+ if(ret < 0 || ret >= sizeof(dom)) {
+ if (config_labels)
+ krb5_config_free_strings(config_labels);
return -1;
+ }
r = dns_lookup(dom, "TXT");
if(r != NULL) {
ret = copy_txt_to_realms (r->head, realms);
dns_free_data(r);
- if(ret == 0)
+ if(ret == 0) {
+ if (config_labels)
+ krb5_config_free_strings(config_labels);
return 0;
+ }
}
}
+ if (config_labels)
+ krb5_config_free_strings(config_labels);
return -1;
}
diff --git a/source4/heimdal/lib/krb5/krb5-private.h b/source4/heimdal/lib/krb5/krb5-private.h
index e70527845b..8e2ebcf43e 100644
--- a/source4/heimdal/lib/krb5/krb5-private.h
+++ b/source4/heimdal/lib/krb5/krb5-private.h
@@ -309,6 +309,7 @@ _krb5_pk_rd_pa_reply (
void */*c*/,
krb5_enctype /*etype*/,
unsigned /*nonce*/,
+ const krb5_data */*req_buffer*/,
PA_DATA */*pa*/,
krb5_keyblock **/*key*/);
diff --git a/source4/heimdal/lib/krb5/krb5-protos.h b/source4/heimdal/lib/krb5/krb5-protos.h
index 2750c8b5d2..711c5ead6e 100644
--- a/source4/heimdal/lib/krb5/krb5-protos.h
+++ b/source4/heimdal/lib/krb5/krb5-protos.h
@@ -20,6 +20,15 @@ extern "C" {
#endif
#endif
+void
+initialize_heim_error_table_r (struct et_list **/*list*/);
+
+void
+initialize_k524_error_table_r (struct et_list **/*list*/);
+
+void
+initialize_krb5_error_table_r (struct et_list **/*list*/);
+
krb5_error_code KRB5_LIB_FUNCTION
krb524_convert_creds_kdc (
krb5_context /*context*/,
@@ -2392,7 +2401,7 @@ krb5_prepend_config_files_default (
const char */*filelist*/,
char ***/*pfilenames*/);
-krb5_realm*
+krb5_realm* KRB5_LIB_FUNCTION
krb5_princ_realm (
krb5_context /*context*/,
krb5_principal /*principal*/);
@@ -2418,18 +2427,18 @@ krb5_principal_compare_any_realm (
const char* KRB5_LIB_FUNCTION
krb5_principal_get_comp_string (
krb5_context /*context*/,
- krb5_principal /*principal*/,
+ krb5_const_principal /*principal*/,
unsigned int /*component*/);
const char* KRB5_LIB_FUNCTION
krb5_principal_get_realm (
krb5_context /*context*/,
- krb5_principal /*principal*/);
+ krb5_const_principal /*principal*/);
int KRB5_LIB_FUNCTION
krb5_principal_get_type (
krb5_context /*context*/,
- krb5_principal /*principal*/);
+ krb5_const_principal /*principal*/);
krb5_boolean KRB5_LIB_FUNCTION
krb5_principal_match (
@@ -3155,6 +3164,12 @@ krb5_unparse_name (
char **/*name*/);
krb5_error_code KRB5_LIB_FUNCTION
+krb5_unparse_name_always_short (
+ krb5_context /*context*/,
+ krb5_const_principal /*principal*/,
+ char **/*name*/);
+
+krb5_error_code KRB5_LIB_FUNCTION
krb5_unparse_name_fixed (
krb5_context /*context*/,
krb5_const_principal /*principal*/,
diff --git a/source4/heimdal/lib/krb5/principal.c b/source4/heimdal/lib/krb5/principal.c
index b510478f65..74db080ab7 100644
--- a/source4/heimdal/lib/krb5/principal.c
+++ b/source4/heimdal/lib/krb5/principal.c
@@ -41,7 +41,7 @@
#include <fnmatch.h>
#include "resolve.h"
-RCSID("$Id: principal.c,v 1.90 2005/06/30 01:38:15 lha Exp $");
+RCSID("$Id: principal.c,v 1.91 2005/08/23 08:34:40 lha Exp $");
#define princ_num_comp(P) ((P)->name.name_string.len)
#define princ_type(P) ((P)->name.name_type)
@@ -69,21 +69,21 @@ krb5_principal_set_type(krb5_context context,
int KRB5_LIB_FUNCTION
krb5_principal_get_type(krb5_context context,
- krb5_principal principal)
+ krb5_const_principal principal)
{
return princ_type(principal);
}
const char* KRB5_LIB_FUNCTION
krb5_principal_get_realm(krb5_context context,
- krb5_principal principal)
+ krb5_const_principal principal)
{
return princ_realm(principal);
}
const char* KRB5_LIB_FUNCTION
krb5_principal_get_comp_string(krb5_context context,
- krb5_principal principal,
+ krb5_const_principal principal,
unsigned int component)
{
if(component >= princ_num_comp(principal))
@@ -268,16 +268,6 @@ unparse_name_fixed(krb5_context context,
return ERANGE;
}
/* add realm if different from default realm */
- if(short_form) {
- krb5_realm r;
- krb5_error_code ret;
- ret = krb5_get_default_realm(context, &r);
- if(ret)
- return ret;
- if(strcmp(princ_realm(principal), r) != 0)
- short_form = 0;
- free(r);
- }
if(!short_form) {
add_char(name, idx, len, '@');
idx = quote_string(princ_realm(principal), name, idx, len);
@@ -297,12 +287,30 @@ krb5_unparse_name_fixed(krb5_context context,
}
krb5_error_code KRB5_LIB_FUNCTION
+krb5_unparse_name_norealm_fixed(krb5_context context,
+ krb5_const_principal principal,
+ char *name,
+ size_t len)
+{
+ return unparse_name_fixed(context, principal, name, len, TRUE);
+}
+
+krb5_error_code KRB5_LIB_FUNCTION
krb5_unparse_name_fixed_short(krb5_context context,
krb5_const_principal principal,
char *name,
size_t len)
{
- return unparse_name_fixed(context, principal, name, len, TRUE);
+ krb5_realm r;
+ krb5_error_code ret;
+ krb5_boolean short_form = TRUE;
+ ret = krb5_get_default_realm(context, &r);
+ if(ret)
+ return ret;
+ if(strcmp(princ_realm(principal), r) != 0)
+ short_form = 0;
+ free(r);
+ return unparse_name_fixed(context, principal, name, len, short_form);
}
static krb5_error_code
@@ -356,6 +364,23 @@ krb5_unparse_name_short(krb5_context context,
krb5_const_principal principal,
char **name)
{
+ krb5_realm r;
+ krb5_error_code ret;
+ krb5_boolean short_form = TRUE;
+ ret = krb5_get_default_realm(context, &r);
+ if(ret)
+ return ret;
+ if(strcmp(princ_realm(principal), r) != 0)
+ short_form = 0;
+ free(r);
+ return unparse_name(context, principal, name, short_form);
+}
+
+krb5_error_code KRB5_LIB_FUNCTION
+krb5_unparse_name_norealm(krb5_context context,
+ krb5_const_principal principal,
+ char **name)
+{
return unparse_name(context, principal, name, TRUE);
}
@@ -372,7 +397,7 @@ krb5_unparse_name_ext(krb5_context context,
#endif
-krb5_realm*
+krb5_realm* KRB5_LIB_FUNCTION
krb5_princ_realm(krb5_context context,
krb5_principal principal)
{
@@ -380,6 +405,7 @@ krb5_princ_realm(krb5_context context,
}
+
void KRB5_LIB_FUNCTION
krb5_princ_set_realm(krb5_context context,
krb5_principal principal,
@@ -764,7 +790,6 @@ krb5_425_conv_principal_ext2(krb5_context context,
}
#else
struct addrinfo hints, *ai;
- int ret;
memset (&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
diff --git a/source4/heimdal/lib/roken/resolve.c b/source4/heimdal/lib/roken/resolve.c
index 46a1e4de71..d035982077 100644
--- a/source4/heimdal/lib/roken/resolve.c
+++ b/source4/heimdal/lib/roken/resolve.c
@@ -45,7 +45,7 @@
#include <assert.h>
-RCSID("$Id: resolve.c,v 1.51 2005/06/16 16:46:16 lha Exp $");
+RCSID("$Id: resolve.c,v 1.52 2005/08/22 19:16:21 lha Exp $");
#ifdef _AIX /* AIX have broken res_nsearch() in 5.1 (5.0 also ?) */
#undef HAVE_RES_NSEARCH
@@ -534,8 +534,12 @@ dns_lookup_int(const char *domain, int rr_class, int rr_type)
}
if (len < 0) {
#ifdef HAVE_RES_NSEARCH
+#ifdef HAVE_RES_NDESTROY
+ res_ndestroy(&state);
+#else
res_nclose(&state);
#endif
+#endif
free(reply);
return NULL;
}
diff --git a/source4/heimdal/lib/roken/setprogname.c b/source4/heimdal/lib/roken/setprogname.c
index 9c4210da9b..315fa52e50 100644
--- a/source4/heimdal/lib/roken/setprogname.c
+++ b/source4/heimdal/lib/roken/setprogname.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: setprogname.c,v 1.3 2005/04/12 11:29:05 lha Exp $");
+RCSID("$Id: setprogname.c,v 1.4 2005/08/23 10:19:20 lha Exp $");
#endif
#include "roken.h"
@@ -47,12 +47,12 @@ void ROKEN_LIB_FUNCTION
setprogname(const char *argv0)
{
#ifndef HAVE___PROGNAME
- char *p;
+ const char *p;
if(argv0 == NULL)
return;
p = strrchr(argv0, '/');
if(p == NULL)
- p = (char *)argv0;
+ p = argv0;
else
p++;
__progname = p;
diff --git a/source4/heimdal/lib/roken/strpool.c b/source4/heimdal/lib/roken/strpool.c
index 8ee95654cb..cf9997af9d 100644
--- a/source4/heimdal/lib/roken/strpool.c
+++ b/source4/heimdal/lib/roken/strpool.c
@@ -33,7 +33,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: strpool.c,v 1.1 2005/06/28 22:46:57 lha Exp $");
+RCSID("$Id: strpool.c,v 1.2 2005/08/25 14:59:06 lha Exp $");
#endif
#include <stdarg.h>
@@ -81,19 +81,18 @@ rk_strpoolprintf(struct rk_strpool *p, const char *fmt, ...)
len = vasprintf(&str, fmt, ap);
va_end(ap);
if (str == NULL) {
- printf("vasprintf");
rk_strpoolfree(p);
return NULL;
}
str2 = realloc(p->str, len + p->len + 1);
if (str2 == NULL) {
- printf("realloc");
rk_strpoolfree(p);
return NULL;
}
p->str = str2;
memcpy(p->str + p->len, str, len + 1);
p->len += len;
+ free(str);
return p;
}
diff --git a/source4/heimdal/lib/roken/print_version.c b/source4/heimdal/lib/vers/print_version.c
index 9d678056b5..92c709b494 100644
--- a/source4/heimdal/lib/roken/print_version.c
+++ b/source4/heimdal/lib/vers/print_version.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1998 - 2004 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,46 +33,23 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: print_version.c,v 1.9 2005/04/12 11:29:00 lha Exp $");
+RCSID("$Id: print_version.c,v 1.9 2005/01/01 14:27:47 lha Exp $");
#endif
#include "roken.h"
#include "print_version.h"
-void ROKEN_LIB_FUNCTION
+void
print_version(const char *progname)
{
- const char *arg[] = VERSIONLIST;
- const int num_args = sizeof(arg) / sizeof(arg[0]);
- char *msg;
- size_t len = 0;
- int i;
+ const char *package_list = VERSIONLIST;
if(progname == NULL)
progname = getprogname();
- if(num_args == 0)
- msg = "no version information";
- else {
- for(i = 0; i < num_args; i++) {
- if(i > 0)
- len += 2;
- len += strlen(arg[i]);
- }
- msg = malloc(len + 1);
- if(msg == NULL) {
- fprintf(stderr, "%s: out of memory\n", progname);
- return;
- }
- msg[0] = '\0';
- for(i = 0; i < num_args; i++) {
- if(i > 0)
- strcat(msg, ", ");
- strcat(msg, arg[i]);
- }
- }
- fprintf(stderr, "%s (%s)\n", progname, msg);
- fprintf(stderr, "Copyright (c) 1999 - 2001 Kungliga Tekniska Högskolan\n");
- if(num_args != 0)
- free(msg);
+ if(*package_list == '\0')
+ package_list = "no version information";
+ fprintf(stderr, "%s (%s)\n", progname, package_list);
+ fprintf(stderr, "Copyright 1999-2005 Kungliga Tekniska Högskolan\n");
+ fprintf(stderr, "Send bug-reports to %s\n", PACKAGE_BUGREPORT);
}