/* 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;
}
xbzero(retval, sizeof(*retval));
- retval->confounder = val->confounder;
retval->session = KRB5_EncryptionKey2krb5_keyblock(val->key, error);
if (!retval->session) {
xfree(retval);
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;
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) {
}
}
retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
- val->srealm,
+ val->realm,
error);
if (!retval->server) {
goto errout;
{
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);
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);
}
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);
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;
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);
}
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);
register int *error;
{
register krb5_kdc_rep *retval;
- krb5_data *temp;
+ krb5_enc_data *temp;
retval = (krb5_kdc_rep *)xmalloc(sizeof(*retval));
if (!retval) {
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);
/* 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);
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) {
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) {
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;
}
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) {
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]);
}
}
+ /* 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;
}
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);
}
#include <krb5/copyright.h>
#include <krb5/krb5.h>
-/*#include <time.h> */
#include <isode/psap.h>
#include "KRB5-types.h"
#include "asn1glue.h"
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);
}
retval->keytype = val->keytype;
- retval->session = temp;
+ retval->keyvalue = temp;
return(retval);
}
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);
}
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);
/* 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;
}
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);
}
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);
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);
*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;
register int *error;
{
register krb5_priv *retval;
- krb5_data *temp;
+ krb5_enc_data *temp;
retval = (krb5_priv *)xmalloc(sizeof(*retval));
if (!retval) {
}
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);
/* 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);
}
register int *error;
{
register krb5_ticket *retval;
- krb5_data *temp;
+ krb5_enc_data *temp;
retval = (krb5_ticket *)xmalloc(sizeof(*retval));
if (!retval) {
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);