libfido2: pick up debug logging from libfido2, and funnel it through our log subsystem

Fixes: #27984
This commit is contained in:
Lennart Poettering
2023-08-08 15:41:43 +02:00
parent 5c240bdd50
commit 5a96b32dea
2 changed files with 20 additions and 1 deletions
+18 -1
View File
@@ -60,10 +60,18 @@ int (*sym_fido_dev_make_cred)(fido_dev_t *, fido_cred_t *, const char *) = NULL;
fido_dev_t* (*sym_fido_dev_new)(void) = NULL;
int (*sym_fido_dev_open)(fido_dev_t *, const char *) = NULL;
int (*sym_fido_dev_close)(fido_dev_t *) = NULL;
void (*sym_fido_init)(int) = NULL;
void (*sym_fido_set_log_handler)(fido_log_handler_t *) = NULL;
const char* (*sym_fido_strerr)(int) = NULL;
static void fido_log_propagate_handler(const char *s) {
log_debug("libfido2: %s", strempty(s));
}
int dlopen_libfido2(void) {
return dlopen_many_sym_or_warn(
int r;
r = dlopen_many_sym_or_warn(
&libfido2_dl, "libfido2.so.1", LOG_DEBUG,
DLSYM_ARG(fido_assert_allow_cred),
DLSYM_ARG(fido_assert_free),
@@ -109,7 +117,16 @@ int dlopen_libfido2(void) {
DLSYM_ARG(fido_dev_new),
DLSYM_ARG(fido_dev_open),
DLSYM_ARG(fido_dev_close),
DLSYM_ARG(fido_init),
DLSYM_ARG(fido_set_log_handler),
DLSYM_ARG(fido_strerr));
if (r < 0)
return r;
sym_fido_init(FIDO_DEBUG);
sym_fido_set_log_handler(fido_log_propagate_handler);
return 0;
}
static int verify_features(
+2
View File
@@ -61,6 +61,8 @@ extern int (*sym_fido_dev_make_cred)(fido_dev_t *, fido_cred_t *, const char *);
extern fido_dev_t* (*sym_fido_dev_new)(void);
extern int (*sym_fido_dev_open)(fido_dev_t *, const char *);
extern int (*sym_fido_dev_close)(fido_dev_t *);
extern void (*sym_fido_init)(int);
extern void (*sym_fido_set_log_handler)(fido_log_handler_t *);
extern const char* (*sym_fido_strerr)(int);
int dlopen_libfido2(void);