See ChangeLog: Thu Jul 8 16:21:27 CEST 1999 Werner Koch
authorWerner Koch <wk@gnupg.org>
Thu, 8 Jul 1999 14:24:35 +0000 (14:24 +0000)
committerWerner Koch <wk@gnupg.org>
Thu, 8 Jul 1999 14:24:35 +0000 (14:24 +0000)
13 files changed:
NEWS
doc/FAQ
doc/gpg.sgml
g10/ChangeLog
g10/build-packet.c
g10/g10.c
g10/mainproc.c
g10/packet.h
g10/parse-packet.c
g10/trustdb.c
tools/ChangeLog
tools/Makefile.am
tools/lspgpot [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index da00e57..fbf97ad 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@
     * Changes to support libtool which is needed for the development
       of libgcrypt.
 
+    * New script tools/lspgpot to help transferring assigned
+      trustvalues from PGP to GnuPG.
+
+
 Noteworthy changes in version 0.9.8
 -----------------------------------
 
diff --git a/doc/FAQ b/doc/FAQ
index 620b27e..c57b490 100644 (file)
--- a/doc/FAQ
+++ b/doc/FAQ
      you active characterset matches the one displayed - if not, restrict
      yourself to plain 7 bit ASCII and no mapping has to be done.
 
+  Q: How do I transfer owner trust values from PGP to GnuPG?
+  A: There is a script in the tools directory to help you:
+     After you have imported the PGP keyring you can give this command:
+       $ lspgpot pgpkeyring | gpg --import-ownertrust
+
+
index 21d74fc..83eac9d 100644 (file)
@@ -1087,6 +1087,14 @@ Print key listings delimited by colons.
 Print key listings delimited by colons and print the public key data.
 </para></listitem></varlistentry>
 
+<varlistentry>
+<term>--with-fingerprint</term>
+<listitem><para>
+Same as the command --fingerprint but changes only the format of the output
+and may be used together with another command.
+</para></listitem></varlistentry>
+
+
 </variablelist>
 </refsect1>
 
index 6828cab..fcc2a97 100644 (file)
@@ -1,3 +1,16 @@
+Thu Jul  8 16:21:27 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
+
+
+       * packet.h (PKT_ring_trust): New
+       * parse-packet.c (parse_trust): Store trust value
+       * build-packet (build_packet): Ignore ring trust packets.
+       * mainproc.c (add_ring_trust): New.
+       (list_node): Print "rtv" records.
+       * g10.c: New option --with-fingerprint.
+
+       * trustdb.c (verify_own_keys): Don't insert if we are dry running
+       (check_trust): Ditto.
+
 Wed Jul  7 13:08:40 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
index 75066de..4049f37 100644 (file)
@@ -125,6 +125,7 @@ build_packet( IOBUF out, PACKET *pkt )
        rc = do_onepass_sig( out, ctb, pkt->pkt.onepass_sig );
        break;
       case PKT_RING_TRUST:
+       break; /* ignore it */
       default:
        log_bug("invalid packet type in build_packet()\n");
        break;
index 48774eb..092def6 100644 (file)
--- a/g10/g10.c
+++ b/g10/g10.c
@@ -105,6 +105,7 @@ enum cmd_and_opt_values { aNull = 0,
 
     oTextmode,
     oFingerprint,
+    oWithFingerprint,
     oAnswerYes,
     oAnswerNo,
     oKeyring,
@@ -319,6 +320,7 @@ static ARGPARSE_OPTS opts[] = {
     { oUseEmbeddedFilename, "use-embedded-filename", 0, "@" },
     { oUtf8Strings, "utf8-strings", 0, "@" },
     { oNoUtf8Strings, "no-utf8-strings", 0, "@" },
+    { oWithFingerprint, "with-fingerprint", 0, "@" },
 {0} };
 
 
@@ -510,6 +512,7 @@ main( int argc, char **argv )
     char *s2k_cipher_string = NULL;
     char *s2k_digest_string = NULL;
     int pwfd = -1;
+    int with_fpr = 0; /* make an option out of --fingerprint */
   #ifdef USE_SHM_COPROCESSING
     ulong requested_shm_size=0;
   #endif
@@ -684,6 +687,8 @@ main( int argc, char **argv )
          case oDebugAll: opt.debug = ~0; break;
          case oStatusFD: set_status_fd( pargs.r.ret_int ); break;
          case oLoggerFD: log_set_logfile( NULL, pargs.r.ret_int ); break;
+         case oWithFingerprint:
+               with_fpr=1; /*fall thru*/
          case oFingerprint: opt.fingerprint++; break;
          case oSecretKeyring: append_to_strlist( &sec_nrings, pargs.r.ret_str); break;
          case oOptions:
@@ -875,7 +880,7 @@ main( int argc, char **argv )
     if( log_get_errorcount(0) )
        g10_exit(2);
 
-    if( !cmd && opt.fingerprint )
+    if( !cmd && opt.fingerprint && !with_fpr )
        set_cmd( &cmd, aListKeys);
 
     if( cmd == aKMode || cmd == aKModeC ) { /* kludge to be compatible to pgp */
index 51d4361..edd393a 100644 (file)
@@ -124,6 +124,17 @@ add_subkey( CTX c, PACKET *pkt )
     return 1;
 }
 
+static int
+add_ring_trust( CTX c, PACKET *pkt )
+{
+    if( !c->list ) {
+       log_error("ring trust w/o key\n" );
+       return 0;
+    }
+    add_kbnode( c->list, new_kbnode( pkt ) );
+    return 1;
+}
+
 
 static int
 add_signature( CTX c, PACKET *pkt )
@@ -570,6 +581,13 @@ list_node( CTX c, KBNODE node )
            if( c->local_id )
                putchar( get_ownertrust_info( c->local_id ) );
            putchar(':');
+           if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) {
+               putchar('\n'); any=1;
+               if( opt.fingerprint )
+                   print_fingerprint( pk, NULL );
+               printf("rtv:1:%u:\n",
+                           node->next->pkt->pkt.ring_trust->trustval );
+           }
        }
        else
            printf("%s  %4u%c/%08lX %s ",
@@ -604,6 +622,11 @@ list_node( CTX c, KBNODE node )
                    putchar('\n');
                    if( opt.fingerprint && !any )
                        print_fingerprint( pk, NULL );
+                   if( node->next
+                       && node->next->pkt->pkttype == PKT_RING_TRUST ) {
+                       printf("rtv:2:%u:\n",
+                                node->next->pkt->pkt.ring_trust->trustval );
+                   }
                    any=1;
                }
                else if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
