1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

winbindd: add and use idmap_child_pid()

We should avoid calling idmap_child() as much as possible.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14539

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Stefan Metzmacher 2020-09-11 14:06:04 +02:00 committed by Andrew Bartlett
parent 1694de1ae6
commit 2103543629
4 changed files with 15 additions and 9 deletions

View File

@ -464,11 +464,11 @@ void set_domain_offline(struct winbindd_domain *domain)
primary domain goes offline */
if ( domain->primary ) {
struct winbindd_child *idmap = idmap_child();
pid_t idmap_pid = idmap_child_pid();
if ( idmap->pid != 0 ) {
if (idmap_pid != 0) {
messaging_send_buf(global_messaging_context(),
pid_to_procid(idmap->pid),
pid_to_procid(idmap_pid),
MSG_WINBIND_OFFLINE,
(const uint8_t *)domain->name,
strlen(domain->name)+1);
@ -550,11 +550,11 @@ static void set_domain_online(struct winbindd_domain *domain)
primary domain comes online */
if ( domain->primary ) {
struct winbindd_child *idmap = idmap_child();
pid_t idmap_pid = idmap_child_pid();
if ( idmap->pid != 0 ) {
if (idmap_pid != 0) {
messaging_send_buf(global_messaging_context(),
pid_to_procid(idmap->pid),
pid_to_procid(idmap_pid),
MSG_WINBIND_ONLINE,
(const uint8_t *)domain->name,
strlen(domain->name)+1);

View File

@ -1039,11 +1039,11 @@ void winbind_msg_online(struct messaging_context *msg_ctx,
primary domain comes back online */
if ( domain->primary ) {
struct winbindd_child *idmap = idmap_child();
pid_t idmap_pid = idmap_child_pid();
if ( idmap->pid != 0 ) {
if (idmap_pid != 0) {
messaging_send_buf(msg_ctx,
pid_to_procid(idmap->pid),
pid_to_procid(idmap_pid),
MSG_WINBIND_ONLINE,
(const uint8_t *)domain->name,
strlen(domain->name)+1);

View File

@ -34,6 +34,11 @@ struct winbindd_child *idmap_child(void)
return &static_idmap_child;
}
pid_t idmap_child_pid(void)
{
return static_idmap_child.pid;
}
struct dcerpc_binding_handle *idmap_child_handle(void)
{
return static_idmap_child.binding_handle;

View File

@ -359,6 +359,7 @@ NTSTATUS winbindd_print_groupmembers(struct db_context *members,
void init_idmap_child(void);
struct winbindd_child *idmap_child(void);
pid_t idmap_child_pid(void);
struct dcerpc_binding_handle *idmap_child_handle(void);
struct idmap_domain *idmap_find_domain_with_sid(const char *domname,
const struct dom_sid *sid);