1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-28 02:12:46 +02:00

gpg: Change armor Version header to emit only the major version.

* g10/options.h (opt): Rename field no_version to emit_version.
* g10/gpg.c (main): Init opt.emit_vesion to 1.  Change --emit-version
to bump up opt.emit_version.
* g10/armor.c (armor_filter): Implement different --emit-version
values.
--

GnuPG-bug-id: 1572
Signed-off-by: Werner Koch <wk@gnupg.org>
(cherry picked from commit e951782e93)

Resolved conflicts:
	NEWS
	g10/armor.c
	g10/gpg.c
This commit is contained in:
Werner Koch 2013-11-27 09:20:02 +01:00
parent cad8216f9a
commit b135372176
5 changed files with 51 additions and 24 deletions

3
NEWS
View File

@ -3,6 +3,9 @@ Noteworthy changes in version 1.4.16 (unreleased)
* Do not create a trustdb file if --trust-model=always is used.
* Only the major version number is by default included in the armored
output.
Noteworthy changes in version 1.4.15 (2013-10-04)
-------------------------------------------------

View File

@ -2408,8 +2408,12 @@ protected by the signature.
@item --emit-version
@itemx --no-emit-version
@opindex emit-version
Force inclusion of the version string in ASCII armored output.
@option{--no-emit-version} disables this option.
Force inclusion of the version string in ASCII armored output. If
given once only the name of the program and the major number is
emitted (default), given twice the minor is also emitted, given triple
the micro is added, and given quad an operating system identification
is also emitted. @option{--no-emit-version} disables the version
line.
@item --sig-notation @code{name=value}
@itemx --cert-notation @code{name=value}

View File

@ -1080,10 +1080,25 @@ armor_filter( void *opaque, int control,
iobuf_writestr(a, head_strings[afx->what] );
iobuf_writestr(a, "-----" );
iobuf_writestr(a,afx->eol);
if( !opt.no_version )
if (opt.emit_version)
{
iobuf_writestr(a, "Version: GnuPG v" VERSION " ("
PRINTABLE_OS_NAME ")" );
iobuf_writestr (a, "Version: GnuPG v");
for (s=VERSION; *s && *s != '.'; s++)
iobuf_writebyte (a, *s);
if (opt.emit_version > 1 && *s)
{
iobuf_writebyte (a, *s++);
for (; *s && *s != '.'; s++)
iobuf_writebyte (a, *s);
if (opt.emit_version > 2)
{
for (; *s && *s != '-' && !spacep (s); s++)
iobuf_writebyte (a, *s);
if (opt.emit_version > 3)
iobuf_writestr (a, " (" PRINTABLE_OS_NAME ")");
}
}
iobuf_writestr(a,afx->eol);
}

View File

@ -1908,6 +1908,7 @@ main (int argc, char **argv )
opt.def_cert_expire="0";
set_homedir ( default_homedir () );
opt.passwd_repeat=1;
opt.emit_version = 1; /* Limit to the major number. */
#ifdef ENABLE_CARD_SUPPORT
#if defined(_WIN32) || defined(__CYGWIN__)
@ -2245,8 +2246,8 @@ main (int argc, char **argv )
case oNoVerbose: g10_opt_verbose = 0;
opt.verbose = 0; opt.list_sigs=0; break;
case oQuickRandom: quick_random_gen(1); break;
case oEmitVersion: opt.no_version=0; break;
case oNoEmitVersion: opt.no_version=1; break;
case oEmitVersion: opt.emit_version++; break;
case oNoEmitVersion: opt.emit_version=0; break;
case oCompletesNeeded: opt.completes_needed = pargs.r.ret_int; break;
case oMarginalsNeeded: opt.marginals_needed = pargs.r.ret_int; break;
case oMaxCertDepth: opt.max_cert_depth = pargs.r.ret_int; break;

View File

@ -79,7 +79,11 @@ struct
int def_cert_level;
int min_cert_level;
int ask_cert_level;
int no_version;
int emit_version; /* 0 = none,
1 = major only,
2 = major and minor,
3 = full version,
4 = full version plus OS string. */
int marginals_needed;
int completes_needed;
int max_cert_depth;