File gnupg-accepts-path-separators-literal-data.patch of Package gpg2.42496
commit ad0c6c33c3d6fe7ff7cc8c2e73d02ead5788e5b3
Author: Werner Koch <wk@gnupg.org>
Date: Mon Oct 27 12:43:27 2025 +0100
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.
Index: gnupg-2.4.4/g10/gpg.c
===================================================================
--- gnupg-2.4.4.orig/g10/gpg.c
+++ gnupg-2.4.4/g10/gpg.c
@@ -1025,6 +1025,7 @@ static struct debug_flags_s debug_flags
{ DBG_CLOCK_VALUE , "clock" },
{ DBG_LOOKUP_VALUE , "lookup" },
{ DBG_EXTPROG_VALUE, "extprog" },
+ { COMPAT_SUGGEST_EMBEDDED_NAME, "suggest-embedded-name" },
{ 0, NULL }
};
Index: gnupg-2.4.4/g10/openfile.c
===================================================================
--- gnupg-2.4.4.orig/g10/openfile.c
+++ gnupg-2.4.4/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
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);
Index: gnupg-2.4.4/g10/options.h
===================================================================
--- gnupg-2.4.4.orig/g10/options.h
+++ gnupg-2.4.4/g10/options.h
@@ -376,6 +376,11 @@ EXTERN_UNLESS_MAIN_MODULE int memory_sta
/* Compatibility flags */
/* #define COMPAT_FOO 1 */
#define COMPAT_ALLOW_NOT_DASH_ESCAPED 32 /* Handle NotDashEscaped header. */
+#define COMPAT_SUGGEST_EMBEDDED_NAME 16 /* Show the non-signed
+ * embedded filename as
+ * suggestion. */
+
+
/* Compliance test macors. */
#define GNUPG (opt.compliance==CO_GNUPG || opt.compliance==CO_DE_VS)