summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-12-30 10:25:41 +0100
committerVolker Lendecke <vl@samba.org>2010-01-02 12:09:05 +0100
commitd05e17f875300615c0b8543291e7e021448ddff1 (patch)
tree4e25e85095f2bcabd3248c3a894a101305a80a7f /source3/winbindd
parent504754856eed363dde28cdff821c086754deb7f8 (diff)
downloadsamba-d05e17f875300615c0b8543291e7e021448ddff1.tar.gz
samba-d05e17f875300615c0b8543291e7e021448ddff1.tar.bz2
samba-d05e17f875300615c0b8543291e7e021448ddff1.zip
s3: Introduce domain_is_forest_root() helper function
Hopefully this makes the flag tests a bit more understandable
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_ads.c7
-rw-r--r--source3/winbindd/winbindd_proto.h1
-rw-r--r--source3/winbindd/winbindd_util.c12
3 files changed, 12 insertions, 8 deletions
diff --git a/source3/winbindd/winbindd_ads.c b/source3/winbindd/winbindd_ads.c
index b0ca9b8176..d15fb86d86 100644
--- a/source3/winbindd/winbindd_ads.c
+++ b/source3/winbindd/winbindd_ads.c
@@ -1263,7 +1263,6 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
int i;
uint32 flags;
struct rpc_pipe_client *cli;
- uint32 fr_flags = (NETR_TRUST_FLAG_IN_FOREST | NETR_TRUST_FLAG_TREEROOT);
int ret_count;
DEBUG(3,("ads: trusted_domains\n"));
@@ -1274,9 +1273,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
query for all trusts. If not, then just look for domain
trusts in the target forest */
- if ( domain->primary ||
- ((domain->domain_flags&fr_flags) == fr_flags) )
- {
+ if (domain->primary || domain_is_forest_root(domain)) {
flags = NETR_TRUST_FLAG_OUTBOUND |
NETR_TRUST_FLAG_INBOUND |
NETR_TRUST_FLAG_IN_FOREST;
@@ -1354,7 +1351,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
wcache_tdc_add_domain( &d );
ret_count++;
- } else if ( (domain->domain_flags&fr_flags) == fr_flags ) {
+ } else if (domain_is_forest_root(domain)) {
/* Check if we already have this record. If
* we are following our forest root that is not
* our primary domain, we want to keep trust
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index 263e326917..cf429c764f 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -413,6 +413,7 @@ enum winbindd_result winbindd_dual_pam_chng_pswd_auth_crap(struct winbindd_domai
struct winbindd_domain *domain_list(void);
void free_domain_list(void);
+bool domain_is_forest_root(const struct winbindd_domain *domain);
void rescan_trusted_domains(struct tevent_context *ev, struct tevent_timer *te,
struct timeval now, void *private_data);
enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domain,
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 17603820d4..5442a90cdf 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -223,6 +223,14 @@ done:
return domain;
}
+bool domain_is_forest_root(const struct winbindd_domain *domain)
+{
+ const uint32_t fr_flags =
+ (NETR_TRUST_FLAG_TREEROOT|NETR_TRUST_FLAG_IN_FOREST);
+
+ return ((domain->domain_flags & fr_flags) == fr_flags);
+}
+
/********************************************************************
rescan our domains looking for new trusted domains
********************************************************************/
@@ -243,8 +251,6 @@ static void add_trusted_domains( struct winbindd_domain *domain )
TALLOC_CTX *mem_ctx;
struct winbindd_request *request;
struct winbindd_response *response;
- uint32 fr_flags = (NETR_TRUST_FLAG_TREEROOT|NETR_TRUST_FLAG_IN_FOREST);
-
struct trustdom_state *state;
mem_ctx = talloc_init("add_trusted_domains");
@@ -269,7 +275,7 @@ static void add_trusted_domains( struct winbindd_domain *domain )
/* Flags used to know how to continue the forest trust search */
state->primary = domain->primary;
- state->forest_root = ((domain->domain_flags & fr_flags) == fr_flags );
+ state->forest_root = domain_is_forest_root(domain);
request->length = sizeof(*request);
request->cmd = WINBINDD_LIST_TRUSTDOM;