diff options
author | John Carr <jfc@mit.edu> | 1992-08-21 03:08:26 +0000 |
---|---|---|
committer | John Carr <jfc@mit.edu> | 1992-08-21 03:08:26 +0000 |
commit | ddf4d9cc473eb8728d753e5d7fdd815aa8f069bd (patch) | |
tree | 43ceb175f56f0a8e99ca72c0d122aa1e6382fde7 /src/lib/krb5/asn.1 | |
parent | 7dd84612afc80ee4de8fc8b996ef8c55a0d0f216 (diff) | |
download | krb5-ddf4d9cc473eb8728d753e5d7fdd815aa8f069bd.tar.gz krb5-ddf4d9cc473eb8728d753e5d7fdd815aa8f069bd.tar.xz krb5-ddf4d9cc473eb8728d753e5d7fdd815aa8f069bd.zip |
Principal type changes
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2355 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/asn.1')
-rw-r--r-- | src/lib/krb5/asn.1/kauth2auth.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/kekrp2ekrp.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/kerr2err.c | 4 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/ketpt2etpt.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/kkdcr2kdcr.c | 4 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/kprin2prin.c | 6 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/ktgrq2tgrq.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/ktkt2tkt.c | 2 | ||||
-rw-r--r-- | src/lib/krb5/asn.1/prin2kprin.c | 50 |
9 files changed, 49 insertions, 25 deletions
diff --git a/src/lib/krb5/asn.1/kauth2auth.c b/src/lib/krb5/asn.1/kauth2auth.c index 69dc2e5c2..5bf7e1521 100644 --- a/src/lib/krb5/asn.1/kauth2auth.c +++ b/src/lib/krb5/asn.1/kauth2auth.c @@ -56,7 +56,7 @@ register int *error; xbzero(retval, sizeof(*retval)); retval->authenticator__vno = KRB5_PVNO; - retval->crealm = krb5_data2qbuf(val->client[0]); + retval->crealm = krb5_data2qbuf(krb5_princ_realm(val->client)); if (!retval->crealm) { *error = ENOMEM; errout: diff --git a/src/lib/krb5/asn.1/kekrp2ekrp.c b/src/lib/krb5/asn.1/kekrp2ekrp.c index edfea3ee3..833313777 100644 --- a/src/lib/krb5/asn.1/kekrp2ekrp.c +++ b/src/lib/krb5/asn.1/kekrp2ekrp.c @@ -97,7 +97,7 @@ register int *error; goto errout; } } - retval->srealm = krb5_data2qbuf(val->server[0]); + retval->srealm = krb5_data2qbuf(krb5_princ_realm(val->server)); if (!retval->srealm) { *error = ENOMEM; goto errout; diff --git a/src/lib/krb5/asn.1/kerr2err.c b/src/lib/krb5/asn.1/kerr2err.c index 12ec65b91..f1a4572a0 100644 --- a/src/lib/krb5/asn.1/kerr2err.c +++ b/src/lib/krb5/asn.1/kerr2err.c @@ -80,7 +80,7 @@ register int *error; retval->error__code = val->error; if (val->client) { - retval->crealm = krb5_data2qbuf(val->client[0]); + retval->crealm = krb5_data2qbuf(krb5_princ_realm(val->client)); if (!retval->crealm) { *error = ENOMEM; goto errout; @@ -93,7 +93,7 @@ register int *error; /* server is technically not optional, but... */ if (val->server) { - retval->realm = krb5_data2qbuf(val->server[0]); + retval->realm = krb5_data2qbuf(krb5_princ_realm(val->server)); if (!retval->realm) { *error = ENOMEM; goto errout; diff --git a/src/lib/krb5/asn.1/ketpt2etpt.c b/src/lib/krb5/asn.1/ketpt2etpt.c index 690412d0d..876baa4bc 100644 --- a/src/lib/krb5/asn.1/ketpt2etpt.c +++ b/src/lib/krb5/asn.1/ketpt2etpt.c @@ -62,7 +62,7 @@ register int *error; free_KRB5_EncTicketPart(retval); return(0); } - retval->crealm = krb5_data2qbuf(val->client[0]); + retval->crealm = krb5_data2qbuf(krb5_princ_realm(val->client)); if (!retval->crealm) { *error = ENOMEM; goto errout; diff --git a/src/lib/krb5/asn.1/kkdcr2kdcr.c b/src/lib/krb5/asn.1/kkdcr2kdcr.c index c2ffbc38c..ef80313c5 100644 --- a/src/lib/krb5/asn.1/kkdcr2kdcr.c +++ b/src/lib/krb5/asn.1/kkdcr2kdcr.c @@ -38,8 +38,6 @@ static char rcsid_kkdcr2kdcr_c[] = #include <krb5/ext-proto.h> -/* ISODE defines max(a,b) */ - struct type_KRB5_TGS__REP * krb5_kdc_rep2KRB5_KDC__REP(DECLARG(const register krb5_kdc_rep *,val), DECLARG(register int *,error)) @@ -65,7 +63,7 @@ OLDDECLARG(register int *,error) } } - retval->crealm = krb5_data2qbuf(val->client[0]); + retval->crealm = krb5_data2qbuf(krb5_princ_realm(val->client)); if (!retval->crealm) { *error = ENOMEM; errout: diff --git a/src/lib/krb5/asn.1/kprin2prin.c b/src/lib/krb5/asn.1/kprin2prin.c index c2c6dc759..585d09e41 100644 --- a/src/lib/krb5/asn.1/kprin2prin.c +++ b/src/lib/krb5/asn.1/kprin2prin.c @@ -80,9 +80,11 @@ register int *error; #endif register struct type_KRB5_PrincipalName *retval = 0, *rv1 = 0, *rv2; register int i; + int nelem = krb5_princ_size(val); + /* still skipping realm */ - for (i = 1; val[i]; i++, rv1 = rv2) { + for (i = 0; i < nelem; i++, rv1 = rv2) { rv2 = (struct type_KRB5_PrincipalName *) xmalloc(sizeof(*rv2)); if (!rv2) { if (retval) @@ -96,7 +98,7 @@ register int *error; if (!retval) retval = rv2; - rv2->GeneralString = krb5_data2qbuf(val[i]); + rv2->GeneralString = krb5_data2qbuf(krb5_princ_component(val, i)); if (!rv2->GeneralString) { /* clean up */ if (retval) diff --git a/src/lib/krb5/asn.1/ktgrq2tgrq.c b/src/lib/krb5/asn.1/ktgrq2tgrq.c index 8663097ce..31e6a7b9a 100644 --- a/src/lib/krb5/asn.1/ktgrq2tgrq.c +++ b/src/lib/krb5/asn.1/ktgrq2tgrq.c @@ -71,7 +71,7 @@ register int *error; goto errout; } } - retval->realm = krb5_data2qbuf(val->server[0]); + retval->realm = krb5_data2qbuf(krb5_princ_realm(val->server)); if (!retval->realm) { *error = ENOMEM; goto errout; diff --git a/src/lib/krb5/asn.1/ktkt2tkt.c b/src/lib/krb5/asn.1/ktkt2tkt.c index ef34e6baa..833facd2e 100644 --- a/src/lib/krb5/asn.1/ktkt2tkt.c +++ b/src/lib/krb5/asn.1/ktkt2tkt.c @@ -56,7 +56,7 @@ register int *error; xbzero(retval, sizeof(*retval)); retval->tkt__vno = KRB5_PVNO; - retval->realm = krb5_data2qbuf(val->server[0]); + retval->realm = krb5_data2qbuf(krb5_princ_realm(val->server)); if (!retval->realm) { *error = ENOMEM; errout: diff --git a/src/lib/krb5/asn.1/prin2kprin.c b/src/lib/krb5/asn.1/prin2kprin.c index f9cb20024..36701d7ba 100644 --- a/src/lib/krb5/asn.1/prin2kprin.c +++ b/src/lib/krb5/asn.1/prin2kprin.c @@ -39,7 +39,23 @@ static char rcsid_prin2kprin_c[] = #include <krb5/ext-proto.h> -/* ISODE defines max(a,b) */ +static int qbuf_to_data(val, data) +register const struct qbuf *val; +krb5_data *data; +{ + int length; + if (qb_pullup(val) != OK) + return 1; + if ((length = val->qb_forw->qb_len) > 0) { + data->data = malloc(length); + memcpy(data->data, val->qb_forw->qb_data, length); + } else { + data->data = 0; + } + data->length = length; + return 0; +} + krb5_principal KRB5_PrincipalName2krb5_principal(val, realm, error) @@ -85,26 +101,34 @@ register int *error; for (i = 1, rv = val; rv->next; i++, rv = rv->next) ; - /* plus one for the realm, plus one for null term */ - retval = (krb5_principal) xcalloc(i + 2, sizeof(krb5_data *)); - + retval = (krb5_principal) malloc(sizeof(krb5_principal_data)); + if (!retval) { *error = ENOMEM; return(0); } + /* plus one for the realm */ + retval->length = i; + retval->data = (krb5_data *)malloc(i * sizeof(krb5_data)); + if (retval->data == 0) { + xfree(retval); + *error = ENOMEM; + return 0; + } - retval[0] = qbuf2krb5_data(realm, error); - if (!retval[0]) { + if (qbuf_to_data(realm, krb5_princ_realm(retval))) { + xfree(retval->data); xfree(retval); - return(0); + *error = ENOMEM; + return 0; } - for (i = 1, rv = val; rv; rv = rv->next, i++) { - retval[i] = qbuf2krb5_data(rv->GeneralString, error); - if (!retval[i]) { - krb5_free_principal(retval); + + for (i = 0, rv = val; rv; rv = rv->next, i++) + if (qbuf_to_data(rv->GeneralString, krb5_princ_component(retval, i))) { + while (--i >= 0) + free(krb5_princ_component(retval, i)->data); + *error = ENOMEM; return(0); } - } - retval[i] = 0; return(retval); } |