aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Bellon <[email protected]>2002-01-02 17:49:29 +0000
committerStefan Bellon <[email protected]>2002-01-02 17:49:29 +0000
commit47f2e3c2457da310132142513d8a3643bfa49d8f (patch)
treee6e18290821d10eeca90516981781211a7bebb8a
parentupdated prototypes for RISC OS (diff)
downloadgnupg-47f2e3c2457da310132142513d8a3643bfa49d8f.tar.gz
gnupg-47f2e3c2457da310132142513d8a3643bfa49d8f.zip
lock only writable key rings and free unused iobuf
-rw-r--r--g10/ChangeLog17
-rw-r--r--g10/keyring.c14
2 files changed, 28 insertions, 3 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 339653e22..dd23b0a1b 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,18 @@
+2002-01-02 Stefan Bellon <[email protected]>
+
+ * keyserver.c: Moved util.h include down in order to avoid
+ redefinition problems on RISC OS.
+
+ * keyring.c (keyring_lock): Only lock keyrings that are writable.
+
+ * keyring.c (keyring_update_keyblock): Close unused iobuf.
+
+ * hkp.c (parse_hkp_index, hkp_search) [__riscos__]: Changed
+ unsigned char* to char* because of compiler issues.
+
+ * exec.c (exec_finish) [__riscos__]: Invalidate close cache so
+ that file can be unlinked.
+
2001-12-28 David Shaw <[email protected]>
* g10.c (main): Use a different strlist to check extensions since
@@ -181,8 +196,6 @@
* getkey.c (get_ctx_handle): New.
* keylist.c (list_one): Implement option here. By David Champion.
-=======
->>>>>>> 1.162.2.192
2001-12-20 David Shaw <[email protected]>
* keyserver.c (keyserver_spawn): Use mkdtemp() to make temp
diff --git a/g10/keyring.c b/g10/keyring.c
index 153647572..7852a1481 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -292,6 +292,8 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
if (yes) {
/* first make sure the lock handles are created */
for (kr=kr_names; kr; kr = kr->next) {
+ if (!keyring_is_writable(kr))
+ continue;
if (!kr->lockhd) {
kr->lockhd = create_dotlock( kr->fname );
if (!kr->lockhd) {
@@ -305,6 +307,8 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
/* and now set the locks */
for (kr=kr_names; kr; kr = kr->next) {
+ if (!keyring_is_writable(kr))
+ continue;
if (kr->is_locked)
;
else if (make_dotlock (kr->lockhd, -1) ) {
@@ -318,6 +322,8 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
if (rc || !yes) {
for (kr=kr_names; kr; kr = kr->next) {
+ if (!keyring_is_writable(kr))
+ continue;
if (!kr->is_locked)
;
else if (release_dotlock (kr->lockhd))
@@ -488,6 +494,12 @@ keyring_update_keyblock (KEYRING_HANDLE hd, KBNODE kb)
BUG ();
}
+ /* The open iobuf isn't needed anymore and in fact is a problem when
+ it comes to renaming the keyring files on some operating systems,
+ so close it here */
+ iobuf_close(hd->current.iobuf);
+ hd->current.iobuf = NULL;
+
/* do the update */
rc = do_copy (3, hd->found.kr->fname, kb, hd->secret,
hd->found.offset, hd->found.n_packets );
@@ -1410,6 +1422,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
permissions of the file */
if (access (fname, W_OK))
return G10ERR_WRITE_FILE;
+
fp = iobuf_open (fname);
if (mode == 1 && !fp && errno == ENOENT) {
/* insert mode but file does not exist: create a new file */
@@ -1456,7 +1469,6 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
iobuf_close(fp);
goto leave;
}
-
if( mode == 1 ) { /* insert */
/* copy everything to the new file */
rc = copy_all_packets (fp, newfp);