]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
winbindd: add and use is_idmap_child()
authorStefan Metzmacher <metze@samba.org>
Fri, 11 Sep 2020 12:06:04 +0000 (14:06 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 23 Oct 2020 03:25:35 +0000 (03:25 +0000)
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>
source3/winbindd/winbindd_dual.c
source3/winbindd/winbindd_idmap.c
source3/winbindd/winbindd_proto.h

index ba3f79efa8c73cc6d09ddc69f488cb5de01e9b31..3d8a567a6e48c66f2d4d526a2c213fb63dd099ba 100644 (file)
@@ -1744,7 +1744,7 @@ static bool fork_domain_child(struct winbindd_child *child)
 
        if (child_domain != NULL) {
                setproctitle("domain child [%s]", child_domain->name);
-       } else if (child == idmap_child()) {
+       } else if (is_idmap_child(child)) {
                setproctitle("idmap child");
        }
 
@@ -1790,7 +1790,7 @@ static bool fork_domain_child(struct winbindd_child *child)
         * We are in idmap child, make sure that we set the
         * check_online_event to bring primary domain online.
         */
-       if (child == idmap_child()) {
+       if (is_idmap_child(child)) {
                set_domain_online_request(primary_domain);
        }
 
index 965a7839f17d1b3400ff1df25935d44f466d06ba..bd5f3a67aadeec0415622082fd913fb7b950d535 100644 (file)
@@ -34,6 +34,15 @@ struct winbindd_child *idmap_child(void)
        return &static_idmap_child;
 }
 
+bool is_idmap_child(const struct winbindd_child *child)
+{
+       if (child == &static_idmap_child) {
+               return true;
+       }
+
+       return false;
+}
+
 pid_t idmap_child_pid(void)
 {
        return static_idmap_child.pid;
index 0476dd529982d297c5e8eb7473320fc4db5f3794..7448c417b0c78c9ac84a351d74786972eff91131 100644 (file)
@@ -359,6 +359,7 @@ NTSTATUS winbindd_print_groupmembers(struct db_context *members,
 
 void init_idmap_child(void);
 struct winbindd_child *idmap_child(void);
+bool is_idmap_child(const struct winbindd_child *child);
 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,