]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
CVE-2020-25717 winbindd: add and use is_idmap_child()
authorStefan Metzmacher <metze@samba.org>
Fri, 11 Sep 2020 12:06:04 +0000 (14:06 +0200)
committerJule Anger <janger@samba.org>
Mon, 8 Nov 2021 09:52:09 +0000 (10:52 +0100)
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>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14556

(cherry picked from commit cd9a9702c1f97c47bd3447e2014eeff3e56268cf)

source3/winbindd/winbindd_dual.c
source3/winbindd/winbindd_idmap.c
source3/winbindd/winbindd_proto.h

index 0edfc2d205d0b1d8d806132b43883adf2a058238..4f07ff494451ad5bbe6b1826d377b4a91450fbbf 100644 (file)
@@ -1776,7 +1776,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");
        }
 
@@ -1826,7 +1826,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 ce391ab7ec557b6b86812a3df690cec21ab35ddd..97c38018aac55568e75efc03ab922a6e17e3544b 100644 (file)
@@ -366,6 +366,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,