From: Samuel Cabrero Date: Wed, 2 Mar 2022 16:54:54 +0000 (+0100) Subject: s3:winbind: Move functions to enable or disable cache to winbindd-lib subsystem X-Git-Tag: tevent-0.12.0~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=321c51e14ab797dd0d31086741b5eb668d022f1c;p=thirdparty%2Fsamba.git s3:winbind: Move functions to enable or disable cache to winbindd-lib subsystem The source3/winbindd/winbindd.c file does not belong to 'winbindd-lib' subsystem. Funtions called from winbindd-lib must be part of it. Signed-off-by: Samuel Cabrero Reviewed-by: Jeremy Allison --- diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 0f9c6449a5a..e4c75ead93f 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -62,7 +62,6 @@ static bool client_is_idle(struct winbindd_cli_state *state); static void remove_client(struct winbindd_cli_state *state); static void winbindd_setup_max_fds(void); -static bool opt_nocache = False; static bool interactive = False; struct imessaging_context *winbind_imessaging_context(void) @@ -1367,16 +1366,6 @@ failed: return false; } -bool winbindd_use_idmap_cache(void) -{ - return !opt_nocache; -} - -bool winbindd_use_cache(void) -{ - return !opt_nocache; -} - static void winbindd_register_handlers(struct messaging_context *msg_ctx, bool foreground) { @@ -1666,7 +1655,7 @@ int main(int argc, const char **argv) while ((opt = poptGetNextOpt(pc)) != -1) { switch (opt) { case 'n': - opt_nocache = true; + winbindd_set_use_cache(false); break; default: d_fprintf(stderr, "\nInvalid option %s: %s\n\n", diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 9a3238a8002..c8f15aec5aa 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -59,6 +59,8 @@ extern struct winbindd_methods sam_passdb_methods; static void wcache_flush_cache(void); +static bool opt_nocache = False; + /* * JRA. KEEP THIS LIST UP TO DATE IF YOU ADD CACHE ENTRIES. * Here are the list of entry types that are *not* stored @@ -72,6 +74,21 @@ static const char *non_centry_keys[] = { NULL }; +bool winbindd_use_idmap_cache(void) +{ + return !opt_nocache; +} + +bool winbindd_use_cache(void) +{ + return !opt_nocache; +} + +void winbindd_set_use_cache(bool use_cache) +{ + opt_nocache = !use_cache; +} + /************************************************************************ Is this key a non-centry type ? ************************************************************************/ diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index d61915241d3..35ff72c36f4 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -30,6 +30,7 @@ bool winbindd_setup_stdin_handler(bool parent, bool foreground); bool winbindd_setup_sig_hup_handler(const char *lfile); bool winbindd_use_idmap_cache(void); bool winbindd_use_cache(void); +void winbindd_set_use_cache(bool use_cache); char *get_winbind_priv_pipe_dir(void); void winbindd_flush_caches(void); bool winbindd_reload_services_file(const char *lfile);