@@ -886,6 +909,7 @@ do_proc_packets( CTX c, IOBUF a )
              case PKT_PLAINTEXT:   proc_plaintext( c, pkt ); break;
              case PKT_COMPRESSED:  proc_compressed( c, pkt ); break;
              case PKT_ONEPASS_SIG: newpkt = add_onepass_sig( c, pkt ); break;
+             case PKT_RING_TRUST:  newpkt = add_ring_trust( c, pkt ); break;
              default: newpkt = 0; break;
            }
        }
index ac44a4f..91253eb 100644 (file)
@@ -173,6 +173,10 @@ typedef struct {
 } PKT_encrypted;
 
 typedef struct {
+    unsigned int trustval;
+} PKT_ring_trust;
+
+typedef struct {
     u32  len;            /* length of encrypted data */
     IOBUF buf;           /* IOBUF reference */
     byte new_ctb;
@@ -198,6 +202,7 @@ struct packet_struct {
        PKT_user_id     *user_id;       /* PKT_USER_ID */
        PKT_compressed  *compressed;    /* PKT_COMPRESSED */
        PKT_encrypted   *encrypted;     /* PKT_ENCRYPTED[_MDC] */
+       PKT_ring_trust  *ring_trust;    /* PKT_RING_TRUST */
        PKT_plaintext   *plaintext;     /* PKT_PLAINTEXT */
     } pkt;
 };
