<<< Date Index >>>     <<< Thread Index >>>

PKA for Mutt



Hello all,

i have worked on PKA support for Mutt.  Seems to work so far, would be
great if it could be integrated into CVS.  It probably needs some more
work (review, testing, etc.), though.

I have attached two patches:

mutt-pka.diff: this contains the PKA support implementation.
mutt-gpgme.diff: this contains gpgme/build-relevant fixes for Makefile
and configure.in (e.g., defining HAVE_GPGME_PKA_TRUST).

Thanks!
Moritz

ChangeLog:

2006-11-01  Moritz Schulte  <moritz@xxxxxxxxxxx>

        * Makefile.am: Use $(GPGME_CFLAGS) instead of
$(LIBGPGME_CFLAGS).
        * configure.in: Replaced self-hacked GPGME checking code with
        "standard code", also take care of defining
HAVE_GPGME_PKA_TRUST.

        * init.h: Add new use_pka option.

        * crypt.c (mutt_protect): Call
        crypt_smime_set_sender/crypt_pgp_set_sender when necessary.

        * crypt-gpgme.c (PKA_NOTATION_NAME): New symbol definition.
        (is_pka_notation): New macro.

        (show_sig_summary): New parameter:
        gpgme_signature_t sig (for printing the pka address), adjust
        caller (show_one_sig_status).
        (verify_one): Adjust notation printing code so that PKA
notations
        are skipped.
        (encrypt_gpgme_object): Change type of ERR from int to
        gpgme_error_t.
        (set_pka_sig_notation): New function.
        (encrypt_gpgme_object): In case signing is desired and PKA is
        enabled, call set_pka_sig_notation on gpgme context before
        encrypting/signing.
        (sign_message): Call set_pka_sig_notation on gpgme context in
case
        PKA is enabled.
        (show_sig_summary): Evaluate PKA related data in signature
object
        and write out according information with state_attach_puts.

        * crypt-gpgme.h (gpgme_set_sender): Declare function.

        * mutt_crypt.h: Insert function declarations for
        crypt_pgp_set_sender and crypt_smime_set_sender.

        * cryptglue.c (crypt_pgp_set_sender, crypt_smime_set_sender):
New
        functions, calling the set_sender module function.

        * crypt-mod-smime-gpgme.c (crypt_mod_smime_gpgme): Fill new
        set_sender member with NULL.
        * crypt-mod-smime-classic.c (crypt_mod_smime_classic): Fill new
        set_sender member with NULL.

        * crypt-mod-pgp-gpgme.c (crypt_mod_pgp_set_sender): New
function,
        call gpgme_set_sender.
        (crypt_mod_pgp_gpgme): Fill new set_sender member with
        crypt_mod_pgp_set_sender.

        * crypt-mod-pgp-classic.c (crypt_mod_pgp_classic): Fill new
        set_sender member with NULL.

        * crypt-mod.h (crypt_func_set_sender_t): New function type.
        (crypt_module_functions): New member: set_sender.

        * mutt.h: New option: OPTCRYPTUSEPKA.

