[krbdev.mit.edu #6706] Re: Small kdc/kdc_preauth.c mods for your consideration
Jeff Blaine via RT
rt-comment at krbdev.mit.edu
Fri Apr 23 15:39:58 EDT 2010
Actually, this is better. Ditch the 1st diff and consider
this one instead.
I will take more care with future efforts.
* Log the valid preauth methods
* Use NULL instead of '0' per calloc/malloc man page
* Log a not enough memory message if needed, since this
function does not return krb5_error_code
* Set length to 0, not NULL, fixed gcc warning
--- ../../PRISTINE-DONT-MOD-krb5-1.8/src/kdc/kdc_preauth.c 2010-02-12
15:28:39.000000000 -0500
+++ kdc/kdc_preauth.c 2010-04-23 12:36:15.000000000 -0400
@@ -562,6 +562,10 @@
free(kdc_realm_names);
n_preauth_systems = k;
/* Add the end-of-list marker. */
+ for (i = 0; i < k; i++) {
+ krb5_klog_syslog (LOG_INFO, "preauth method %s valid",
+ preauth_systems[i].name);
+ }
preauth_systems[k].name = "[end]";
preauth_systems[k].type = -1;
return 0;
@@ -1006,8 +1010,11 @@
hw_only = isflagset(client->attributes, KRB5_KDB_REQUIRES_HW_AUTH);
/* Allocate two extra entries for the cookie and the terminator. */
pa_data = calloc(n_preauth_systems + 2, sizeof(krb5_pa_data *));
- if (pa_data == 0)
+ if (pa_data == NULL) {
+ krb5_klog_syslog (LOG_INFO,
+ "Not enough memory in get_preauth_hint_list");
return;
+ }
pa = pa_data;
for (ap = preauth_systems; ap->type != -1; ap++) {
@@ -1328,7 +1335,7 @@
}
key_modified = FALSE;
null_item.contents = NULL;
- null_item.length = NULL;
+ null_item.length = 0;
send_pa = send_pa_list;
*send_pa = 0;
More information about the krb5-bugs
mailing list