index 5ce7e26..577a1fc 100644 (file)
@@ -63,7 +63,8 @@ static int  parse_user_id( IOBUF inp, int pkttype, unsigned long pktlen,
                                                           PACKET *packet );
 static int  parse_comment( IOBUF inp, int pkttype, unsigned long pktlen,
                                                           PACKET *packet );
-static void parse_trust( IOBUF inp, int pkttype, unsigned long pktlen );
+static void parse_trust( IOBUF inp, int pkttype, unsigned long pktlen,
+                                                          PACKET *packet );
 static int  parse_plaintext( IOBUF inp, int pkttype, unsigned long pktlen,
                                               PACKET *packet, int new_ctb);
 static int  parse_compressed( IOBUF inp, int pkttype, unsigned long pktlen,
@@ -421,8 +422,8 @@ parse( IOBUF inp, PACKET *pkt, int reqtype, ulong *retpos,
        rc = parse_comment(inp, pkttype, pktlen, pkt);
        break;
       case PKT_RING_TRUST:
-       parse_trust(inp, pkttype, pktlen);
-       rc = G10ERR_UNKNOWN_PACKET;
+       parse_trust(inp, pkttype, pktlen, pkt);
+       rc = 0;
        break;
       case PKT_PLAINTEXT:
        rc = parse_plaintext(inp, pkttype, pktlen, pkt, new_ctb );
@@ -1517,11 +1518,13 @@ parse_comment( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
 
 
 static void
-parse_trust( IOBUF inp, int pkttype, unsigned long pktlen )
+parse_trust( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *pkt )
 {
     int c;
 
     c = iobuf_get_noeof(inp);
+    pkt->pkt.ring_trust = m_alloc( sizeof *pkt->pkt.ring_trust );
+    pkt->pkt.ring_trust->trustval = c;
     if( list_mode )
        printf(":trust packet: flag=%02x\n", c );
 }
index 497fa9e..3f5b4fc 100644 (file)
@@ -477,6 +477,8 @@ verify_own_keys(void)
 
        /* make sure that the pubkey is in the trustdb */
        rc = query_trust_record( pk );
+       if( rc == -1 && opt.dry_run )
+           goto skip;
        if( rc == -1 ) { /* put it into the trustdb */
            rc = insert_trust_record_by_pk( pk );
            if( rc ) {
@@ -2217,6 +2219,8 @@ check_trust( PKT_public_key *pk, unsigned *r_trustlevel,
                                                            g10_errstr(rc));
            return rc;
        }
+       else if( rc == -1 && opt.dry_run )
+           return G10ERR_GENERAL;
        else if( rc == -1 ) { /* not found - insert */
            rc = insert_trust_record_by_pk( pk );
            if( rc ) {
index b59145f..f3b32ea 100644 (file)
@@ -1,3 +1,8 @@
+Thu Jul  8 16:21:27 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
+
+
+       * lspgpot: New
+
 Wed Jul  7 13:08:40 CEST 1999  Werner Koch  <wk@isil.d.shuttle.de>
 
 
index 403aa67..2cf2e20 100644 (file)
@@ -1,5 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
+EXTRA_DIST = lspgpot
 INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl
 needed_libs = ../cipher/libcipher.la  \
              ../mpi/libmpi.la ../util/libutil.la @INTLLIBS@
diff --git a/tools/lspgpot b/tools/lspgpot
new file mode 100755 (executable)
index 0000000..4041367
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# lspgpot - script to extract the ownertrust values
+# from a PGP keyrings and list them in GnuPG ownertrust format.
+
+../g10/gpg --dry-run --with-fingerprint --with-colons $* | awk '
+BEGIN { FS=":"
+       printf "# Ownertrust listing generated by lspgpot\n"
+       printf "# This can be imported using the command:\n"
+       printf "#    ggp --import-ownertrust\n\n"  }
+$1 == "fpr" { fpr = $10 }
+$1 == "rtv" && $2 == 1 && $3 == 2 { printf "%s:3:\n", fpr; next }
+$1 == "rtv" && $2 == 1 && $3 == 5 { printf "%s:4:\n", fpr; next }
+$1 == "rtv" && $2 == 1 && $3 == 6 { printf "%s:5:\n", fpr; next }
+'
+