]> git.sthu.org Git - pgp-tools.git/commitdiff
Add gpgdiff
authorweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Tue, 29 Jun 2004 13:03:10 +0000 (13:03 +0000)
committerweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Tue, 29 Jun 2004 13:03:10 +0000 (13:03 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@10 b513b33f-fedd-0310-b452-c3deb5f4c849

caff/gpgdiff [new file with mode: 0644]

diff --git a/caff/gpgdiff b/caff/gpgdiff
new file mode 100644 (file)
index 0000000..cb0870a
--- /dev/null
@@ -0,0 +1,375 @@
+diff -ur gnupg-1.3.6.orig/g10/keyedit.c gnupg-1.3.6/g10/keyedit.c
+--- gnupg-1.3.6.orig/g10/keyedit.c     2004-05-22 13:26:00.000000000 +0200
++++ gnupg-1.3.6/g10/keyedit.c  2004-06-12 15:32:51.219996456 +0200
+@@ -136,48 +136,68 @@
+       break;
+     }
+     if( sigrc != '?' || print_without_key ) {
+-        tty_printf("%s%c%c %c%c%c%c%c%c %s %s",
+-                 is_rev? "rev":"sig",sigrc,
+-                 (sig->sig_class-0x10>0 &&
+-                  sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
+-                 sig->flags.exportable?' ':'L',
+-                 sig->flags.revocable?' ':'R',
+-                 sig->flags.policy_url?'P':' ',
+-                 sig->flags.notation?'N':' ',
+-                   sig->flags.expired?'X':' ',
+-                 (sig->trust_depth>9)?'T':
+-                 (sig->trust_depth>0)?'0'+sig->trust_depth:' ',
+-                 keystr(sig->keyid),datestr_from_sig(sig));
+-      if(opt.list_options&LIST_SHOW_SIG_EXPIRE)
+-        tty_printf(" %s",expirestr_from_sig(sig));
+-      tty_printf("  ");
+-      if( sigrc == '%' )
+-          tty_printf("[%s] ", g10_errstr(rc) );
+-      else if( sigrc == '?' )
+-          ;
+-      else if( *is_selfsig ) {
+-          tty_printf( is_rev? _("[revocation]")
+-                            : _("[self-signature]") );
+-      }
+-      else
+-        {
++      if (opt.with_colons) {
+           size_t n;
+-          char *p = get_user_id( sig->keyid, &n );
+-          tty_print_utf8_string2( p, n, opt.screen_columns-keystrlen()-26 );
+-          m_free(p);
+-        }
+-      tty_printf("\n");
+-      if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY_URLS))
+-        show_policy_url(sig,3,0);
++          printf("%s:%c::%d:%08lX%08lX:%s:%s:::",
++                     is_rev? "rev":"sig", sigrc,
++                     sig->pubkey_algo,
++                     (ulong)sig->keyid[0], (ulong)sig->keyid[1],
++                     colon_datestr_from_sig(sig),
++                     colon_expirestr_from_sig(sig));
++          if( sigrc != '%' && sigrc != '?') {
++              char *p;
++              p = get_user_id( sig->keyid, &n);
++              print_string( stdout, p, n, ':' );
++              m_free(p);
++          };
++          printf(":%02x%c:\n",
++                     sig->sig_class,sig->flags.exportable?'x':'l'
++                     );
++      } else {
++          tty_printf("%s%c%c %c%c%c%c%c%c %s %s",
++                     is_rev? "rev":"sig",sigrc,
++                     (sig->sig_class-0x10>0 &&
++                      sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
++                     sig->flags.exportable?' ':'L',
++                     sig->flags.revocable?' ':'R',
++                     sig->flags.policy_url?'P':' ',
++                     sig->flags.notation?'N':' ',
++                     sig->flags.expired?'X':' ',
++                     (sig->trust_depth>9)?'T':
++                     (sig->trust_depth>0)?'0'+sig->trust_depth:' ',
++                     keystr(sig->keyid),datestr_from_sig(sig));
++          if(opt.list_options&LIST_SHOW_SIG_EXPIRE)
++            tty_printf(" %s",expirestr_from_sig(sig));
++          tty_printf("  ");
++          if( sigrc == '%' )
++              tty_printf("[%s] ", g10_errstr(rc) );
++          else if( sigrc == '?' )
++              ;
++          else if( *is_selfsig ) {
++              tty_printf( is_rev? _("[revocation]")
++                                : _("[self-signature]") );
++          }
++          else
++            {
++              size_t n;
++              char *p = get_user_id( sig->keyid, &n );
++              tty_print_utf8_string2( p, n, opt.screen_columns-keystrlen()-26 );
++              m_free(p);
++            }
++          tty_printf("\n");
++
++          if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY_URLS))
++            show_policy_url(sig,3,0);
+-      if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
+-        show_notation(sig,3,0,
+-                      ((opt.list_options&LIST_SHOW_STD_NOTATIONS)?1:0)+
+-                      ((opt.list_options&LIST_SHOW_USER_NOTATIONS)?2:0));
++          if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
++            show_notation(sig,3,0,
++                          ((opt.list_options&LIST_SHOW_STD_NOTATIONS)?1:0)+
++                          ((opt.list_options&LIST_SHOW_USER_NOTATIONS)?2:0));
+-      if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
+-        show_keyserver_url(sig,3,0);
++          if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
++            show_keyserver_url(sig,3,0);
++      }
+     }
+     return (sigrc == '!');
+@@ -1812,7 +1832,7 @@
+     else {
+         tty_printf("    ");
+         for(i=0; prefs[i].type; i++ ) {
+-            tty_printf( " %c%d", prefs[i].type == PREFTYPE_SYM   ? 'S' :
++                   tty_printf( " %c%d", prefs[i].type == PREFTYPE_SYM   ? 'S' :
+                                  prefs[i].type == PREFTYPE_HASH  ? 'H' :
+                                  prefs[i].type == PREFTYPE_ZIP ? 'Z':'?',
+                                  prefs[i].value);
+@@ -1826,6 +1846,82 @@
+ }
++/* This shows one uid, in an easy to parse format and does not translate utf8 */
++static void
++show_one_uid_colon (KBNODE node, int index, PKT_public_key *primary, int ulti_hack, int pk_version)
++{
++    int j;
++    assert ( node->pkt->pkttype == PKT_USER_ID );
++    PKT_user_id *uid = node->pkt->pkt.user_id;
++
++    if(uid->attrib_data)
++      printf("uat:");
++    else
++      printf("uid:");
++
++    if ( uid->is_revoked )
++      printf("r::::::::");
++    else if ( uid->is_expired )
++      printf("e::::::::");
++    else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
++      printf("::::::::");
++    else
++      {
++      int uid_validity;
++
++      if( primary && !ulti_hack )
++        uid_validity = get_validity_info( primary, uid );
++      else
++        uid_validity = 'u';
++      printf("%c::::::::",uid_validity);
++      }
++
++    if(uid->attrib_data)
++      printf ("%u %lu",uid->numattribs,uid->attrib_len);
++    else
++      print_string (stdout, uid->name, uid->len, ':');
++
++    putchar (':');
++    /* signature class */
++    putchar (':');
++    /* capabilities */
++    putchar (':');
++    /* preferences */
++    if (pk_version>3 || uid->selfsigversion>3)
++      {
++      const prefitem_t *prefs = uid->prefs;
++      
++      for (j=0; prefs && prefs[j].type; j++)
++        {
++          if (j)
++            putchar (' ');
++          printf ("%c%d", prefs[j].type == PREFTYPE_SYM   ? 'S' :
++                  prefs[j].type == PREFTYPE_HASH  ? 'H' :
++                  prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
++                  prefs[j].value);
++        } 
++      if (uid->mdc_feature)
++        printf (",mdc");
++      if (!uid->ks_modify)
++        printf (",no-ks-modify");
++      } 
++    putchar (':');
++    /* flags */
++    printf ("%d,", index);
++    if (uid->is_primary)
++      putchar ('p');
++    if (uid->is_revoked)
++      putchar ('r');
++    if (uid->is_expired)
++      putchar ('e');
++    if ((node->flag & NODFLG_SELUID))
++      putchar ('s');
++    if ((node->flag & NODFLG_MARK_A))
++      putchar ('m');
++    putchar (':');
++    putchar('\n');
++}
++
+ /* This is the version of show_key_with_all_names used when
+    opt.with_colons is used.  It prints all available data in a easy to
+    parse format and does not translate utf8 */
+@@ -1905,80 +2001,12 @@
+   
+     /* the user ids */
+     i = 0;
+-    for (node = keyblock; node; node = node->next) 
++    for (node = keyblock; node; node = node->next)
+       {
+       if ( node->pkt->pkttype == PKT_USER_ID )
+           {
+-            PKT_user_id *uid = node->pkt->pkt.user_id;
+-
+           ++i;
+-
+-          if(uid->attrib_data)
+-            printf("uat:");
+-          else
+-            printf("uid:");
+-
+-          if ( uid->is_revoked )
+-            printf("r::::::::");
+-          else if ( uid->is_expired )
+-            printf("e::::::::");
+-          else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
+-            printf("::::::::");
+-          else
+-            {
+-              int uid_validity;
+-
+-              if( primary && !ulti_hack )
+-                uid_validity = get_validity_info( primary, uid );
+-              else
+-                uid_validity = 'u';
+-              printf("%c::::::::",uid_validity);
+-            }
+-
+-          if(uid->attrib_data)
+-            printf ("%u %lu",uid->numattribs,uid->attrib_len);
+-          else
+-            print_string (stdout, uid->name, uid->len, ':');
+-
+-            putchar (':');
+-            /* signature class */
+-            putchar (':');
+-            /* capabilities */
+-            putchar (':');
+-            /* preferences */
+-            if (pk_version>3 || uid->selfsigversion>3)
+-              {
+-                const prefitem_t *prefs = uid->prefs;
+-                
+-                for (j=0; prefs && prefs[j].type; j++)
+-                  {
+-                    if (j)
+-                      putchar (' ');
+-                    printf ("%c%d", prefs[j].type == PREFTYPE_SYM   ? 'S' :
+-                            prefs[j].type == PREFTYPE_HASH  ? 'H' :
+-                            prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
+-                            prefs[j].value);
+-                  } 
+-                if (uid->mdc_feature)
+-                  printf (",mdc");
+-                if (!uid->ks_modify)
+-                  printf (",no-ks-modify");
+-              } 
+-            putchar (':');
+-            /* flags */
+-            printf ("%d,", i);
+-            if (uid->is_primary)
+-              putchar ('p');
+-            if (uid->is_revoked)
+-              putchar ('r');
+-            if (uid->is_expired)
+-              putchar ('e');
+-            if ((node->flag & NODFLG_SELUID))
+-              putchar ('s');
+-            if ((node->flag & NODFLG_MARK_A))
+-              putchar ('m');
+-            putchar (':');
+-            putchar('\n');
++          show_one_uid_colon(node, i, primary, ulti_hack, pk_version);
+           }
+       }
+ }
+@@ -2506,17 +2534,23 @@
+     KBNODE node;
+     PKT_user_id *uid = NULL;
+     int changed=0;
++    KBNODE uidnode = NULL;
+     for( node = pub_keyblock; node; node = node->next ) {
+       if( node->pkt->pkttype == PKT_USER_ID ) {
+           uid = (node->flag & NODFLG_SELUID)? node->pkt->pkt.user_id : NULL;
++          uidnode = node;
+       }
+       else if( uid && node->pkt->pkttype == PKT_SIGNATURE ) {
+          int okay, valid, selfsig, inv_sig, no_key, other_err;
+-          tty_printf("uid  ");
+-          tty_print_utf8_string( uid->name, uid->len );
+-          tty_printf("\n");
++          if (opt.with_colons)
++              show_one_uid_colon (uidnode, 0, NULL, 0, 0); /* FIXME: pk_version */
++          else {
++              tty_printf("uid  ");
++              tty_print_utf8_string( uid->name, uid->len );
++              tty_printf("\n");
++         }
+          okay = inv_sig = no_key = other_err = 0;
+           valid = print_and_check_one_sig( pub_keyblock, node,
+diff -ur gnupg-1.3.6.orig/g10/status.c gnupg-1.3.6/g10/status.c
+--- gnupg-1.3.6.orig/g10/status.c      2004-05-22 13:19:05.000000000 +0200
++++ gnupg-1.3.6/g10/status.c   2004-06-12 15:25:53.142553888 +0200
+@@ -590,6 +590,9 @@
+ {
+     char *p;
++    fflush(stdout);
++    fflush(stderr);
++
+     if( opt.command_fd != -1 )
+       return do_get_from_fd ( keyword, 0, 0 );
+ #ifdef USE_SHM_COPROCESSING
+@@ -607,6 +610,9 @@
+ {
+     char *p;
++    fflush(stdout);
++    fflush(stderr);
++
+     if( opt.command_fd != -1 )
+       return do_get_from_fd ( keyword, 0, 0 );
+ #ifdef USE_SHM_COPROCESSING
+@@ -643,6 +649,9 @@
+ {
+     char *p;
++    fflush(stdout);
++    fflush(stderr);
++
+     if( opt.command_fd != -1 )
+       return do_get_from_fd ( keyword, 1, 0 );
+ #ifdef USE_SHM_COPROCESSING
+@@ -679,6 +688,9 @@
+     int yes;
+     char *p;
++    fflush(stdout);
++    fflush(stderr);
++
+     if( opt.command_fd != -1 )
+       return !!do_get_from_fd ( keyword, 0, 1 );
+ #ifdef USE_SHM_COPROCESSING
+@@ -707,6 +719,9 @@
+     int yes;
+     char *p;
++    fflush(stdout);
++    fflush(stderr);
++
+     if( opt.command_fd != -1 )
+       return !!do_get_from_fd ( keyword, 0, 1 );
+ #ifdef USE_SHM_COPROCESSING
+@@ -739,6 +754,9 @@
+   char *answer = NULL;
+   char *p;
++  fflush(stdout);
++  fflush(stderr);
++
+   if( opt.command_fd != -1 )
+     answer = do_get_from_fd ( keyword, 0, 0 );
+ #ifdef USE_SHM_COPROCESSING