From 5a7ace809ee2b5acd69817f29b589200d6398e73 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 8 Dec 2025 18:17:14 -0600 Subject: [PATCH] kadmind: Add -A option for async HDB writes --- kadmin/kadmind.c | 2 ++ kadmin/rpc.c | 4 ++++ kadmin/server.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/kadmin/kadmind.c b/kadmin/kadmind.c index 4ea513e08..fcbc1818a 100644 --- a/kadmin/kadmind.c +++ b/kadmin/kadmind.c @@ -48,6 +48,7 @@ static char *fuzz_keytab_name; static char *fuzz_service_name; static char *fuzz_admin_server; #endif +int async_flag; static int help_flag; static int version_flag; static int debug_flag; @@ -71,6 +72,7 @@ static struct getargs args[] = { { "realm", 'r', arg_string, &realm, "realm to use", "realm" }, + { "async", 'A', arg_flag, &async_flag, "do not fsync HDB writes", NULL }, #ifdef HAVE_DLOPEN { "check-library", 0, arg_string, &check_library, "library to load password check function from", "library" }, diff --git a/kadmin/rpc.c b/kadmin/rpc.c index 8a176da63..c826b9dfd 100644 --- a/kadmin/rpc.c +++ b/kadmin/rpc.c @@ -37,6 +37,8 @@ #include #include +extern int async_flag; + #define CHECK(x) \ do { \ int __r; \ @@ -1029,6 +1031,8 @@ process_stream(krb5_context contextp, 0, 0, &server_handle); INSIST(ret == 0); + if (async_flag) + realm_params.mask |= KADM5_CONFIG_ASYNC_HDB_WRITES; } INSIST(gctx.ctx != GSS_C_NO_CONTEXT); diff --git a/kadmin/server.c b/kadmin/server.c index 281822a30..6f52788a5 100644 --- a/kadmin/server.c +++ b/kadmin/server.c @@ -34,6 +34,8 @@ #include "kadmin_locl.h" #include +extern int async_flag; + static kadm5_ret_t check_aliases(kadm5_server_context *, kadm5_principal_ent_rec *, kadm5_principal_ent_rec *); @@ -1111,6 +1113,8 @@ handle_v5(krb5_context contextp, krb5_free_ticket(contextp, ticket); return; } + if (async_flag) + realm_params.mask |= KADM5_CONFIG_ASYNC_HDB_WRITES; } initial = ticket->ticket.flags.initial;