summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-11-10 17:45:28 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-11-17 00:34:09 +0100
commite743fbc26ef64f8f3e4164f809140a12b304c90f (patch)
treecc489e8b5eaac5807ad178749383b6cc777d4e6c
parentea7cb8ccb7f19fa8f4c5e6c61147dd6a4a877e22 (diff)
downloadsamba-e743fbc26ef64f8f3e4164f809140a12b304c90f.tar.gz
samba-e743fbc26ef64f8f3e4164f809140a12b304c90f.tar.bz2
samba-e743fbc26ef64f8f3e4164f809140a12b304c90f.zip
param: Check if server role and security parameters are conflicting
-rw-r--r--lib/param/loadparm.h1
-rw-r--r--lib/param/loadparm_server_role.c39
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h
index ecf8f9c6a8..a50384d873 100644
--- a/lib/param/loadparm.h
+++ b/lib/param/loadparm.h
@@ -136,3 +136,4 @@ struct parm_struct {
const char* server_role_str(uint32_t role);
int lp_find_server_role(int server_role, int security, bool domain_logons, bool domain_master);
int lp_find_security(int server_role, int security);
+bool lp_is_security_and_server_role_valid(int server_role, int security);
diff --git a/lib/param/loadparm_server_role.c b/lib/param/loadparm_server_role.c
index d80ee7e876..a39d5fa214 100644
--- a/lib/param/loadparm_server_role.c
+++ b/lib/param/loadparm_server_role.c
@@ -141,3 +141,42 @@ int lp_find_security(int server_role, int security)
return SEC_USER;
}
}
+
+
+/**
+ * Check if server role and security parameters are contradictory
+ */
+bool lp_is_security_and_server_role_valid(int server_role, int security)
+{
+ bool valid = false;
+
+ if (server_role == ROLE_AUTO || security == SEC_AUTO) {
+ return false;
+ }
+
+ switch (server_role) {
+ case ROLE_STANDALONE:
+ if (security == SEC_SHARE || security == SEC_SERVER || security == SEC_USER) {
+ valid = true;
+ }
+ break;
+
+ case ROLE_DOMAIN_MEMBER:
+ if (security == SEC_ADS || security == SEC_DOMAIN) {
+ valid = true;
+ }
+ break;
+
+ case ROLE_DOMAIN_PDC:
+ case ROLE_DOMAIN_BDC:
+ if (security == SEC_USER) {
+ valid = true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return valid;
+}