2006-11-01  Moritz Schulte  <moritz@xxxxxxxxxxx>

        * crypt.c (mutt_protect): Call
        crypt_smime_set_sender/crypt_pgp_set_sender when necessary.

        * crypt-gpgme.c (PKA_NOTATION_NAME): New symbol definition.
        (is_pka_notation): New macro.

        (show_sig_summary): New parameter:
        gpgme_signature_t sig (for printing the pka address), adjust
        caller (show_one_sig_status).
        (verify_one): Adjust notation printing code so that PKA notations
        are skipped.
        (encrypt_gpgme_object): Change type of ERR from int to
        gpgme_error_t.
        (set_pka_sig_notation): New function.
        (encrypt_gpgme_object): In case signing is desired and PKA is
        enabled, call set_pka_sig_notation on gpgme context before
        encrypting/signing.
        (sign_message): Call set_pka_sig_notation on gpgme context in case
        PKA is enabled.
        (show_sig_summary): Evaluate PKA related data in signature object
        and write out according information with state_attach_puts.

        * crypt-gpgme.h (gpgme_set_sender): Declare function.

        * mutt_crypt.h: Insert function declarations for
        crypt_pgp_set_sender and crypt_smime_set_sender.

        * cryptglue.c (crypt_pgp_set_sender, crypt_smime_set_sender): New
        functions, calling the set_sender module function.

        * crypt-mod-smime-gpgme.c (crypt_mod_smime_gpgme): Fill new
        set_sender member with NULL.
        * crypt-mod-smime-classic.c (crypt_mod_smime_classic): Fill new
        set_sender member with NULL.

        * crypt-mod-pgp-gpgme.c (crypt_mod_pgp_set_sender): New function,
        call gpgme_set_sender.
        (crypt_mod_pgp_gpgme): Fill new set_sender member with
        crypt_mod_pgp_set_sender.

        * crypt-mod-pgp-classic.c (crypt_mod_pgp_classic): Fill new
        set_sender member with NULL.

        * crypt-mod.h (crypt_func_set_sender_t): New function type.
        (crypt_module_functions): New member: set_sender.

        * mutt.h: New option: OPTCRYPTUSEPKA.

Index: crypt-gpgme.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-gpgme.c,v
retrieving revision 3.10
diff -u -p -r3.10 crypt-gpgme.c
--- crypt-gpgme.c       21 Oct 2005 04:35:37 -0000      3.10
+++ crypt-gpgme.c       1 Nov 2006 18:24:58 -0000
@@ -71,6 +71,10 @@
                      *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
 #define xtoi_2(p)   ((xtoi_1(p) * 16) + xtoi_1((p)+1))
 
+#define PKA_NOTATION_NAME "pka-address@xxxxxxxxx"
+#define is_pka_notation(notation) (! strcmp ((notation)->name, \
+                                            PKA_NOTATION_NAME))
+
 /* Values used for comparing addresses. */
 #define CRYPT_KV_VALID    1
 #define CRYPT_KV_ADDR     2
@@ -115,6 +119,8 @@ typedef struct crypt_entry
 
 static struct crypt_cache *id_defaults = NULL;
 static gpgme_key_t signature_key = NULL;
