summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-05-26 12:31:39 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-05-26 12:37:09 +1000
commit6ef65389fd2f2bdcafe840e0cd0221bb9f26bdfc (patch)
tree04df0bce183d759a17d25483f302ed56d65e8153 /source4/param
parent86039855759ce38e6074f956073199b0ccd29bdf (diff)
downloadsamba-6ef65389fd2f2bdcafe840e0cd0221bb9f26bdfc.tar.gz
samba-6ef65389fd2f2bdcafe840e0cd0221bb9f26bdfc.tar.bz2
samba-6ef65389fd2f2bdcafe840e0cd0221bb9f26bdfc.zip
Don't use crossRef records to find our own domain
A single AD server can only host a single domain, so don't stuff about with looking up our crossRef record in the cn=Partitions container. We instead trust that lp_realm() and lp_workgroup() works correctly. Andrew Bartlett
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/loadparm.c1
-rw-r--r--source4/param/param.h5
-rw-r--r--source4/param/util.c17
3 files changed, 23 insertions, 0 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index d6f418e568..eeffe9874f 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -2725,3 +2725,4 @@ struct gensec_settings *lp_gensec_settings(TALLOC_CTX *mem_ctx, struct loadparm_
settings->target_hostname = lp_parm_string(lp_ctx, NULL, "gensec", "target_hostname");
return settings;
}
+
diff --git a/source4/param/param.h b/source4/param/param.h
index 3d257be062..27bc32f9b9 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -362,6 +362,9 @@ int param_write(struct param_context *ctx, const char *fn);
bool lp_is_mydomain(struct loadparm_context *lp_ctx,
const char *domain);
+bool lp_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
+ const char *domain);
+
/**
see if a string matches either our primary or one of our secondary
netbios aliases. do a case insensitive match
@@ -434,6 +437,8 @@ const char *lp_messaging_path(TALLOC_CTX *mem_ctx,
struct smb_iconv_convenience *smb_iconv_convenience_init_lp(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx);
+const char *lp_sam_name(struct loadparm_context *lp_ctx);
+
/* The following definitions come from lib/version.c */
const char *samba_version_string(void);
diff --git a/source4/param/util.c b/source4/param/util.c
index 3881107cbc..366c3f1d78 100644
--- a/source4/param/util.c
+++ b/source4/param/util.c
@@ -41,6 +41,13 @@ bool lp_is_mydomain(struct loadparm_context *lp_ctx,
return strequal(lp_workgroup(lp_ctx), domain);
}
+bool lp_is_my_domain_or_realm(struct loadparm_context *lp_ctx,
+ const char *domain)
+{
+ return strequal(lp_workgroup(lp_ctx), domain) ||
+ strequal(lp_realm(lp_ctx), domain);
+}
+
/**
see if a string matches either our primary or one of our secondary
netbios aliases. do a case insensitive match
@@ -296,3 +303,13 @@ struct smb_iconv_convenience *smb_iconv_convenience_init_lp(TALLOC_CTX *mem_ctx,
}
+const char *lp_sam_name(struct loadparm_context *lp_ctx)
+{
+ switch (lp_server_role(lp_ctx)) {
+ case ROLE_DOMAIN_CONTROLLER:
+ return lp_workgroup(lp_ctx);
+ default:
+ return lp_netbios_name(lp_ctx);
+ }
+}
+