diff options
| author | Werner Koch <[email protected]> | 2025-10-27 11:43:27 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2025-10-27 11:43:27 +0000 |
| commit | ad0c6c33c3d6fe7ff7cc8c2e73d02ead5788e5b3 (patch) | |
| tree | 8c2692e19486d7ceab3261a660725ea2a235d4e8 | |
| parent | gpg: Improve/relax the checking of preference options. (diff) | |
| download | gnupg-ad0c6c33c3d6fe7ff7cc8c2e73d02ead5788e5b3.tar.gz gnupg-ad0c6c33c3d6fe7ff7cc8c2e73d02ead5788e5b3.zip | |
gpg: Do not use a default when asking for another output filename.
* g10/options.h (COMPAT_SUGGEST_EMBEDDED_NAME): New.
* g10/gpg.c (compatibility_flags): New flags "suggest-embedded-name".
* g10/openfile.c (ask_outfile_name): Do not show a default unless the
compatibiliy flag is used.
| -rw-r--r-- | g10/gpg.c | 1 | ||||
| -rw-r--r-- | g10/openfile.c | 12 | ||||
| -rw-r--r-- | g10/options.h | 5 |
3 files changed, 15 insertions, 3 deletions
@@ -1064,6 +1064,7 @@ static struct compatibility_flags_s compatibility_flags [] = { COMPAT_T7014_OLD, "t7014-old" }, { COMPAT_COMPR_KEYS, "compr-keys" }, { COMPAT_NO_MANU, "no-manu" }, + { COMPAT_SUGGEST_EMBEDDED_NAME, "suggest-embedded-name" }, { 0, NULL } }; diff --git a/g10/openfile.c b/g10/openfile.c index 42d470889..04545ea75 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -125,7 +125,7 @@ make_outfile_name (const char *iname) NAMELEN is its actual length. */ char * -ask_outfile_name( const char *name, size_t namelen ) +ask_outfile_name (const char *name, size_t namelen) { size_t n; const char *s; @@ -136,8 +136,14 @@ ask_outfile_name( const char *name, size_t namelen ) if ( opt.batch ) return NULL; - defname = name && namelen? make_printable_string (name, namelen, 0) : NULL; - + /* To avoid tricking the user into using the embedded filename we do + * not anymore include that name in the prompt as default. For + * modern v5 signature this might make sense as they are now covered + * by the signature but we better leave such a decision to a GUI. */ + if (name && namelen && (opt.compat_flags & COMPAT_SUGGEST_EMBEDDED_NAME)) + defname = make_printable_string (name, namelen, 0); + else + defname = NULL; s = _("Enter new filename"); n = strlen(s) + (defname?strlen (defname):0) + 10; prompt = xmalloc (n); diff --git a/g10/options.h b/g10/options.h index 5512ecb11..962f45f16 100644 --- a/g10/options.h +++ b/g10/options.h @@ -404,6 +404,11 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode; #define COMPAT_T7014_OLD 2 /* Use initial T7014 test data. */ #define COMPAT_COMPR_KEYS 4 /* Allow import of compressed keys. (T7014) */ #define COMPAT_NO_MANU 8 /* Do not include a "manu" notation. */ +#define COMPAT_SUGGEST_EMBEDDED_NAME 16 /* Show the non-signed + * embedded filename as + * suggestion. */ + + /* Compliance test macros. */ #define GNUPG (opt.compliance==CO_GNUPG || opt.compliance==CO_DE_VS) |
