1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

s3-param: Add "server role" as global parameter

This will help extracting server role processing code in common
library.
This commit is contained in:
Amitay Isaacs 2011-11-08 12:12:06 +11:00 committed by Andrew Bartlett
parent 7b175e875e
commit d97acc8fb9
3 changed files with 31 additions and 10 deletions

View File

@ -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 */

View File

@ -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;
}

View File

@ -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;
}