#ifndef ComErrLib
#define ComErrLib -lcom_err
#endif
-#ifndef PosyFlags
-#define PosyFlags -f -h2 -a -s
+#ifndef PepsyFlags
+#define PepsyFlags -f -h0 -a -s
+/* -h2 breaks pepsy, ARRGH! */
#endif
-#ifndef PepyFlags
-#define PepyFlags -a PY_advise -P -s -r
-#endif
-#ifndef PepyCmd
-#define PepyCmd pepy
-#endif
-#ifndef PosyCmd
-#define PosyCmd posy
+#ifndef PepsyCmd
+#define PepsyCmd pepsy
#endif
#ifndef ArAddCmd
#define ArAddCmd ar cruv
#define DesDefines YouMustFigureOutYourDesDefines
#endif
-#ifndef PepyPosyRules
-#define PepyPosyRules() @@\
+#ifndef PepsyTarget
+#define PepsyTarget(basename) @@\
.SUFFIXES: .py @@\
-.py.c: @@\
- $(PEPY) $(PYFLAGS) $<
-#endif /* PepyPosyRules */
+basename/**/_tables.c: basename-asn.py @@\
+ @echo '***Ignore the warning message "Warning: Can'\''t find UNIV.ph failed"' @@\
+ $(PEPSY) $(PSYFLAGS) basename-asn.py @@\
+basename-types.h: basename/**/_tables.c
+#endif /* PepsyTarget */
#ifndef ErrorTableObjectRule
TOP_INCLUDES = -I$(TOP)/include $(STDC_TOP_INCLUDES)
CONFIGSRC = $(TOP)/config
ISODE = IsodeDir
- POFLAGS = PosyFlags
- PYFLAGS = PepyFlags
- PEPY = PepyCmd
- POSY = PosyCmd
+ PSYFLAGS = PepsyFlags
+ PEPSY = PepsyCmd
TOUCH = TouchCmd
IMAKE = ImakeCmd
DEPEND = DependCmd
library. This might want to be -lisode if you have it installed.
IsodeDir is put into the 'make' variable ISODE. */
-#define IsodeLib -L/mit/isode/isode-6.0/@sys/lib -lisode
-#define IsodeDir /mit/isode/isode-6.0
+#define IsodeLib -L/mit/isode/isode-6.8/@sys/lib -lisode
+#define IsodeDir /mit/isode/isode-6.8
-/* Re-define PepyCmd and PosyCmd if pepy & posy aren't in your search
- path. */
-
-#define PepyCmd $(ISODE)/@sys/bin/pepy
-#define PosyCmd $(ISODE)/@sys/bin/posy
+/* Re-define PepsyCmd if pepsy isn't in your search path. */
+#define PepsyCmd $(ISODE)/@sys/bin/pepsy
#define UseImakeInstalled /* -- turn on if you have imake installed */
#define UseMakedependInstalled /* -- turn on if you have makedepend installed */
KRB5 DEFINITIONS ::=
BEGIN
+-- needed to do the Right Thing with pepsy; this isn't a valid ASN.1
+-- token, however.
+
+SECTIONS encode decode none
+
-- the order of stuff in this file matches the order in the draft RFC
Realm ::= GeneralString
register krb5_last_req_entry * 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_LastReq *retval;
register krb5_last_req_entry * const *temp;
register int i;
}
}
return(retval);
+#endif
+ register struct type_KRB5_LastReq *retval = 0, *rv1 = 0, *rv2;
+ register krb5_last_req_entry * const *temp;
+ register int i;
+
+ /* count elements */
+ for (i = 0, temp = val; *temp; temp++,i++, rv1 = rv2) {
+
+ rv2 = (struct type_KRB5_LastReq *) xmalloc(sizeof(*rv2));
+ if (!rv2) {
+ if (retval)
+ free_KRB5_LastReq(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ if (rv1)
+ rv1->next = rv2;
+ xbzero((char *)rv2, sizeof (*rv2));
+ if (!retval)
+ retval = rv2;
+
+ rv2->element_KRB5_4 = (struct element_KRB5_5 *)
+ xmalloc(sizeof(*(retval->element_KRB5_4)));
+ if (!rv2->element_KRB5_4) {
+ errout:
+ *error = ENOMEM;
+ if (retval)
+ free_KRB5_LastReq(retval);
+ return(0);
+ }
+ rv2->element_KRB5_4->lr__type = val[i]->lr_type;
+ rv2->element_KRB5_4->lr__value = unix2gentime(val[i]->value,
+ error);
+ if (!retval->element_KRB5_4->lr__value) {
+ goto errout;
+ }
+ }
+ return(retval);
}
krb5_const_principal val;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register int i;
register struct type_KRB5_PrincipalName *retval;
}
}
return(retval);
+
+#endif
+ register struct type_KRB5_PrincipalName *retval = 0, *rv1 = 0, *rv2;
+ register int i;
+
+ /* still skipping realm */
+ for (i = 1; val[i]; i++, rv1 = rv2) {
+ rv2 = (struct type_KRB5_PrincipalName *) xmalloc(sizeof(*rv2));
+ if (!rv2) {
+ if (retval)
+ free_KRB5_PrincipalName(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ if (rv1)
+ rv1->next = rv2;
+ xbzero((char *)rv2, sizeof (*rv2));
+ if (!retval)
+ retval = rv2;
+
+ rv2->GeneralString = krb5_data2qbuf(val[i]);
+ if (!rv2->GeneralString) {
+ /* clean up */
+ if (retval)
+ free_KRB5_PrincipalName(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ }
+ return(retval);
}
}
}
retval->nonce = val->nonce;
+#if 0
+ /* XXX !@#*)@# busted ASN.1 compiler, -h2 doesn't generate compilable
+ code */
retval->etype = (struct element_KRB5_8 *)malloc(sizeof(*retval->etype)+
max(0,val->netypes-1)*sizeof(integer));
- if (!retval->etype)
+ if (!retval->etype) {
+ *error = ENOMEM;
goto errout;
-
-#if 0
+ }
for (i = 0; i < val->netypes; i++) {
retval->etype->element_KRB5_9[i] = val->etype[i];
}
retval->etype->nelem = val->netypes;
-#else
- /* XXX !@#*)@# busted ASN.1 compiler */
- retval->etype->element_KRB5_9 = val->etype[0];
- retval->etype->nelem = 1;
#endif
+ {
+ register struct element_KRB5_8 *rv1 = 0, *rv2;
+ register int i;
+
+ for (i = 0; i < val->netypes; i++, rv1 = rv2) {
+ rv2 = (struct element_KRB5_8 *) xmalloc(sizeof(*rv2));
+ if (!rv2) {
+ *error = ENOMEM;
+ goto errout;
+ }
+ if (rv1)
+ rv1->next = rv2;
+ xbzero((char *)rv2, sizeof (*rv2));
+ if (!retval->etype)
+ retval->etype = rv2;
+ rv2->element_KRB5_9 = val->etype[i];
+ }
+ }
if (val->addresses) {
retval->addresses =
goto errout;
}
if (val->second_ticket) {
+#if 0
+ /* code for -h2 structures, which generate bogus code from pepsy */
+
struct element_KRB5_10 *adtk;
krb5_ticket * const *temp;
register int i;
}
}
retval->additional__tickets = adtk;
+#endif
+ register struct element_KRB5_10 *adtk = 0, *rv1 = 0, *rv2;
+ krb5_ticket * const *temp;
+ register int i;
+
+ /* count elements */
+ for (i = 0, temp = val->second_ticket; *temp; temp++,i++, rv1 = rv2) {
+
+ rv2 = (struct element_KRB5_10 *)xmalloc(sizeof(*rv2));
+ if (!rv2) {
+ *error = ENOMEM;
+ goto errout;
+ }
+ xbzero(adtk, sizeof(*adtk));
+ if (rv1)
+ rv1->next = rv2;
+ xbzero((char *)rv2, sizeof (*rv2));
+ if (!adtk)
+ adtk = rv2;
+
+ rv2->Ticket = krb5_ticket2KRB5_Ticket(val->second_ticket[i],
+ error);
+ if (!rv2->Ticket) {
+ for (rv1 = adtk; rv1; rv1 = rv2) {
+ if (rv1->Ticket)
+ free_KRB5_Ticket(rv1->Ticket);
+ rv2 = rv1->next;
+ xfree(rv1);
+ }
+ goto errout;
+ }
+ }
+ retval->additional__tickets = adtk;
} else {
+#if 0
+ /* this was once necessary to get around faulty optional processing */
+
struct element_KRB5_10 *adtk;
adtk = (struct element_KRB5_10 *)xmalloc(sizeof(*adtk));
if (!adtk) {
xbzero(adtk, sizeof(*adtk));
adtk->nelem = 0;
retval->additional__tickets = adtk;
+#endif
+ retval->additional__tickets = 0;
}
return retval;
const struct type_KRB5_LastReq *val;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register krb5_last_req_entry **retval;
register int i;
}
retval[i] = 0;
return(retval);
+#endif
+ register krb5_last_req_entry **retval;
+ register int i;
+ register struct type_KRB5_LastReq *rv;
+
+ for (i = 0, rv = val; rv; i++, rv = rv->next)
+ ;
+
+ /* plus one for null terminator */
+ retval = (krb5_last_req_entry **) xcalloc(i + 1, sizeof(*retval));
+ if (!retval) {
+ *error = ENOMEM;
+ return(0);
+ }
+ for (i = 0, rv = val; rv; rv = rv->next, i++) {
+ retval[i] = (krb5_last_req_entry *) xmalloc(sizeof(*retval[i]));
+ if (!retval[i]) {
+ krb5_free_last_req(retval);
+ *error = ENOMEM;
+ return(0);
+ }
+ retval[i]->value = gentime2unix(rv->element_KRB5_4->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 = rv->element_KRB5_4->lr__type;
+ }
+ retval[i] = 0;
+ return(retval);
}
const struct type_KRB5_Realm *realm;
register int *error;
{
+#if 0
+ /* this code is for -h2 style ISODE structures. However, pepsy
+ generates horribly broken when given -h2. */
+
register krb5_principal retval;
register int i;
}
retval[i+1] = 0;
return(retval);
+#endif
+
+ register krb5_principal retval;
+ register int i;
+ register struct type_KRB5_PrincipalName *rv;
+
+ 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 *));
+
+ if (!retval) {
+ *error = ENOMEM;
+ return(0);
+ }
+
+ retval[0] = qbuf2krb5_data(realm, error);
+ if (!retval[0]) {
+ xfree(retval);
+ 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);
+ return(0);
+ }
+ }
+ retval[i] = 0;
+ return(retval);
}
}
retval->nonce = val->nonce;
+#if 0
retval->etype = (krb5_enctype *) xmalloc(sizeof(*(retval->etype))*min(1,val->etype->nelem));
- if (!retval->etype)
+ if (!retval->etype) {
+ *error = ENOMEM;
goto errout;
-#if 0
+ }
+ /* XXX @#$#@ broken ASN.1 compiler, -h2 generates unusable code,
+ but the structures would be handle like so: */
for (i = 0; i < val->etype->nelem; i++) {
retval->etype[i] = val->etype->element_KRB5_9[i];
}
- val->netypes = val->etype->nelem;
-#else
- /* XXX @#$#@ broken ASN.1 compiler */
- retval->etype[0] = val->etype->element_KRB5_9;
- retval->netypes = 1;
+ retval->netypes = val->etype->nelem;
#endif
-
+ {
+ register int i;
+ register struct element_KRB5_8 *rv;
+ for (i = 0, rv = val->etype; rv; i++, rv = rv->next)
+ ;
+ retval->netypes = i;
+ retval->etype = (krb5_enctype *) xcalloc(i+1,sizeof(*retval->etype));
+ if (!retval->etype) {
+ *error = ENOMEM;
+ goto errout;
+ }
+ for (i = 0, rv = val->etype; rv; rv = rv->next, i++)
+ retval->etype[i] = rv->element_KRB5_9;
+ }
+
if (val->addresses) {
retval->addresses =
KRB5_HostAddresses2krb5_address(val->addresses, error);
goto errout;
}
if (val->additional__tickets) {
+#if 0
+ /* code for -h2 style, which pepsy can't do right */
+
register krb5_ticket **aticks;
register struct element_KRB5_10 *tptr;
register int i;
/* plus one for null terminator */
aticks = (krb5_ticket **) xcalloc(tptr->nelem + 1,
sizeof(*aticks));
+ if (!aticks) {
+ *error = ENOMEM;
+ goto errout;
+ }
for (i = 0; (i < tptr->nelem) && tptr->Ticket[i]; i++) {
aticks[i] = KRB5_Ticket2krb5_ticket(tptr->Ticket[i], error);
if (!aticks[i]) {
krb5_free_ticket(aticks[i]);
i--;
}
+ xfree(aticks);
+ goto errout;
+ }
+ }
+ retval->second_ticket = aticks;
+#endif
+ register krb5_ticket **aticks;
+ register struct element_KRB5_10 *tptr, *rv;
+ register int i;
+
+ tptr = val->additional__tickets;
+ for (i = 0, rv = tptr; rv; i++, rv = rv->next)
+ ;
+
+ /* plus one for null terminator */
+ aticks = (krb5_ticket **) xcalloc(i + 1, sizeof(*aticks));
+ if (!aticks) {
+ *error = ENOMEM;
+ goto errout;
+ }
+
+ for (i = 0, rv = tptr; rv; rv = rv->next, i++) {
+ aticks[i] = KRB5_Ticket2krb5_ticket(rv->Ticket, error);
+ if (!aticks[i]) {
+ while (i >= 0) {
+ krb5_free_ticket(aticks[i]);
+ i--;
+ }
+ xfree(aticks);
goto errout;
}
}