+static char *current_sender = NULL;
+
 
 /*
  * General helper functions.
@@ -661,6 +667,23 @@ static int set_signer (gpgme_ctx_t ctx, 
   return 0;
 }
 
+static gpgme_error_t
+set_pka_sig_notation (gpgme_ctx_t ctx)
+{
+  gpgme_error_t err;
+
+  err = gpgme_sig_notation_add (ctx,
+                               PKA_NOTATION_NAME, current_sender, 0);
+
+  if (err)
+    {
+      mutt_error (_("error setting PKA signature notation: %s\n"),
+                 gpgme_strerror (err));
+      mutt_sleep (2);
+    }
+
+  return err;
+}
 
 /* Encrypt the gpgme data object PLAINTEXT to the recipients in RSET
    and return an allocated filename to a temporary file containing the
@@ -670,7 +693,7 @@ static int set_signer (gpgme_ctx_t ctx, 
 static char *encrypt_gpgme_object (gpgme_data_t plaintext, gpgme_key_t *rset,
                                    int use_smime, int combined_signed)
 {
-  int err;
+  gpgme_error_t err;
   gpgme_ctx_t ctx;
   gpgme_data_t ciphertext;
   char *outfile;
@@ -689,6 +712,18 @@ static char *encrypt_gpgme_object (gpgme
           gpgme_release (ctx);
           return NULL;
         }
+
+      if (option (OPTCRYPTUSEPKA))
+       {
+         err = set_pka_sig_notation (ctx);
+         if (err)
+           {
+             gpgme_data_release (ciphertext);
+             gpgme_release (ctx);
+             return NULL;
+           }
+       }
+
       err = gpgme_op_encrypt_sign (ctx, rset, GPGME_ENCRYPT_ALWAYS_TRUST,
                                    plaintext, ciphertext);
     }
@@ -788,6 +823,18 @@ static BODY *sign_message (BODY *a, int 
       return NULL;
     }
 
+  if (option (OPTCRYPTUSEPKA))
+    {
+      err = set_pka_sig_notation (ctx);
+      if (err)
+       {
+         gpgme_data_release (signature);
+         gpgme_data_release (message);
+         gpgme_release (ctx);
+         return NULL;
+       }
+    }
+
   err = gpgme_op_sign (ctx, message, signature, GPGME_SIG_MODE_DETACH );
   mutt_need_hard_redraw ();
   gpgme_data_release (message);
@@ -984,7 +1031,7 @@ BODY *smime_gpgme_build_smime_entity (BO
  */
 static int show_sig_summary (unsigned long sum,
                               gpgme_ctx_t ctx, gpgme_key_t key, int idx,
-                              STATE *s)
+                              STATE *s, gpgme_signature_t sig)
 {
   int severe = 0;
 
@@ -1080,6 +1127,27 @@ static int show_sig_summary (unsigned lo
       state_attach_puts ("\n", s);
     }
 
+#ifdef HAVE_GPGME_PKA_TRUST
+
+  if (option (OPTCRYPTUSEPKA))
+    {
+      if (sig->pka_trust == 1 && sig->pka_address)
+       {
+         state_attach_puts (_("WARNING: PKA entry does not match "
+                              "signer's address: "), s);
+         state_attach_puts (sig->pka_address, s);
+         state_attach_puts ("\n", s);
+       }
+      else if (sig->pka_trust == 2 && sig->pka_address)
+       {
+         state_attach_puts (_("PKA verified signer's address is: "), s);
+         state_attach_puts (sig->pka_address, s);
+         state_attach_puts ("\n", s);
+       }
+    }
+
+#endif
+
   return severe;
 }
 
@@ -1259,7 +1327,7 @@ static int show_one_sig_status (gpgme_ct
          state_attach_puts (_("            created: "), s);
          print_time (created, s);
          state_attach_puts ("\n", s);
-         if (show_sig_summary (sum, ctx, key, idx, s))
+         if (show_sig_summary (sum, ctx, key, idx, s, sig))
            anywarn = 1;
          show_one_sig_validity (ctx, idx, s);
        }
