lib/param: Merge handling of security/domain master/domain logons/server role
authorAndrew Bartlett <abartlet@samba.org>
Mon, 23 Jul 2012 03:32:31 +0000 (13:32 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 24 Jul 2012 09:01:17 +0000 (11:01 +0200)
This ensures that the same input parameters always gives the same
output values in both loadparm systems.

Andrew Bartlett

lib/param/loadparm.c
lib/param/param_functions.c
script/mks3param.pl
source3/include/proto.h
source3/param/loadparm.c
source3/param/loadparm_ctx.c

index e744e79206a765c0e957e96168c8913eb154b1b0..8e5fba8c2011ace95d4814f09b54c83d3dcb5a7b 100644 (file)
@@ -83,9 +83,6 @@ static bool defaults_saved = false;
        char *tls_dhpfile;                                              \
        char *loglevel;                                                 \
        char *panic_action;                                             \
-       int security;                                                   \
-       int domain_master;                                              \
-       int domain_logons;                                              \
        int bPreferredMaster;
 
 #include "lib/param/param_global.h"
@@ -123,7 +120,7 @@ static struct parm_struct parm_table[] = {
                .label          = "domain logons",
                .type           = P_ENUM,
                .p_class        = P_GLOBAL,
-               .offset         = GLOBAL_VAR(domain_logons),
+               .offset         = GLOBAL_VAR(bDomainLogons),
                .special        = NULL,
                .enum_list      = enum_bool_auto
        },
@@ -3762,23 +3759,17 @@ struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *mem_ctx, struct loadpa
 
 int lpcfg_server_role(struct loadparm_context *lp_ctx)
 {
-       if (lp_ctx->s3_fns) {
-               return lp_ctx->s3_fns->server_role();
-       }
+       int domain_master = lpcfg__domain_master(lp_ctx);
 
-       return lp_find_server_role(lp_ctx->globals->server_role,
-                                  lp_ctx->globals->security,
-                                  lp_ctx->globals->domain_logons,
-                                  (lp_ctx->globals->domain_master == true) ||
-                                  (lp_ctx->globals->domain_master == Auto));
+       return lp_find_server_role(lpcfg__server_role(lp_ctx),
+                                  lpcfg__security(lp_ctx),
+                                  lpcfg__domain_logons(lp_ctx),
+                                  (domain_master == true) ||
+                                  (domain_master == Auto));
 }
 
 int lpcfg_security(struct loadparm_context *lp_ctx)
 {
-       if (lp_ctx->s3_fns) {
-               return lp_ctx->s3_fns->security();
-       }
-
-       return lp_find_security(lp_ctx->globals->server_role,
-                               lp_ctx->globals->security);
+       return lp_find_security(lpcfg__server_role(lp_ctx),
+                               lpcfg__security(lp_ctx));
 }
index 7f2d87855209f48d4e78615a37634c84ccad7b55..d7e09ffafdc40e2dd84907380c4a54fd0ddf84fc 100644 (file)
@@ -177,6 +177,7 @@ FN_GLOBAL_BOOL(debug_uid, bDebugUid)
 FN_GLOBAL_BOOL(defer_sharing_violations, bDeferSharingViolations)
 FN_GLOBAL_BOOL(disable_netbios, bDisableNetbios)
 FN_GLOBAL_BOOL(_disable_spoolss, bDisableSpoolss)
+FN_GLOBAL_BOOL(_domain_logons, bDomainLogons)
 FN_GLOBAL_BOOL(dns_recursive_queries, dns_recursive_queries)
 FN_GLOBAL_BOOL(enable_asu_support, bASUSupport)
 FN_GLOBAL_BOOL(enable_core_files, bEnableCoreFiles)
@@ -210,7 +211,6 @@ FN_GLOBAL_BOOL(passwd_chat_debug, bPasswdChatDebug)
 FN_GLOBAL_BOOL(registry_shares, bRegistryShares)
 FN_GLOBAL_BOOL(reset_on_zero_vc, bResetOnZeroVC)
 FN_GLOBAL_BOOL(rpc_big_endian, bRpcBigEndian)
-FN_GLOBAL_BOOL(_server_role, server_role)
 FN_GLOBAL_BOOL(stat_cache, bStatCache)
 FN_GLOBAL_BOOL(syslog_only, bSyslogOnly)
 FN_GLOBAL_BOOL(timestamp_logs, bTimestampLogs)
@@ -286,6 +286,7 @@ FN_GLOBAL_INTEGER(ctdb_timeout, ctdb_timeout)
 FN_GLOBAL_INTEGER(cups_connection_timeout, cups_connection_timeout)
 FN_GLOBAL_INTEGER(deadtime, deadtime)
 FN_GLOBAL_INTEGER(dgram_port, dgram_port)
+FN_GLOBAL_INTEGER(_domain_master, domain_master)
 FN_GLOBAL_INTEGER(idmap_cache_time, iIdmapCacheTime)
 FN_GLOBAL_INTEGER(idmap_negative_cache_time, iIdmapNegativeCacheTime)
 FN_GLOBAL_INTEGER(init_logon_delay, InitLogonDelay)
@@ -329,6 +330,8 @@ FN_GLOBAL_INTEGER(passwd_chat_timeout, iPasswdChatTimeout)
 FN_GLOBAL_INTEGER(passwordlevel, pwordlevel)
 FN_GLOBAL_INTEGER(printcap_cache_time, PrintcapCacheTime)
 FN_GLOBAL_INTEGER(restrict_anonymous, restrict_anonymous)
+FN_GLOBAL_INTEGER(_security, security)
+FN_GLOBAL_INTEGER(_server_role, server_role)
 FN_GLOBAL_INTEGER(server_schannel, serverSchannel)
 FN_GLOBAL_INTEGER(server_signing, server_signing)
 FN_GLOBAL_INTEGER(smb2_max_read, ismb2_max_read)
index 5c5eea3ce1c6ffb0520b1266ba3ae7818c5c9e9f..4222ca57442ba0420454de215ba52f5a3247bfc6 100644 (file)
@@ -95,8 +95,6 @@ sub print_header($$)
        $file->("\tbool (*load)(const char *filename);\n");
        $file->("\tbool (*set_cmdline)(const char *pszParmName, const char *pszParmValue);\n");
        $file->("\tvoid (*dump)(FILE *f, bool show_defaults, int maxtoprint);\n");
-       $file->("\tint (*server_role)(void);\n");
-       $file->("\tint (*security)(void);\n");
 }
 
 sub print_footer($$) 
