const struct type_KRB5_AuthorizationData *val;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register krb5_authdata **retval;
register int i;
retval[i]->contents = (unsigned char *)xmalloc(val->element_KRB5_2[i]->ad__data->qb_forw->qb_len);
if (!retval[i]->contents) {
xfree(retval[i]);
+ retval[i] = 0;
krb5_free_authdata(retval);
goto nomem;
}
}
retval[i] = 0;
return(retval);
+#endif
+
+ register krb5_authdata **retval;
+ register int i;
+ register struct type_KRB5_AuthorizationData *rv;
+
+ for (i = 0, rv = val; rv; i++, rv = rv->next)
+ ;
+
+ /* plus one for null terminator */
+ retval = (krb5_authdata **) xcalloc(i + 1, sizeof(*retval));
+ if (!retval) {
+ nomem:
+ *error = ENOMEM;
+ return(0);
+ }
+ for (i = 0, rv = val; rv->next; rv = rv->next, i++) {
+ if (qb_pullup(rv->element_KRB5_2->ad__data) != OK) {
+ xfree(retval);
+ goto nomem;
+ }
+ retval[i] = (krb5_authdata *) xmalloc(sizeof(*retval[i]));
+ if (!retval[i]) {
+ krb5_free_authdata(retval);
+ goto nomem;
+ }
+ retval[i]->contents = (unsigned char *)xmalloc(rv->element_KRB5_2->ad__data->qb_forw->qb_len);
+ if (!retval[i]->contents) {
+ xfree(retval[i]);
+ retval[i] = 0;
+ krb5_free_authdata(retval);
+ goto nomem;
+ }
+ retval[i]->ad_type = rv->element_KRB5_2->ad__type;
+ retval[i]->length = rv->element_KRB5_2->ad__data->qb_forw->qb_len;
+ xbcopy(rv->element_KRB5_2->ad__data->qb_forw->qb_data,
+ retval[i]->contents, retval[i]->length);
+ }
+ retval[i] = 0;
+ return(retval);
}
const struct type_KRB5_HostAddresses *val;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register krb5_address **retval;
register int i;
retval[i]->contents = (unsigned char *)xmalloc(val->element_KRB5_0[i]->address->qb_forw->qb_len);
if (!retval[i]->contents) {
xfree(retval[i]);
+ retval[i] = 0;
krb5_free_address(retval);
goto nomem;
}
}
retval[i] = 0;
return(retval);
+#endif
+
+ register krb5_address **retval;
+ register int i;
+ register struct type_KRB5_HostAddresses *rv;
+
+ for (i = 0, rv = val; rv; i++, rv = rv->next)
+ ;
+
+ /* plus one for null terminator */
+ retval = (krb5_address **) xcalloc(i + 1, sizeof(*retval));
+ if (!retval) {
+ nomem:
+ *error = ENOMEM;
+ return(0);
+ }
+ for (i = 0, rv = val; rv; rv = rv->next, i++) {
+ if (qb_pullup(rv->element_KRB5_0->address) != OK) {
+ xfree(retval);
+ goto nomem;
+ }
+ retval[i] = (krb5_address *) xmalloc(sizeof(*retval[i]));
+ if (!retval[i]) {
+ krb5_free_address(retval);
+ goto nomem;
+ }
+ retval[i]->contents = (unsigned char *)xmalloc(rv->element_KRB5_0->address->qb_forw->qb_len);
+ if (!retval[i]->contents) {
+ xfree(retval[i]);
+ retval[i] = 0;
+ krb5_free_address(retval);
+ goto nomem;
+ }
+ retval[i]->addrtype = rv->element_KRB5_0->addr__type;
+ retval[i]->length = rv->element_KRB5_0->address->qb_forw->qb_len;
+ xbcopy(rv->element_KRB5_0->address->qb_forw->qb_data,
+ retval[i]->contents, retval[i]->length);
+ }
+ retval[i] = 0;
+ return(retval);
}
register krb5_authdata * const *val;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register struct type_KRB5_AuthorizationData *retval;
register krb5_authdata * const *temp;
register int i;
}
}
return(retval);
+#endif
+ register struct type_KRB5_AuthorizationData *retval = 0, *rv1 = 0, *rv2;
+ register krb5_authdata * const *temp;
+ register int i;
+
+ /* count elements */
+ for (i = 0, temp = val; *temp; temp++,i++, rv1 = rv2) {
+
+ rv2 = (struct type_KRB5_AuthorizationData *) xmalloc(sizeof(*rv2));
+ if (!rv2) {
+ if (retval)
+ free_KRB5_AuthorizationData(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ if (rv1)
+ rv1->next = rv2;
+ xbzero((char *)rv2, sizeof (*rv2));
+ if (!retval)
+ retval = rv2;
+
+ rv2->element_KRB5_2 = (struct element_KRB5_3 *)
+ xmalloc(sizeof(*(rv2->element_KRB5_2)));
+ if (!rv2->element_KRB5_2) {
+ errout:
+ if (retval)
+ free_KRB5_AuthorizationData(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ rv2->element_KRB5_2->ad__type = val[i]->ad_type;
+ rv2->element_KRB5_2->ad__data = str2qb((char *)(val[i])->contents,
+ (val[i])->length, 1);
+ if (!rv2->element_KRB5_2->ad__data) {
+ goto errout;
+ }
+ }
+ return(retval);
}
register krb5_address * const *val;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register struct type_KRB5_HostAddresses *retval;
register krb5_address * const *temp;
register int i;
}
}
return(retval);
+#endif
+ register struct type_KRB5_HostAddresses *retval = 0, *rv1 = 0, *rv2;
+ register krb5_address * const *temp;
+ register int i;
+
+ for (i = 0, temp = val; *temp; temp++,i++, rv1 = rv2) {
+
+ rv2 = (struct type_KRB5_HostAddresses *) xmalloc(sizeof(*rv2));
+ if (!rv2) {
+ if (retval)
+ free_KRB5_HostAddresses(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ if (rv1)
+ rv1->next = rv2;
+ xbzero((char *)rv2, sizeof (*rv2));
+ if (!retval)
+ retval = rv2;
+
+ rv2->element_KRB5_0 = (struct element_KRB5_1 *)
+ xmalloc(sizeof(*(retval->element_KRB5_0)));
+ if (!rv2->element_KRB5_0) {
+ errout:
+ if (retval)
+ free_KRB5_HostAddresses(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ rv2->element_KRB5_0->addr__type = (val[i])->addrtype;
+ rv2->element_KRB5_0->address = str2qb((char *)(val[i])->contents,
+ (val[i])->length, 1);
+ if (!rv2->element_KRB5_0->address) {
+ /* clean up */
+ xfree(rv2->element_KRB5_0);
+ goto errout;
+ }
+ }
+ return(retval);
}