From 11d0266c7431f0602c83fbfac1160c41c22ae085 Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Wed, 2 Mar 2022 18:16:51 +0100 Subject: s3:winbind: Move servide reload related functions 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 --- source3/winbindd/winbindd.c | 60 ---------------------------------------- source3/winbindd/winbindd_misc.c | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index e93e7114d93..088773b6b4c 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -60,42 +60,11 @@ 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 interactive = False; /* Reload configuration */ -bool winbindd_reload_services_file(const char *lfile) -{ - const struct loadparm_substitution *lp_sub = - loadparm_s3_global_substitution(); - bool ret; - - if (lp_loaded()) { - char *fname = lp_next_configfile(talloc_tos(), lp_sub); - - if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) { - set_dyn_CONFIGFILE(fname); - } - TALLOC_FREE(fname); - } - - reopen_logs(); - ret = lp_load_global(get_dyn_CONFIGFILE()); - - /* if this is a child, restore the logfile to the special - name - , idmap, etc. */ - if (lfile && *lfile) { - lp_set_logfile(lfile); - } - - reopen_logs(); - load_interfaces(); - winbindd_setup_max_fds(); - - return(ret); -} static void winbindd_status(void) @@ -1208,35 +1177,6 @@ static void winbindd_listen_fde_handler(struct tevent_context *ev, * Winbindd socket accessor functions */ -static void winbindd_setup_max_fds(void) -{ - int num_fds = MAX_OPEN_FUDGEFACTOR; - int actual_fds; - - num_fds += lp_winbind_max_clients(); - /* Add some more to account for 2 sockets open - when the client transitions from unprivileged - to privileged socket - */ - num_fds += lp_winbind_max_clients() / 10; - - /* Add one socket per child process - (yeah there are child processes other than the - domain children but only domain children can vary - with configuration - */ - num_fds += lp_winbind_max_domain_connections() * - (lp_allow_trusted_domains() ? WINBIND_MAX_DOMAINS_HINT : 1); - - actual_fds = set_maxfiles(num_fds); - - if (actual_fds < num_fds) { - DEBUG(1, ("winbindd_setup_max_fds: Information only: " - "requested %d open files, %d are available.\n", - num_fds, actual_fds)); - } -} - static bool winbindd_setup_listeners(void) { struct winbindd_listen_state *pub_state = NULL; diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c index f8173f19a4f..3155a2224de 100644 --- a/source3/winbindd/winbindd_misc.c +++ b/source3/winbindd/winbindd_misc.c @@ -415,3 +415,63 @@ bool winbindd_priv_pipe_dir(struct winbindd_cli_state *state) return true; } + +static void winbindd_setup_max_fds(void) +{ + int num_fds = MAX_OPEN_FUDGEFACTOR; + int actual_fds; + + num_fds += lp_winbind_max_clients(); + /* Add some more to account for 2 sockets open + when the client transitions from unprivileged + to privileged socket + */ + num_fds += lp_winbind_max_clients() / 10; + + /* Add one socket per child process + (yeah there are child processes other than the + domain children but only domain children can vary + with configuration + */ + num_fds += lp_winbind_max_domain_connections() * + (lp_allow_trusted_domains() ? WINBIND_MAX_DOMAINS_HINT : 1); + + actual_fds = set_maxfiles(num_fds); + + if (actual_fds < num_fds) { + DEBUG(1, ("winbindd_setup_max_fds: Information only: " + "requested %d open files, %d are available.\n", + num_fds, actual_fds)); + } +} + +bool winbindd_reload_services_file(const char *lfile) +{ + const struct loadparm_substitution *lp_sub = + loadparm_s3_global_substitution(); + bool ret; + + if (lp_loaded()) { + char *fname = lp_next_configfile(talloc_tos(), lp_sub); + + if (file_exist(fname) && !strcsequal(fname,get_dyn_CONFIGFILE())) { + set_dyn_CONFIGFILE(fname); + } + TALLOC_FREE(fname); + } + + reopen_logs(); + ret = lp_load_global(get_dyn_CONFIGFILE()); + + /* if this is a child, restore the logfile to the special + name - , idmap, etc. */ + if (lfile && *lfile) { + lp_set_logfile(lfile); + } + + reopen_logs(); + load_interfaces(); + winbindd_setup_max_fds(); + + return(ret); +} -- cgit v1.2.1