/* ISODE defines max(a,b) */
-struct type_KRB5_TGS__REQ *
-krb5_kdc_req2KRB5_TGS__REQ(val, error)
+struct type_KRB5_KDC__REQ__BODY *
+krb5_kdc_req2KRB5_KDC__REQ__BODY(val, error)
const register krb5_kdc_req *val;
register int *error;
{
- register struct type_KRB5_TGS__REQ *retval;
-
- retval = (struct type_KRB5_TGS__REQ *)xmalloc(sizeof(*retval));
+ register struct type_KRB5_KDC__REQ__BODY *retval;
+
+ retval = krb5_kdc_req2KRB5_KDC__REQ__BODY(val, error);
if (!retval) {
*error = ENOMEM;
return(0);
}
- xbzero(retval, sizeof(*retval));
- 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->req__body->kdc__options =
+ retval->kdc__options =
krb5_kdcoptions2KRB5_KDCOptions(val->kdc_options,
error);
- if (!retval->req__body->kdc__options) {
+ if (!retval->kdc__options) {
errout:
- free_KRB5_TGS__REQ(retval);
+ free_KRB5_KDC__REQ__BODY(retval);
return(0);
}
if (val->client) {
- retval->req__body->cname =
+ retval->cname =
krb5_principal2KRB5_PrincipalName(val->client, error);
- if (!retval->req__body->cname) {
+ if (!retval->cname) {
goto errout;
}
}
- retval->req__body->realm = krb5_data2qbuf(val->server[0]);
- if (!retval->req__body->realm) {
+ retval->realm = krb5_data2qbuf(val->server[0]);
+ if (!retval->realm) {
*error = ENOMEM;
goto errout;
}
- retval->req__body->sname = krb5_principal2KRB5_PrincipalName(val->server,
- error);
- if (!retval->req__body->sname) {
+ retval->sname = krb5_principal2KRB5_PrincipalName(val->server, error);
+ if (!retval->sname) {
goto errout;
}
- retval->req__body->from = unix2gentime(val->from, error);
- if (!retval->req__body->from) {
+ retval->from = unix2gentime(val->from, error);
+ if (!retval->from) {
goto errout;
}
- retval->req__body->till = unix2gentime(val->till, error);
- if (!retval->req__body->till) {
+ retval->till = unix2gentime(val->till, error);
+ if (!retval->till) {
goto errout;
}
if (val->kdc_options & KDC_OPT_RENEWABLE) {
- retval->req__body->rtime = unix2gentime(val->rtime, error);
- if (!retval->req__body->rtime) {
+ retval->rtime = unix2gentime(val->rtime, error);
+ if (!retval->rtime) {
goto errout;
}
}
- retval->req__body->ctime = unix2gentime(val->ctime, error);
- if (!retval->req__body->ctime) {
+ retval->ctime = unix2gentime(val->ctime, error);
+ if (!retval->ctime) {
goto errout;
}
- retval->req__body->nonce = val->nonce;
- retval->req__body->etype = val->etype;
+ retval->nonce = val->nonce;
+ retval->etype = val->etype;
if (val->addresses) {
- retval->req__body->addresses =
+ retval->addresses =
krb5_address2KRB5_HostAddresses(val->addresses, error);
- if (!retval->req__body->addresses) {
+ if (!retval->addresses) {
goto errout;
}
}
if (val->authorization_data) {
- retval->req__body->authorization__data =
+ retval->authorization__data =
krb5_authdata2KRB5_AuthorizationData(val->authorization_data,
error);
- if (!retval->req__body->authorization__data)
+ if (!retval->authorization__data)
goto errout;
}
if (val->second_ticket) {
- struct element_KRB5_9 *adtk;
+ struct element_KRB5_6 *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) +
+ adtk = (struct element_KRB5_6 *)xmalloc(sizeof(*retval) +
max(0,i-1)*sizeof(adtk->Ticket));
if (!adtk) {
*error = ENOMEM;
goto errout;
}
}
- retval->req__body->additional__tickets = adtk;
+ retval->additional__tickets = adtk;
+ }
+ return retval;
+}
+
+struct type_KRB5_TGS__REQ *
+krb5_kdc_req2KRB5_TGS__REQ(val, error)
+const register krb5_kdc_req *val;
+register int *error;
+{
+ register struct type_KRB5_TGS__REQ *retval;
+
+ retval = (struct type_KRB5_TGS__REQ *)xmalloc(sizeof(*retval));
+ if (!retval) {
+ *error = ENOMEM;
+ return(0);
+ }
+ xbzero(retval, sizeof(*retval));
+ 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->req__body = krb5_kdc_req2KRB5_KDC__REQ__BODY(val, error);
+ if (!retval->req__body) {
+ xfree(retval);
+ return(0);
}
return(retval);
}
/* ISODE defines max(a,b) */
krb5_kdc_req *
-KRB5_TGS__REQ2krb5_kdc_req(val, error)
-const register struct type_KRB5_TGS__REQ *val;
+KRB5_KDC__REQ__BODY2krb5_kdc_req(val, error)
+const register struct type_KRB5_KDC__REQ__BODY *val;
register int *error;
{
register krb5_kdc_req *retval;
- krb5_data *temp;
retval = (krb5_kdc_req *)xmalloc(sizeof(*retval));
if (!retval) {
}
xbzero(retval, sizeof(*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,
+ KRB5_KDCOptions2krb5_kdcoptions(val->kdc__options,
error);
if (*error) {
errout:
krb5_free_kdc_req(retval);
return(0);
}
- if (val->req__body->cname)
+ if (val->cname)
retval->client =
- KRB5_PrincipalName2krb5_principal(val->req__body->cname,
- val->req__body->realm,
+ KRB5_PrincipalName2krb5_principal(val->cname,
+ val->realm,
error);
- retval->server = KRB5_PrincipalName2krb5_principal(val->req__body->sname,
- val->req__body->realm,
+ retval->server = KRB5_PrincipalName2krb5_principal(val->sname,
+ val->realm,
error);
if (!retval->server) {
goto errout;
}
- retval->from = gentime2unix(val->req__body->from, error);
+ retval->from = gentime2unix(val->from, error);
if (*error) {
goto errout;
}
- retval->till = gentime2unix(val->req__body->till, error);
+ retval->till = gentime2unix(val->till, error);
if (*error) {
goto errout;
}
if (retval->kdc_options & KDC_OPT_RENEWABLE) {
- retval->rtime = gentime2unix(val->req__body->rtime, error);
+ retval->rtime = gentime2unix(val->rtime, error);
if (*error) {
goto errout;
}
}
- retval->ctime = gentime2unix(val->req__body->ctime, error);
+ retval->ctime = gentime2unix(val->ctime, error);
if (*error) {
goto errout;
}
- retval->nonce = val->req__body->nonce;
+ retval->nonce = val->nonce;
- retval->etype = val->req__body->etype;
+ retval->etype = val->etype;
- if (val->req__body->addresses) {
+ if (val->addresses) {
retval->addresses =
- KRB5_HostAddresses2krb5_address(val->req__body->addresses, error);
+ KRB5_HostAddresses2krb5_address(val->addresses, error);
if (!retval->addresses) {
goto errout;
}
}
- if (val->req__body->authorization__data) {
+ if (val->authorization__data) {
retval->authorization_data =
- KRB5_AuthorizationData2krb5_authdata(val->req__body->
+ KRB5_AuthorizationData2krb5_authdata(val->
authorization__data,
error);
if (*error)
goto errout;
}
- if (val->req__body->additional__tickets) {
+ if (val->additional__tickets) {
register krb5_ticket **aticks;
- register struct element_KRB5_9 *tptr;
+ register struct element_KRB5_6 *tptr;
register int i;
- tptr = val->req__body->additional__tickets;
+ tptr = val->additional__tickets;
/* plus one for null terminator */
aticks = (krb5_ticket **) xcalloc(tptr->nelem + 1,
sizeof(*aticks));
}
retval->second_ticket = aticks;
}
+ return retval;
+}
+
+krb5_kdc_req *
+KRB5_TGS__REQ2krb5_kdc_req(val, error)
+const register struct type_KRB5_TGS__REQ *val;
+register int *error;
+{
+ register krb5_kdc_req *retval;
+ krb5_data *temp;
+
+ if (!(retval = KRB5_KDC__REQ__BODY2krb5_kdc_req(val->req__body, error)))
+ return 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 {
+ krb5_free_kdc_req(retval);
+ return(0);
+ }
+ }
return(retval);
}