The Samba-Bugzilla – Attachment 13796 Details for
Bug 13150
winbind parent and child share a ctdb connection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Back-port of cherry-pick from master - git am for 4.6.next.
bug-13150-4.6 (text/plain), 40.84 KB, created by
Jeremy Allison
on 2017-11-20 21:26:45 UTC
(
hide
)
Description:
Back-port of cherry-pick from master - git am for 4.6.next.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2017-11-20 21:26:45 UTC
Size:
40.84 KB
patch
obsolete
>From 34f55844c83c7f59bc4f92fd7c78f8d914988cee Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Fri, 17 Nov 2017 11:35:19 +0100 >Subject: [PATCH 1/4] winbind: Replace winbind_event_context with > server_event_context > >There's no point in having two global event contexts > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 7e83d1489406cd53d72097e40bf02295c88ea61e) >--- > source3/winbindd/idmap_ldap.c | 2 +- > source3/winbindd/idmap_rfc2307.c | 2 +- > source3/winbindd/winbindd.c | 58 +++++++++++----------- > source3/winbindd/winbindd_cm.c | 4 +- > source3/winbindd/winbindd_cred_cache.c | 14 +++--- > source3/winbindd/winbindd_dual.c | 16 +++--- > source3/winbindd/winbindd_irpc.c | 8 +-- > source3/winbindd/winbindd_misc.c | 2 +- > source3/winbindd/winbindd_pam_auth.c | 2 +- > source3/winbindd/winbindd_pam_auth_crap.c | 2 +- > source3/winbindd/winbindd_pam_chauthtok.c | 2 +- > .../winbindd/winbindd_pam_chng_pswd_auth_crap.c | 2 +- > source3/winbindd/winbindd_pam_logoff.c | 2 +- > source3/winbindd/winbindd_util.c | 2 +- > 14 files changed, 59 insertions(+), 59 deletions(-) > >diff --git a/source3/winbindd/idmap_ldap.c b/source3/winbindd/idmap_ldap.c >index 0520f213ef6..7fa43653c56 100644 >--- a/source3/winbindd/idmap_ldap.c >+++ b/source3/winbindd/idmap_ldap.c >@@ -471,7 +471,7 @@ static NTSTATUS idmap_ldap_db_init(struct idmap_domain *dom) > > /* get_credentials deals with setting up creds */ > >- ret = smbldap_init(ctx, winbind_event_context(), ctx->url, >+ ret = smbldap_init(ctx, server_event_context(), ctx->url, > false, NULL, NULL, &ctx->smbldap_state); > if (!NT_STATUS_IS_OK(ret)) { > DEBUG(1, ("ERROR: smbldap_init (%s) failed!\n", ctx->url)); >diff --git a/source3/winbindd/idmap_rfc2307.c b/source3/winbindd/idmap_rfc2307.c >index 0e0311abd81..cfe774bf786 100644 >--- a/source3/winbindd/idmap_rfc2307.c >+++ b/source3/winbindd/idmap_rfc2307.c >@@ -194,7 +194,7 @@ static NTSTATUS idmap_rfc2307_init_ldap(struct idmap_rfc2307_context *ctx, > } > > /* assume anonymous if we don't have a specified user */ >- ret = smbldap_init(mem_ctx, winbind_event_context(), url, >+ ret = smbldap_init(mem_ctx, server_event_context(), url, > (user_dn == NULL), user_dn, secret, > &ctx->smbldap_state); > SAFE_FREE(secret); >diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c >index 2cd20014267..a34c41421f6 100644 >--- a/source3/winbindd/winbindd.c >+++ b/source3/winbindd/winbindd.c >@@ -90,7 +90,7 @@ struct messaging_context *winbind_messaging_context(void) > * Note we MUST use the NULL context here, not the autofree context, > * to avoid side effects in forked children exiting. > */ >- msg = messaging_init(NULL, winbind_event_context()); >+ msg = messaging_init(NULL, server_event_context()); > if (msg == NULL) { > smb_panic("Could not init winbindd's messaging context.\n"); > } >@@ -123,7 +123,7 @@ struct imessaging_context *winbind_imessaging_context(void) > * Note we MUST use the NULL context here, not the autofree context, > * to avoid side effects in forked children exiting. > */ >- msg = imessaging_init(NULL, lp_ctx, myself, winbind_event_context()); >+ msg = imessaging_init(NULL, lp_ctx, myself, server_event_context()); > talloc_unlink(NULL, lp_ctx); > > if (msg == NULL) { >@@ -306,14 +306,14 @@ bool winbindd_setup_sig_term_handler(bool parent) > struct tevent_signal *se; > bool *is_parent; > >- is_parent = talloc(winbind_event_context(), bool); >+ is_parent = talloc(server_event_context(), bool); > if (!is_parent) { > return false; > } > > *is_parent = parent; > >- se = tevent_add_signal(winbind_event_context(), >+ se = tevent_add_signal(server_event_context(), > is_parent, > SIGTERM, 0, > winbindd_sig_term_handler, >@@ -324,7 +324,7 @@ bool winbindd_setup_sig_term_handler(bool parent) > return false; > } > >- se = tevent_add_signal(winbind_event_context(), >+ se = tevent_add_signal(server_event_context(), > is_parent, > SIGINT, 0, > winbindd_sig_term_handler, >@@ -335,7 +335,7 @@ bool winbindd_setup_sig_term_handler(bool parent) > return false; > } > >- se = tevent_add_signal(winbind_event_context(), >+ se = tevent_add_signal(server_event_context(), > is_parent, > SIGQUIT, 0, > winbindd_sig_term_handler, >@@ -356,7 +356,7 @@ bool winbindd_setup_stdin_handler(bool parent, bool foreground) > if (foreground) { > struct stat st; > >- is_parent = talloc(winbind_event_context(), bool); >+ is_parent = talloc(server_event_context(), bool); > if (!is_parent) { > return false; > } >@@ -372,7 +372,7 @@ bool winbindd_setup_stdin_handler(bool parent, bool foreground) > return false; > } > if (S_ISFIFO(st.st_mode) || S_ISSOCK(st.st_mode)) { >- tevent_add_fd(winbind_event_context(), >+ tevent_add_fd(server_event_context(), > is_parent, > 0, > TEVENT_FD_READ, >@@ -404,15 +404,15 @@ bool winbindd_setup_sig_hup_handler(const char *lfile) > char *file = NULL; > > if (lfile) { >- file = talloc_strdup(winbind_event_context(), >+ file = talloc_strdup(server_event_context(), > lfile); > if (!file) { > return false; > } > } > >- se = tevent_add_signal(winbind_event_context(), >- winbind_event_context(), >+ se = tevent_add_signal(server_event_context(), >+ server_event_context(), > SIGHUP, 0, > winbindd_sig_hup_handler, > file); >@@ -441,8 +441,8 @@ static bool winbindd_setup_sig_chld_handler(void) > { > struct tevent_signal *se; > >- se = tevent_add_signal(winbind_event_context(), >- winbind_event_context(), >+ se = tevent_add_signal(server_event_context(), >+ server_event_context(), > SIGCHLD, 0, > winbindd_sig_chld_handler, > NULL); >@@ -467,8 +467,8 @@ static bool winbindd_setup_sig_usr2_handler(void) > { > struct tevent_signal *se; > >- se = tevent_add_signal(winbind_event_context(), >- winbind_event_context(), >+ se = tevent_add_signal(server_event_context(), >+ server_event_context(), > SIGUSR2, 0, > winbindd_sig_usr2_handler, > NULL); >@@ -733,7 +733,7 @@ static void process_request(struct winbindd_cli_state *state) > DEBUG(10, ("process_request: Handling async request %d:%s\n", > (int)state->pid, state->cmd_name)); > >- req = atable->send_req(state->mem_ctx, winbind_event_context(), >+ req = atable->send_req(state->mem_ctx, server_event_context(), > state, state->request); > if (req == NULL) { > DEBUG(0, ("process_request: atable->send failed for " >@@ -827,7 +827,7 @@ static void request_finished(struct winbindd_cli_state *state) > > TALLOC_FREE(state->request); > >- req = wb_resp_write_send(state, winbind_event_context(), >+ req = wb_resp_write_send(state, server_event_context(), > state->out_queue, state->sock, > state->response); > if (req == NULL) { >@@ -868,7 +868,7 @@ static void winbind_client_response_written(struct tevent_req *req) > state->cmd_name = "no request"; > state->recv_fn = NULL; > >- req = wb_req_read_send(state, winbind_event_context(), state->sock, >+ req = wb_req_read_send(state, server_event_context(), state->sock, > WINBINDD_MAX_EXTRA_DATA); > if (req == NULL) { > remove_client(state); >@@ -936,7 +936,7 @@ static void new_connection(int listen_sock, bool privileged) > > state->privileged = privileged; > >- req = wb_req_read_send(state, winbind_event_context(), state->sock, >+ req = wb_req_read_send(state, server_event_context(), state->sock, > WINBINDD_MAX_EXTRA_DATA); > if (req == NULL) { > TALLOC_FREE(state); >@@ -976,7 +976,7 @@ static void winbind_client_request_read(struct tevent_req *req) > return; > } > >- req = wait_for_read_send(state, winbind_event_context(), state->sock, >+ req = wait_for_read_send(state, server_event_context(), state->sock, > true); > if (req == NULL) { > DEBUG(0, ("winbind_client_request_read[%d:%s]:" >@@ -1237,7 +1237,7 @@ static bool winbindd_setup_listeners(void) > int rc; > char *socket_path; > >- pub_state = talloc(winbind_event_context(), >+ pub_state = talloc(server_event_context(), > struct winbindd_listen_state); > if (!pub_state) { > goto failed; >@@ -1254,7 +1254,7 @@ static bool winbindd_setup_listeners(void) > goto failed; > } > >- fde = tevent_add_fd(winbind_event_context(), pub_state, pub_state->fd, >+ fde = tevent_add_fd(server_event_context(), pub_state, pub_state->fd, > TEVENT_FD_READ, winbindd_listen_fde_handler, > pub_state); > if (fde == NULL) { >@@ -1263,7 +1263,7 @@ static bool winbindd_setup_listeners(void) > } > tevent_fd_set_auto_close(fde); > >- priv_state = talloc(winbind_event_context(), >+ priv_state = talloc(server_event_context(), > struct winbindd_listen_state); > if (!priv_state) { > goto failed; >@@ -1286,7 +1286,7 @@ static bool winbindd_setup_listeners(void) > goto failed; > } > >- fde = tevent_add_fd(winbind_event_context(), priv_state, >+ fde = tevent_add_fd(server_event_context(), priv_state, > priv_state->fd, TEVENT_FD_READ, > winbindd_listen_fde_handler, priv_state); > if (fde == NULL) { >@@ -1295,7 +1295,7 @@ static bool winbindd_setup_listeners(void) > } > tevent_fd_set_auto_close(fde); > >- winbindd_scrub_clients_handler(winbind_event_context(), NULL, >+ winbindd_scrub_clients_handler(server_event_context(), NULL, > timeval_current(), NULL); > return true; > failed: >@@ -1410,7 +1410,7 @@ static void winbindd_register_handlers(struct messaging_context *msg_ctx, > smb_nscd_flush_group_cache(); > > if (lp_allow_trusted_domains()) { >- if (tevent_add_timer(winbind_event_context(), NULL, timeval_zero(), >+ if (tevent_add_timer(server_event_context(), NULL, timeval_zero(), > rescan_trusted_domains, NULL) == NULL) { > DEBUG(0, ("Could not trigger rescan_trusted_domains()\n")); > exit(1); >@@ -1775,7 +1775,7 @@ int main(int argc, const char **argv) > */ > > status = reinit_after_fork(winbind_messaging_context(), >- winbind_event_context(), >+ server_event_context(), > false, NULL); > if (!NT_STATUS_IS_OK(status)) { > exit_daemon("Winbindd reinit_after_fork() failed", map_errno_from_nt_status(status)); >@@ -1805,7 +1805,7 @@ int main(int argc, const char **argv) > rpc_lsarpc_init(NULL); > rpc_samr_init(NULL); > >- winbindd_init_addrchange(NULL, winbind_event_context(), >+ winbindd_init_addrchange(NULL, server_event_context(), > winbind_messaging_context()); > > /* setup listen sockets */ >@@ -1826,7 +1826,7 @@ int main(int argc, const char **argv) > while (1) { > frame = talloc_stackframe(); > >- if (tevent_loop_once(winbind_event_context()) == -1) { >+ if (tevent_loop_once(server_event_context()) == -1) { > DEBUG(1, ("tevent_loop_once() failed: %s\n", > strerror(errno))); > return 1; >diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c >index 2cf89edad86..b507f1ad25b 100644 >--- a/source3/winbindd/winbindd_cm.c >+++ b/source3/winbindd/winbindd_cm.c >@@ -427,7 +427,7 @@ void set_domain_offline(struct winbindd_domain *domain) > > calc_new_online_timeout_check(domain); > >- domain->check_online_event = tevent_add_timer(winbind_event_context(), >+ domain->check_online_event = tevent_add_timer(server_event_context(), > NULL, > timeval_current_ofs(domain->check_online_timeout,0), > check_domain_online_handler, >@@ -603,7 +603,7 @@ void set_domain_online_request(struct winbindd_domain *domain) > > TALLOC_FREE(domain->check_online_event); > >- domain->check_online_event = tevent_add_timer(winbind_event_context(), >+ domain->check_online_event = tevent_add_timer(server_event_context(), > NULL, > tev, > check_domain_online_handler, >diff --git a/source3/winbindd/winbindd_cred_cache.c b/source3/winbindd/winbindd_cred_cache.c >index 20b4d55fb80..7cd7a4c9f23 100644 >--- a/source3/winbindd/winbindd_cred_cache.c >+++ b/source3/winbindd/winbindd_cred_cache.c >@@ -285,7 +285,7 @@ done: > if (entry->refresh_time == 0) { > entry->refresh_time = new_start; > } >- entry->event = tevent_add_timer(winbind_event_context(), entry, >+ entry->event = tevent_add_timer(server_event_context(), entry, > timeval_set(new_start, 0), > krb5_ticket_refresh_handler, > entry); >@@ -385,7 +385,7 @@ static void krb5_ticket_gain_handler(struct tevent_context *event_ctx, > if (entry->refresh_time == 0) { > entry->refresh_time = t.tv_sec; > } >- entry->event = tevent_add_timer(winbind_event_context(), >+ entry->event = tevent_add_timer(server_event_context(), > entry, > t, > krb5_ticket_refresh_handler, >@@ -404,7 +404,7 @@ static void add_krb5_ticket_gain_handler_event(struct WINBINDD_CCACHE_ENTRY *ent > struct timeval t) > { > entry->refresh_time = 0; >- entry->event = tevent_add_timer(winbind_event_context(), >+ entry->event = tevent_add_timer(server_event_context(), > entry, > t, > krb5_ticket_gain_handler, >@@ -424,13 +424,13 @@ void ccache_regain_all_now(void) > * the event has the krb5_ticket_gain_handler > */ > if (cur->refresh_time == 0) { >- new_event = tevent_add_timer(winbind_event_context(), >+ new_event = tevent_add_timer(server_event_context(), > cur, > t, > krb5_ticket_gain_handler, > cur); > } else { >- new_event = tevent_add_timer(winbind_event_context(), >+ new_event = tevent_add_timer(server_event_context(), > cur, > t, > krb5_ticket_refresh_handler, >@@ -547,7 +547,7 @@ NTSTATUS add_ccache_to_list(const char *princ_name, > if (!entry->refresh_time) { > entry->refresh_time = t.tv_sec; > } >- entry->event = tevent_add_timer(winbind_event_context(), >+ entry->event = tevent_add_timer(server_event_context(), > entry, > t, > krb5_ticket_refresh_handler, >@@ -645,7 +645,7 @@ NTSTATUS add_ccache_to_list(const char *princ_name, > if (entry->refresh_time == 0) { > entry->refresh_time = t.tv_sec; > } >- entry->event = tevent_add_timer(winbind_event_context(), >+ entry->event = tevent_add_timer(server_event_context(), > entry, > t, > krb5_ticket_refresh_handler, >diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c >index 8636ccd7e0a..0b98a8368e4 100644 >--- a/source3/winbindd/winbindd_dual.c >+++ b/source3/winbindd/winbindd_dual.c >@@ -175,7 +175,7 @@ static void wb_child_request_trigger(struct tevent_req *req, > return; > } > >- subreq = wb_simple_trans_send(state, winbind_event_context(), NULL, >+ subreq = wb_simple_trans_send(state, server_event_context(), NULL, > state->child->sock, state->request); > if (tevent_req_nomem(subreq, req)) { > return; >@@ -968,7 +968,7 @@ static void account_lockout_policy_handler(struct tevent_context *ctx, > nt_errstr(result))); > } > >- child->lockout_policy_event = tevent_add_timer(winbind_event_context(), NULL, >+ child->lockout_policy_event = tevent_add_timer(server_event_context(), NULL, > timeval_current_ofs(3600, 0), > account_lockout_policy_handler, > child); >@@ -1130,7 +1130,7 @@ static void machine_password_change_handler(struct tevent_context *ctx, > } > > done: >- child->machine_password_change_event = tevent_add_timer(winbind_event_context(), NULL, >+ child->machine_password_change_event = tevent_add_timer(server_event_context(), NULL, > next_change, > machine_password_change_handler, > child); >@@ -1251,7 +1251,7 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself, > > status = reinit_after_fork( > winbind_messaging_context(), >- winbind_event_context(), >+ server_event_context(), > true, NULL); > if (!NT_STATUS_IS_OK(status)) { > DEBUG(0,("reinit_after_fork() failed\n")); >@@ -1556,7 +1556,7 @@ static bool fork_domain_child(struct winbindd_child *child) > } > > child->lockout_policy_event = tevent_add_timer( >- winbind_event_context(), NULL, timeval_zero(), >+ server_event_context(), NULL, timeval_zero(), > account_lockout_policy_handler, > child); > } >@@ -1570,13 +1570,13 @@ static bool fork_domain_child(struct winbindd_child *child) > if (calculate_next_machine_pwd_change(child->domain->name, > &next_change)) { > child->machine_password_change_event = tevent_add_timer( >- winbind_event_context(), NULL, next_change, >+ server_event_context(), NULL, next_change, > machine_password_change_handler, > child); > } > } > >- fde = tevent_add_fd(winbind_event_context(), NULL, state.cli.sock, >+ fde = tevent_add_fd(server_event_context(), NULL, state.cli.sock, > TEVENT_FD_READ, child_handler, &state); > if (fde == NULL) { > DEBUG(1, ("tevent_add_fd failed\n")); >@@ -1588,7 +1588,7 @@ static bool fork_domain_child(struct winbindd_child *child) > int ret; > TALLOC_CTX *frame = talloc_stackframe(); > >- ret = tevent_loop_once(winbind_event_context()); >+ ret = tevent_loop_once(server_event_context()); > if (ret != 0) { > DEBUG(1, ("tevent_loop_once failed: %s\n", > strerror(errno))); >diff --git a/source3/winbindd/winbindd_irpc.c b/source3/winbindd/winbindd_irpc.c >index 9a9f75373f1..d6c3661c3c0 100644 >--- a/source3/winbindd/winbindd_irpc.c >+++ b/source3/winbindd/winbindd_irpc.c >@@ -123,7 +123,7 @@ static NTSTATUS wb_irpc_DsrUpdateReadOnlyServerDnsRecords(struct irpc_message *m > DEBUG(5, ("wb_irpc_DsrUpdateReadOnlyServerDnsRecords called\n")); > > return wb_irpc_forward_rpc_call(msg, msg, >- winbind_event_context(), >+ server_event_context(), > req, NDR_WINBIND_DSRUPDATEREADONLYSERVERDNSRECORDS, > "winbind_DsrUpdateReadOnlyServerDnsRecords", > domain, IRPC_CALL_TIMEOUT); >@@ -147,7 +147,7 @@ static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg, > DEBUG(5, ("wb_irpc_SamLogon called\n")); > > return wb_irpc_forward_rpc_call(msg, msg, >- winbind_event_context(), >+ server_event_context(), > req, NDR_WINBIND_SAMLOGON, > "winbind_SamLogon", > domain, IRPC_CALL_TIMEOUT); >@@ -207,7 +207,7 @@ static NTSTATUS wb_irpc_LogonControl(struct irpc_message *msg, > > TALLOC_FREE(frame); > return wb_irpc_forward_rpc_call(msg, msg, >- winbind_event_context(), >+ server_event_context(), > req, NDR_WINBIND_LOGONCONTROL, > "winbind_LogonControl", > domain, 45 /* timeout */); >@@ -247,7 +247,7 @@ static NTSTATUS wb_irpc_GetForestTrustInformation(struct irpc_message *msg, > DEBUG(5, ("wb_irpc_GetForestTrustInformation called\n")); > > return wb_irpc_forward_rpc_call(msg, msg, >- winbind_event_context(), >+ server_event_context(), > req, NDR_WINBIND_GETFORESTTRUSTINFORMATION, > "winbind_GetForestTrustInformation", > domain, 45 /* timeout */); >diff --git a/source3/winbindd/winbindd_misc.c b/source3/winbindd/winbindd_misc.c >index 12c5faa6b48..fb558df561f 100644 >--- a/source3/winbindd/winbindd_misc.c >+++ b/source3/winbindd/winbindd_misc.c >@@ -277,7 +277,7 @@ void winbindd_domain_info(struct winbindd_cli_state *cli) > * Send a ping down. This implicitly initializes the domain. > */ > >- req = wb_domain_request_send(state, winbind_event_context(), >+ req = wb_domain_request_send(state, server_event_context(), > domain, &state->ping_request); > if (req == NULL) { > DEBUG(3, ("wb_domain_request_send failed\n")); >diff --git a/source3/winbindd/winbindd_pam_auth.c b/source3/winbindd/winbindd_pam_auth.c >index 4f963a32818..7ff44888975 100644 >--- a/source3/winbindd/winbindd_pam_auth.c >+++ b/source3/winbindd/winbindd_pam_auth.c >@@ -81,7 +81,7 @@ struct tevent_req *winbindd_pam_auth_send(TALLOC_CTX *mem_ctx, > return tevent_req_post(req, ev); > } > >- subreq = wb_domain_request_send(state, winbind_event_context(), domain, >+ subreq = wb_domain_request_send(state, server_event_context(), domain, > request); > if (tevent_req_nomem(subreq, req)) { > return tevent_req_post(req, ev); >diff --git a/source3/winbindd/winbindd_pam_auth_crap.c b/source3/winbindd/winbindd_pam_auth_crap.c >index e6a47c86785..cfeafbcfda8 100644 >--- a/source3/winbindd/winbindd_pam_auth_crap.c >+++ b/source3/winbindd/winbindd_pam_auth_crap.c >@@ -93,7 +93,7 @@ struct tevent_req *winbindd_pam_auth_crap_send( > fstrcpy(request->data.auth_crap.workstation, lp_netbios_name()); > } > >- subreq = wb_domain_request_send(state, winbind_event_context(), domain, >+ subreq = wb_domain_request_send(state, server_event_context(), domain, > request); > if (tevent_req_nomem(subreq, req)) { > return tevent_req_post(req, ev); >diff --git a/source3/winbindd/winbindd_pam_chauthtok.c b/source3/winbindd/winbindd_pam_chauthtok.c >index 8ffbc29b973..0d749fbcecd 100644 >--- a/source3/winbindd/winbindd_pam_chauthtok.c >+++ b/source3/winbindd/winbindd_pam_chauthtok.c >@@ -79,7 +79,7 @@ struct tevent_req *winbindd_pam_chauthtok_send( > return tevent_req_post(req, ev); > } > >- subreq = wb_domain_request_send(state, winbind_event_context(), >+ subreq = wb_domain_request_send(state, server_event_context(), > contact_domain, request); > if (tevent_req_nomem(subreq, req)) { > return tevent_req_post(req, ev); >diff --git a/source3/winbindd/winbindd_pam_chng_pswd_auth_crap.c b/source3/winbindd/winbindd_pam_chng_pswd_auth_crap.c >index 9133a91fa50..e9ee0ab63ce 100644 >--- a/source3/winbindd/winbindd_pam_chng_pswd_auth_crap.c >+++ b/source3/winbindd/winbindd_pam_chng_pswd_auth_crap.c >@@ -73,7 +73,7 @@ struct tevent_req *winbindd_pam_chng_pswd_auth_crap_send( > return tevent_req_post(req, ev); > } > >- subreq = wb_domain_request_send(state, winbind_event_context(), >+ subreq = wb_domain_request_send(state, server_event_context(), > domain, request); > if (tevent_req_nomem(subreq, req)) { > return tevent_req_post(req, ev); >diff --git a/source3/winbindd/winbindd_pam_logoff.c b/source3/winbindd/winbindd_pam_logoff.c >index b3c60adf857..b5b7840f99c 100644 >--- a/source3/winbindd/winbindd_pam_logoff.c >+++ b/source3/winbindd/winbindd_pam_logoff.c >@@ -94,7 +94,7 @@ struct tevent_req *winbindd_pam_logoff_send(TALLOC_CTX *mem_ctx, > break; > } > >- subreq = wb_domain_request_send(state, winbind_event_context(), domain, >+ subreq = wb_domain_request_send(state, server_event_context(), domain, > request); > if (tevent_req_nomem(subreq, req)) { > return tevent_req_post(req, ev); >diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c >index 8a97e80cae9..8e04ac664b5 100644 >--- a/source3/winbindd/winbindd_util.c >+++ b/source3/winbindd/winbindd_util.c >@@ -323,7 +323,7 @@ static void add_trusted_domains( struct winbindd_domain *domain ) > state->request.length = sizeof(state->request); > state->request.cmd = WINBINDD_LIST_TRUSTDOM; > >- req = wb_domain_request_send(state, winbind_event_context(), >+ req = wb_domain_request_send(state, server_event_context(), > domain, &state->request); > if (req == NULL) { > DEBUG(1, ("wb_domain_request_send failed\n")); >-- >2.15.0.448.gf294e3d99a-goog > > >From e062388536ccaae920d57b1085ec17027001eb7c Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Fri, 17 Nov 2017 11:37:30 +0100 >Subject: [PATCH 2/4] winbind: Remove winbind_event_context > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit e1f12acc13a3cc004518ac3460c6000ea0b95115) >--- > source3/torture/torture.c | 9 --------- > source3/winbindd/winbindd.c | 19 ------------------- > source3/winbindd/winbindd_proto.h | 1 - > 3 files changed, 29 deletions(-) > >diff --git a/source3/torture/torture.c b/source3/torture/torture.c >index 015ea3765a0..bb4fefa64b2 100644 >--- a/source3/torture/torture.c >+++ b/source3/torture/torture.c >@@ -11486,15 +11486,6 @@ static struct { > { "qpathinfo-bufsize", run_qpathinfo_bufsize, 0 }, > {NULL, NULL, 0}}; > >-/* >- * dummy function to satisfy linker dependency >- */ >-struct tevent_context *winbind_event_context(void); >-struct tevent_context *winbind_event_context(void) >-{ >- return NULL; >-} >- > /**************************************************************************** > run a specified test or "ALL" > ****************************************************************************/ >diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c >index a34c41421f6..6ff697a689f 100644 >--- a/source3/winbindd/winbindd.c >+++ b/source3/winbindd/winbindd.c >@@ -59,25 +59,6 @@ static bool interactive = False; > > extern bool override_logfile; > >-struct tevent_context *winbind_event_context(void) >-{ >- static struct tevent_context *ev = NULL; >- >- if (ev != NULL) { >- return ev; >- } >- >- /* >- * Note we MUST use the NULL context here, not the autofree context, >- * to avoid side effects in forked children exiting. >- */ >- ev = samba_tevent_context_init(NULL); >- if (ev == NULL) { >- smb_panic("Could not init winbindd's messaging context.\n"); >- } >- return ev; >-} >- > struct messaging_context *winbind_messaging_context(void) > { > static struct messaging_context *msg = NULL; >diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h >index 46fb60038e6..4878b89c372 100644 >--- a/source3/winbindd/winbindd_proto.h >+++ b/source3/winbindd/winbindd_proto.h >@@ -36,7 +36,6 @@ bool winbindd_setup_sig_hup_handler(const char *lfile); > bool winbindd_use_idmap_cache(void); > bool winbindd_use_cache(void); > char *get_winbind_priv_pipe_dir(void); >-struct tevent_context *winbind_event_context(void); > > /* The following definitions come from winbindd/winbindd_ads.c */ > >-- >2.15.0.448.gf294e3d99a-goog > > >From 23f3a359381ec93b9bb2ec6e8f7366a520f35eff Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Fri, 17 Nov 2017 11:42:34 +0100 >Subject: [PATCH 3/4] winbind: winbind_messaging_context -> > server_messaging_context > >Don't use winbind_messaging_context anymore. > >This fixes a bug analysed by Peter Somogyi <PSOMOGYI@hu.ibm.com>: If a >parent winbind forks, it only called reinit_after_fork on >winbind_messaging_context. On the other hand, deep in dbwrap_open we use >server_messaging_context(). This is not reinitialized by >winbind_reinit_after fork, so the parent and child share a ctdb >connection. This is invalid, because replies from ctdb end up in the >wrong process. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit d8a01d09c13728f36107f6eb94ecb7653706a4db) >--- > source3/winbindd/winbindd.c | 16 ++++++++-------- > source3/winbindd/winbindd_cm.c | 32 ++++++++++++++++---------------- > source3/winbindd/winbindd_dual.c | 34 +++++++++++++++++----------------- > source3/winbindd/winbindd_dual_srv.c | 6 +++--- > 4 files changed, 44 insertions(+), 44 deletions(-) > >diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c >index 6ff697a689f..e83ab332100 100644 >--- a/source3/winbindd/winbindd.c >+++ b/source3/winbindd/winbindd.c >@@ -239,7 +239,7 @@ static void terminate(bool is_parent) > #endif > > if (is_parent) { >- struct messaging_context *msg = winbind_messaging_context(); >+ struct messaging_context *msg = server_messaging_context(); > struct server_id self = messaging_server_id(msg); > serverid_deregister(self); > pidfile_unlink(lp_pid_directory(), "winbindd"); >@@ -1348,9 +1348,9 @@ static void winbindd_register_handlers(struct messaging_context *msg_ctx, > MSG_WINBIND_ONLINESTATUS, winbind_msg_onlinestatus); > > /* Handle domain online/offline messages for domains */ >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_DOMAIN_OFFLINE, winbind_msg_domain_offline); >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_DOMAIN_ONLINE, winbind_msg_domain_online); > > messaging_register(msg_ctx, NULL, >@@ -1661,7 +1661,7 @@ int main(int argc, const char **argv) > > /* Initialise messaging system */ > >- if (winbind_messaging_context() == NULL) { >+ if (server_messaging_context() == NULL) { > exit(1); > } > >@@ -1755,7 +1755,7 @@ int main(int argc, const char **argv) > * winbindd-specific resources we must free yet. JRA. > */ > >- status = reinit_after_fork(winbind_messaging_context(), >+ status = reinit_after_fork(server_messaging_context(), > server_event_context(), > false, NULL); > if (!NT_STATUS_IS_OK(status)) { >@@ -1772,9 +1772,9 @@ int main(int argc, const char **argv) > exit_daemon(nt_errstr(status), map_errno_from_nt_status(status)); > } > >- winbindd_register_handlers(winbind_messaging_context(), !Fork); >+ winbindd_register_handlers(server_messaging_context(), !Fork); > >- if (!messaging_parent_dgm_cleanup_init(winbind_messaging_context())) { >+ if (!messaging_parent_dgm_cleanup_init(server_messaging_context())) { > exit(1); > } > >@@ -1787,7 +1787,7 @@ int main(int argc, const char **argv) > rpc_samr_init(NULL); > > winbindd_init_addrchange(NULL, server_event_context(), >- winbind_messaging_context()); >+ server_messaging_context()); > > /* setup listen sockets */ > >diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c >index b507f1ad25b..e09ba8479bf 100644 >--- a/source3/winbindd/winbindd_cm.c >+++ b/source3/winbindd/winbindd_cm.c >@@ -222,10 +222,10 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) > > if (domain->dc_probe_pid != (pid_t)0) { > /* Parent */ >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_TRY_TO_GO_ONLINE, > msg_try_to_go_online); >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_FAILED_TO_GO_ONLINE, > msg_failed_to_go_online); > return True; >@@ -246,7 +246,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) > if (!NT_STATUS_IS_OK(status)) { > DEBUG(1, ("winbindd_reinit_after_fork failed: %s\n", > nt_errstr(status))); >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(parent_pid), > MSG_WINBIND_FAILED_TO_GO_ONLINE, > (const uint8_t *)domain->name, >@@ -258,7 +258,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) > mem_ctx = talloc_init("fork_child_dc_connect"); > if (!mem_ctx) { > DEBUG(0,("talloc_init failed.\n")); >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(parent_pid), > MSG_WINBIND_FAILED_TO_GO_ONLINE, > (const uint8_t *)domain->name, >@@ -268,7 +268,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) > > if ((!get_dcs(mem_ctx, domain, &dcs, &num_dcs)) || (num_dcs == 0)) { > /* Still offline ? Can't find DC's. */ >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(parent_pid), > MSG_WINBIND_FAILED_TO_GO_ONLINE, > (const uint8_t *)domain->name, >@@ -279,7 +279,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) > /* We got a DC. Send a message to our parent to get it to > try and do the same. */ > >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(parent_pid), > MSG_WINBIND_TRY_TO_GO_ONLINE, > (const uint8_t *)domain->name, >@@ -443,7 +443,7 @@ void set_domain_offline(struct winbindd_domain *domain) > > /* Send a message to the parent that the domain is offline. */ > if (parent_pid > 1 && !domain->internal) { >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(parent_pid), > MSG_WINBIND_DOMAIN_OFFLINE, > (uint8_t *)domain->name, >@@ -457,7 +457,7 @@ void set_domain_offline(struct winbindd_domain *domain) > struct winbindd_child *idmap = idmap_child(); > > if ( idmap->pid != 0 ) { >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(idmap->pid), > MSG_WINBIND_OFFLINE, > (const uint8_t *)domain->name, >@@ -520,16 +520,16 @@ static void set_domain_online(struct winbindd_domain *domain) > TALLOC_FREE(domain->check_online_event); > > /* Ensure we ignore any pending child messages. */ >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_TRY_TO_GO_ONLINE, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_FAILED_TO_GO_ONLINE, NULL); > > domain->online = True; > > /* Send a message to the parent that the domain is online. */ > if (parent_pid > 1 && !domain->internal) { >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(parent_pid), > MSG_WINBIND_DOMAIN_ONLINE, > (uint8_t *)domain->name, >@@ -543,7 +543,7 @@ static void set_domain_online(struct winbindd_domain *domain) > struct winbindd_child *idmap = idmap_child(); > > if ( idmap->pid != 0 ) { >- messaging_send_buf(winbind_messaging_context(), >+ messaging_send_buf(server_messaging_context(), > pid_to_procid(idmap->pid), > MSG_WINBIND_ONLINE, > (const uint8_t *)domain->name, >@@ -1412,7 +1412,7 @@ static bool dcip_to_name(TALLOC_CTX *mem_ctx, > } > #endif > >- status = nbt_getdc(winbind_messaging_context(), 10, pss, domain->name, >+ status = nbt_getdc(server_messaging_context(), 10, pss, domain->name, > &domain->sid, nt_version, mem_ctx, &nt_version, > &dc_name, NULL); > if (NT_STATUS_IS_OK(status)) { >@@ -1778,14 +1778,14 @@ NTSTATUS wb_open_internal_pipe(TALLOC_CTX *mem_ctx, > table, > session_info, > NULL, >- winbind_messaging_context(), >+ server_messaging_context(), > &cli); > } else { > status = rpc_pipe_open_internal(mem_ctx, > table, > session_info, > NULL, >- winbind_messaging_context(), >+ server_messaging_context(), > &cli); > } > if (!NT_STATUS_IS_OK(status)) { >@@ -3199,7 +3199,7 @@ static NTSTATUS cm_connect_netlogon_transport(struct winbindd_domain *domain, > enum dcerpc_transport_t transport, > struct rpc_pipe_client **cli) > { >- struct messaging_context *msg_ctx = winbind_messaging_context(); >+ struct messaging_context *msg_ctx = server_messaging_context(); > struct winbindd_cm_conn *conn; > NTSTATUS result; > enum netr_SchannelType sec_chan_type; >diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c >index 0b98a8368e4..eaa7d9f26f9 100644 >--- a/source3/winbindd/winbindd_dual.c >+++ b/source3/winbindd/winbindd_dual.c >@@ -1051,7 +1051,7 @@ static void machine_password_change_handler(struct tevent_context *ctx, > struct timeval now, > void *private_data) > { >- struct messaging_context *msg_ctx = winbind_messaging_context(); >+ struct messaging_context *msg_ctx = server_messaging_context(); > struct winbindd_child *child = > (struct winbindd_child *)private_data; > struct rpc_pipe_client *netlogon_pipe = NULL; >@@ -1250,7 +1250,7 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself, > NTSTATUS status; > > status = reinit_after_fork( >- winbind_messaging_context(), >+ server_messaging_context(), > server_event_context(), > true, NULL); > if (!NT_STATUS_IS_OK(status)) { >@@ -1275,26 +1275,26 @@ NTSTATUS winbindd_reinit_after_fork(const struct winbindd_child *myself, > CatchChild(); > > /* Don't handle the same messages as our parent. */ >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_SMB_CONF_UPDATED, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_SHUTDOWN, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_OFFLINE, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_ONLINE, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_ONLINESTATUS, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_DUMP_EVENT_LIST, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_DUMP_DOMAIN_LIST, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_DEBUG, NULL); > >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_DOMAIN_OFFLINE, NULL); >- messaging_deregister(winbind_messaging_context(), >+ messaging_deregister(server_messaging_context(), > MSG_WINBIND_DOMAIN_ONLINE, NULL); > > /* We have destroyed all events in the winbindd_event_context >@@ -1492,15 +1492,15 @@ static bool fork_domain_child(struct winbindd_child *child) > } > > /* Handle online/offline messages. */ >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_OFFLINE, child_msg_offline); >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_ONLINE, child_msg_online); >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_DUMP_EVENT_LIST, child_msg_dump_event_list); >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_DEBUG, debug_message); >- messaging_register(winbind_messaging_context(), NULL, >+ messaging_register(server_messaging_context(), NULL, > MSG_WINBIND_IP_DROPPED, > winbind_msg_ip_dropped); > >diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c >index 0a2a5e27f8f..d083534aed7 100644 >--- a/source3/winbindd/winbindd_dual_srv.c >+++ b/source3/winbindd/winbindd_dual_srv.c >@@ -518,7 +518,7 @@ NTSTATUS _wbint_DsGetDcName(struct pipes_struct *p, struct wbint_DsGetDcName *r) > struct dcerpc_binding_handle *b; > > if (domain == NULL) { >- return dsgetdcname(p->mem_ctx, winbind_messaging_context(), >+ return dsgetdcname(p->mem_ctx, server_messaging_context(), > r->in.domain_name, r->in.domain_guid, > r->in.site_name ? r->in.site_name : "", > r->in.flags, >@@ -710,7 +710,7 @@ again: > NTSTATUS _wbint_ChangeMachineAccount(struct pipes_struct *p, > struct wbint_ChangeMachineAccount *r) > { >- struct messaging_context *msg_ctx = winbind_messaging_context(); >+ struct messaging_context *msg_ctx = server_messaging_context(); > struct winbindd_domain *domain; > NTSTATUS status; > struct rpc_pipe_client *netlogon_pipe; >@@ -1353,7 +1353,7 @@ static WERROR _winbind_LogonControl_CHANGE_PASSWORD(struct pipes_struct *p, > struct winbindd_domain *domain, > struct winbind_LogonControl *r) > { >- struct messaging_context *msg_ctx = winbind_messaging_context(); >+ struct messaging_context *msg_ctx = server_messaging_context(); > NTSTATUS status; > struct rpc_pipe_client *netlogon_pipe; > struct cli_credentials *creds = NULL; >-- >2.15.0.448.gf294e3d99a-goog > > >From 3c01efd26231c7652fe84ee12cdc14368f7bef41 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Fri, 17 Nov 2017 11:47:37 +0100 >Subject: [PATCH 4/4] winbind: Remove winbind_messaging_context > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=13150 > >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Sat Nov 18 04:07:24 CET 2017 on sn-devel-144 > >(cherry picked from commit 050ca45dc7fc5bbab6e1c60b919ac0b1e9661e27) >--- > source3/winbindd/winbindd.c | 19 ------------------- > source3/winbindd/winbindd_proto.h | 1 - > 2 files changed, 20 deletions(-) > >diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c >index e83ab332100..f6010053c31 100644 >--- a/source3/winbindd/winbindd.c >+++ b/source3/winbindd/winbindd.c >@@ -59,25 +59,6 @@ static bool interactive = False; > > extern bool override_logfile; > >-struct messaging_context *winbind_messaging_context(void) >-{ >- static struct messaging_context *msg = NULL; >- >- if (msg != NULL) { >- return msg; >- } >- >- /* >- * Note we MUST use the NULL context here, not the autofree context, >- * to avoid side effects in forked children exiting. >- */ >- msg = messaging_init(NULL, server_event_context()); >- if (msg == NULL) { >- smb_panic("Could not init winbindd's messaging context.\n"); >- } >- return msg; >-} >- > struct imessaging_context *winbind_imessaging_context(void) > { > static struct imessaging_context *msg = NULL; >diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h >index 4878b89c372..7fd3f6cf79c 100644 >--- a/source3/winbindd/winbindd_proto.h >+++ b/source3/winbindd/winbindd_proto.h >@@ -26,7 +26,6 @@ > #include "ads.h" > > /* The following definitions come from winbindd/winbindd.c */ >-struct messaging_context *winbind_messaging_context(void); > struct imessaging_context *winbind_imessaging_context(void); > void request_error(struct winbindd_cli_state *state); > void request_ok(struct winbindd_cli_state *state); >-- >2.15.0.448.gf294e3d99a-goog >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
vl
:
review+
Actions:
View
Attachments on
bug 13150
:
13795
| 13796