* 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., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * this program. If not, see <https://www.gnu.org/licenses/>.
*/
+#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include "cleankey.h"
-#include "decodekey.h"
-#include "hash.h"
#include "keydb.h"
-#include "keyid.h"
#include "keystructs.h"
+#include "ll.h"
#include "log.h"
-#include "mem.h"
-#include "merge.h"
#include "onak-conf.h"
-#include "openpgp.h"
-#include "parsekey.h"
-#include "sendsync.h"
struct onak_stacked_dbctx {
struct ll *backends;
publickey, intrans, update);
}
-static int stacked_delete_key(struct onak_dbctx *dbctx, uint64_t keyid,
+static int stacked_delete_key(struct onak_dbctx *dbctx,
+ struct openpgp_fingerprint *fp,
bool intrans)
{
struct onak_stacked_dbctx *privctx =
(struct onak_dbctx *) privctx->backends->object;
return backend->delete_key(backend,
- keyid, intrans);
+ fp, intrans);
}
static int stacked_update_keys(struct onak_dbctx *dbctx,
- struct openpgp_publickey **keys, bool sendsync)
+ struct openpgp_publickey **keys,
+ struct keyarray *blacklist,
+ bool sendsync)
{
struct onak_stacked_dbctx *privctx =
(struct onak_stacked_dbctx *) dbctx->priv;
struct onak_dbctx *backend =
(struct onak_dbctx *) privctx->backends->object;
- return backend->update_keys(backend, keys, sendsync);
+ return backend->update_keys(backend, keys, blacklist, sendsync);
}
static int stacked_iterate_keys(struct onak_dbctx *dbctx,
(struct onak_dbctx *) privctx->backends->object;
struct openpgp_publickey *curkey;
- cleankeys(publickey);
+ cleankeys(&publickey, config.clean_policies);
/*
* If we walked the stack at all, store the key in the first
* backend if configured to do so. It's not an update as we
*/
#define NEED_KEYID2UID 1
#define NEED_GETKEYSIGS 1
-#define NEED_GETFULLKEYID 1
#define NEED_UPDATEKEYS 1
#include "keydb.c"
return res;
}
-static uint64_t stacked_getfullkeyid(struct onak_dbctx *dbctx,
- uint64_t keyid)
-{
- struct onak_stacked_dbctx *privctx =
- (struct onak_stacked_dbctx *) dbctx->priv;
- struct onak_dbctx *backend =
- (struct onak_dbctx *) privctx->backends->object;
- uint64_t res = 0;
-
- res = backend->getfullkeyid(backend, keyid);
- if (res == 0) {
- res = generic_getfullkeyid(dbctx, keyid);
- }
-
- return res;
-}
-
static void stacked_cleanupdb(struct onak_dbctx *dbctx)
{
struct onak_stacked_dbctx *privctx =
dbctx->getkeysigs = stacked_getkeysigs;
dbctx->cached_getkeysigs = stacked_cached_getkeysigs;
dbctx->keyid2uid = stacked_keyid2uid;
- dbctx->getfullkeyid = stacked_getfullkeyid;
dbctx->iterate_keys = stacked_iterate_keys;
}