diff options
author | Amitay Isaacs <amitay@gmail.com> | 2011-11-08 12:12:06 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-11-17 00:34:08 +0100 |
commit | d97acc8fb9710c41c9758801af1e79c38f9ffdcc (patch) | |
tree | 8d695f0f6ad8ade27b5f5673f879b5a2dcd14574 | |
parent | 7b175e875ea4cdfa27c21369a28e9c4ef14c925b (diff) | |
download | samba-d97acc8fb9710c41c9758801af1e79c38f9ffdcc.tar.gz samba-d97acc8fb9710c41c9758801af1e79c38f9ffdcc.tar.bz2 samba-d97acc8fb9710c41c9758801af1e79c38f9ffdcc.zip |
s3-param: Add "server role" as global parameter
This will help extracting server role processing code in common
library.
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/param/loadparm.c | 28 | ||||
-rw-r--r-- | source3/param/loadparm_server_role.c | 12 |
3 files changed, 31 insertions, 10 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 679311158c..b2a10f69d6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1646,6 +1646,7 @@ int lp_min_receive_file_size(void); char* lp_perfcount_module(void); void widelinks_warning(int snum); const char *lp_ncalrpc_dir(void); +void _lp_set_server_role(int server_role); /* The following definitions come from param/loadparm_ctx.c */ diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 36e35e8d44..7e9c09f5ed 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -512,6 +512,18 @@ static const struct enum_list enum_kerberos_method[] = { {-1, NULL} }; +/* Server role options */ +static const struct enum_list enum_server_role_s3[] = { + {ROLE_STANDALONE, "standalone"}, + {ROLE_DOMAIN_MEMBER, "member server"}, + {ROLE_DOMAIN_MEMBER, "member"}, + {ROLE_DOMAIN_BDC, "bdc"}, + {ROLE_DOMAIN_BDC, "domain controller"}, + {ROLE_DOMAIN_BDC, "dc"}, + {ROLE_DOMAIN_PDC, "pdc"}, + {-1, NULL} +}; + /* Note: We do not initialise the defaults union - it is not allowed in ANSI C * * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit @@ -662,6 +674,15 @@ static struct parm_struct parm_table[] = { .enum_list = enum_config_backend, .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META, }, + { + .label = "server role", + .type = P_ENUM, + .p_class = P_GLOBAL, + .offset = GLOBAL_VAR(ServerRole), + .special = NULL, + .enum_list = enum_server_role_s3, + .flags = FLAG_BASIC | FLAG_ADVANCED, + }, {N_("Security Options"), P_SEP, P_SEPARATOR}, @@ -4796,6 +4817,7 @@ static void init_globals(bool reinit_globals) Globals.PrintcapCacheTime = 750; /* 12.5 minutes */ Globals.ConfigBackend = config_backend; + Globals.ServerRole = ROLE_STANDALONE; /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */ /* Discovered by 2 days of pain by Don McCall @ HP :-). */ @@ -5363,6 +5385,7 @@ FN_GLOBAL_INTEGER(lp_lock_spin_time, iLockSpinTime) FN_GLOBAL_INTEGER(lp_usershare_max_shares, iUsershareMaxShares) FN_GLOBAL_CONST_STRING(lp_socket_options, szSocketOptions) FN_GLOBAL_INTEGER(lp_config_backend, ConfigBackend) +FN_GLOBAL_INTEGER(lp_server_role, ServerRole) FN_GLOBAL_INTEGER(lp_smb2_max_read, ismb2_max_read) FN_GLOBAL_INTEGER(lp_smb2_max_write, ismb2_max_write) FN_GLOBAL_INTEGER(lp_smb2_max_trans, ismb2_max_trans) @@ -9707,3 +9730,8 @@ bool lp_readraw(void) } return _lp_readraw(); } + +void _lp_set_server_role(int server_role) +{ + Globals.ServerRole = server_role; +} diff --git a/source3/param/loadparm_server_role.c b/source3/param/loadparm_server_role.c index 1f18b4fd12..7fe4411b54 100644 --- a/source3/param/loadparm_server_role.c +++ b/source3/param/loadparm_server_role.c @@ -30,7 +30,6 @@ /******************************************************************* Set the server type we will announce as via nmbd. ********************************************************************/ -static int server_role; static const struct srv_role_tab { uint32 role; @@ -56,7 +55,7 @@ const char* server_role_str(uint32 role) void set_server_role(void) { - server_role = ROLE_STANDALONE; + int server_role = ROLE_STANDALONE; switch (lp_security()) { case SEC_SHARE: @@ -98,14 +97,7 @@ void set_server_role(void) break; } + _lp_set_server_role(server_role); DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role))); } -/*********************************************************** - returns role of Samba server -************************************************************/ - -int lp_server_role(void) -{ - return server_role; -} |