diff options
| author | Werner Koch <[email protected]> | 2018-04-17 08:04:20 +0000 | 
|---|---|---|
| committer | Werner Koch <[email protected]> | 2018-04-17 08:04:20 +0000 | 
| commit | 4bba3b8e2c350b8ff0d562ec63cc03a096448d84 (patch) | |
| tree | ea160533cb38ecbed2cfbf8e8bf936a84c9d263d | |
| parent | core: New encryption flag GPGME_ENCRYPT_WANT_ADDRESS. (diff) | |
| download | gpgme-4bba3b8e2c350b8ff0d562ec63cc03a096448d84.tar.gz gpgme-4bba3b8e2c350b8ff0d562ec63cc03a096448d84.zip | |
core: Allow for --hidden keyword in OpenPGP recpstrings.
* src/engine-gpg.c (append_args_from_recipients_string): Add special
keywords.
--
GnuPG-bug-id: 3775
Signed-off-by: Werner Koch <[email protected]>
| -rw-r--r-- | doc/gpgme.texi | 12 | ||||
| -rw-r--r-- | src/engine-gpg.c | 12 | 
2 files changed, 19 insertions, 5 deletions
| diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 330b167e..3975a971 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -6180,8 +6180,16 @@ This is an extended version of @code{gpgme_op_encrypt} with  @var{recpstring} is not NULL, the latter is expected to be a linefeed  delimited string with the set of key specifications.  In contrast to  @var{recp} the keys are given directly as strings and there is no need -to first create key objects.  The keys are passed verbatim to the -backend engine. +to first create key objects.  Leading and trailing white space is +remove from each line in @var{recpstring}.  The keys are then passed +verbatim to the backend engine. + +For the OpenPGP backend two special keywords are supported to modify +the operation: If the keyword "--hidden" is given as a recipient, it +is skipped but will trun all following key specifications to be hidden +recipients.  If the keyword "--" is given as a recipient, it will be +skipped but no keywords will be detected in all following key +specifications.  @end deftypefun diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 90e3b89e..49a1c75e 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1985,6 +1985,8 @@ append_args_from_recipients_string (engine_gpg_t gpg,  {    gpg_error_t err = 0;    int any = 0; +  int ignore = 0; +  int hidden = 0;    const char *s;    int n; @@ -2005,10 +2007,14 @@ append_args_from_recipients_string (engine_gpg_t gpg,        while (n && (string[n-1] == ' ' || string[n-1] == '\t'))          n--; -      /* Add arg if it is not empty.  */ -      if (n) +      if (!ignore && n == 2 && !memcmp (string, "--", 2)) +        ignore = 1; +      else if (!ignore && n == 8 && !memcmp (string, "--hidden", 8)) +        hidden = 1; +      else if (n)          { -          err = add_arg (gpg, "-r"); +          /* Add arg if it is not empty.  */ +          err = add_arg (gpg, hidden? "-R":"-r");            if (!err)              err = add_arg_recipient_string (gpg, flags, string, n);            if (!err) | 
