aboutsummaryrefslogtreecommitdiffstats
path: root/g10/import.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2002-07-22 22:26:14 +0000
committerDavid Shaw <[email protected]>2002-07-22 22:26:14 +0000
commit125613737cf7b2e600b782369d40473b1bacb603 (patch)
tree7ec067b90bbf1de0ff4c65bc51d6752f44e83db6 /g10/import.c
parent* options.h, main.h, export.c (parse_export_options, do_export_stream), (diff)
downloadgnupg-125613737cf7b2e600b782369d40473b1bacb603.tar.gz
gnupg-125613737cf7b2e600b782369d40473b1bacb603.zip
* options.h, main.h, g10.c (main), import.c (parse_import_options,
delete_inv_parts), keyserver.c (parse_keyserver_options): add new --import-options option. The only current flag is "allow-local-sigs". * g10.c (main): Don't disable MDC in pgp7 mode. * options.h, g10.c (main), keyserver.c (parse_keyserver_options): Remove old keyserver-option include-attributes now that there is an export-option for the same thing.
Diffstat (limited to 'g10/import.c')
-rw-r--r--g10/import.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/g10/import.c b/g10/import.c
index ccc665145..40c1e85ef 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -81,6 +81,48 @@ static int merge_keysigs( KBNODE dst, KBNODE src, int *n_sigs,
const char *fname, u32 *keyid );
+int
+parse_import_options(char *str,unsigned int *options)
+{
+ char *tok;
+ int hit=0;
+ struct
+ {
+ char *name;
+ unsigned int bit;
+ } import_opts[]=
+ {
+ {"allow-local-sigs",IMPORT_ALLOW_LOCAL_SIGS},
+ {NULL,0}
+ };
+
+ while((tok=strsep(&str," ,")))
+ {
+ int i,rev=0;
+
+ if(ascii_memcasecmp("no-",tok,3)==0)
+ rev=1;
+
+ for(i=0;import_opts[i].name;i++)
+ {
+ if(ascii_strcasecmp(import_opts[i].name,tok)==0)
+ {
+ if(rev)
+ *options&=~import_opts[i].bit;
+ else
+ *options|=import_opts[i].bit;
+ hit=1;
+ break;
+ }
+ }
+
+ if(!hit && !import_opts[i].name)
+ return 0;
+ }
+
+ return hit;
+}
+
void *
import_new_stats_handle (void)
{
@@ -1039,6 +1081,7 @@ delete_inv_parts( const char *fname, KBNODE keyblock, u32 *keyid )
delete_kbnode( node ); /* build_packet() can't handle this */
else if( node->pkt->pkttype == PKT_SIGNATURE &&
!node->pkt->pkt.signature->flags.exportable &&
+ !(opt.import_options&IMPORT_ALLOW_LOCAL_SIGS) &&
seckey_available( node->pkt->pkt.signature->keyid ) ) {
/* here we violate the rfc a bit by still allowing
* to import non-exportable signature when we have the