Package: gnupg Version: 1.4.1-1.1 Followup-For: Bug #38857 tags 38857 + patch thanks
Hi, I wrote a patch for gnupg to handle readonly keyrings correctly. What it does now, is that when you try to modify a key in a keyring that is not writable it makes a copy of that keyring to a writable one and modifies it. Patch attached. -- Toni Timonen "toni dot timonen at iki dot fi" NP Solutions Ltd Helsinki University of Technology Department of Engineering Physics and Mathematics
diff -Nrub orig/gnupg-1.4.1/debian/patches/00list new/gnupg-1.4.1/debian/patches/00list --- orig/gnupg-1.4.1/debian/patches/00list 2005-07-18 19:17:32.000000000 +0300 +++ new/gnupg-1.4.1/debian/patches/00list 2005-07-18 19:53:17.000000000 +0300 @@ -1,2 +1,3 @@ 15_free_caps 16_min_privileges +20_readonly_keyrings diff -Nrub orig/gnupg-1.4.1/debian/patches/20_readonly_keyrings.dpatch new/gnupg-1.4.1/debian/patches/20_readonly_keyrings.dpatch --- orig/gnupg-1.4.1/debian/patches/20_readonly_keyrings.dpatch 1970-01-01 02:00:00.000000000 +0200 +++ new/gnupg-1.4.1/debian/patches/20_readonly_keyrings.dpatch 2005-07-18 19:53:13.000000000 +0300 @@ -0,0 +1,38 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 20_readonly_keyrings.dpatch by <[EMAIL PROTECTED]> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Patch to handle readonly keyrings (see #38857). + [EMAIL PROTECTED]@ + +diff -rub orig/gnupg-1.4.1/g10/keydb.c gnupg-1.4.1/g10/keydb.c +--- orig/gnupg-1.4.1/g10/keydb.c 2004-10-14 10:11:56.000000000 +0300 ++++ gnupg-1.4.1/g10/keydb.c 2005-07-18 19:34:53.000000000 +0300 +@@ -526,7 +526,17 @@ + rc = G10ERR_GENERAL; /* oops */ + break; + case KEYDB_RESOURCE_TYPE_KEYRING: ++ if(keyring_is_writable (hd->active[hd->found].token)) { + rc = keyring_update_keyblock (hd->active[hd->found].u.kr, kb); ++ } else { ++ rc = keydb_locate_writable(hd,NULL); ++ if (rc) { ++ log_error (_("no writable keyring found: %s\n"), g10_errstr (rc)); ++ break; ++ } ++ rc = keyring_insert_keyblock (hd->active[hd->current].u.kr, kb); ++ ++ } + break; + } + +@@ -680,6 +690,8 @@ + case KEYDB_RESOURCE_TYPE_NONE: /* ignore */ + break; + case KEYDB_RESOURCE_TYPE_KEYRING: ++ if(!keyring_is_writable(all_resources[i].token)) ++ break; + rc = keyring_rebuild_cache (all_resources[i].token,noisy); + if (rc) + log_error (_("failed to rebuild keyring cache: %s\n"),
signature.asc
Description: Digital signature