[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Events with optional principals
According to the ASN.1 for Event, the principal is
optional:
Event ::= SEQUENCE {
time[0] KerberosTime,
principal[1] Principal OPTIONAL
}
Thus, shouldn't event2string() check first whether principal
is NULL before trying to unparse it?
lukeh@padl/au[753]% diff -u print.c.orig print.c
--- print.c.orig Sun Dec 26 15:45:34 1999
+++ print.c Sun Dec 26 15:46:23 1999
@@ -101,9 +101,13 @@
*str = strdup("-");
return (*str == NULL) ? ENOMEM : 0;
}
- ret = krb5_unparse_name(context, ev->principal, &pr);
- if(ret)
- return ret;
+ if (ev->principal == NULL) {
+ pr = strdup("UNKNOWN");
+ } else {
+ ret = krb5_unparse_name(context, ev->principal, &pr);
+ if(ret)
+ return ret;
+ }
ret = asprintf(&p, "%s:%s", time2str(ev->time), pr);
free(pr);
if(ret < 0)
Also, in get_s.c, I needed to change kadm5_s_get_principal()
to check for nullity of ent.created_by.principal. There may
be other cases, too, but these two changes seem to work for
me. (We discovered this whilst working a new backend where
the store itself is responsible for maintaining creation
and modification events.)
cheers,
-- Luke
--
___________________________________________________________________________
luke howard lukeh@PADL.COM
PADL software pty ltd http://www.PADL.COM