Update Debian Vcs-* fields to point to git repository
[onak.git] / stripkey.c
index 12d8791526a5ddd107b2c436b3458010bef65c2d..e0fb5e38a56957699c70b7630ca1e7291b2e2a48 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * stripkey.c - Strip a key of all signatures except self-sigs.
+ *
+ * Copyright 2004 Daniel Silverstone <dsilvers@digital-scurf.org>
+ *
+ * This program is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
 #include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -28,7 +47,6 @@ int main(int argc, char** argv) {
   struct openpgp_signedpacket_list *uid = NULL;
   struct openpgp_packet_list *sig = NULL;
   struct openpgp_packet_list *prevsig = NULL;
-  int result = 0;
   uint64_t my_key = 0;
 
   if( argc > 1 )
@@ -38,14 +56,15 @@ int main(int argc, char** argv) {
   /* strip each key of everything but its pubkey component, uids and
    * selfsigs and revsigs on those selfsigs */
 
-  result = read_openpgp_stream( stdin_getchar, NULL, &packets, 0 );
-  result = parse_keys( packets, &keys );
+  read_openpgp_stream( stdin_getchar, NULL, &packets, 0 );
+  parse_keys( packets, &keys );
   free_packet_list(packets);
   packets = NULL;
-  result = cleankeys( keys );
+  cleankeys( keys );
   /* Iterate over the keys... */
   for( key = keys; key; key = key->next ) {
-    uint64_t keyid = get_keyid( key );
+    uint64_t keyid;
+    get_keyid( key, &keyid );
     for( uid = key->uids; uid; uid = uid->next ) {
       REPEATTHISUID: 
       for( sig = uid->sigs, prevsig = NULL; 
@@ -65,8 +84,8 @@ int main(int argc, char** argv) {
         }
       }
     }
-    flatten_publickey( key, &packets, &list_end );
   }
+  flatten_publickey( keys, &packets, &list_end );
   write_openpgp_stream( stdout_putchar, NULL, packets );
   return 0;
 }