index ddccbb73b4d5268020c7c63db14ef9bdb2149ddc..0b4f09353709661123d2f74e1130b0d0b72b0cc4 100644 (file)
@@ -1191,6 +1191,10 @@ bool lp_getwd_cache(void);
 int lp_srv_maxprotocol(void);
 int lp_srv_minprotocol(void);
 int lp_security(void);
+int lp__server_role(void);
+int lp__security(void);
+int lp__domain_master(void);
+bool lp__domain_logons(void);
 const char **lp_auth_methods(void);
 bool lp_paranoid_server_security(void);
 int lp_maxdisksize(void);
index bee204b9c796b57819bc4e7f2af5ac8afacf5aca..39097395de08f1954cfcf74041c0277614e3ec31 100644 (file)
@@ -116,7 +116,6 @@ static bool defaults_saved = false;
        char *szPrintcapname;                                           \
        int CupsEncrypt;                                                \
        int  iPreferredMaster;                                          \
-       int domain_master;                                              \
        char *szLdapMachineSuffix;                                      \
        char *szLdapUserSuffix;                                         \
        char *szLdapIdmapSuffix;                                        \
@@ -5197,7 +5196,6 @@ char *lp_ ## fn_name(TALLOC_CTX *ctx,int i) {return(lp_string((ctx), (LP_SNUM_OK
  char lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
 
 
-static FN_GLOBAL_BOOL(domain_logons, bDomainLogons)
 static FN_GLOBAL_BOOL(_readraw, bReadRaw)
 static FN_GLOBAL_BOOL(_writeraw, bWriteRaw)
 
@@ -5264,7 +5262,6 @@ int lp_cups_encrypt(void)
 
 /* These functions remain in source3/param for now */
 
-FN_GLOBAL_INTEGER(security, security)
 FN_GLOBAL_STRING(configfile, szConfigFile)
 
 #include "lib/param/param_functions.c"
@@ -9555,7 +9552,13 @@ bool lp_readraw(void)
 int lp_server_role(void)
 {
        return lp_find_server_role(lp__server_role(),
-                                  lp_security(),
-                                  lp_domain_logons(),
+                                  lp__security(),
+                                  lp__domain_logons(),
                                   lp_domain_master_true_or_auto());
 }
+
+int lp_security(void)
+{
+       return lp_find_security(lp__server_role(),
+                               lp__security());
+}
index 9c78f15879b8c048228142266d3df3c903f7050d..75f7e38957dfd3c117b57ace22600c5c80d5a447 100644 (file)
@@ -73,8 +73,10 @@ static const struct loadparm_s3_helpers s3_fns =
        .set_cmdline = lp_set_cmdline,
        .dump = lp_dump,
 
-       .server_role = lp_server_role,
-       .security = lp_security,
+       ._server_role = lp__server_role,
+       ._security = lp__security,
+       ._domain_master = lp__domain_master,
+       ._domain_logons = lp__domain_logons,
 
        .winbind_separator = lp_winbind_separator,
        .template_homedir = lp_template_homedir,