diff options
author | Werner Koch <wk@gnupg.org> | 1998-12-23 13:41:40 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 1998-12-23 13:41:40 +0100 |
commit | 750d74333ce5b3ec8ff37d45b64fd0603e043051 (patch) | |
tree | b6ccec469294334b2510d7bb15ac102b409619b8 /g10 | |
parent | See ChangeLog: Thu Dec 17 18:31:15 CET 1998 Werner Koch (diff) | |
download | gnupg2-750d74333ce5b3ec8ff37d45b64fd0603e043051.tar.xz gnupg2-750d74333ce5b3ec8ff37d45b64fd0603e043051.zip |
See ChangeLog: Wed Dec 23 13:34:22 CET 1998 Werner Koch
Diffstat (limited to 'g10')
57 files changed, 390 insertions, 180 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index b2ccffac4..8e959a21d 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,15 @@ +Wed Dec 23 13:18:14 CET 1998 Werner Koch <wk@isil.d.shuttle.de> + + * pkclist.c (add_ownertrust): Refresh validity values. + + * trustdb.c (enum_cert_paths_print): New arg refresh. + + * ringedit.c: Fixed problems fix keyrings + * parse-packet.c (dbg_parse_packet): New debug functions. + + * getkey.c (getkey_disable_caches): New. + * import.c (import_keys): Disable caches. + Thu Dec 17 18:31:15 CET 1998 Werner Koch <wk@isil.d.shuttle.de> * misc.c (trap_unaligned): Only for glibc 1 diff --git a/g10/armor.c b/g10/armor.c index ca74fe448..0aca33333 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -1179,7 +1179,7 @@ armor_filter( void *opaque, int control, iobuf_writestr(a, "-----\n"); } else if( !afx->any_data && !afx->inp_bypass ) - log_error(_("no valid RFC1991 or OpenPGP data found.\n")); + log_error(_("no valid OpenPGP data found.\n")); } else if( control == IOBUFCTRL_DESC ) *(char**)buf = "armor_filter"; diff --git a/g10/build-packet.c b/g10/build-packet.c index d83568328..5b952f153 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -1,14 +1,14 @@ /* build-packet.c - assemble packets and write them * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/cipher.c b/g10/cipher.c index 4664a4a83..c654db011 100644 --- a/g10/cipher.c +++ b/g10/cipher.c @@ -1,14 +1,14 @@ /* cipher.c - En-/De-ciphering filter * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/comment.c b/g10/comment.c index 71d524c40..6d27e481b 100644 --- a/g10/comment.c +++ b/g10/comment.c @@ -1,14 +1,14 @@ /* comment.c - write comment stuff * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/compress.c b/g10/compress.c index 6a2f8f8c5..31cc4c500 100644 --- a/g10/compress.c +++ b/g10/compress.c @@ -1,14 +1,14 @@ /* compress.c - compress filter * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/dearmor.c b/g10/dearmor.c index 6b15f491b..43fc6b059 100644 --- a/g10/dearmor.c +++ b/g10/dearmor.c @@ -1,14 +1,14 @@ /* dearmor.c - Armor utility * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/decrypt.c b/g10/decrypt.c index cb1cccd4c..4094321c3 100644 --- a/g10/decrypt.c +++ b/g10/decrypt.c @@ -1,14 +1,14 @@ /* verify.c - verify signed data * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/delkey.c b/g10/delkey.c index 08648b84b..8d4f1a5b0 100644 --- a/g10/delkey.c +++ b/g10/delkey.c @@ -1,14 +1,14 @@ /* delkey.c - delete keys * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/encode.c b/g10/encode.c index 8245dd02e..303cf798a 100644 --- a/g10/encode.c +++ b/g10/encode.c @@ -1,14 +1,14 @@ /* encode.c - encode data * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/encr-data.c b/g10/encr-data.c index e5338c75d..ff7954c64 100644 --- a/g10/encr-data.c +++ b/g10/encr-data.c @@ -1,14 +1,14 @@ /* encr-data.c - process an encrypted data packet * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/export.c b/g10/export.c index c9056115d..6b4b41cdd 100644 --- a/g10/export.c +++ b/g10/export.c @@ -1,14 +1,14 @@ /* export.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/filter.h b/g10/filter.h index f4d924965..75d629e68 100644 --- a/g10/filter.h +++ b/g10/filter.h @@ -1,14 +1,14 @@ /* filter.h * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/free-packet.c b/g10/free-packet.c index e2bbc1640..bd4ed0422 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -1,14 +1,14 @@ /* free-packet.c - cleanup stuff for packets * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -1,14 +1,14 @@ /* g10.c - The GnuPG utility (main for gpg) * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/getkey.c b/g10/getkey.c index 65c0ae495..f31529910 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1,14 +1,14 @@ /* getkey.c - Get a key from the database * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -160,7 +160,7 @@ cache_public_key( PKT_public_key *pk ) if( pk_cache_entries >= MAX_PK_CACHE_ENTRIES ) { /* fixme: use another algorithm to free some cache slots */ pk_cache_disabled=1; - if( opt.verbose ) + if( opt.verbose > 1 ) log_info(_("too many entries in pk cache - disabled\n")); return; } @@ -208,6 +208,38 @@ cache_user_id( PKT_user_id *uid, u32 *keyid ) } +void +getkey_disable_caches() +{ + #if MAX_UNK_CACHE_ENTRIES + { + keyid_list_t kl, kl2; + for( kl = unknown_keyids; kl; kl = kl2 ) { + kl2 = kl->next; + m_free(kl); + } + unknown_keyids = NULL; + unk_cache_disabled = 1; + } + #endif + #if MAX_PK_CACHE_ENTRIES + { + pk_cache_entry_t ce, ce2; + u32 keyid[2]; + + for( ce = pk_cache; ce; ce = ce2 ) { + ce2 = ce->next; + free_public_key( ce->pk ); + m_free( ce ); + } + pk_cache_disabled=1; + pk_cache_entries = 0; + pk_cache = NULL; + } + #endif + /* fixme: disable user id cache ? */ +} + /**************** * Get a public key and store it into the allocated pk @@ -259,7 +291,7 @@ get_pubkey( PKT_public_key *pk, u32 *keyid ) ; else if( ++unk_cache_entries > MAX_UNK_CACHE_ENTRIES ) { unk_cache_disabled = 1; - if( opt.verbose ) + if( opt.verbose > 1 ) log_info(_("too many entries in unk cache - disabled\n")); } else { diff --git a/g10/gpgd.c b/g10/gpgd.c index 5d85e1f13..b4be6044c 100644 --- a/g10/gpgd.c +++ b/g10/gpgd.c @@ -1,14 +1,14 @@ -/* ggpd.c - The GNUPG daemon (keyserver) +/* ggpd.c - The GnuPG daemon (keyserver) * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/import.c b/g10/import.c index 2fa25c542..7de0fc919 100644 --- a/g10/import.c +++ b/g10/import.c @@ -130,6 +130,9 @@ import_keys( const char *fname, int fast ) return G10ERR_OPEN_FILE; } + + getkey_disable_caches(); + if( !opt.no_armor ) /* armored reading is not disabled */ iobuf_push_filter( inp, armor_filter, &afx ); diff --git a/g10/kbnode.c b/g10/kbnode.c index 1048f316d..70c85f7bd 100644 --- a/g10/kbnode.c +++ b/g10/kbnode.c @@ -1,14 +1,14 @@ /* kbnode.c - keyblock node utility functions * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/keydb.h b/g10/keydb.h index a3abbe76f..1d1c6c26c 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -1,14 +1,14 @@ /* keydb.h - Key database * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -77,6 +77,7 @@ struct keyblock_pos_struct { byte keybuf[21]; #endif PACKET *pkt; /* ditto */ + int valid; }; typedef struct keyblock_pos_struct KBPOS; @@ -130,6 +131,7 @@ char *get_last_passphrase(void); /*-- getkey.c --*/ int classify_user_id( const char *name, u32 *keyid, byte *fprint, const char **retstr, size_t *retlen ); +void getkey_disable_caches(void); int get_pubkey( PKT_public_key *pk, u32 *keyid ); int get_pubkey_byname( GETKEY_CTX *rx, PKT_public_key *pk, const char *name, KBNODE *ret_keyblock ); diff --git a/g10/keyedit.c b/g10/keyedit.c index b402b4f99..0a711c282 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -1,14 +1,14 @@ /* keyedit.c - keyedit stuff * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/keygen.c b/g10/keygen.c index cea7ffdb5..2745649c5 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -1,14 +1,14 @@ /* keygen.c - generate a key pair * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/keyid.c b/g10/keyid.c index 21e7e12e3..665b3be86 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -1,14 +1,14 @@ /* keyid.c - jeyid and fingerprint handling * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/keylist.c b/g10/keylist.c index f2ded0455..3c68680e4 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1,14 +1,14 @@ /* keylist.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/ks-proto.c b/g10/ks-proto.c index b5109f2ad..43abf468a 100644 --- a/g10/ks-proto.c +++ b/g10/ks-proto.c @@ -1,14 +1,14 @@ /* ks-proto.c keyserver protocol handling * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/ks-proto.h b/g10/ks-proto.h index 67d2ed4ae..bd58db5f9 100644 --- a/g10/ks-proto.h +++ b/g10/ks-proto.h @@ -1,14 +1,14 @@ /* ks-proto.h * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/main.h b/g10/main.h index 72f433fcc..b917bae26 100644 --- a/g10/main.h +++ b/g10/main.h @@ -1,14 +1,14 @@ /* main.h * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/mainproc.c b/g10/mainproc.c index acf5bf5e7..0d5c88f5c 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1,14 +1,14 @@ /* mainproc.c - handle packets * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/mdfilter.c b/g10/mdfilter.c index a18636e8b..1d26e20ba 100644 --- a/g10/mdfilter.c +++ b/g10/mdfilter.c @@ -1,14 +1,14 @@ /* mdfilter.c - filter data and calculate a message digest * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/misc.c b/g10/misc.c index e7990475b..e533966d9 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1,14 +1,14 @@ /* misc.c - miscellaneous functions * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/openfile.c b/g10/openfile.c index a6d24ed38..1ffeeedee 100644 --- a/g10/openfile.c +++ b/g10/openfile.c @@ -1,14 +1,14 @@ /* openfile.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/options.h b/g10/options.h index b6b1cd2de..e6491864e 100644 --- a/g10/options.h +++ b/g10/options.h @@ -1,14 +1,14 @@ /* options.h * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/options.skel b/g10/options.skel index 82916826c..1ad93b487 100644 --- a/g10/options.skel +++ b/g10/options.skel @@ -33,7 +33,7 @@ force-v3-sigs # cleartext signatures; all other PGP versions it this way too. # To enable full OpenPGP compliance you have to remove this option. -escape_from_lines +escape-from-lines # If you do not use the Latin-1 (ISO-8859-1) charset, you should # tell GnuPG which is the native character set. Please check diff --git a/g10/packet.h b/g10/packet.h index e047fd944..1f5f57416 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -1,14 +1,14 @@ /* packet.h - packet read/write stuff * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -27,6 +27,8 @@ #include "cipher.h" #include "filter.h" +#define DEBUG_PARSE_PACKET 1 + typedef enum { PKT_NONE =0, PKT_PUBKEY_ENC =1, /* public key encrypted packet */ @@ -236,11 +238,26 @@ int list_packets( IOBUF a ); /*-- parse-packet.c --*/ int set_packet_list_mode( int mode ); + +#if DEBUG_PARSE_PACKET +int dbg_search_packet( IOBUF inp, PACKET *pkt, int pkttype, ulong *retpos, const char* file, int lineno ); +int dbg_parse_packet( IOBUF inp, PACKET *ret_pkt, const char* file, int lineno ); +int dbg_copy_all_packets( IOBUF inp, IOBUF out, const char* file, int lineno ); +int dbg_copy_some_packets( IOBUF inp, IOBUF out, ulong stopoff, const char* file, int lineno ); +int dbg_skip_some_packets( IOBUF inp, unsigned n, const char* file, int lineno ); +#define search_packet( a,b,c,d ) dbg_search_packet( (a), (b), (c), (d), __FILE__, __LINE__ ) +#define parse_packet( a, b ) dbg_parse_packet( (a), (b), __FILE__, __LINE__ ) +#define copy_all_packets( a,b ) dbg_copy_all_packets((a),(b), __FILE__, __LINE__ ) +#define copy_some_packets( a,b,c ) dbg_copy_some_packets((a),(b),(c), __FILE__, __LINE__ ) +#define skip_some_packets( a,b ) dbg_skip_some_packets((a),(b), __FILE__, __LINE__ ) +#else int search_packet( IOBUF inp, PACKET *pkt, int pkttype, ulong *retpos ); int parse_packet( IOBUF inp, PACKET *ret_pkt); int copy_all_packets( IOBUF inp, IOBUF out ); int copy_some_packets( IOBUF inp, IOBUF out, ulong stopoff ); int skip_some_packets( IOBUF inp, unsigned n ); +#endif + const byte *parse_sig_subpkt( const byte *buffer, sigsubpkttype_t reqtype, size_t *ret_n ); const byte *parse_sig_subpkt2( PKT_signature *sig, diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 29e4fc4e6..5bee45b32 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -1,14 +1,14 @@ /* parse-packet.c - read packets * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -39,7 +39,11 @@ static int mpi_print_mode = 0; static int list_mode = 0; static int parse( IOBUF inp, PACKET *pkt, int reqtype, - ulong *retpos, int *skip, IOBUF out, int do_skip ); + ulong *retpos, int *skip, IOBUF out, int do_skip + #ifdef DEBUG_PARSE_PACKET + ,const char *dbg_w, const char *dbg_f, int dbg_l + #endif + ); static int copy_packet( IOBUF inp, IOBUF out, int pkttype, unsigned long pktlen ); static void skip_packet( IOBUF inp, int pkttype, unsigned long pktlen ); @@ -119,6 +123,18 @@ unknown_pubkey_warning( int algo ) * Note: The function may return an error and a partly valid packet; * caller must free this packet. */ +#ifdef DEBUG_PARSE_PACKET +int +dbg_parse_packet( IOBUF inp, PACKET *pkt, const char *dbg_f, int dbg_l ) +{ + int skip, rc; + + do { + rc = parse( inp, pkt, 0, NULL, &skip, NULL, 0, "parse", dbg_f, dbg_l ); + } while( skip ); + return rc; +} +#else int parse_packet( IOBUF inp, PACKET *pkt ) { @@ -129,10 +145,24 @@ parse_packet( IOBUF inp, PACKET *pkt ) } while( skip ); return rc; } +#endif /**************** * Like parse packet, but only return packets of the given type. */ +#ifdef DEBUG_PARSE_PACKET +int +dbg_search_packet( IOBUF inp, PACKET *pkt, int pkttype, ulong *retpos, + const char *dbg_f, int dbg_l ) +{ + int skip, rc; + + do { + rc = parse( inp, pkt, pkttype, retpos, &skip, NULL, 0, "search", dbg_f, dbg_l ); + } while( skip ); + return rc; +} +#else int search_packet( IOBUF inp, PACKET *pkt, int pkttype, ulong *retpos ) { @@ -143,10 +173,24 @@ search_packet( IOBUF inp, PACKET *pkt, int pkttype, ulong *retpos ) } while( skip ); return rc; } +#endif /**************** * Copy all packets from INP to OUT, thereby removing unused spaces. */ +#ifdef DEBUG_PARSE_PACKET +int +dbg_copy_all_packets( IOBUF inp, IOBUF out, + const char *dbg_f, int dbg_l ) +{ + PACKET pkt; + int skip, rc=0; + do { + init_packet(&pkt); + } while( !(rc = parse( inp, &pkt, 0, NULL, &skip, out, 0, "copy", dbg_f, dbg_l ))); + return rc; +} +#else int copy_all_packets( IOBUF inp, IOBUF out ) { @@ -157,11 +201,28 @@ copy_all_packets( IOBUF inp, IOBUF out ) } while( !(rc = parse( inp, &pkt, 0, NULL, &skip, out, 0 ))); return rc; } +#endif /**************** * Copy some packets from INP to OUT, thereby removing unused spaces. * Stop at offset STOPoff (i.e. don't copy packets at this or later offsets) */ +#ifdef DEBUG_PARSE_PACKET +int +dbg_copy_some_packets( IOBUF inp, IOBUF out, ulong stopoff, + const char *dbg_f, int dbg_l ) +{ + PACKET pkt; + int skip, rc=0; + do { + if( iobuf_tell(inp) >= stopoff ) + return 0; + init_packet(&pkt); + } while( !(rc = parse( inp, &pkt, 0, NULL, &skip, out, 0, + "some", dbg_f, dbg_l )) ); + return rc; +} +#else int copy_some_packets( IOBUF inp, IOBUF out, ulong stopoff ) { @@ -174,10 +235,26 @@ copy_some_packets( IOBUF inp, IOBUF out, ulong stopoff ) } while( !(rc = parse( inp, &pkt, 0, NULL, &skip, out, 0 )) ); return rc; } +#endif /**************** * Skip over N packets */ +#ifdef DEBUG_PARSE_PACKET +int +dbg_skip_some_packets( IOBUF inp, unsigned n, + const char *dbg_f, int dbg_l ) +{ + int skip, rc=0; + PACKET pkt; + + for( ;n && !rc; n--) { + init_packet(&pkt); + rc = parse( inp, &pkt, 0, NULL, &skip, NULL, 1, "skip", dbg_f, dbg_l ); + } + return rc; +} +#else int skip_some_packets( IOBUF inp, unsigned n ) { @@ -190,7 +267,7 @@ skip_some_packets( IOBUF inp, unsigned n ) } return rc; } - +#endif /**************** @@ -202,7 +279,11 @@ skip_some_packets( IOBUF inp, unsigned n ) */ static int parse( IOBUF inp, PACKET *pkt, int reqtype, ulong *retpos, - int *skip, IOBUF out, int do_skip ) + int *skip, IOBUF out, int do_skip +#ifdef DEBUG_PARSE_PACKET + ,const char *dbg_w, const char *dbg_f, int dbg_l +#endif + ) { int rc=0, c, ctb, pkttype, lenbytes; unsigned long pktlen; @@ -214,6 +295,7 @@ parse( IOBUF inp, PACKET *pkt, int reqtype, ulong *retpos, assert( !pkt->pkt.generic ); if( retpos ) *retpos = iobuf_tell(inp); + if( (ctb = iobuf_get(inp)) == -1 ) { rc = -1; goto leave; @@ -221,7 +303,8 @@ parse( IOBUF inp, PACKET *pkt, int reqtype, ulong *retpos, hdrlen=0; hdr[hdrlen++] = ctb; if( !(ctb & 0x80) ) { - log_error("%s: invalid packet (ctb=%02x)\n", iobuf_where(inp), ctb ); + log_error("%s: invalid packet (ctb=%02x) near %lu\n", + iobuf_where(inp), ctb, iobuf_tell(inp) ); rc = G10ERR_INVALID_PACKET; goto leave; } @@ -294,9 +377,16 @@ parse( IOBUF inp, PACKET *pkt, int reqtype, ulong *retpos, goto leave; } - if( DBG_PACKET ) + if( DBG_PACKET ) { + #ifdef DEBUG_PARSE_PACKET + log_debug("parse_packet(iob=%d): type=%d length=%lu%s (%s.%s.%d)\n", + iobuf_id(inp), pkttype, pktlen, new_ctb?" (new_ctb)":"", + dbg_w, dbg_f, dbg_l ); + #else log_debug("parse_packet(iob=%d): type=%d length=%lu%s\n", iobuf_id(inp), pkttype, pktlen, new_ctb?" (new_ctb)":"" ); + #endif + } pkt->pkttype = pkttype; rc = G10ERR_UNKNOWN_PACKET; /* default error */ switch( pkttype ) { @@ -384,6 +474,7 @@ copy_packet( IOBUF inp, IOBUF out, int pkttype, unsigned long pktlen ) return G10ERR_WRITE_FILE; /* write error */ } else if( !pktlen && pkttype == PKT_COMPRESSED ) { + log_debug("copy_packet: compressed!\n"); /* compressed packet, copy till EOF */ while( (n = iobuf_read( inp, buf, 100 )) != -1 ) if( iobuf_write(out, buf, n ) ) diff --git a/g10/passphrase.c b/g10/passphrase.c index 966338ff9..7f975b840 100644 --- a/g10/passphrase.c +++ b/g10/passphrase.c @@ -1,14 +1,14 @@ /* passphrase.c - Get a passphrase * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/pkclist.c b/g10/pkclist.c index fb0a89e7a..86c239115 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -1,14 +1,14 @@ /* pkclist.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -205,6 +205,8 @@ edit_ownertrust( ulong lid, int mode ) /**************** * Try to add some more owner trusts (interactive) + * This function presents all the signator in a certificate + * chain who have no trust value assigned. * Returns: -1 if no ownertrust were added. */ static int @@ -232,10 +234,18 @@ _("Could not find a valid trust path to the key. Let's see whether we\n" if( lid == pk->local_id ) continue; any=1; - if( otrust == TRUST_UNDEFINED || otrust == TRUST_EXPIRED || - otrust == TRUST_UNKNOWN ) { + if( changed ) { + /* because enum_cert_paths() makes a snapshop of the + * trust paths, the otrust and validity are not anymore + * valid after changing an entry - we have to reread + * those values from then on + */ + otrust = get_ownertrust( lid ); + } + if( otrust == TRUST_UNDEFINED ) { any_undefined=1; - enum_cert_paths_print( &context, NULL, lid ); + enum_cert_paths_print( &context, NULL, changed, lid ); + tty_printf("\n"); rc = edit_ownertrust( lid, 0 ); if( rc == -1 ) { *quit = 1; diff --git a/g10/plaintext.c b/g10/plaintext.c index d471b9fe3..60f00cbf3 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -1,14 +1,14 @@ /* plaintext.c - process an plaintext packet * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/pref.c b/g10/pref.c index 342696907..53ae41845 100644 --- a/g10/pref.c +++ b/g10/pref.c @@ -1,14 +1,14 @@ /* pref.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/pref.h b/g10/pref.h index ec173c90b..cc827bbc5 100644 --- a/g10/pref.h +++ b/g10/pref.h @@ -1,14 +1,14 @@ /* pref.h * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index cb021c47f..4e6e78409 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -1,14 +1,14 @@ /* pubkey-enc.c - public key encoded packet handling * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/revoke.c b/g10/revoke.c index 2491ee023..b4728e27d 100644 --- a/g10/revoke.c +++ b/g10/revoke.c @@ -1,14 +1,14 @@ /* revoke.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/ringedit.c b/g10/ringedit.c index 008fa18c9..d46094cee 100644 --- a/g10/ringedit.c +++ b/g10/ringedit.c @@ -1,14 +1,14 @@ /* ringedit.c - Function for key ring editing * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -298,7 +298,7 @@ add_keyblock_resource( const char *url, int force, int secret ) else log_info(_("%s: keyring created\n"), filename ); } - #ifdef __MINGW32__ + #if __MINGW32__ || 1 /* must close it again */ iobuf_close( iobuf ); iobuf = NULL; @@ -687,6 +687,7 @@ enum_keyblocks( int mode, KBPOS *kbpos, KBNODE *ret_root ) kbpos->resno = i; rentry = check_pos( kbpos ); kbpos->rt = resource_table[i].rt; + kbpos->valid = 0; switch( kbpos->rt ) { case rt_RING: kbpos->fp = iobuf_open( rentry->fname ); @@ -860,7 +861,7 @@ update_keyblock( KBPOS *kbpos, KBNODE root ) * A string "GnuPG user db", a \n. * user ids of one key, delimited by \t, * a # or ^ followed by a 20 byte fingerprint, followed by an \n - * The literal characters =, \n, \t, #, ^ must be replaced by a equal sign + * The literal characters %, \n, \t, #, ^ must be replaced by a percent sign * and their hex value. * * (We use Boyer/Moore pattern matching) @@ -1019,8 +1020,9 @@ keyring_search( PACKET *req, KBPOS *kbpos, IOBUF iobuf, const char *fname ) init_packet(&pkt); save_mode = set_packet_list_mode(0); kbpos->rt = rt_RING; + kbpos->valid = 0; - #if __MINGW32__ + #if __MINGW32__ || 1 assert(!iobuf); iobuf = iobuf_open( fname ); if( !iobuf ) { @@ -1057,13 +1059,15 @@ keyring_search( PACKET *req, KBPOS *kbpos, IOBUF iobuf, const char *fname ) BUG(); free_packet(&pkt); } - if( !rc ) + if( !rc ) { kbpos->offset = offset; + kbpos->valid = 1; + } leave: free_packet(&pkt); set_packet_list_mode(save_mode); - #if __MINGW32__ + #if __MINGW32__ || 1 iobuf_close(iobuf); #endif return rc; @@ -1089,6 +1093,8 @@ keyring_read( KBPOS *kbpos, KBNODE *ret_root ) return G10ERR_OPEN_FILE; } + if( !kbpos->valid ) + log_debug("kbpos not valid in keyring_read, want %d\n", (int)kbpos->offset ); if( iobuf_seek( a, kbpos->offset ) ) { log_error("can't seek to %lu\n", kbpos->offset); iobuf_close(a); @@ -1112,6 +1118,12 @@ keyring_read( KBPOS *kbpos, KBNODE *ret_root ) } /* make a linked list of all packets */ switch( pkt->pkttype ) { + case PKT_COMPRESSED: + log_error("skipped compressed packet in keyring\n" ); + free_packet(pkt); + init_packet(pkt); + break; + case PKT_PUBLIC_KEY: case PKT_SECRET_KEY: if( in_cert ) @@ -1129,6 +1141,7 @@ keyring_read( KBPOS *kbpos, KBNODE *ret_root ) } } ready: + kbpos->valid = 0; if( rc == -1 && root ) rc = 0; @@ -1174,6 +1187,12 @@ keyring_enum( KBPOS *kbpos, KBNODE *ret_root, int skipsigs ) } /* make a linked list of all packets */ switch( pkt->pkttype ) { + case PKT_COMPRESSED: + log_error("skipped compressed packet in keyring\n" ); + free_packet(pkt); + init_packet(pkt); + break; + case PKT_PUBLIC_KEY: case PKT_SECRET_KEY: if( root ) { /* store this packet */ @@ -1387,6 +1406,7 @@ keyring_copy( KBPOS *kbpos, int mode, KBNODE root ) goto leave; } } + kbpos->valid = 0; } if( mode == 2 || mode == 3 ) { /* delete or update */ diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c index 1950ae0e1..6adfafdf4 100644 --- a/g10/seckey-cert.c +++ b/g10/seckey-cert.c @@ -1,14 +1,14 @@ /* seckey-cert.c - secret key certifucate packet handling * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/seskey.c b/g10/seskey.c index b9dab28cc..bb158abc0 100644 --- a/g10/seskey.c +++ b/g10/seskey.c @@ -1,14 +1,14 @@ /* seskey.c - make sesssion keys etc. * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/sig-check.c b/g10/sig-check.c index 63bdda220..355f6cdef 100644 --- a/g10/sig-check.c +++ b/g10/sig-check.c @@ -1,14 +1,14 @@ /* sig-check.c - Check a signature * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/sign.c b/g10/sign.c index f3373ed4f..8a9ef0bba 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -1,14 +1,14 @@ /* sign.c - sign data * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/signal.c b/g10/signal.c index 8a0f3feee..1f599d9d0 100644 --- a/g10/signal.c +++ b/g10/signal.c @@ -1,14 +1,14 @@ /* signal.c - signal handling * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/skclist.c b/g10/skclist.c index caaab207c..baf4a5cf3 100644 --- a/g10/skclist.c +++ b/g10/skclist.c @@ -1,14 +1,14 @@ /* skclist.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/status.c b/g10/status.c index e441d5e21..71a4e8341 100644 --- a/g10/status.c +++ b/g10/status.c @@ -1,14 +1,14 @@ /* status.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/status.h b/g10/status.h index 4adce1282..fa1583687 100644 --- a/g10/status.h +++ b/g10/status.h @@ -1,14 +1,14 @@ /* status.h * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/tdbio.c b/g10/tdbio.c index 5d1864c3d..f7ba36f7c 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -1,14 +1,14 @@ /* tdbio.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/tdbio.h b/g10/tdbio.h index d2d369bed..925c7f93c 100644 --- a/g10/tdbio.h +++ b/g10/tdbio.h @@ -1,14 +1,14 @@ /* tdbio.h - Trust database I/O functions * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/textfilter.c b/g10/textfilter.c index fc81a9136..9e820d159 100644 --- a/g10/textfilter.c +++ b/g10/textfilter.c @@ -1,14 +1,14 @@ /* textfilter.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. diff --git a/g10/trustdb.c b/g10/trustdb.c index ff05a32ac..de76a25e6 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -1,14 +1,14 @@ /* trustdb.c * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -1750,7 +1750,8 @@ enum_cert_paths( void **context, ulong *lid, * Print the current path */ int -enum_cert_paths_print( void **context, FILE *fp, ulong selected_lid ) +enum_cert_paths_print( void **context, FILE *fp, + int refresh, ulong selected_lid ) { struct enum_cert_paths_ctx *ctx; TRUST_SEG_LIST tsl; @@ -1760,11 +1761,32 @@ enum_cert_paths_print( void **context, FILE *fp, ulong selected_lid ) ctx = *context; if( !ctx->tsl ) return; + tsl = ctx->tsl; if( !fp ) fp = stderr; - print_path( ctx->tsl->pathlen, ctx->tsl->path, fp, selected_lid ); + if( refresh ) { /* update the ownertrust and if possible the validity */ + int i; + int match = tdbio_db_matches_options(); + + for( i = 0; i < tsl->pathlen; i++ ) { + TRUSTREC rec; + + read_record( tsl->path[i].lid, &rec, RECTYPE_DIR ); + tsl->path[i].otrust = rec.r.dir.ownertrust; + /* update validity only if we have it in the cache + * calculation is too time consuming */ + if( match && (rec.r.dir.dirflags & DIRF_VALVALID) + && rec.r.dir.validity ) { + tsl->path[i].trust = rec.r.dir.validity; + if( rec.r.dir.dirflags & DIRF_REVOKED ) + tsl->path[i].trust = TRUST_FLAG_REVOKED; + } + } + } + + print_path( tsl->pathlen, tsl->path, fp, selected_lid ); } diff --git a/g10/trustdb.h b/g10/trustdb.h index fd92826ba..52caadb8f 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -1,14 +1,14 @@ /* trustdb.h - Trust database * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. @@ -53,7 +53,8 @@ int check_trust( PKT_public_key *pk, unsigned *r_trustlevel ); int query_trust_info( PKT_public_key *pk ); int enum_cert_paths( void **context, ulong *lid, unsigned *ownertrust, unsigned *validity ); -int enum_cert_paths_print( void **context, FILE *fp, ulong selected_lid ); +int enum_cert_paths_print( void **context, FILE *fp, + int refresh, ulong selected_lid ); unsigned get_ownertrust( ulong lid ); int get_ownertrust_info( ulong lid ); byte *get_pref_data( ulong lid, const byte *namehash, size_t *ret_n ); diff --git a/g10/verify.c b/g10/verify.c index 02cc5d003..86537d07c 100644 --- a/g10/verify.c +++ b/g10/verify.c @@ -1,14 +1,14 @@ /* verify.c - verify signed data * Copyright (C) 1998 Free Software Foundation, Inc. * - * This file is part of GNUPG. + * This file is part of GnuPG. * - * GNUPG is free software; you can redistribute it and/or modify + * GnuPG 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; either version 2 of the License, or * (at your option) any later version. * - * GNUPG is distributed in the hope that it will be useful, + * GnuPG 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. |