diff options
author | Werner Koch <[email protected]> | 2003-12-17 17:12:14 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2003-12-17 17:12:14 +0000 |
commit | 711c4853d63a9eb4bacac3f540dfcbb71fba2a51 (patch) | |
tree | 7924976f43ba3c14386093b85425c21f9e56b86f /sm/encrypt.c | |
parent | Requires now libassuan 0.6.2. (diff) | |
download | gnupg-711c4853d63a9eb4bacac3f540dfcbb71fba2a51.tar.gz gnupg-711c4853d63a9eb4bacac3f540dfcbb71fba2a51.zip |
* server.c (gpgsm_server): Add arg DEFAULT_RECPLIST.
(cmd_encrypt): Add all enrypt-to marked certs to the list.
* encrypt.c (gpgsm_encrypt): Check that real recipients are
available.
* gpgsm.c (main): Make the --encrypt-to and --no-encrypt-to
options work. Pass the list of recients to gpgsm_server.
* gpgsm.h (certlist_s): Add field IS_ENCRYPT_TO.
(opt): Add NO_ENCRYPT_TO.
* certlist.c (gpgsm_add_to_certlist): New arg IS_ENCRYPT_TO.
Changed all callers and ignore duplicate entries.
(is_cert_in_certlist): New.
(gpgsm_add_cert_to_certlist): New.
Diffstat (limited to 'sm/encrypt.c')
-rw-r--r-- | sm/encrypt.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sm/encrypt.c b/sm/encrypt.c index f31391e7c..8f2c26b45 100644 --- a/sm/encrypt.c +++ b/sm/encrypt.c @@ -306,7 +306,13 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp) memset (&encparm, 0, sizeof encparm); - if (!recplist) + /* Check that the certificate list is not empty and that at least + one certificate is not flagged as encrypt_to; i.e. is a real + recipient. */ + for (cl = recplist; cl; cl = cl->next) + if (!cl->is_encrypt_to) + break; + if (!cl) { log_error(_("no valid recipients given\n")); gpgsm_status (ctrl, STATUS_NO_RECP, "0"); @@ -412,7 +418,7 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp) goto leave; } - /* gather certificates of recipients, encrypt the session key for + /* Gather certificates of recipients, encrypt the session key for each and store them in the CMS object */ for (recpno = 0, cl = recplist; cl; recpno++, cl = cl->next) { @@ -447,7 +453,7 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp) } } - /* main control loop for encryption */ + /* Main control loop for encryption. */ recpno = 0; do { |