changes for draft 3 ASN.1 definitions
authorJohn Kohl <jtkohl@mit.edu>
Tue, 9 Oct 1990 16:46:48 +0000 (16:46 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 9 Oct 1990 16:46:48 +0000 (16:46 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1175 dc483132-0cff-0310-8789-dd5450dbe970

17 files changed:
src/lib/krb5/asn.1/ekrp2kekrp.c
src/lib/krb5/asn.1/enck2kkey.c
src/lib/krb5/asn.1/err2kerr.c
src/lib/krb5/asn.1/kaprp2aprp.c
src/lib/krb5/asn.1/kdcr2kkdcr.c
src/lib/krb5/asn.1/kekrp2ekrp.c
src/lib/krb5/asn.1/kerr2err.c
src/lib/krb5/asn.1/kkdcr2kdcr.c
src/lib/krb5/asn.1/kkey2enck.c
src/lib/krb5/asn.1/klsrq2lsrq.c
src/lib/krb5/asn.1/kpriv2priv.c
src/lib/krb5/asn.1/ktgrq2tgrq.c
src/lib/krb5/asn.1/ktkt2tkt.c
src/lib/krb5/asn.1/lsrq2klsrq.c
src/lib/krb5/asn.1/priv2kpriv.c
src/lib/krb5/asn.1/tgrq2ktgrq.c
src/lib/krb5/asn.1/tkt2ktkt.c

index d3f4322308ecd85f455163d998dcff0f1f3621d3..65474dc80b6144e0607a4c332d43863de628c235 100644 (file)
@@ -29,8 +29,8 @@ static char rcsid_ekrp2kekrp_c[] =
 /* ISODE defines max(a,b) */
 
 krb5_enc_kdc_rep_part *
-KRB5_EncKDCRepPart2krb5_enc_kdc_rep_part(val, error)
-const register struct type_KRB5_EncKDCRepPart *val;
+KRB5_EncTGSRepPart2krb5_enc_kdc_rep_part(val, error)
+const register struct type_KRB5_EncTGSRepPart *val;
 register int *error;
 {
     register krb5_enc_kdc_rep_part *retval;
@@ -42,7 +42,6 @@ register int *error;
     }
     xbzero(retval, sizeof(*retval));
 
-    retval->confounder = val->confounder;
     retval->session = KRB5_EncryptionKey2krb5_keyblock(val->key, error);
     if (!retval->session) {
        xfree(retval);
@@ -56,15 +55,14 @@ register int *error;
        return(0);
     }
 
-    retval->ctime = gentime2unix(val->ctime, error);
-    if (*error) {
-       goto errout;
-    }
-    retval->key_exp = gentime2unix(val->key__exp, error);
-    if (*error) {
-       goto errout;
-    }
+    retval->nonce = val->nonce;
 
+    if (val->key__expiration) {
+       retval->key_exp = gentime2unix(val->key__expiration, error);
+       if (*error) {
+           goto errout;
+       }
+    }
     retval->flags = KRB5_TicketFlags2krb5_flags(val->flags, error);
     if (*error) {
        goto errout;
@@ -73,9 +71,11 @@ register int *error;
     if (*error) {
        goto errout;
     }
-    retval->times.starttime = gentime2unix(val->starttime, error);
-    if (*error) {
-       goto errout;
+    if (val->starttime) {
+       retval->times.starttime = gentime2unix(val->starttime, error);
+       if (*error) {
+           goto errout;
+       }
     }
     retval->times.endtime = gentime2unix(val->endtime, error);
     if (retval->flags & TKT_FLG_RENEWABLE) {
@@ -85,7 +85,7 @@ register int *error;
        }
     }
     retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
-                                                      val->srealm,
+                                                      val->realm,
                                                       error);
     if (!retval->server) {
        goto errout;
index deb389702b64824e9762be2a144b66f3e989ec5a..a2385258412b8717223080867e04983e93ee2649 100644 (file)
@@ -36,13 +36,13 @@ register int *error;
 {
     krb5_keyblock *retval;
 
-    if (!val->session) {
+    if (!val->keyvalue) {
        *error = EINVAL;
        return(0);
     } else
        *error = 0;
     /* pull up, then play with the single string */
-    if (qb_pullup(val->session) != OK) {
+    if (qb_pullup(val->keyvalue) != OK) {
     nomem:
        *error = ENOMEM;
        return(0);
@@ -51,15 +51,15 @@ register int *error;
     if (!retval) {
        goto nomem;
     }
-    retval->contents = (unsigned char *) xmalloc(val->session->qb_forw->qb_len);
+    retval->contents = (unsigned char *) xmalloc(val->keyvalue->qb_forw->qb_len);
     if (!retval->contents) {
        xfree(retval);
        goto nomem;
     }
     retval->keytype = val->keytype;
-    retval->length = val->session->qb_forw->qb_len;
-    xbcopy(val->session->qb_forw->qb_data, retval->contents,
-         val->session->qb_forw->qb_len);
+    retval->length = val->keyvalue->qb_forw->qb_len;
+    xbcopy(val->keyvalue->qb_forw->qb_data, retval->contents,
+         val->keyvalue->qb_forw->qb_len);
     return(retval);
 }
 
index 1355cddbadc52226b6be07fa30fb4512d3623ac0..655021af02c91c46405af273f96397e0f32a4f9b 100644 (file)
@@ -44,20 +44,26 @@ register int *error;
     xbzero(retval, sizeof(*retval));
 
 
-    retval->ctime = gentime2unix(val->ctime, error);
-    if (*error) {
-    errout:
-       krb5_free_error(retval);
-       return(0);
-    }  
-    retval->cmsec = val->cmsec;
+    if (val->ctime) {
+       retval->ctime = gentime2unix(val->ctime, error);
+       if (*error) {
+       errout:
+           krb5_free_error(retval);
+           return(0);
+       }       
+    }
+    if (val->optionals & opt_KRB5_KRB__ERROR_cmsec)
+       retval->cmsec = val->cmsec;
+    else
+       retval->cmsec = 0;
+
     retval->stime = gentime2unix(val->stime, error);
     if (*error) {
        goto errout;
     }  
     retval->smsec = val->smsec;
-    retval->error = val->error;
-    if (val->crealm) {
+    retval->error = val->error__code;
+    if (val->crealm && val->cname) {
        retval->client = KRB5_PrincipalName2krb5_principal(val->cname,
                                                           val->crealm,
                                                           error);
@@ -65,9 +71,9 @@ register int *error;
            goto errout;
        }
     }
-    if (val->sname) {
+    if (val->sname && val->realm) {
        retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
-                                                          val->srealm,
+                                                          val->realm,
                                                           error);
        if (!retval->server) {
            goto errout;
@@ -82,5 +88,14 @@ register int *error;
            goto errout;
        }
     }
+    if (val->e__data) {
+       temp = qbuf2krb5_data(val->e__text, error);
+       if (temp) {
+           retval->text = *temp;
+           xfree(temp);
+       } else {
+           goto errout;
+       }
+    }
     return(retval);
 }
index 14bc90f7ae5d8fc9cf5c26c3e829a52d593fa5c1..074a26ba7674f5a2eb877471bf6f79733975040e 100644 (file)
@@ -44,10 +44,10 @@ register int *error;
 
     retval->pvno = KRB5_PVNO;
     retval->msg__type = KRB5_AP_REP;
-    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    retval->enc__part = krb5_enc_data2KRB5_EncryptedData(&(val->enc_part),
+                                                        error);
     if (!retval->enc__part) {
        xfree(retval);
-       *error = ENOMEM;
        return(0);
     }
     return(retval);
index 4e8ee56860fad5ed467be1617ca566ccbfb287f3..002ee2e6ee92d05ccf68fc1af3f464cd92946253 100644 (file)
@@ -35,7 +35,7 @@ krb5_msgtype *type;
 register int *error;
 {
     register krb5_kdc_rep *retval;
-    krb5_data *temp;
+    krb5_enc_data *temp;
 
     retval = (krb5_kdc_rep *)xmalloc(sizeof(*retval));
     if (!retval) {
@@ -54,15 +54,12 @@ register int *error;
        return(0);
     }
 
-    retval->etype = val->etype;
-    retval->ckvno = val->ckvno;
-
     retval->ticket = KRB5_Ticket2krb5_ticket(val->ticket, error);
     if (!retval->ticket) {
        krb5_free_kdc_rep(retval);
        return(0);
     }
-    temp = qbuf2krb5_data(val->enc__part, error);
+    temp = KRB5_EncryptedData2krb5_enc_data(val->enc__part, error);
     if (temp) {
        retval->enc_part = *temp;
        xfree(temp);
index ca14290466ebf1c9a5bb44e14e25fa9a6d6260b2..16585a2b395aafc6f062eb02e0b2e6b42a28d2cc 100644 (file)
@@ -28,21 +28,20 @@ static char rcsid_kekrp2ekrp_c[] =
 
 /* ISODE defines max(a,b) */
 
-struct type_KRB5_EncKDCRepPart *
-krb5_enc_kdc_rep_part2KRB5_EncKDCRepPart(val, error)
+struct type_KRB5_EncTGSRepPart *
+krb5_enc_kdc_rep_part2KRB5_EncTGSRepPart(val, error)
 const register krb5_enc_kdc_rep_part *val;
 register int *error;
 {
-    register struct type_KRB5_EncKDCRepPart *retval;
+    register struct type_KRB5_EncTGSRepPart *retval;
 
-    retval = (struct type_KRB5_EncKDCRepPart *)xmalloc(sizeof(*retval));
+    retval = (struct type_KRB5_EncTGSRepPart *)xmalloc(sizeof(*retval));
     if (!retval) {
        *error = ENOMEM;
        return(0);
     }
     xbzero(retval, sizeof(*retval));
 
-    retval->confounder = val->confounder;
     retval->key = krb5_keyblock2KRB5_EncryptionKey(val->session, error);
     if (!retval->key) {
        xfree(retval);
@@ -51,16 +50,15 @@ register int *error;
     retval->last__req = krb5_last_req2KRB5_LastReq(val->last_req, error);
     if (!retval->last__req) {
     errout:
-       free_KRB5_EncKDCRepPart(retval);
+       free_KRB5_EncTGSRepPart(retval);
        return(0);
     }
-    retval->ctime = unix2gentime(val->ctime, error);
-    if (!retval->ctime) {
-       goto errout;
-    }
-    retval->key__exp = unix2gentime(val->key_exp, error);
-    if (!retval->key__exp) {
-       goto errout;
+    retval->nonce = val->nonce;
+    if (val->key_exp) {
+       retval->key__expiration = unix2gentime(val->key_exp, error);
+       if (!retval->key__expiration) {
+           goto errout;
+       }
     }
     retval->flags = krb5_flags2KRB5_TicketFlags(val->flags, error);
     if (!retval->flags) {
@@ -70,9 +68,11 @@ register int *error;
     if (!retval->authtime) {
        goto errout;
     }
-    retval->starttime = unix2gentime(val->times.starttime, error);
-    if (!retval->starttime) {
-       goto errout;
+    if (val->times.starttime) {
+       retval->starttime = unix2gentime(val->times.starttime, error);
+       if (!retval->starttime) {
+           goto errout;
+       }
     }
     retval->endtime = unix2gentime(val->times.endtime, error);
     if (!retval->endtime) {
@@ -84,8 +84,8 @@ register int *error;
            goto errout;
        }
     }
-    retval->srealm = krb5_data2qbuf(val->server[0]);
-    if (!retval->srealm) {
+    retval->realm = krb5_data2qbuf(val->server[0]);
+    if (!retval->realm) {
        *error = ENOMEM;
        goto errout;
     }
index 44fca6accc67c20bf6c47c08a990bd339187130d..8eaf0aecbdc5f5154f0c55347ed13db501917690 100644 (file)
@@ -45,12 +45,17 @@ register int *error;
     retval->pvno = KRB5_PVNO;
     retval->msg__type = KRB5_ERROR;
 
-    retval->ctime = unix2gentime(val->ctime, error);
-    if (!retval->ctime) {
-       xfree(retval);
-       return(0);
+    if (val->ctime) {
+       retval->ctime = unix2gentime(val->ctime, error);
+       if (!retval->ctime) {
+           xfree(retval);
+           return(0);
+       }
+    }
+    if (val->cmsec) {
+       retval->cmsec = val->cmsec;
+       retval->optionals = opt_KRB5_KRB__ERROR_cmsec;
     }
-    retval->cmsec = val->cmsec;
 
     retval->stime = unix2gentime(val->stime, error);
     if (!retval->stime) {
@@ -59,7 +64,7 @@ register int *error;
        return(0);
     }
     retval->smsec = val->smsec;
-    retval->error = val->error;
+    retval->error__code = val->error;
 
     if (val->client) {
        retval->crealm = krb5_data2qbuf(val->client[0]);
@@ -73,9 +78,10 @@ register int *error;
        }
     }
 
+    /* server is technically not optional, but... */
     if (val->server) {
-       retval->srealm = krb5_data2qbuf(val->server[0]);
-       if (!retval->srealm) {
+       retval->realm = krb5_data2qbuf(val->server[0]);
+       if (!retval->realm) {
            *error = ENOMEM;
            goto errout;
        }
@@ -91,5 +97,12 @@ register int *error;
            goto errout;
        }
     }
+    if (val->e_data.data) {
+       retval->e__data = krb5_data2qbuf(&val->e_data);
+       if (!retval->e__data) {
+           *error = ENOMEM;
+           goto errout;
+       }
+    }
     return(retval);
 }
index 350340f6176ae391960e2768370eed985cf5985f..0315f9da4bb70c7b3f851637aac606d34f89b692 100644 (file)
@@ -18,7 +18,6 @@ static char rcsid_kkdcr2kdcr_c[] =
 #include <krb5/copyright.h>
 #include <krb5/krb5.h>
 
-/*#include <time.h> */
 #include <isode/psap.h>
 #include "KRB5-types.h"
 #include "asn1glue.h"
@@ -59,16 +58,13 @@ OLDDECLARG(register int *,error)
     if (!retval->cname) {
        goto errout;
     }
-    retval->etype = val->etype;
-    retval->ckvno = val->ckvno;
-
     retval->ticket = krb5_ticket2KRB5_Ticket(val->ticket, error);
     if (!retval->ticket) {
        goto errout;
     }
-    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    retval->enc__part = krb5_enc_data2KRB5_EncryptedData(&(val->enc_part),
+                                                        error);
     if (!retval->enc__part) {
-       *error = ENOMEM;
        goto errout;
     }
     return(retval);
index cc611909f3c96023fad1dcd4a34b7f03c28b7974..11a55d482236b2dbbe91c5a2cdafb53dac1b7a6b 100644 (file)
@@ -59,7 +59,7 @@ register int *error;
     }
 
     retval->keytype = val->keytype;
-    retval->session = temp;
+    retval->keyvalue = temp;
     
     return(retval);
 }
index 3a6cd0d9fbaacf7bc601ab7e58be84bae1a007b4..3e63086db735ba73dc80a65cb94689ac1e61408d 100644 (file)
@@ -52,13 +52,18 @@ register int *error;
        retval->element_KRB5_4[i] = (struct element_KRB5_5 *)
            xmalloc(sizeof(*(retval->element_KRB5_4[i])));
        if (!retval->element_KRB5_4[i]) {
+           *error = ENOMEM;
+       errout:
            retval->nelem = i;
            free_KRB5_LastReq(retval);
-           *error = ENOMEM;
            return(0);
        }           
        retval->element_KRB5_4[i]->lr__type = val[i]->lr_type;
-       retval->element_KRB5_4[i]->lr__value = val[i]->value;
+       retval->element_KRB5_4[i]->lr__value = unix2gentime(val[i]->value,
+                                                           error);
+       if (!retval->element_KRB5_4[i]->lr__value) {
+           goto errout;
+       }
     }
     return(retval);
 }
index 6226aa254af5788c74979c71eb76010cf802b8b3..21749d4c5e09ed289899a8e289b051be6e5f97a5 100644 (file)
@@ -45,12 +45,10 @@ register int *error;
     retval->pvno = KRB5_PVNO;
     retval->msg__type = KRB5_PRIV;
 
-    retval->etype = val->etype;
-    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    retval->enc__part = krb5_enc_data2KRB5_EncryptedData(&(val->enc_part),
+                                                        error);
     if (!retval->enc__part) {
-       free_KRB5_KRB__PRIV(retval);
-       *error = ENOMEM;
+       xfree(retval);
        return(0);
     }
     return(retval);
index f85c207ad634eb685bfd9263aaed69b53040e5fb..0bd1ffc64a73937896040728ce9f2cd44072bdfe 100644 (file)
@@ -29,8 +29,8 @@ static char rcsid_ktgrq2tgrq_c[] =
 /* ISODE defines max(a,b) */
 
 struct type_KRB5_TGS__REQ *
-krb5_tgs_req2KRB5_TGS__REQ(val, error)
-const register krb5_tgs_req *val;
+krb5_kdc_req2KRB5_TGS__REQ(val, error)
+const register krb5_kdc_req *val;
 register int *error;
 {
     register struct type_KRB5_TGS__REQ *retval;
@@ -42,18 +42,104 @@ register int *error;
     }
     xbzero(retval, sizeof(*retval));
 
-    retval->header = krb5_data2qbuf(&(val->header));
-    if (!retval->header) {
+    retval->pvno = KRB5_PVNO;
+    retval->msg__type = val->msg_type;
+    retval->padata__type = val->padata_type;
+    retval->padata = krb5_data2qbuf(&(val->padata));
+    if (!retval->padata) {
        xfree(retval);
        *error = ENOMEM;
        return(0);
     }
-    retval->tgs__request = krb5_data2qbuf(&(val->tgs_request));
-    if (!retval->tgs__request) {
-       xfree(retval->header);
-       xfree(retval);
-       *error = ENOMEM;
+    retval->req__body->kdc__options =
+       krb5_kdcoptions2KRB5_KDCOptions(val->kdc_options,
+                                       error);
+    if (!retval->req__body->kdc__options) {
+    errout:
+       free_KRB5_TGS__REQ(retval);
        return(0);
     }
+    if (val->client) {
+       retval->req__body->cname =
+           krb5_principal2KRB5_PrincipalName(val->client, error);
+       if (!retval->req__body->cname) {
+           goto errout;
+       }
+    }    
+    retval->req__body->realm = krb5_data2qbuf(val->server[0]);
+    if (!retval->req__body->realm) {
+       *error = ENOMEM;
+       goto errout;
+    }
+    retval->req__body->sname = krb5_principal2KRB5_PrincipalName(val->server,
+                                                                error);
+    if (!retval->req__body->sname) {
+       goto errout;
+    }
+    retval->req__body->from = unix2gentime(val->from, error);
+    if (!retval->req__body->from) {
+       goto errout;
+    }
+    retval->req__body->till = unix2gentime(val->till, error);
+    if (!retval->req__body->till) {
+       goto errout;
+    }
+    if (val->kdc_options & KDC_OPT_RENEWABLE) {
+       retval->req__body->rtime = unix2gentime(val->rtime, error);
+       if (!retval->req__body->rtime) {
+           goto errout;
+       }
+    }
+    retval->req__body->ctime = unix2gentime(val->ctime, error);
+    if (!retval->req__body->ctime) {
+       goto errout;
+    }
+    retval->req__body->nonce = val->nonce;
+    retval->req__body->etype = val->etype;
+    if (val->addresses) {
+       retval->req__body->addresses =
+           krb5_address2KRB5_HostAddresses(val->addresses, error);
+       if (!retval->req__body->addresses) {
+           goto errout;
+       }
+    }
+    if (val->authorization_data) {
+       retval->req__body->authorization__data =
+           krb5_authdata2KRB5_AuthorizationData(val->authorization_data,
+                                                error);
+       if (!retval->req__body->authorization__data)
+           goto errout;
+    }
+    if (val->second_ticket) {
+       struct element_KRB5_9 *adtk;
+       krb5_ticket * const *temp;
+       register int i;
+
+       /* count elements */
+       for (i = 0, temp = val->second_ticket; *temp; temp++,i++);
+
+       adtk = (struct element_KRB5_9 *)xmalloc(sizeof(*retval) +
+                                               max(0,i-1)*sizeof(adtk->Ticket));
+       if (!adtk) {
+           *error = ENOMEM;
+           goto errout;
+       }
+       xbzero(adtk, sizeof(adtk));
+       adtk->nelem = i;
+       for (i = 0; i < adtk->nelem; i++) {
+           adtk->Ticket[i] = krb5_ticket2KRB5_Ticket(val->second_ticket[i],
+                                                     error);
+           if (!adtk->Ticket[i]) {
+               while (i >= 0) {
+                   free_KRB5_Ticket(adtk->Ticket[i]);
+                   i--;
+               }
+               xfree(adtk);
+               goto errout;
+           }
+       }
+       retval->req__body->additional__tickets = adtk;
+    }
     return(retval);
 }
index fecff7ddda40a9260935534984b95cc54df4f911..f368ee0b0d26a089608c855412f52b24ed46a853 100644 (file)
@@ -43,8 +43,8 @@ register int *error;
     xbzero(retval, sizeof(*retval));
 
     retval->tkt__vno = KRB5_PVNO;
-    retval->srealm = krb5_data2qbuf(val->server[0]);
-    if (!retval->srealm) {
+    retval->realm = krb5_data2qbuf(val->server[0]);
+    if (!retval->realm) {
        *error = ENOMEM;
     errout:
        free_KRB5_Ticket(retval);
@@ -55,12 +55,9 @@ register int *error;
        goto errout;
     }
 
-    retval->etype = val->etype;
-
-    retval->skvno = val->skvno;
-    retval->enc__part = krb5_data2qbuf(&(val->enc_part));
+    retval->enc__part = krb5_enc_data2KRB5_EncryptedData(&(val->enc_part),
+                                                        error);
     if (!retval->enc__part) {
-       *error = ENOMEM;
        goto errout;
     }
     return(retval);
index 23f7becfccf68f067bdd4b5c106e2924936476ec..81fb27c2f62992c32a09c9f6fdb40cd4c314d339 100644 (file)
@@ -50,7 +50,13 @@ register int *error;
            *error = ENOMEM;
            return(0);
        }
-       retval[i]->value = val->element_KRB5_4[i]->lr__value;
+       retval[i]->value = gentime2unix(val->element_KRB5_4[i]->lr__value,
+                                       error);
+       if (*error) {
+           /* value is zero if error, so it won't get freed... */
+           krb5_free_last_req(retval);
+           return(0);
+       }
        retval[i]->lr_type = val->element_KRB5_4[i]->lr__type;
     }
     retval[i] = 0;
index e7d0acd9dd1dc2b18a72c87f218402bfc64c1195..793e033d804439e138dbc0a9caa1b382bee0c542 100644 (file)
@@ -34,7 +34,7 @@ const register struct type_KRB5_KRB__PRIV *val;
 register int *error;
 {
     register krb5_priv *retval;
-    krb5_data *temp;
+    krb5_enc_data *temp;
 
     retval = (krb5_priv *)xmalloc(sizeof(*retval));
     if (!retval) {
@@ -43,9 +43,7 @@ register int *error;
     }
     xbzero(retval, sizeof(*retval));
 
-    retval->etype = val->etype;
-
-    temp = qbuf2krb5_data(val->enc__part, error);
+    temp = KRB5_EncryptedData2krb5_enc_data(val->enc__part, error);
     if (temp) {
        retval->enc_part = *temp;
        xfree(temp);
index 20de5b8f68802691ba87ebe67b88ae8adac3a511..e9f464196484738d695717ec0a3afd07af268cbe 100644 (file)
@@ -28,37 +28,110 @@ static char rcsid_tgrq2ktgrq_c[] =
 
 /* ISODE defines max(a,b) */
 
-krb5_tgs_req *
-KRB5_TGS__REQ2krb5_tgs_req(val, error)
+krb5_kdc_req *
+KRB5_TGS__REQ2krb5_kdc_req(val, error)
 const register struct type_KRB5_TGS__REQ *val;
 register int *error;
 {
-    register krb5_tgs_req *retval;
+    register krb5_kdc_req *retval;
     krb5_data *temp;
 
-    retval = (krb5_tgs_req *)xmalloc(sizeof(*retval));
+    retval = (krb5_kdc_req *)xmalloc(sizeof(*retval));
     if (!retval) {
        *error = ENOMEM;
        return(0);
     }
     xbzero(retval, sizeof(*retval));
 
-    temp = qbuf2krb5_data(val->header, error);
-    if (temp) {
-       retval->header = *temp;
-       xfree(temp);
-    } else {
-       xfree(retval);
+    retval->msg_type = val->msg__type;
+    retval->padata_type = val->padata__type;
+    if (val->padata) {
+       temp = qbuf2krb5_data(val->padata, error);
+       if (temp) {
+           retval->padata = *temp;
+           xfree(temp);
+       } else {
+           goto errout;
+       }
+    }  
+
+    retval->kdc_options =
+       KRB5_KDCOptions2krb5_kdcoptions(val->req__body->kdc__options,
+                                       error);
+    if (*error) {
+    errout:
+       krb5_free_kdc_req(retval);
        return(0);
     }
-    temp = qbuf2krb5_data(val->tgs__request, error);
-    if (temp) {
-       retval->tgs_request = *temp;
-       xfree(temp);
-    } else {
-       xfree(retval->header.data);
-       xfree(retval);
-       return(0);
+    if (val->req__body->cname)
+       retval->client =
+           KRB5_PrincipalName2krb5_principal(val->req__body->cname,
+                                             val->req__body->realm,
+                                             error);
+    retval->server = KRB5_PrincipalName2krb5_principal(val->req__body->sname,
+                                                      val->req__body->realm,
+                                                      error);
+    if (!retval->server) {
+       goto errout;
+    }
+    retval->from = gentime2unix(val->req__body->from, error);
+    if (*error) {
+       goto errout;
+    }
+    retval->till = gentime2unix(val->req__body->till, error);
+    if (*error) {
+       goto errout;
+    }
+    if (retval->kdc_options & KDC_OPT_RENEWABLE) {
+       retval->rtime = gentime2unix(val->req__body->rtime, error);
+       if (*error) {
+           goto errout;
+       }
+    }
+    retval->ctime = gentime2unix(val->req__body->ctime, error);
+    if (*error) {
+       goto errout;
+    }
+    retval->nonce = val->req__body->nonce;
+
+    retval->etype = val->req__body->etype;
+
+
+    if (val->req__body->addresses) {
+       retval->addresses =
+           KRB5_HostAddresses2krb5_address(val->req__body->addresses, error);
+       if (!retval->addresses) {
+           goto errout;
+       }
+    }
+    if (val->req__body->authorization__data) {
+       retval->authorization_data =
+           KRB5_AuthorizationData2krb5_authdata(val->req__body->
+                                                authorization__data,
+                                                error);
+       if (*error)
+           goto errout;
+    }
+    if (val->req__body->additional__tickets) {
+       register krb5_ticket **aticks;
+        register struct element_KRB5_9 *tptr;
+       register int i;
+
+       tptr = val->req__body->additional__tickets;
+       /* plus one for null terminator */
+       aticks = (krb5_ticket **) xcalloc(tptr->nelem + 1,
+                                         sizeof(*aticks));
+       for (i = 0; i < tptr->nelem; i++) {
+           aticks[i] = KRB5_Ticket2krb5_ticket(tptr->Ticket[i], error);
+           if (!aticks[i]) {
+               while (i >= 0) {
+                   krb5_free_ticket(aticks[i]);
+                   i--;
+               }
+               goto errout;
+           }
+       }
+       retval->second_ticket = aticks;
     }
     return(retval);
 }
index 68ef43ef5f266b19a225dfabe87fdbe0e6e547dc..cda06a550ddab3ec4dda1b1d9cd466df1c48e468 100644 (file)
@@ -34,7 +34,7 @@ const register struct type_KRB5_Ticket *val;
 register int *error;
 {
     register krb5_ticket *retval;
-    krb5_data *temp;
+    krb5_enc_data *temp;
 
     retval = (krb5_ticket *)xmalloc(sizeof(*retval));
     if (!retval) {
@@ -45,16 +45,14 @@ register int *error;
 
 
     retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
-                                                      val->srealm,
+                                                      val->realm,
                                                       error);
     if (!retval->server) {
        xfree(retval);
        return(0);
     }
-    retval->etype = val->etype;
-    retval->skvno = val->skvno;
 
-    temp = qbuf2krb5_data(val->enc__part, error);
+    temp = KRB5_EncryptedData2krb5_enc_data(val->enc__part, error);
     if (temp) {
        retval->enc_part = *temp;
        xfree(temp);