s3:winbind: Move functions to enable or disable cache to winbindd-lib subsystem
authorSamuel Cabrero <scabrero@samba.org>
Wed, 2 Mar 2022 16:54:54 +0000 (17:54 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 8 Apr 2022 20:13:37 +0000 (20:13 +0000)
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 <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd.c
source3/winbindd/winbindd_cache.c
source3/winbindd/winbindd_proto.h

index 0f9c6449a5a9d933a0b5f64543cec5208e2608a0..e4c75ead93f843aa7e706fd1f4573f2a7289d798 100644 (file)
@@ -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",
index 9a3238a8002dc70e80ff50f39ec4dd2e04a6af20..c8f15aec5aaa53c068e30874c5aba01b18b76f78 100644 (file)
@@ -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 ?
 ************************************************************************/
index d61915241d32425655fe8091a9a16f085fb88dd9..35ff72c36f4f86fe966f55f2c37892624bbc482f 100644 (file)
@@ -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);