1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

kbx: Implement keybox_lock for use by gpg.

* kbx/keybox-defs.h: Include dotlock.h and logging.h.
(CONST_KB_NAME): Remove.  Replace usage by KB_NAME.
(struct keybox_name): Add field "lockhd".
* kbx/keybox-init.c (keybox_register_file): Init LOCKHD.
(keybox_lock): Chnage to return gpg_error_t.  Implement locking.
--

The keybox locking for gpg was not implemented - This needs to be
fixed of course.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-13 10:16:27 +01:00
parent 9dc355ad3a
commit 1608629786
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 55 additions and 15 deletions

View file

@ -40,6 +40,8 @@
fixme: Better use the LIBOBJ mechnism. */
#include "../common/types.h"
#include "../common/stringhelp.h"
#include "../common/dotlock.h"
#include "../common/logging.h"
#include "keybox.h"
@ -48,7 +50,6 @@ typedef struct keyboxblob *KEYBOXBLOB;
typedef struct keybox_name *KB_NAME;
typedef struct keybox_name const *CONST_KB_NAME;
struct keybox_name
{
/* Link to the next resources, so that we can walk all
@ -58,14 +59,15 @@ struct keybox_name
/* True if this is a keybox with secret keys. */
int secret;
/*DOTLOCK lockhd;*/
/* A table with all the handles accessing this resources.
HANDLE_TABLE_SIZE gives the allocated length of this table unused
entrues are set to NULL. HANDLE_TABLE may be NULL. */
KEYBOX_HANDLE *handle_table;
size_t handle_table_size;
/* The lock handle or NULL it not yet initialized. */
dotlock_t lockhd;
/* Not yet used. */
int is_locked;
@ -85,7 +87,7 @@ struct keybox_found_s
};
struct keybox_handle {
CONST_KB_NAME kb;
KB_NAME kb;
int secret; /* this is for a secret keybox */
FILE *fp;
int eof;