mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-23 10:29:58 +01:00
lock only writable key rings and free unused iobuf
This commit is contained in:
parent
52901c7380
commit
47f2e3c245
@ -1,3 +1,18 @@
|
||||
2002-01-02 Stefan Bellon <sbellon@sbellon.de>
|
||||
|
||||
* 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 <dshaw@jabberwocky.com>
|
||||
|
||||
* 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 <dshaw@jabberwocky.com>
|
||||
|
||||
* keyserver.c (keyserver_spawn): Use mkdtemp() to make temp
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user