- sprintf(soname, "%s/libkeydb_%s.so", config.backends_dir,
- config.db_backend);
- }
-
- logthing(LOGTHING_INFO, "Loading dynamic backend: %s", soname);
-
- handle = dlopen(soname, RTLD_LAZY);
- if (handle == NULL) {
- logthing(LOGTHING_ERROR,
- "Failed to open handle to library '%s': %s",
- soname, dlerror());
- free(soname);
- soname = NULL;
- return false;
- }
- free(soname);
- soname = NULL;
-
- backend->initdb = (initdbfunc_t) dlsym(handle, "initdb");
- backend->cleanupdb = (cleanupdbfunc_t) dlsym(handle, "cleanupdb");
- backend->starttrans = (starttransfunc_t) dlsym(handle, "starttrans");
- backend->endtrans = (endtransfunc_t) dlsym(handle, "endtrans");
- backend->fetch_key = (fetch_keyfunc_t) dlsym(handle, "fetch_key");
- backend->store_key = (store_keyfunc_t) dlsym(handle, "store_key");
- backend->delete_key = (delete_keyfunc_t) dlsym(handle, "delete_key");
- backend->fetch_key_text = (fetch_key_textfunc_t)
- dlsym (handle, "fetch_key_text");
- backend->update_keys = (update_keysfunc_t)
- dlsym(handle, "update_keys");
- backend->keyid2uid = (keyid2uidfunc_t) dlsym(handle, "keyid2uid");
- backend->cached_getkeysigs = (cached_getkeysigsfunc_t)
- dlsym(handle, "cached_getkeysigs");
- backend->getfullkeyid = (getfullkeyidfunc_t)
- dlsym(handle, "getfullkeyid");
- backend->iterate_keys = (iterate_keysfunc_t)
- dlsym(handle, "iterate_keys");
-
- backend->handle = handle;
- backend->loaded = true;
-
- return true;