now, kinit and klist seems to work

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@845 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1996-10-14 02:51:14 +00:00
parent b55aed018f
commit f048b264d9
8 changed files with 74 additions and 14 deletions

View File

@@ -25,7 +25,7 @@ FOO_HDRS = lex.h parse.h hash.h symbol.h gen.h
PROG = foo
ASN1_SRCS = der_get.c der_put.c
ASN1_OBJS = der_get.o der_put.o foo.o
ASN1_OBJS = foo.o der_get.o der_put.o
ASN1_HDRS =
.c.o:
@@ -45,7 +45,7 @@ foo: $(FOO_OBJS)
libasn1.a: $(ASN1_OBJS)
ar cr $@ $(ASN1_OBJS)
foo.c foo.h: k5.asn1
foo.c foo.h: k5.asn1 foo
./foo $(srcdir)/k5.asn1
parse.h: parse.c

View File

@@ -379,6 +379,25 @@ decode_type (char *name, Type *t)
decode_primitive ("octet_string", name);
break;
case TBitString:
/* XXX */
fprintf (codefile,
"l = der_match_tag (p, len, UNIV, PRIM, UT_BitString);\n"
"if(l < 0)\n"
"return l;\n"
"p += l;\n"
"len -= l;\n"
"ret += l;\n"
"l = der_get_length (p, len, &reallen);\n"
"if(l < 0)\n"
"return l;\n"
"p += l;\n"
"len -= l;\n"
"ret += l;\n"
"if(len < reallen)\n"
"return -1;\n"
"p += reallen;\n"
"len -= reallen;\n"
"ret += reallen;\n");
break;
case TSequence: {
Member *m;
@@ -427,13 +446,21 @@ decode_type (char *name, Type *t)
"return -1;\n"
"oldlen = len;\n"
"len = newlen;\n");
if (m->optional)
fprintf (codefile,
"%s = malloc(sizeof(*%s));\n",
s, s);
decode_type (s, m->type);
fprintf (codefile,
"len = oldlen - newlen;\n"
"}\n");
if (!m->optional)
"}\n"
"else {\n");
if(m->optional)
fprintf (codefile,
"%s = NULL;\n"
"}\n", s);
else
fprintf (codefile,
"else {\n"
"return l;\n"
"}\n");
fprintf (codefile,

View File

@@ -224,7 +224,8 @@ ret_principal(int fd,
p = ALLOC(1, krb5_principal_data);
ret_int32(fd, &p->type);
if(ret_int32(fd, &p->type))
return -1;
ret_int32(fd, &p->ncomp);
ret_data(fd, &p->realm);
p->comp = ALLOC(p->ncomp, krb5_data);

View File

@@ -179,7 +179,7 @@ krb5_get_in_tkt(krb5_context context,
if (err) {
return err;
}
if(decode_AS_REP(resp.data, resp.length, &rep) < 0)
if(decode_AS_REP(resp.data, resp.length, &rep.part1) < 0)
return ASN1_PARSE_ERROR;
free (rep.part1.crealm);
@@ -213,6 +213,8 @@ krb5_get_in_tkt(krb5_context context,
decrypt_proc = decrypt_tkt;
err = (*decrypt_proc)(context, key, decryptarg, &rep);
if (err)
return err;
memset (key->contents.data, 0, key->contents.length);
krb5_data_free (&key->contents);
free (key);

View File

@@ -25,7 +25,7 @@ FOO_HDRS = lex.h parse.h hash.h symbol.h gen.h
PROG = foo
ASN1_SRCS = der_get.c der_put.c
ASN1_OBJS = der_get.o der_put.o foo.o
ASN1_OBJS = foo.o der_get.o der_put.o
ASN1_HDRS =
.c.o:
@@ -45,7 +45,7 @@ foo: $(FOO_OBJS)
libasn1.a: $(ASN1_OBJS)
ar cr $@ $(ASN1_OBJS)
foo.c foo.h: k5.asn1
foo.c foo.h: k5.asn1 foo
./foo $(srcdir)/k5.asn1
parse.h: parse.c

View File

@@ -379,6 +379,25 @@ decode_type (char *name, Type *t)
decode_primitive ("octet_string", name);
break;
case TBitString:
/* XXX */
fprintf (codefile,
"l = der_match_tag (p, len, UNIV, PRIM, UT_BitString);\n"
"if(l < 0)\n"
"return l;\n"
"p += l;\n"
"len -= l;\n"
"ret += l;\n"
"l = der_get_length (p, len, &reallen);\n"
"if(l < 0)\n"
"return l;\n"
"p += l;\n"
"len -= l;\n"
"ret += l;\n"
"if(len < reallen)\n"
"return -1;\n"
"p += reallen;\n"
"len -= reallen;\n"
"ret += reallen;\n");
break;
case TSequence: {
Member *m;
@@ -427,13 +446,21 @@ decode_type (char *name, Type *t)
"return -1;\n"
"oldlen = len;\n"
"len = newlen;\n");
if (m->optional)
fprintf (codefile,
"%s = malloc(sizeof(*%s));\n",
s, s);
decode_type (s, m->type);
fprintf (codefile,
"len = oldlen - newlen;\n"
"}\n");
if (!m->optional)
"}\n"
"else {\n");
if(m->optional)
fprintf (codefile,
"%s = NULL;\n"
"}\n", s);
else
fprintf (codefile,
"else {\n"
"return l;\n"
"}\n");
fprintf (codefile,

View File

@@ -224,7 +224,8 @@ ret_principal(int fd,
p = ALLOC(1, krb5_principal_data);
ret_int32(fd, &p->type);
if(ret_int32(fd, &p->type))
return -1;
ret_int32(fd, &p->ncomp);
ret_data(fd, &p->realm);
p->comp = ALLOC(p->ncomp, krb5_data);

View File

@@ -179,7 +179,7 @@ krb5_get_in_tkt(krb5_context context,
if (err) {
return err;
}
if(decode_AS_REP(resp.data, resp.length, &rep) < 0)
if(decode_AS_REP(resp.data, resp.length, &rep.part1) < 0)
return ASN1_PARSE_ERROR;
free (rep.part1.crealm);
@@ -213,6 +213,8 @@ krb5_get_in_tkt(krb5_context context,
decrypt_proc = decrypt_tkt;
err = (*decrypt_proc)(context, key, decryptarg, &rep);
if (err)
return err;
memset (key->contents.data, 0, key->contents.length);
krb5_data_free (&key->contents);
free (key);