Return-Path: Received: from pch.mit.edu (PCH.MIT.EDU [18.7.21.90]) by krbdev.mit.edu (Postfix) with ESMTP id 8C3AB3F109; Fri, 23 Apr 2010 15:39:56 -0400 (EDT) Received: from pch.mit.edu (pch.mit.edu [127.0.0.1]) by pch.mit.edu (8.13.6/8.12.8) with ESMTP id o3NJduvp028661; Fri, 23 Apr 2010 15:39:56 -0400 Received: from mailhub-dmz-1.mit.edu (MAILHUB-DMZ-1.MIT.EDU [18.9.21.41]) by pch.mit.edu (8.13.6/8.12.8) with ESMTP id o3NFKuBY010974 for ; Fri, 23 Apr 2010 11:20:56 -0400 Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by mailhub-dmz-1.mit.edu (8.13.8/8.9.2) with ESMTP id o3NFJoRf010784 for ; Fri, 23 Apr 2010 11:20:56 -0400 X-Auditid: 12074423-b7c0bae0000030f0-f7-4bd1bad7b1d8 Received: from homiemail-a12.g.dreamhost.com (Unknown_Domain [208.97.132.83]) by dmz-mailsec-scanner-6.mit.edu (Symantec Brightmail Gateway) with SMTP id 74.48.12528.8DAB1DB4; Fri, 23 Apr 2010 11:20:56 -0400 (EDT) Received: from [192.168.1.4] (pool-96-254-109-43.tampfl.fios.verizon.net [96.254.109.43]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jblaine@kickflop.net) by homiemail-a12.g.dreamhost.com (Postfix) with ESMTPSA id 2C9D0714070 for ; Fri, 23 Apr 2010 08:20:55 -0700 (PDT) Message-ID: <4BD1BACA.90001@kickflop.net> Date: Fri, 23 Apr 2010 11:20:42 -0400 From: Jeff Blaine User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: krb5-bugs@mit.edu Subject: Small kdc/kdc_preauth.c mods for your consideration Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAARPZKCw= X-Mailman-Approved-At: Fri, 23 Apr 2010 15:39:55 -0400 X-Beenthere: krb5-bugs-incoming@mailman.mit.edu X-Mailman-Version: 2.1.6 Precedence: list Sender: krb5-bugs-incoming-bounces@PCH.mit.edu Errors-To: krb5-bugs-incoming-bounces@PCH.mit.edu X-RT-Original-Encoding: iso-8859-1 Content-Length: 2345 As usual, don't assume I have any clue, but I am trying to fold what I consider small worthwhile changes into future releases. In order as seen in the diff: * Log the static preauth mechs that have been found to be "valid" * Log the dynamic preauth mechs that have been found to be "valid" * Check against NULL, not 0, per the calloc()/malloc() man page. A nitpick. * Set length to 0, not NULL. This cleared up a gcc warning, so maybe it's right... --- ../../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 11:13:16.000000000 -0400 @@ -490,6 +490,9 @@ ((*server_init_proc)(context, &plugin_context, (const char **)kdc_realm_names) != 0)) { memset(&preauth_systems[k], 0, sizeof(preauth_systems[k])); + krb5_klog_syslog (LOG_INFO, + "Static preauth mechanism %s valid for use.", + static_preauth_systems[i].name); continue; } preauth_systems[k].plugin_context = plugin_context; @@ -537,6 +540,9 @@ } preauth_systems[k].name = ftable->name; preauth_systems[k].type = ftable->pa_type_list[j]; + krb5_klog_syslog (LOG_INFO, + "Dynamic preauth mechanism %s valid for use.", + preauth_systems[k].name); if (ftable->flags_proc != NULL) preauth_systems[k].flags = ftable->flags_proc(context, preauth_systems[k].type); @@ -1006,8 +1012,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 +1337,7 @@ } key_modified = FALSE; null_item.contents = NULL; - null_item.length = NULL; + null_item.length = 0; send_pa = send_pa_list; *send_pa = 0;