]> the.earth.li Git - onak.git/blobdiff - keydb_keyring.c
Add option to only accept updates for existing keys
[onak.git] / keydb_keyring.c
index 62371aedce9a6e9918127acaecd72fff361485b9..9550434c612d5b027f3cf4a369b001d696d8e9fe 100644 (file)
@@ -85,7 +85,7 @@ static int keyring_fetch_key(struct onak_keyring_dbctx *privctx,
        if (index > privctx->count)
                return 0;
 
-       buf.buffer = privctx->keys[index].start;
+       buf.buffer = (char *) privctx->keys[index].start;
        buf.size = privctx->keys[index].len;
        buf.offset = 0;
 
@@ -161,13 +161,13 @@ static int keyring_store_key(struct onak_dbctx *dbctx,
 
 /**
  *     delete_key - Given a keyid delete the key from storage.
- *     @keyid: The keyid to delete.
+ *     @fp: The fingerprint of the key to delete.
  *     @intrans: If we're already in a transaction.
  *
  *     We don't support removing keys from a keyring file.
  */
 static int keyring_delete_key(struct onak_dbctx *dbctx,
-               uint64_t keyid, bool intrans)
+               struct openpgp_fingerprint *fp, bool intrans)
 {
        return 1;
 }
@@ -222,7 +222,10 @@ static int keyring_iterate_keys(struct onak_dbctx *dbctx,
 }
 
 static int keyring_update_keys(struct onak_dbctx *dbctx,
-                struct openpgp_publickey **keys, bool sendsync)
+               struct openpgp_publickey **keys,
+               struct keyarray *blacklist,
+               bool updateonly,
+               bool sendsync)
 {
        return 0;
 }
@@ -232,8 +235,6 @@ static int keyring_update_keys(struct onak_dbctx *dbctx,
  */
 #define NEED_KEYID2UID 1
 #define NEED_GETKEYSIGS 1
-#define NEED_GETFULLKEYID 1
-#define NEED_GET_FP 1
 #include "keydb.c"
 
 static int keyring_parse_keys(struct onak_keyring_dbctx *privctx)
@@ -254,7 +255,7 @@ static int keyring_parse_keys(struct onak_keyring_dbctx *privctx)
         * Walk the keyring file, noting the start of each public key and the
         * total length of packets associated with it.
         */
-       pos = start = totlen = 0;
+       len = pos = start = totlen = 0;
        while (((privctx->length - pos) > 5) && (privctx->file[pos] & 0x80)) {
                if (privctx->file[pos] & 0x40) {
                        tag = privctx->file[pos] & 0x3F;
@@ -265,7 +266,7 @@ static int keyring_parse_keys(struct onak_keyring_dbctx *privctx)
                                len += privctx->file[pos + 2];
                                len += 192;
                                len += 1; /* Header */
-                       } else if (len > 223 & len < 255) {
+                       } else if (len > 223 && len < 255) {
                                // Unsupported
                        } else if (len == 255) {
                                len = privctx->file[pos + 2];
@@ -448,7 +449,6 @@ struct onak_dbctx *keydb_keyring_init(struct onak_db_config *dbcfg,
        dbctx->getkeysigs               = generic_getkeysigs;
        dbctx->cached_getkeysigs        = generic_cached_getkeysigs;
        dbctx->keyid2uid                = generic_keyid2uid;
-       dbctx->getfullkeyid             = generic_getfullkeyid;
        dbctx->iterate_keys             = keyring_iterate_keys;
 
        return dbctx;