Commit 4615a829 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Introduce an oppenc_mode parameter

It's added to the parameter lists through the call stack down to the
find_keys calls.

No functionality is implemented yet.  This patch is separated just to
keep other patches more readable.
parent ecbba07c
......@@ -4305,8 +4305,10 @@ static crypt_key_t *crypt_ask_for_key (char *tag,
}
/* 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. */
static char *find_keys (ADDRESS *adrlist, unsigned int app)
message. It returns NULL if any of the keys can not be found.
If oppenc_mode is true, only keys that can be determined without
prompting will be used. */
static char *find_keys (ADDRESS *adrlist, unsigned int app, int oppenc_mode)
{
char *keyID, *keylist = NULL, *t;
size_t keylist_size = 0;
......@@ -4409,14 +4411,14 @@ static char *find_keys (ADDRESS *adrlist, unsigned int app)
return (keylist);
}
char *pgp_gpgme_findkeys (ADDRESS *adrlist)
char *pgp_gpgme_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
return find_keys (adrlist, APPLICATION_PGP);
return find_keys (adrlist, APPLICATION_PGP, oppenc_mode);
}
char *smime_gpgme_findkeys (ADDRESS *adrlist)
char *smime_gpgme_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
return find_keys (adrlist, APPLICATION_SMIME);
return find_keys (adrlist, APPLICATION_SMIME, oppenc_mode);
}
#ifdef HAVE_GPGME_OP_EXPORT_KEYS
......
......@@ -24,8 +24,8 @@
void pgp_gpgme_init (void);
void smime_gpgme_init (void);
char *pgp_gpgme_findkeys (ADDRESS *adrlist);
char *smime_gpgme_findkeys (ADDRESS *adrlist);
char *pgp_gpgme_findkeys (ADDRESS *adrlist, int oppenc_mode);
char *smime_gpgme_findkeys (ADDRESS *adrlist, int oppenc_mode);
BODY *pgp_gpgme_encrypt_message (BODY *a, char *keylist, int sign);
BODY *smime_gpgme_build_smime_entity (BODY *a, char *keylist);
......
......@@ -46,9 +46,9 @@ static int crypt_mod_pgp_application_handler (BODY *m, STATE *s)
return pgp_application_pgp_handler (m, s);
}
static char *crypt_mod_pgp_findkeys (ADDRESS *adrlist)
static char *crypt_mod_pgp_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
return pgp_findKeys (adrlist);
return pgp_findKeys (adrlist, oppenc_mode);
}
static BODY *crypt_mod_pgp_sign_message (BODY *a)
......
......@@ -70,9 +70,9 @@ static void crypt_mod_pgp_invoke_import (const char *fname)
pgp_gpgme_invoke_import (fname);
}
static char *crypt_mod_pgp_findkeys (ADDRESS *adrlist)
static char *crypt_mod_pgp_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
return pgp_gpgme_findkeys (adrlist);
return pgp_gpgme_findkeys (adrlist, oppenc_mode);
}
static BODY *crypt_mod_pgp_sign_message (BODY *a)
......
......@@ -46,9 +46,9 @@ static int crypt_mod_smime_application_handler (BODY *m, STATE *s)
return smime_application_smime_handler (m, s);
}
static char *crypt_mod_smime_findkeys (ADDRESS *adrlist)
static char *crypt_mod_smime_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
return smime_findKeys (adrlist);
return smime_findKeys (adrlist, oppenc_mode);
}
static BODY *crypt_mod_smime_sign_message (BODY *a)
......
......@@ -55,9 +55,9 @@ static int crypt_mod_smime_application_handler (BODY *m, STATE *s)
return smime_gpgme_application_handler (m, s);
}
static char *crypt_mod_smime_findkeys (ADDRESS *adrlist)
static char *crypt_mod_smime_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
return smime_gpgme_findkeys (adrlist);
return smime_gpgme_findkeys (adrlist, oppenc_mode);
}
static BODY *crypt_mod_smime_sign_message (BODY *a)
......
......@@ -43,7 +43,7 @@ typedef int (*crypt_func_pgp_check_traditional_t) (FILE *fp, BODY *b,
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 char *(*crypt_func_findkeys_t) (ADDRESS *adrlist);
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,
int sign);
......
......@@ -737,7 +737,7 @@ int crypt_get_keys (HEADER *msg, char **keylist)
if ((WithCrypto & APPLICATION_PGP)
&& (msg->security & APPLICATION_PGP))
{
if ((*keylist = crypt_pgp_findkeys (adrlist)) == NULL)
if ((*keylist = crypt_pgp_findkeys (adrlist, 0)) == NULL)
{
rfc822_free_address (&adrlist);
return (-1);
......@@ -747,7 +747,7 @@ int crypt_get_keys (HEADER *msg, char **keylist)
if ((WithCrypto & APPLICATION_SMIME)
&& (msg->security & APPLICATION_SMIME))
{
if ((*keylist = crypt_smime_findkeys (adrlist)) == NULL)
if ((*keylist = crypt_smime_findkeys (adrlist, 0)) == NULL)
{
rfc822_free_address (&adrlist);
return (-1);
......
......@@ -199,11 +199,13 @@ BODY *crypt_pgp_make_key_attachment (char *tempf)
}
/* 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. */
char *crypt_pgp_findkeys (ADDRESS *adrlist)
message. It returns NULL if any of the keys can not be found.
If oppenc_mode is true, only keys that can be determined without
prompting will be used. */
char *crypt_pgp_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
if (CRYPT_MOD_CALL_CHECK (PGP, findkeys))
return (CRYPT_MOD_CALL (PGP, findkeys)) (adrlist);
return (CRYPT_MOD_CALL (PGP, findkeys)) (adrlist, oppenc_mode);
return NULL;
}
......@@ -333,11 +335,13 @@ int crypt_smime_verify_sender(HEADER *h)
}
/* 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. */
char *crypt_smime_findkeys (ADDRESS *adrlist)
message. It returns NULL if any of the keys can not be found.
If oppenc_mode is true, only keys that can be determined without
prompting will be used. */
char *crypt_smime_findkeys (ADDRESS *adrlist, int oppenc_mode)
{
if (CRYPT_MOD_CALL_CHECK (SMIME, findkeys))
return (CRYPT_MOD_CALL (SMIME, findkeys)) (adrlist);
return (CRYPT_MOD_CALL (SMIME, findkeys)) (adrlist, oppenc_mode);
return NULL;
}
......
......@@ -210,8 +210,10 @@ void crypt_pgp_free_key (pgp_key_t *kpp);
BODY *crypt_pgp_make_key_attachment (char *tempf);
/* 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. */
char *crypt_pgp_findkeys (ADDRESS *adrlist);
message. It returns NULL if any of the keys can not be found.
If oppenc_mode is true, only keys that can be determined without
prompting will be used. */
char *crypt_pgp_findkeys (ADDRESS *adrlist, int oppenc_mode);
/* Create a new body with a PGP signed message from A. */
BODY *crypt_pgp_sign_message (BODY *a);
......@@ -259,8 +261,10 @@ int crypt_smime_verify_sender(HEADER *h);
char *crypt_smime_ask_for_key (char *prompt, char *mailbox, short public);
/* 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. */
char *crypt_smime_findkeys (ADDRESS *adrlist);
message. It returns NULL if any of the keys can not be found.
If oppenc_mode is true, only keys that can be determined without
prompting will be used. */
char *crypt_smime_findkeys (ADDRESS *adrlist, int oppenc_mode);
/* fixme: Needs documentation. */
BODY *crypt_smime_sign_message (BODY *a);
......
......@@ -1182,8 +1182,10 @@ static short is_numerical_keyid (const char *s)
/* 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.
* If oppenc_mode is true, only keys that can be determined without
* prompting will be used.
*/
char *pgp_findKeys (ADDRESS *adrlist)
char *pgp_findKeys (ADDRESS *adrlist, int oppenc_mode)
{
char *keyID, *keylist = NULL;
size_t keylist_size = 0;
......
......@@ -51,7 +51,7 @@ pgp_key_t pgp_get_candidates (pgp_ring_t, LIST *);
pgp_key_t pgp_getkeybyaddr (ADDRESS *, short, pgp_ring_t);
pgp_key_t pgp_getkeybystr (char *, short, pgp_ring_t);
char *pgp_findKeys (ADDRESS *adrlist);
char *pgp_findKeys (ADDRESS *adrlist, int oppenc_mode);
void pgp_forget_passphrase (void);
int pgp_application_pgp_handler (BODY *, STATE *);
......
......@@ -729,9 +729,11 @@ void smime_getkeys (ENVELOPE *env)
/* 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.
* If oppenc_mode is true, only keys that can be determined without
* prompting will be used.
*/
char *smime_findKeys (ADDRESS *adrlist)
char *smime_findKeys (ADDRESS *adrlist, int oppenc_mode)
{
char *keyID, *keylist = NULL;
size_t keylist_size = 0;
......
......@@ -50,7 +50,7 @@ void smime_getkeys (ENVELOPE *);
char* smime_ask_for_key (char *, char *, short);
char *smime_findKeys (ADDRESS *adrlist);
char *smime_findKeys (ADDRESS *adrlist, int oppenc_mode);
void smime_invoke_import (char *, char *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment