From c7dae801a81f263e6fd5c508880c363cee2c04c5 Mon Sep 17 00:00:00 2001 From: Markus Valentin Date: Tue, 7 Apr 2020 12:56:46 +0200 Subject: [PATCH] auth: mech-otp: Add mech_otp_deinit and call it in main_deinit This change make sure the otp_lock_table is destroyed on deinit. --- src/auth/main.c | 3 +++ src/auth/mech-otp-skey-common.c | 5 +++++ src/auth/mech-otp-skey-common.h | 1 + 3 files changed, 9 insertions(+) diff --git a/src/auth/main.c b/src/auth/main.c index c7d7e6252c..647003bbc7 100644 --- a/src/auth/main.c +++ b/src/auth/main.c @@ -19,6 +19,8 @@ #include "password-scheme.h" #include "passdb-cache.h" #include "mech.h" +#include "otp.h" +#include "mech-otp-skey-common.h" #include "auth.h" #include "auth-penalty.h" #include "auth-token.h" @@ -280,6 +282,7 @@ static void main_deinit(void) auth_policy_deinit(); mech_register_deinit(&mech_reg); + mech_otp_deinit(); mech_deinit(global_auth_settings); /* allow modules to unregister their dbs/drivers/etc. before freeing diff --git a/src/auth/mech-otp-skey-common.c b/src/auth/mech-otp-skey-common.c index 1e20fc07b1..b20951e197 100644 --- a/src/auth/mech-otp-skey-common.c +++ b/src/auth/mech-otp-skey-common.c @@ -64,3 +64,8 @@ void mech_otp_skey_auth_free(struct auth_request *auth_request) pool_unref(&auth_request->pool); } + +void mech_otp_deinit(void) +{ + hash_table_destroy(&otp_lock_table); +} diff --git a/src/auth/mech-otp-skey-common.h b/src/auth/mech-otp-skey-common.h index 91f60f4aa8..ca64c810b9 100644 --- a/src/auth/mech-otp-skey-common.h +++ b/src/auth/mech-otp-skey-common.h @@ -18,5 +18,6 @@ void otp_unlock(struct auth_request *auth_request); void otp_set_credentials_callback(bool success, struct auth_request *auth_request); void mech_otp_skey_auth_free(struct auth_request *auth_request); +void mech_otp_deinit(void); #endif -- 2.47.3