@@ -1268,7 +1336,7 @@ static int show_one_sig_status (gpgme_ct
          state_attach_puts (_("*BAD* signature claimed to be from: "), s);
          state_attach_puts (uid, s);
          state_attach_puts ("\n", s);
-         show_sig_summary (sum, ctx, key, idx, s);
+         show_sig_summary (sum, ctx, key, idx, s, sig);
        }
       else if (!anybad && key && (key->protocol == GPGME_PROTOCOL_OpenPGP))
        { /* We can't decide (yellow) but this is a PGP key with a good
@@ -1283,14 +1351,14 @@ static int show_one_sig_status (gpgme_ct
          state_attach_puts ("\n", s);
          show_one_sig_validity (ctx, idx, s);
          show_fingerprint (key,s);
-         if (show_sig_summary (sum, ctx, key, idx, s))
+         if (show_sig_summary (sum, ctx, key, idx, s, sig))
            anywarn = 1;
        }
       else /* can't decide (yellow) */
        {
          state_attach_puts (_("Error checking signature"), s);
          state_attach_puts ("\n", s);
-         show_sig_summary (sum, ctx, key, idx, s);
+         show_sig_summary (sum, ctx, key, idx, s, sig);
        }
 
       if (key != signature_key)
@@ -1372,6 +1440,7 @@ static int verify_one (BODY *sigbdy, STA
       gpgme_verify_result_t result;
       gpgme_sig_notation_t notation;
       gpgme_signature_t signature;
+      int non_pka_notations;
 
       result = gpgme_op_verify_result (ctx);
       if (result)
@@ -1379,7 +1448,13 @@ static int verify_one (BODY *sigbdy, STA
        for (signature = result->signatures; signature;
              signature = signature->next)
        {
-         if (signature->notations)
+         non_pka_notations = 0;
+         for (notation = signature->notations; notation;
+              notation = notation->next)
+           if (! is_pka_notation (notation))
+             non_pka_notations++;
+
+         if (non_pka_notations)
          {
            char buf[SHORT_STRING];
            snprintf (buf, sizeof (buf),
@@ -1389,6 +1464,9 @@ static int verify_one (BODY *sigbdy, STA
            for (notation = signature->notations; notation;
                  notation = notation->next)
            {
+             if (is_pka_notation (notation))
+               continue;
+
              if (notation->name)
              {
                state_attach_puts (notation->name, s);
@@ -4266,4 +4344,12 @@ int smime_gpgme_verify_sender (HEADER *h
   return verify_sender (h, GPGME_PROTOCOL_CMS);
 }
 
+void gpgme_set_sender (const char *sender)
+{
+  mutt_error ("[setting sender] mailbox: %s\n", sender);
+  FREE (&current_sender);
+  current_sender = safe_strdup (sender);
+}
+
+
 #endif
Index: crypt-gpgme.h
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-gpgme.h,v
retrieving revision 3.4
diff -u -p -r3.4 crypt-gpgme.h
--- crypt-gpgme.h       17 Sep 2005 20:46:10 -0000      3.4
+++ crypt-gpgme.h       1 Nov 2006 18:24:58 -0000
@@ -51,4 +51,7 @@ int pgp_gpgme_send_menu (HEADER *msg, in
 int smime_gpgme_send_menu (HEADER *msg, int *redraw);
 
 int smime_gpgme_verify_sender (HEADER *h);
+
+void gpgme_set_sender (const char *sender);
+
 #endif
Index: crypt-mod-pgp-classic.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-mod-pgp-classic.c,v
retrieving revision 3.5
diff -u -p -r3.5 crypt-mod-pgp-classic.c
--- crypt-mod-pgp-classic.c     17 Sep 2005 20:46:10 -0000      3.5
+++ crypt-mod-pgp-classic.c     1 Nov 2006 18:24:58 -0000
@@ -119,6 +119,7 @@ struct crypt_module_specs crypt_mod_pgp_
       crypt_mod_pgp_sign_message,
       crypt_mod_pgp_verify_one,
       crypt_mod_pgp_send_menu,
+      NULL,
 
       crypt_mod_pgp_encrypt_message,
       crypt_mod_pgp_make_key_attachment,
Index: crypt-mod-pgp-gpgme.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-mod-pgp-gpgme.c,v
retrieving revision 3.5
diff -u -p -r3.5 crypt-mod-pgp-gpgme.c
--- crypt-mod-pgp-gpgme.c       17 Sep 2005 20:46:10 -0000      3.5
+++ crypt-mod-pgp-gpgme.c       1 Nov 2006 18:24:58 -0000
@@ -90,6 +90,11 @@ static BODY *crypt_mod_pgp_encrypt_messa
   return pgp_gpgme_encrypt_message (a, keylist, sign);
 }
 
+static void crypt_mod_pgp_set_sender (const char *sender)
+{
+  gpgme_set_sender (sender);
+}
+
 struct crypt_module_specs crypt_mod_pgp_gpgme =
   { APPLICATION_PGP,
     {
@@ -104,6 +109,7 @@ struct crypt_module_specs crypt_mod_pgp_
       crypt_mod_pgp_sign_message,
       crypt_mod_pgp_verify_one,
       crypt_mod_pgp_send_menu,
+      crypt_mod_pgp_set_sender,
 
       /* PGP specific.  */
       crypt_mod_pgp_encrypt_message,
Index: crypt-mod-smime-classic.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-mod-smime-classic.c,v
retrieving revision 3.5
diff -u -p -r3.5 crypt-mod-smime-classic.c
--- crypt-mod-smime-classic.c   17 Sep 2005 20:46:10 -0000      3.5
+++ crypt-mod-smime-classic.c   1 Nov 2006 18:24:58 -0000
@@ -100,6 +100,7 @@ struct crypt_module_specs crypt_mod_smim
       crypt_mod_smime_sign_message,
       crypt_mod_smime_verify_one,
       crypt_mod_smime_send_menu,
+      NULL,
 
       NULL,                    /* pgp_encrypt_message */
       NULL,                    /* pgp_make_key_attachment */
Index: crypt-mod-smime-gpgme.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-mod-smime-gpgme.c,v
retrieving revision 3.5
diff -u -p -r3.5 crypt-mod-smime-gpgme.c
--- crypt-mod-smime-gpgme.c     17 Sep 2005 20:46:10 -0000      3.5
+++ crypt-mod-smime-gpgme.c     1 Nov 2006 18:24:58 -0000
@@ -98,6 +98,7 @@ struct crypt_module_specs crypt_mod_smim
       crypt_mod_smime_sign_message,
       crypt_mod_smime_verify_one,
       crypt_mod_smime_send_menu,
+      NULL,
 
       NULL,                    /* pgp_encrypt_message */
       NULL,                    /* pgp_make_key_attachment */
Index: crypt-mod.h
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-mod.h,v
retrieving revision 3.4
diff -u -p -r3.4 crypt-mod.h
--- crypt-mod.h 17 Sep 2005 20:46:10 -0000      3.4
+++ crypt-mod.h 1 Nov 2006 18:24:58 -0000
@@ -67,6 +67,7 @@ typedef void (*crypt_func_smime_invoke_i
 
 typedef void (*crypt_func_init_t) (void);
 
+typedef void (*crypt_func_set_sender_t) (const char *sender);
 
 /*
    A structure to keep all crypto module fucntions together.
@@ -84,6 +85,7 @@ typedef struct crypt_module_functions
   crypt_func_sign_message_t sign_message;
   crypt_func_verify_one_t verify_one;
   crypt_func_send_menu_t send_menu;
+  crypt_func_set_sender_t set_sender;
 
   /* PGP specific functions.  */
   crypt_func_pgp_encrypt_message_t pgp_encrypt_message;
Index: crypt.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt.c,v
retrieving revision 3.34
diff -u -p -r3.34 crypt.c
--- crypt.c     8 Jun 2006 11:38:08 -0000       3.34
+++ crypt.c     1 Nov 2006 18:25:00 -0000
@@ -169,6 +169,18 @@ int mutt_protect (HEADER *msg, char *key
   if ((WithCrypto & APPLICATION_PGP))
     tmp_pgp_pbody   = msg->content;
 
+  if (option (OPTCRYPTUSEPKA) && (msg->security & SIGN))
+    {
+      /* Set sender (necessary for e.g. PKA).  */
+
+      if ((WithCrypto & APPLICATION_SMIME)
+         && (msg->security & APPLICATION_SMIME))
+       crypt_smime_set_sender (msg->env->from->mailbox);
+      else if ((WithCrypto & APPLICATION_PGP)
+         && (msg->security & APPLICATION_PGP))
+       crypt_pgp_set_sender (msg->env->from->mailbox);
+    }
+
   if (msg->security & SIGN)
   {
     if ((WithCrypto & APPLICATION_SMIME)
Index: cryptglue.c
===================================================================
RCS file: /home/roessler/cvs/mutt/cryptglue.c,v
retrieving revision 3.10
diff -u -p -r3.10 cryptglue.c
--- cryptglue.c 13 Jun 2006 07:52:52 -0000      3.10
+++ cryptglue.c 1 Nov 2006 18:25:00 -0000
@@ -260,8 +260,15 @@ void crypt_pgp_extract_keys_from_attachm
     (CRYPT_MOD_CALL (PGP, pgp_extract_keys_from_attachment_list)) (fp, tag, 
top);
 }
 
+void crypt_pgp_set_sender (const char *sender)
+{
+  if (CRYPT_MOD_CALL_CHECK (PGP, set_sender))
+    (CRYPT_MOD_CALL (PGP, set_sender)) (sender);
+}
+
 
 
+
 /* 
 
    S/MIME 
@@ -376,3 +383,9 @@ int crypt_smime_send_menu (HEADER *msg, 
 
   return 0;
 }
+
+void crypt_smime_set_sender (const char *sender)
+{
+  if (CRYPT_MOD_CALL_CHECK (SMIME, set_sender))
+    (CRYPT_MOD_CALL (SMIME, set_sender)) (sender);
+}
Index: init.h
===================================================================
RCS file: /home/roessler/cvs/mutt/init.h,v
retrieving revision 3.103
diff -u -p -r3.103 init.h
--- init.h      11 Aug 2006 09:08:20 -0000      3.103
+++ init.h      1 Nov 2006 18:25:03 -0000
@@ -2939,6 +2939,12 @@ struct option_t MuttVars[] = {
   ** Controls whether mutt writes out the Bcc header when preparing
   ** messages to be sent.  Exim users may wish to unset this.
   */
+  /*
+  ** .pp Controls wether Mutt uses PKA
+  ** (http://www.g10code.de/docs/pka-intro.de.pdf) during signature
+  ** verification (only supported by the GPGME backend).
+  */
+  { "use_pka", DT_BOOL, R_NONE, OPTCRYPTUSEPKA, 0 },
   /*--*/
   { NULL }
 };
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.68
diff -u -p -r3.68 mutt.h
--- mutt.h      15 Aug 2006 17:08:32 -0000      3.68
+++ mutt.h      1 Nov 2006 18:25:03 -0000
@@ -451,6 +451,7 @@ enum
   OPTXMAILER,
 
   OPTCRYPTUSEGPGME,
+  OPTCRYPTUSEPKA,
 
   /* PGP options */
   
Index: mutt_crypt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt_crypt.h,v
retrieving revision 3.12
diff -u -p -r3.12 mutt_crypt.h
--- mutt_crypt.h        20 Apr 2006 16:46:49 -0000      3.12
+++ mutt_crypt.h        1 Nov 2006 18:25:03 -0000
@@ -220,7 +220,7 @@ char *crypt_pgp_keyid (pgp_key_t k);
 /* fixme: needs documentation */
 void crypt_pgp_extract_keys_from_attachment_list (FILE *fp, int tag,BODY *top);
 
-
+void crypt_pgp_set_sender (const char *sender);
 
 
 
@@ -259,6 +259,8 @@ void crypt_smime_invoke_import (char *in
 
 int crypt_smime_send_menu (HEADER *msg, int *redraw);
 
+void crypt_smime_set_sender (const char *sender);
+
 /* fixme: needs documentation */
 int crypt_smime_verify_one (BODY *sigbdy, STATE *s, const char *tempf);
 
2006-11-01  Moritz Schulte  <moritz@xxxxxxxxxxx>

        * Makefile.am: Use $(GPGME_CFLAGS) instead of $(LIBGPGME_CFLAGS).
        * configure.in: Replaced self-hacked GPGME checking code with
        "standard code", also take care of defining HAVE_GPGME_PKA_TRUST.

Index: Makefile.am
===================================================================
RCS file: /home/roessler/cvs/mutt/Makefile.am,v
retrieving revision 3.50
diff -u -p -r3.50 Makefile.am
--- Makefile.am 8 Sep 2006 15:45:57 -0000       3.50
+++ Makefile.am 1 Nov 2006 18:24:56 -0000
@@ -32,7 +32,7 @@ mutt_SOURCES = $(BUILT_SOURCES) \
        url.c ascii.c mutt_idna.c crypt-mod.c crypt-mod.h
 
 mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
-       $(INTLLIBS) $(LIBICONV)  $(LIBGPGME_LIBS)
+       $(INTLLIBS) $(LIBICONV)  $(GPGME_LIBS)
 
 mutt_DEPENDENCIES = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAPDEPS) \
        $(INTLDEPS)
@@ -52,7 +52,7 @@ DEFS=-DPKGDATADIR=\"$(pkgdatadir)\" -DSY
        -DBINDIR=\"$(bindir)\" -DMUTTLOCALEDIR=\"$(datadir)/locale\" \
        -DHAVE_CONFIG_H=1
 
-AM_CPPFLAGS=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(LIBGPGME_CFLAGS) -Iintl
+AM_CPPFLAGS=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(GPGME_CFLAGS) -Iintl
 
 CPPFLAGS=@CPPFLAGS@ -I$(includedir)
 
Index: configure.in
===================================================================
RCS file: /home/roessler/cvs/mutt/configure.in,v
retrieving revision 3.56
diff -u -p -r3.56 configure.in
--- configure.in        1 Sep 2006 19:26:39 -0000       3.56
+++ configure.in        1 Nov 2006 18:24:56 -0000
@@ -107,31 +107,31 @@ AC_DEFINE_UNQUOTED(SENDMAIL,"$ac_cv_path
 
 OPS='$(srcdir)/OPS'
 
+AC_MSG_CHECKING([whether to build with GPGME support])
 AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--enable-gpgme], [Enable GPGME support]),
 [       if test x$enableval = xyes; then
-               have_gpgme=yes
+               enable_gpgme=yes
        fi
 ])
-AC_ARG_WITH(gpgme-prefix, AC_HELP_STRING([--with-gpgme-prefix=PFX], [prefix 
where GPGME is installed (optional)]),
-gpgme_config_prefix="$withval", gpgme_config_prefix="")
 
-if test x$have_gpgme = xyes; then
-       if test x$gpgme_config_prefix != x; then
-               GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config"
-       else
-               AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
-       fi
-       if test "x$GPGME_CONFIG" = "xno"; then
-               AC_MSG_ERROR([GPGME not found])
-       else
-               LIBGPGME_CFLAGS=`$GPGME_CONFIG --cflags`
-               LIBGPGME_LIBS=`$GPGME_CONFIG --libs`
-               MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt-gpgme.o 
crypt-mod-pgp-gpgme.o crypt-mod-smime-gpgme.o"
-               AC_DEFINE(CRYPT_BACKEND_GPGME, 1, [Defined, if GPGME support is 
enabled])
-       fi
+if test x"$enable_gpgme" = xyes; then
+   AC_MSG_RESULT(yes)
+   AM_PATH_GPGME(1.0.0, AC_DEFINE(CRYPT_BACKEND_GPGME, 1,
+                [Defined, if GPGME support is enabled]),
+                [gpgme_found=no])
+   if test x"$gpgme_found" = xno; then
+      AC_MSG_ERROR([*** GPGME not found ***])
+   else
+      AM_PATH_GPGME(1.1.1, AC_DEFINE(HAVE_GPGME_PKA_TRUST, 1,
+                                 [Define if GPGME supports PKA]))
+      #needed to get GPGME_LIBS and al correctly
+      AM_PATH_GPGME(1.0.0, AC_DEFINE(CRYPT_BACKEND_GPGME, 1,
+                    [Define if you use GPGME to support OpenPGP]))
+      MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS crypt-gpgme.o crypt-mod-pgp-gpgme.o 
crypt-mod-smime-gpgme.o"
+   fi
+else
+   AC_MSG_RESULT([no])
 fi
-AC_SUBST(LIBGPGME_CFLAGS)
-AC_SUBST(LIBGPGME_LIBS)
 
 AC_ARG_ENABLE(pgp, AC_HELP_STRING([--disable-pgp], [Disable PGP support]),
 [       if test x$enableval = xno ; then

Attachment: signature.asc
Description: This is a digitally signed message part