unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ulrich Mueller <ulm@gentoo.org>
To: emacs-devel@gnu.org
Cc: mueli@gentoo.org, emacs@gentoo.org
Subject: Emacs support for Heimdal vs MIT Kerberos (patch included)
Date: Tue, 5 Aug 2008 17:24:48 +0200	[thread overview]
Message-ID: <18584.28864.366705.285809@a1i15.kph.uni-mainz.de> (raw)

[I had sent this patch already in April, but the message was lost or ignored.]

From Gentoo Bug 215558, <http://bugs.gentoo.org/show_bug.cgi?id=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  <ulm@gentoo.org>

	* configure.in: Add checks for krb5_error.text and
	krb5_error.e_text struct members.

emacs/lib-src/ChangeLog:
2008-04-02  Ulrich Mueller  <ulm@gentoo.org>

	* 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 <krb5.h>]))
   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);




             reply	other threads:[~2008-08-05 15:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 15:24 Ulrich Mueller [this message]
2008-08-05 18:08 ` Emacs support for Heimdal vs MIT Kerberos (patch included) Chong Yidong
2008-08-05 23:22   ` Ulrich Mueller
2008-08-05 23:45     ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18584.28864.366705.285809@a1i15.kph.uni-mainz.de \
    --to=ulm@gentoo.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs@gentoo.org \
    --cc=mueli@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).