]> granicus.if.org Git - mutt/commitdiff
Remove make_key_attachment parameter.
authorKevin McCarthy <kevin@8t8.us>
Sun, 20 Oct 2019 06:06:24 +0000 (14:06 +0800)
committerKevin McCarthy <kevin@8t8.us>
Sun, 20 Oct 2019 07:08:06 +0000 (15:08 +0800)
The parameter is not actually used anywhere.  The next commit will
convert the classic pgp implementation to use the buffer pool.  This
change will simplify the logic.

compose.c
crypt-gpgme.c
crypt-gpgme.h
crypt-mod-pgp-classic.c
crypt-mod-pgp-gpgme.c
crypt-mod.h
cryptglue.c
mutt_crypt.h
pgp.h
pgpkey.c
send.c

index 484435f4dacb5635356671c59f32f3606fc52f66..c0a3f6d01a46b28d3d69032faf594392722905a6 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1053,7 +1053,7 @@ int mutt_compose_menu (HEADER *msg,   /* structure for new message */
           break;
 
        new = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
-       if ((new->content = crypt_pgp_make_key_attachment(NULL)) != NULL)
+       if ((new->content = crypt_pgp_make_key_attachment()) != NULL)
        {
          update_idx (menu, actx, new);
          menu->redraw |= REDRAW_INDEX;
index 697da3f51d5d217de3c1c864e7efb2dc93a2f331..35441d2cc557e178cefed458871fcb3de118167f 100644 (file)
@@ -5157,7 +5157,7 @@ cleanup:
   return rv;
 }
 
-BODY *pgp_gpgme_make_key_attachment (char *tempf)
+BODY *pgp_gpgme_make_key_attachment (void)
 {
   crypt_key_t *key = NULL;
   gpgme_ctx_t context = NULL;
@@ -5166,6 +5166,7 @@ BODY *pgp_gpgme_make_key_attachment (char *tempf)
   gpgme_error_t err;
   BODY *att = NULL;
   char buff[LONG_STRING];
+  char *attfilename;
   struct stat sb;
 
   unset_option (OPTPGPCHECKTRUST);
@@ -5188,13 +5189,13 @@ BODY *pgp_gpgme_make_key_attachment (char *tempf)
     goto bail;
   }
 
-  tempf = data_object_to_tempfile (keydata, tempf, NULL);
-  if (!tempf)
+  attfilename = data_object_to_tempfile (keydata, NULL, NULL);
+  if (!attfilename)
     goto bail;
 
   att = mutt_new_body ();
-  /* tempf is a newly allocated string, so this is correct: */
-  att->filename = tempf;
+  /* attfilename is a newly allocated string, so this is correct: */
+  att->filename = attfilename;
   att->unlink = 1;
   att->use_disp = 0;
   att->type = TYPEAPPLICATION;
@@ -5207,7 +5208,7 @@ BODY *pgp_gpgme_make_key_attachment (char *tempf)
   att->description = safe_strdup (buff);
   mutt_update_encoding (att);
 
-  stat (tempf, &sb);
+  stat (attfilename, &sb);
   att->length = sb.st_size;
 
 bail:
index 827d86a82b95d9bd55951c5ee6f7d26a7e3785e1..207bcc4f4742c0c4f6e6e049e326cc057bc360d2 100644 (file)
@@ -40,7 +40,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s);
 int smime_gpgme_application_handler (BODY *a, STATE *s);
 int pgp_gpgme_encrypted_handler (BODY *a, STATE *s);
 
-BODY *pgp_gpgme_make_key_attachment (char *tempf);
+BODY *pgp_gpgme_make_key_attachment (void);
 
 BODY *pgp_gpgme_sign_message (BODY *a);
 BODY *smime_gpgme_sign_message (BODY *a);
index 8aaaef859d982336d268dd8b6858fa01297bee61..2773a818f65d50544f37a529a8702d617deaf7b9 100644 (file)
@@ -71,9 +71,9 @@ static BODY *crypt_mod_pgp_encrypt_message (BODY *a, char *keylist, int sign)
   return pgp_encrypt_message (a, keylist, sign);
 }
 
-static BODY *crypt_mod_pgp_make_key_attachment (char *tempf)
+static BODY *crypt_mod_pgp_make_key_attachment (void)
 {
-  return pgp_make_key_attachment (tempf);
+  return pgp_make_key_attachment ();
 }
 
 static int crypt_mod_pgp_check_traditional (FILE *fp, BODY *b, int just_one)
index b10a6e0e0e9afff0d279b4b00571042ca48a6954..b2eb63773c69371375e85cfb5b3dda3139aa8e7a 100644 (file)
@@ -95,9 +95,9 @@ static BODY *crypt_mod_pgp_encrypt_message (BODY *a, char *keylist, int sign)
   return pgp_gpgme_encrypt_message (a, keylist, sign);
 }
 
