winbind: Simplify a logic expression
authorVolker Lendecke <vl@samba.org>
Thu, 9 Mar 2017 17:49:39 +0000 (18:49 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 11 Apr 2017 23:41:14 +0000 (01:41 +0200)
This isn't 100% the same flow, but before this patch we initialized
domain->primary to "false" via "talloc_zero". This means that the
end-result should be the same before and after this patch that IMHO
simplifies the logic a bit.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd_util.c

index 8f16da77fba62449c756f0d5dd23f687b0ae29d5..ee6ca6050ae66387d60218ad44b9ad84ac531138 100644 (file)
@@ -252,12 +252,10 @@ add_trusted_domain_from_tdc(const struct winbindd_tdc_domain *tdc)
        domain->domain_trust_attribs = tdc->trust_attribs;
 
        /* Is this our primary domain ? */
-       if (strequal(domain_name, get_global_sam_name()) &&
-                       (role != ROLE_DOMAIN_MEMBER)) {
-               domain->primary = true;
-       } else if (strequal(domain_name, lp_workgroup()) &&
-                       (role == ROLE_DOMAIN_MEMBER)) {
-               domain->primary = true;
+       if (role == ROLE_DOMAIN_MEMBER) {
+               domain->primary = strequal(domain_name, lp_workgroup());
+       } else {
+               domain->primary = strequal(domain_name, get_global_sam_name());
        }
 
        if (domain->primary) {