From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.devel Subject: Emacs support for Heimdal vs MIT Kerberos (patch included) Date: Tue, 5 Aug 2008 17:24:48 +0200 Message-ID: <18584.28864.366705.285809@a1i15.kph.uni-mainz.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217950008 8145 80.91.229.12 (5 Aug 2008 15:26:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2008 15:26:48 +0000 (UTC) Cc: mueli@gentoo.org, emacs@gentoo.org To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 05 17:27:38 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KQORl-0006TN-5M for ged-emacs-devel@m.gmane.org; Tue, 05 Aug 2008 17:27:37 +0200 Original-Received: from localhost ([127.0.0.1]:57840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQOQp-0002HD-Ti for ged-emacs-devel@m.gmane.org; Tue, 05 Aug 2008 11:26:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQOPJ-0000Kg-1d for emacs-devel@gnu.org; Tue, 05 Aug 2008 11:25:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQOPH-0000Ii-V2 for emacs-devel@gnu.org; Tue, 05 Aug 2008 11:25:04 -0400 Original-Received: from [199.232.76.173] (port=41567 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQOPH-0000IU-EA for emacs-devel@gnu.org; Tue, 05 Aug 2008 11:25:03 -0400 Original-Received: from a1iwww1.kph.uni-mainz.de ([134.93.134.1]:57152) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KQOPH-0008CB-2j for emacs-devel@gnu.org; Tue, 05 Aug 2008 11:25:03 -0400 Original-Received: from a1i15.kph.uni-mainz.de (a1i15.kph.uni-mainz.de [134.93.134.92]) by a1iwww1.kph.uni-mainz.de (8.14.0/8.13.4) with ESMTP id m75FOoF6021746; Tue, 5 Aug 2008 17:24:50 +0200 Original-Received: from a1i15.kph.uni-mainz.de (localhost [127.0.0.1]) by a1i15.kph.uni-mainz.de (8.14.2/8.13.4) with ESMTP id m75FOn7G011263; Tue, 5 Aug 2008 17:24:50 +0200 Original-Received: (from ulm@localhost) by a1i15.kph.uni-mainz.de (8.14.2/8.14.2/Submit) id m75FOn48011257; Tue, 5 Aug 2008 17:24:49 +0200 X-Mailer: VM 8.0.9 under Emacs 22.2.1 (i686-pc-linux-gnu) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:102095 Archived-At: [I had sent this patch already in April, but the message was lost or ignored.] >From Gentoo Bug 215558, : Emacs 22.2 (or rather movemail / pop.c) can only be build with MIT Kerberos but not with Heimdal. Briefly (credits to Michael Hammer): > Here is the definition of the krb5_error struct in mit-krb5 which > seems compatible with emacs-22.2: > typedef struct _krb5_error { > [...] > krb5_data text; /* descriptive text */ > krb5_data e_data; /* additional error-describing data */ > } krb5_error; > and here is the heimdal code. You can see that the struct members > are named differently: > typedef struct KRB_ERROR { > [...] > heim_general_string *e_text; > heim_octet_string *e_data; > } KRB_ERROR; > You can see the difference: > krb5_data text; <-> heim_general_string *e_text; > --- > text <-> e_text Attached patch will make pop.c properly compile/link with the Heimdal headers and library. For the MIT-Kerberos case the resulting code is equivalent, so I think that this should be included into the Emacs 22 branch. Ulrich emacs/ChangeLog: 2008-04-02 Ulrich Mueller * configure.in: Add checks for krb5_error.text and krb5_error.e_text struct members. emacs/lib-src/ChangeLog: 2008-04-02 Ulrich Mueller * pop.c (socket_connection): Add conditionals for HAVE_KRB5_ERROR_TEXT and HAVE_KRB5_ERROR_E_TEXT to support compilation with MIT Kerberos and Heimdal, respectively. --- emacs-22.2-orig/configure.in 2008-04-02 18:28:37.000000000 +0200 +++ emacs-22.2/configure.in 2008-04-02 22:18:38.000000000 +0200 @@ -2700,7 +2700,9 @@ fi if test "${with_kerberos5+set}" = set; then - AC_CHECK_HEADERS(krb5.h) + AC_CHECK_HEADERS(krb5.h, + AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text],,, + [#include ])) else AC_CHECK_HEADERS(des.h,, [AC_CHECK_HEADERS(kerberosIV/des.h,, --- emacs-22.2-orig/lib-src/pop.c 2008-02-23 14:49:00.000000000 +0100 +++ emacs-22.2/lib-src/pop.c 2008-04-02 22:35:55.000000000 +0200 @@ -1200,11 +1200,12 @@ krb5_free_principal (kcontext, server); if (rem) { + strcpy (pop_error, KRB_ERROR); + strncat (pop_error, error_message (rem), + ERROR_MAX - sizeof (KRB_ERROR)); +#if defined HAVE_KRB5_ERROR_TEXT if (err_ret && err_ret->text.length) { - strcpy (pop_error, KRB_ERROR); - strncat (pop_error, error_message (rem), - ERROR_MAX - sizeof (KRB_ERROR)); strncat (pop_error, " [server says '", ERROR_MAX - strlen (pop_error) - 1); strncat (pop_error, err_ret->text.data, @@ -1213,12 +1214,17 @@ strncat (pop_error, "']", ERROR_MAX - strlen (pop_error) - 1); } - else +#elif defined HAVE_KRB5_ERROR_E_TEXT + if (err_ret && err_ret->e_text && strlen(*err_ret->e_text)) { - strcpy (pop_error, KRB_ERROR); - strncat (pop_error, error_message (rem), - ERROR_MAX - sizeof (KRB_ERROR)); + strncat (pop_error, " [server says '", + ERROR_MAX - strlen (pop_error) - 1); + strncat (pop_error, *err_ret->e_text, + ERROR_MAX - strlen (pop_error) - 1); + strncat (pop_error, "']", + ERROR_MAX - strlen (pop_error) - 1); } +#endif if (err_ret) krb5_free_error (kcontext, err_ret); krb5_auth_con_free (kcontext, auth_context);