-static BODY *crypt_mod_pgp_make_key_attachment (char *tempf)
+static BODY *crypt_mod_pgp_make_key_attachment (void)
 {
-  return pgp_gpgme_make_key_attachment (tempf);
+  return pgp_gpgme_make_key_attachment ();
 }
 
 static void crypt_mod_pgp_set_sender (const char *sender)
index 1a03e1fc69044c0c7cff4997056845784e457121..afce2335f5388e79ffb7ebe512eee4786f6b9601 100644 (file)
@@ -42,7 +42,7 @@ typedef int (*crypt_func_pgp_check_traditional_t) (FILE *fp, BODY *b,
                                                    int just_one);
 typedef BODY *(*crypt_func_pgp_traditional_encryptsign_t) (BODY *a, int flags,
                                                            char *keylist);
-typedef BODY *(*crypt_func_pgp_make_key_attachment_t) (char *tempf);
+typedef BODY *(*crypt_func_pgp_make_key_attachment_t) (void);
 typedef char *(*crypt_func_findkeys_t) (ADDRESS *adrlist, int oppenc_mode);
 typedef BODY *(*crypt_func_sign_message_t) (BODY *a);
 typedef BODY *(*crypt_func_pgp_encrypt_message_t) (BODY *a, char *keylist,
index d0e03167dcf4a1dd5f7e8521b60f1df02b489f0f..2cf3942ba003e679f651feebcdad861dfe61d3af 100644 (file)
@@ -243,10 +243,10 @@ BODY *crypt_pgp_traditional_encryptsign (BODY *a, int flags, char *keylist)
 }
 
 /* Generate a PGP public key attachment. */
-BODY *crypt_pgp_make_key_attachment (char *tempf)
+BODY *crypt_pgp_make_key_attachment (void)
 {
   if (CRYPT_MOD_CALL_CHECK (PGP, pgp_make_key_attachment))
-    return (CRYPT_MOD_CALL (PGP, pgp_make_key_attachment)) (tempf);
+    return (CRYPT_MOD_CALL (PGP, pgp_make_key_attachment)) ();
 
   return NULL;
 }
index 4f20e7da38b51aba712c46e420e0ca2daf5e4e31..ea0337a5a43b087dabb60fd063be2a85481fe7dc 100644 (file)
@@ -231,7 +231,7 @@ BODY *crypt_pgp_traditional_encryptsign (BODY *a, int flags, char *keylist);
 void crypt_pgp_free_key (pgp_key_t *kpp);
 
 /* Generate a PGP public key attachment. */
-BODY *crypt_pgp_make_key_attachment (char *tempf);
+BODY *crypt_pgp_make_key_attachment (void);
 
 /* This routine attempts to find the keyids of the recipients of a
    message.  It returns NULL if any of the keys can not be found.
diff --git a/pgp.h b/pgp.h
index 223e5c2083692f88bdbdacdc4e0d73505c2ea6e3..a62e251a4d8dd194cbb193dbadb57e22c5925e93 100644 (file)
--- a/pgp.h
+++ b/pgp.h
@@ -30,7 +30,7 @@ int pgp_use_gpg_agent(void);
 
 int pgp_check_traditional (FILE *, BODY *, int);
 BODY *pgp_decrypt_part (BODY *, STATE *, FILE *, BODY *);
-BODY *pgp_make_key_attachment (char *);
+BODY *pgp_make_key_attachment (void);
 const char *pgp_micalg (const char *fname);
 
 char *_pgp_keyid (pgp_key_t);
index 129b4247c9dc9846cda10998d1cab28675d15e27..67626111da0b37b596ff056f119b9c13aa8e9366 100644 (file)
--- a/pgpkey.c
+++ b/pgpkey.c
@@ -716,7 +716,7 @@ pgp_key_t pgp_ask_for_key (char *tag, char *whatfor,
 
 /* generate a public key attachment */
 
-BODY *pgp_make_key_attachment (char *tempf)
+BODY *pgp_make_key_attachment (void)
 {
   BODY *att;
   char buff[LONG_STRING];
@@ -727,6 +727,7 @@ BODY *pgp_make_key_attachment (char *tempf)
   pid_t thepid;
   pgp_key_t key;
   unset_option (OPTPGPCHECKTRUST);
+  const char *tempf = NULL;
 
   key = pgp_ask_for_key (_("Please enter the key ID: "), NULL, 0, PGP_PUBRING);
 
diff --git a/send.c b/send.c
index 7299a4e68a33c5b7037bf2854b8c7c7e3eb01139..85b39cf6145a5f99bb37ceea5ba89722d473d87d 100644 (file)
--- a/send.c
+++ b/send.c
@@ -966,7 +966,7 @@ generate_body (FILE *tempfp,        /* stream for outgoing message */
     BODY *tmp;
 
     if ((WithCrypto & APPLICATION_PGP)
-        && (tmp = crypt_pgp_make_key_attachment (NULL)) == NULL)
+        && (tmp = crypt_pgp_make_key_attachment ()) == NULL)
       return -1;
 
     tmp->next = msg->content;