diff options
author | Werner Koch <[email protected]> | 2022-08-12 09:46:30 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2022-08-12 09:46:30 +0000 |
commit | 1908fa8b835cc46cb62afb8dcd26cdd0c93bc9fd (patch) | |
tree | 7fd3d69962ceed705e2efae7b259f07975b50824 | |
parent | agent: New option --need-attr for KEYINFO. (diff) | |
download | gnupg-1908fa8b835cc46cb62afb8dcd26cdd0c93bc9fd.tar.gz gnupg-1908fa8b835cc46cb62afb8dcd26cdd0c93bc9fd.zip |
gpg: Improve --edit-key setpref.
* g10/keygen.c (keygen_set_std_prefs): Allow extra spaces before
preference elements. Detect the bracketed versions of the strings.
Ignore "aead".
--
This allows to c+p the list shown by pref with out remove the
brackets.
-rw-r--r-- | g10/keygen.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/g10/keygen.c b/g10/keygen.c index 945494a8b..7f3ed8ccb 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -487,7 +487,9 @@ keygen_set_std_prefs (const char *string,int personal) while((tok=strsep(&prefstring," ,"))) { - if((val=string_to_cipher_algo (tok))) + if (!*tok) + ; + else if((val=string_to_cipher_algo (tok))) { if(set_one_pref(val,1,tok,sym,&nsym)) rc=-1; @@ -507,14 +509,24 @@ keygen_set_std_prefs (const char *string,int personal) if (set_one_pref (val, 4, tok, aead, &naead)) rc = -1; } - else if (ascii_strcasecmp(tok,"mdc")==0) + else if (!ascii_strcasecmp(tok, "mdc") + || !ascii_strcasecmp(tok, "[mdc]")) mdc=1; - else if (ascii_strcasecmp(tok,"no-mdc")==0) + else if (!ascii_strcasecmp(tok, "no-mdc") + || !ascii_strcasecmp(tok, "[no-mdc]")) mdc=0; - else if (ascii_strcasecmp(tok,"ks-modify")==0) + else if (!ascii_strcasecmp(tok, "ks-modify") + || !ascii_strcasecmp(tok, "[ks-modify]")) modify=1; - else if (ascii_strcasecmp(tok,"no-ks-modify")==0) + else if (!ascii_strcasecmp(tok,"no-ks-modify") + || !ascii_strcasecmp(tok,"[no-ks-modify]")) modify=0; + else if (!ascii_strcasecmp(tok,"aead") + || !ascii_strcasecmp(tok,"[aead]")) + { + /* Ignore because this is set from the preferences but + * shown in the in the preferences/features list. */ + } else { log_info (_("invalid item '%s' in preference string\n"),tok); |