#include "keystructs.h"
#include "ll.h"
#include "mem.h"
+#include "onak-conf.h"
#include "parsekey.h"
-#define DBDIR "/home/noodles/onak-0.0.1/db"
-
/**
* keydb_fetchchar - Fetches a char from a file.
*/
/**
* keydb_putchar - Puts a char to a file.
*/
-static int keydb_putchar(void *fd, unsigned char c)
+static int keydb_putchar(void *fd, size_t count, unsigned char *c)
{
- return !(write( *(int *) fd, &c, sizeof(c)));
+ return !(write( *(int *) fd, c, count));
}
/**
char keyfile[1024];
int fd = -1;
- snprintf(keyfile, 1023, "%s/0x%llX", DBDIR, keyid & 0xFFFFFFFF);
+ snprintf(keyfile, 1023, "%s/0x%llX", config.file_dbpath,
+ keyid & 0xFFFFFFFF);
fd = open(keyfile, O_RDONLY); // | O_SHLOCK);
if (fd > -1) {
char keyfile[1024];
int fd = -1;
- snprintf(keyfile, 1023, "%s/0x%llX", DBDIR,
+ snprintf(keyfile, 1023, "%s/0x%llX", config.file_dbpath,
get_keyid(publickey) & 0xFFFFFFFF);
fd = open(keyfile, O_WRONLY | O_CREAT, 0664); // | O_EXLOCK);
{
char keyfile[1024];
- snprintf(keyfile, 1023, "%s/0x%llX", DBDIR,
+ snprintf(keyfile, 1023, "%s/0x%llX", config.file_dbpath,
keyid & 0xFFFFFFFF);
return unlink(keyfile);
/*
* Include the basic keydb routines.
*/
+#define NEED_KEYID2UID 1
+#define NEED_GETKEYSIGS 1
+#define NEED_GETFULLKEYID 1
#include "keydb.c"