[git] GnuPG - branch, STABLE-BRANCH-1-4, updated. gnupg-1.4.15-6-gb135372

by Werner Koch cvs at cvs.gnupg.org
Wed Nov 27 11:03:54 CET 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, STABLE-BRANCH-1-4 has been updated
       via  b135372176b29ca985afa18398a455fd4e2a2063 (commit)
      from  cad8216f9a0b33c9dc84ecc4f385b00045e7b496 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b135372176b29ca985afa18398a455fd4e2a2063
Author: Werner Koch <wk at gnupg.org>
Date:   Wed Nov 27 09:20:02 2013 +0100

    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 at gnupg.org>
    (cherry picked from commit e951782e937ce290be0d89d83e84b3daea997587)
    
    Resolved conflicts:
    	NEWS
    	g10/armor.c
    	g10/gpg.c

diff --git a/NEWS b/NEWS
index ad3471e..6122540 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
 -------------------------------------------------
diff --git a/doc/gpg.texi b/doc/gpg.texi
index c588d7a..26179bd 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -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.
- at 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}
diff --git a/g10/armor.c b/g10/armor.c
index 0fbb997..c50525c 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -148,11 +148,11 @@ release_armor_context (armor_filter_context_t *afx)
 int
 push_armor_filter (armor_filter_context_t *afx, iobuf_t iobuf)
 {
-  int rc; 
+  int rc;
 
   if (!afx->refcount)
     return iobuf_push_filter (iobuf, armor_filter, afx);
-    
+
   afx->refcount++;
   rc = iobuf_push_filter (iobuf, armor_filter, afx);
   if (rc)
@@ -801,7 +801,7 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
 		    goto again;
 		}
 	    }
-            
+
 	    if (!n)
 	      onlypad = 1;
 
@@ -985,7 +985,7 @@ armor_filter( void *opaque, int control,
         /* We need some space for the faked packet.  The minmum
          * required size is the PARTIAL_CHUNK size plus a byte for the
          * length itself */
-	if( size < PARTIAL_CHUNK+1 ) 
+	if( size < PARTIAL_CHUNK+1 )
 	    BUG(); /* supplied buffer too short */
 
 	if( afx->faked )
@@ -1004,7 +1004,7 @@ armor_filter( void *opaque, int control,
 	        unsigned int hashes = afx->hashes;
                 const byte *sesmark;
                 size_t sesmarklen;
-                
+
                 sesmark = get_session_marker( &sesmarklen );
                 if ( sesmarklen > 20 )
                     BUG();
@@ -1026,7 +1026,7 @@ armor_filter( void *opaque, int control,
                 buf[n++] = 0xff; /* new format, type 63, 1 length byte */
                 n++;   /* see below */
                 memcpy(buf+n, sesmark, sesmarklen ); n+= sesmarklen;
-                buf[n++] = CTRLPKT_CLEARSIGN_START; 
+                buf[n++] = CTRLPKT_CLEARSIGN_START;
                 buf[n++] = afx->not_dash_escaped? 0:1; /* sigclass */
                 if( hashes & 1 )
                     buf[n++] = DIGEST_ALGO_RMD160;
@@ -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);
 	      }
 
@@ -1287,7 +1302,7 @@ make_radix64_string( const byte *data, size_t len )
 
 /***********************************************
  *  For the pipemode command we can't use the armor filter for various
- *  reasons, so we use this new unarmor_pump stuff to remove the armor 
+ *  reasons, so we use this new unarmor_pump stuff to remove the armor
  */
 
 enum unarmor_state_e {
@@ -1295,7 +1310,7 @@ enum unarmor_state_e {
     STA_bypass,
     STA_wait_newline,
     STA_wait_dash,
-    STA_first_dash, 
+    STA_first_dash,
     STA_compare_header,
     STA_found_header_wait_newline,
     STA_skip_header_lines,
@@ -1334,12 +1349,12 @@ unarmor_pump_release (UnarmorPump x)
     xfree (x);
 }
 
-/* 
+/*
  * Get the next character from the ascii armor taken from the IOBUF
  * created earlier by unarmor_pump_new().
  * Return:  c = Character
  *        256 = ignore this value
- *         -1 = End of current armor 
+ *         -1 = End of current armor
  *         -2 = Premature EOF (not used)
  *         -3 = Invalid armor
  */
@@ -1350,9 +1365,9 @@ unarmor_pump (UnarmorPump x, int c)
 
     switch (x->state) {
       case STA_init:
-        { 
+        {
             byte tmp[1];
-            tmp[0] = c; 
+            tmp[0] = c;
             if ( is_armored (tmp) )
                 x->state = c == '-'? STA_first_dash : STA_wait_newline;
             else {
@@ -1375,10 +1390,10 @@ unarmor_pump (UnarmorPump x, int c)
         x->state = STA_compare_header;
       case STA_compare_header:
         if ( "-----BEGIN PGP SIGNATURE-----"[++x->pos] == c ) {
-            if ( x->pos == 28 ) 
+            if ( x->pos == 28 )
                 x->state = STA_found_header_wait_newline;
         }
-        else 
+        else
             x->state = c == '\n'? STA_wait_dash : STA_wait_newline;
         break;
       case STA_found_header_wait_newline:
@@ -1425,7 +1440,7 @@ unarmor_pump (UnarmorPump x, int c)
                 break;
             }
         }
-        
+
         switch(x->pos) {
           case 0:
             x->val = c << 2;
@@ -1466,7 +1481,7 @@ unarmor_pump (UnarmorPump x, int c)
             x->state = STA_ready; /* not sure whether this is correct */
             break;
         }
-        
+
         switch(x->pos) {
           case 0:
             x->val = c << 2;
diff --git a/g10/gpg.c b/g10/gpg.c
index ca120ab..c58ee41 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -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;
diff --git a/g10/options.h b/g10/options.h
index de4a2e2..d6326d8 100644
--- a/g10/options.h
+++ b/g10/options.h
@@ -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;

-----------------------------------------------------------------------

Summary of changes:
 NEWS          |    3 +++
 doc/gpg.texi  |    8 ++++++--
 g10/armor.c   |   53 ++++++++++++++++++++++++++++++++++-------------------
 g10/gpg.c     |    5 +++--
 g10/options.h |    6 +++++-
 5 files changed, 51 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list