aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/keybox-init.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2001-11-10 18:06:11 +0000
committerWerner Koch <[email protected]>2001-11-10 18:06:11 +0000
commitfcfec25620c2cb04d96e7e0efbec1fb5f065a806 (patch)
tree61639ff37273e9c89149523db6fbfb7bb60d4f7d /kbx/keybox-init.c
parentImplemented server main loop and started with import command. (diff)
downloadgnupg-fcfec25620c2cb04d96e7e0efbec1fb5f065a806.tar.gz
gnupg-fcfec25620c2cb04d96e7e0efbec1fb5f065a806.zip
Started with keybox implementation by basing it on code from the GnuPG
devel branch.
Diffstat (limited to 'kbx/keybox-init.c')
-rw-r--r--kbx/keybox-init.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/kbx/keybox-init.c b/kbx/keybox-init.c
new file mode 100644
index 000000000..a4649d18c
--- /dev/null
+++ b/kbx/keybox-init.c
@@ -0,0 +1,73 @@
+/* keybox-init.c - Initalization of the library
+ * Copyright (C) 2001 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * 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,
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "keybox-defs.h"
+
+/*
+ * Register a filename for plain keybox files. Returns a pointer to
+ * be used to create a handles etc or NULL to indicate that it has
+ * already been registered */
+void *
+keybox_register_file (const char *fname, int secret)
+{
+ return NULL;
+#if 0
+ KB_NAME kr;
+
+ if (active_handles)
+ BUG (); /* We don't allow that */
+
+ for (kr=kb_names; kr; kr = kr->next) {
+ if ( !compare_filenames (kr->fname, fname) )
+ return NULL; /* already registered */
+ }
+
+ kr = m_alloc (sizeof *kr + strlen (fname));
+ strcpy (kr->fname, fname);
+ kr->secret = !!secret;
+ kr->lockhd = NULL;
+ kr->is_locked = 0;
+ kr->did_full_scan = 0;
+ /* keep a list of all issued pointers */
+ kr->next = kb_names;
+ kb_names = kr;
+
+ /* create the offset table the first time a function here is used */
+ if (!kb_offtbl)
+ kb_offtbl = new_offset_hash_table ();
+
+ return kr;
+#endif
+}
+
+int
+keybox_is_writable (void *token)
+{
+ KB_NAME r = token;
+
+ return r? !access (r->fname, W_OK) : 0;
+}
+