diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-28 01:17:46 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:07:25 -0500 |
commit | 37d53832a4623653f706e77985a79d84bd7c6694 (patch) | |
tree | 265e308027d6641bbdb29a4feddbe86ef8b25fd1 | |
parent | e09226cb35d627affddc08c4a88527184b8ffcf9 (diff) | |
download | samba-37d53832a4623653f706e77985a79d84bd7c6694.tar.gz samba-37d53832a4623653f706e77985a79d84bd7c6694.tar.bz2 samba-37d53832a4623653f706e77985a79d84bd7c6694.zip |
r25398: Parse loadparm context to all lp_*() functions.
(This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238)
164 files changed, 644 insertions, 618 deletions
diff --git a/source4/auth/auth.c b/source4/auth/auth.c index 1ad5332b28..04aa5f5c91 100644 --- a/source4/auth/auth.c +++ b/source4/auth/auth.c @@ -417,7 +417,7 @@ NTSTATUS auth_context_create(TALLOC_CTX *mem_ctx, struct auth_context **auth_ctx) { const char **auth_methods = NULL; - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: auth_methods = lp_parm_string_list(NULL, "auth methods", "standalone", NULL); break; diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c index e9b24d5f60..be8225f0dc 100644 --- a/source4/auth/auth_sam.c +++ b/source4/auth/auth_sam.c @@ -151,7 +151,7 @@ static NTSTATUS authsam_password_ok(struct auth_context *auth_context, NTSTATUS status; if (acct_flags & ACB_PWNOTREQ) { - if (lp_null_passwords()) { + if (lp_null_passwords(global_loadparm)) { DEBUG(3,("Account for user '%s' has no password and null passwords are allowed.\n", user_info->mapped.account_name)); return NT_STATUS_OK; @@ -349,10 +349,10 @@ static NTSTATUS authsam_want_check(struct auth_method_context *ctx, } is_local_name = is_myname(user_info->mapped.domain_name); - is_my_domain = strequal(user_info->mapped.domain_name, lp_workgroup()); + is_my_domain = strequal(user_info->mapped.domain_name, lp_workgroup(global_loadparm)); /* check whether or not we service this domain/workgroup name */ - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: return NT_STATUS_OK; @@ -388,14 +388,14 @@ static NTSTATUS authsam_check_password(struct auth_method_context *ctx, const char *domain; /* check whether or not we service this domain/workgroup name */ - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: case ROLE_DOMAIN_MEMBER: - domain = lp_netbios_name(); + domain = lp_netbios_name(global_loadparm); break; case ROLE_DOMAIN_CONTROLLER: - domain = lp_workgroup(); + domain = lp_workgroup(global_loadparm); break; default: diff --git a/source4/auth/auth_unix.c b/source4/auth/auth_unix.c index dd000e9445..bc2fddee06 100644 --- a/source4/auth/auth_unix.c +++ b/source4/auth/auth_unix.c @@ -319,7 +319,7 @@ static NTSTATUS smb_pam_auth(pam_handle_t *pamh, const char *user) DEBUG(4,("smb_pam_auth: PAM: Authenticate User: %s\n", user)); - pam_error = pam_authenticate(pamh, PAM_SILENT | lp_null_passwords() ? 0 : PAM_DISALLOW_NULL_AUTHTOK); + pam_error = pam_authenticate(pamh, PAM_SILENT | lp_null_passwords(global_loadparm) ? 0 : PAM_DISALLOW_NULL_AUTHTOK); switch( pam_error ){ case PAM_AUTH_ERR: DEBUG(2, ("smb_pam_auth: PAM: Authentication Error for user %s\n", user)); diff --git a/source4/auth/auth_util.c b/source4/auth/auth_util.c index 6597c79b84..69de01aefd 100644 --- a/source4/auth/auth_util.c +++ b/source4/auth/auth_util.c @@ -73,7 +73,7 @@ NTSTATUS map_user_info(TALLOC_CTX *mem_ctx, d++; domain = d; } else { - domain = lp_workgroup(); + domain = lp_workgroup(global_loadparm); } *user_info_mapped = talloc(mem_ctx, struct auth_usersupplied_info); @@ -138,8 +138,8 @@ NTSTATUS map_user_info(TALLOC_CTX *mem_ctx, } chall_blob = data_blob_talloc(mem_ctx, challenge, 8); - if (lp_client_ntlmv2_auth()) { - DATA_BLOB names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(), lp_workgroup()); + if (lp_client_ntlmv2_auth(global_loadparm)) { + DATA_BLOB names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm)); DATA_BLOB lmv2_response, ntlmv2_response, lmv2_session_key, ntlmv2_session_key; if (!SMBNTLMv2encrypt_hash(user_info_temp, @@ -163,7 +163,7 @@ NTSTATUS map_user_info(TALLOC_CTX *mem_ctx, SMBOWFencrypt(user_info_in->password.hash.nt->hash, challenge, blob.data); user_info_temp->password.response.nt = blob; - if (lp_client_lanman_auth() && user_info_in->password.hash.lanman) { + if (lp_client_lanman_auth(global_loadparm) && user_info_in->password.hash.lanman) { DATA_BLOB lm_blob = data_blob_talloc(mem_ctx, NULL, 24); SMBOWFencrypt(user_info_in->password.hash.lanman->hash, challenge, blob.data); user_info_temp->password.response.lanman = lm_blob; @@ -413,7 +413,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx, struct auth_serversuppl server_info->home_drive = talloc_strdup(server_info, ""); NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive); - server_info->logon_server = talloc_strdup(server_info, lp_netbios_name()); + server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm)); NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server); server_info->last_logon = 0; @@ -483,7 +483,7 @@ NTSTATUS auth_system_server_info(TALLOC_CTX *mem_ctx, struct auth_serversupplied server_info->home_drive = talloc_strdup(server_info, ""); NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive); - server_info->logon_server = talloc_strdup(server_info, lp_netbios_name()); + server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm)); NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server); server_info->last_logon = 0; @@ -562,7 +562,7 @@ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(session_info->credentials); + cli_credentials_set_conf(session_info->credentials, global_loadparm); cli_credentials_set_anonymous(session_info->credentials); *_session_info = session_info; @@ -608,7 +608,7 @@ static NTSTATUS _auth_system_session_info(TALLOC_CTX *parent_ctx, return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(session_info->credentials); + cli_credentials_set_conf(session_info->credentials, global_loadparm); if (anonymous_credentials) { cli_credentials_set_anonymous(session_info->credentials); diff --git a/source4/auth/credentials/credentials.c b/source4/auth/credentials/credentials.c index 2899bc5605..e88e05cfb0 100644 --- a/source4/auth/credentials/credentials.c +++ b/source4/auth/credentials/credentials.c @@ -82,7 +82,7 @@ struct cli_credentials *cli_credentials_init_anon(TALLOC_CTX *mem_ctx) struct cli_credentials *anon_credentials; anon_credentials = cli_credentials_init(mem_ctx); - cli_credentials_set_conf(anon_credentials); + cli_credentials_set_conf(anon_credentials, global_loadparm); cli_credentials_set_anonymous(anon_credentials); return anon_credentials; @@ -621,12 +621,13 @@ const char *cli_credentials_get_unparsed_name(struct cli_credentials *credential * * @param cred Credentials structure to fill in */ -void cli_credentials_set_conf(struct cli_credentials *cred) +void cli_credentials_set_conf(struct cli_credentials *cred, + struct loadparm_context *lp_ctx) { cli_credentials_set_username(cred, "", CRED_UNINITIALISED); - cli_credentials_set_domain(cred, lp_workgroup(), CRED_UNINITIALISED); - cli_credentials_set_workstation(cred, lp_netbios_name(), CRED_UNINITIALISED); - cli_credentials_set_realm(cred, lp_realm(), CRED_UNINITIALISED); + cli_credentials_set_domain(cred, lp_workgroup(lp_ctx), CRED_UNINITIALISED); + cli_credentials_set_workstation(cred, lp_netbios_name(lp_ctx), CRED_UNINITIALISED); + cli_credentials_set_realm(cred, lp_realm(lp_ctx), CRED_UNINITIALISED); } /** @@ -639,7 +640,7 @@ void cli_credentials_guess(struct cli_credentials *cred) { char *p; - cli_credentials_set_conf(cred); + cli_credentials_set_conf(cred, global_loadparm); if (getenv("LOGNAME")) { cli_credentials_set_username(cred, getenv("LOGNAME"), CRED_GUESS_ENV); @@ -657,7 +658,8 @@ void cli_credentials_guess(struct cli_credentials *cred) } if (getenv("PASSWD_FD")) { - cli_credentials_parse_password_fd(cred, atoi(getenv("PASSWD_FD")), CRED_GUESS_FILE); + cli_credentials_parse_password_fd(cred, atoi(getenv("PASSWD_FD")), + CRED_GUESS_FILE); } p = getenv("PASSWD_FILE"); diff --git a/source4/auth/credentials/credentials.h b/source4/auth/credentials/credentials.h index 0fd9ce46be..7ea37e40d1 100644 --- a/source4/auth/credentials/credentials.h +++ b/source4/auth/credentials/credentials.h @@ -127,6 +127,7 @@ struct cli_credentials { }; struct ldb_context; +struct loadparm_context; #include "auth/credentials/credentials_proto.h" #endif /* __CREDENTIALS_H__ */ diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index 8a7e8090eb..69e87cf555 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -213,10 +213,10 @@ static NTSTATUS gensec_gssapi_start(struct gensec_security *gensec_security) talloc_free(gensec_gssapi_state); return NT_STATUS_INTERNAL_ERROR; } - if (lp_realm() && *lp_realm()) { - char *upper_realm = strupper_talloc(gensec_gssapi_state, lp_realm()); + if (lp_realm(global_loadparm) && *lp_realm(global_loadparm)) { + char *upper_realm = strupper_talloc(gensec_gssapi_state, lp_realm(global_loadparm)); if (!upper_realm) { - DEBUG(1,("gensec_krb5_start: could not uppercase realm: %s\n", lp_realm())); + DEBUG(1,("gensec_krb5_start: could not uppercase realm: %s\n", lp_realm(global_loadparm))); talloc_free(gensec_gssapi_state); return NT_STATUS_NO_MEMORY; } @@ -332,7 +332,7 @@ static NTSTATUS gensec_gssapi_client_start(struct gensec_security *gensec_securi gensec_gssapi_state->gss_oid = gss_mech_krb5; principal = gensec_get_target_principal(gensec_security); - if (principal && lp_client_use_spnego_principal()) { + if (principal && lp_client_use_spnego_principal(global_loadparm)) { name_type = GSS_C_NULL_OID; } else { principal = talloc_asprintf(gensec_gssapi_state, "%s@%s", @@ -1359,7 +1359,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi } cli_credentials_set_event_context(session_info->credentials, gensec_security->event_ctx); - cli_credentials_set_conf(session_info->credentials); + cli_credentials_set_conf(session_info->credentials, global_loadparm); /* Just so we don't segfault trying to get at a username */ cli_credentials_set_anonymous(session_info->credentials); diff --git a/source4/auth/gensec/gensec_krb5.c b/source4/auth/gensec/gensec_krb5.c index c0348441ed..66a463eef4 100644 --- a/source4/auth/gensec/gensec_krb5.c +++ b/source4/auth/gensec/gensec_krb5.c @@ -261,7 +261,7 @@ static NTSTATUS gensec_krb5_client_start(struct gensec_security *gensec_security } in_data.length = 0; - if (principal && lp_client_use_spnego_principal()) { + if (principal && lp_client_use_spnego_principal(global_loadparm)) { krb5_principal target_principal; ret = krb5_parse_name(gensec_krb5_state->smb_krb5_context->krb5_context, principal, &target_principal); diff --git a/source4/auth/kerberos/krb5_init_context.c b/source4/auth/kerberos/krb5_init_context.c index 06a80e44e4..6b3cf8cb37 100644 --- a/source4/auth/kerberos/krb5_init_context.c +++ b/source4/auth/kerberos/krb5_init_context.c @@ -418,10 +418,10 @@ krb5_error_code smb_krb5_init_context(void *parent_ctx, return ret; } - if (lp_realm() && *lp_realm()) { - char *upper_realm = strupper_talloc(tmp_ctx, lp_realm()); + if (lp_realm(global_loadparm) && *lp_realm(global_loadparm)) { + char *upper_realm = strupper_talloc(tmp_ctx, lp_realm(global_loadparm)); if (!upper_realm) { - DEBUG(1,("gensec_krb5_start: could not uppercase realm: %s\n", lp_realm())); + DEBUG(1,("gensec_krb5_start: could not uppercase realm: %s\n", lp_realm(global_loadparm))); talloc_free(tmp_ctx); return ENOMEM; } diff --git a/source4/auth/ntlm_check.c b/source4/auth/ntlm_check.c index d3dbc3ce66..51488ec882 100644 --- a/source4/auth/ntlm_check.c +++ b/source4/auth/ntlm_check.c @@ -240,7 +240,7 @@ NTSTATUS hash_password_check(TALLOC_CTX *mem_ctx, } } else if (client_lanman && stored_lanman) { - if (!lp_lanman_auth()) { + if (!lp_lanman_auth(global_loadparm)) { DEBUG(3,("ntlm_password_check: Interactive logon: only LANMAN password supplied for user %s, and LM passwords are disabled!\n", username)); return NT_STATUS_WRONG_PASSWORD; @@ -392,7 +392,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, DEBUG(3,("ntlm_password_check: NTLMv2 password check failed\n")); } } else if (nt_response->length == 24 && stored_nt) { - if (lp_ntlm_auth()) { + if (lp_ntlm_auth(global_loadparm)) { /* We have the NT MD4 hash challenge available - see if we can use it (ie. does it exist in the smbpasswd file). */ @@ -404,7 +404,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, /* The LM session key for this response is not very secure, so use it only if we otherwise allow LM authentication */ - if (lp_lanman_auth() && stored_lanman) { + if (lp_lanman_auth(global_loadparm) && stored_lanman) { *lm_sess_key = data_blob_talloc(mem_ctx, stored_lanman->hash, 8); } return NT_STATUS_OK; @@ -432,7 +432,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, return NT_STATUS_WRONG_PASSWORD; } - if (!lp_lanman_auth()) { + if (!lp_lanman_auth(global_loadparm)) { DEBUG(3,("ntlm_password_check: Lanman passwords NOT PERMITTED for user %s\n", username)); } else if (!stored_lanman) { @@ -451,7 +451,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, It not very secure, so use it only if we otherwise allow LM authentication */ - if (lp_lanman_auth() && stored_lanman) { + if (lp_lanman_auth(global_loadparm) && stored_lanman) { uint8_t first_8_lm_hash[16]; memcpy(first_8_lm_hash, stored_lanman->hash, 8); memset(first_8_lm_hash + 8, '\0', 8); @@ -567,7 +567,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, - I think this is related to Win9X pass-though authentication */ DEBUG(4,("ntlm_password_check: Checking NT MD4 password in LM field\n")); - if (lp_ntlm_auth()) { + if (lp_ntlm_auth(global_loadparm)) { if (smb_pwd_check_ntlmv1(mem_ctx, lm_response, stored_nt->hash, challenge, @@ -576,7 +576,7 @@ NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, It not very secure, so use it only if we otherwise allow LM authentication */ - if (lp_lanman_auth() && stored_lanman) { + if (lp_lanman_auth(global_loadparm) && stored_lanman) { uint8_t first_8_lm_hash[16]; memcpy(first_8_lm_hash, stored_lanman->hash, 8); memset(first_8_lm_hash + 8, '\0', 8); diff --git a/source4/auth/ntlmssp/ntlmssp.h b/source4/auth/ntlmssp/ntlmssp.h index 282fcbc510..e39e2d9407 100644 --- a/source4/auth/ntlmssp/ntlmssp.h +++ b/source4/auth/ntlmssp/ntlmssp.h @@ -93,7 +93,7 @@ struct gensec_ntlmssp_state style 'challenge caching' */ char *user; - char *domain; + const char *domain; const char *workstation; char *server_domain; @@ -156,7 +156,6 @@ struct gensec_ntlmssp_state DATA_BLOB *nt_session_key, DATA_BLOB *lm_session_key); const char *server_name; - const char *(*get_domain)(void); bool doing_ntlm2; diff --git a/source4/auth/ntlmssp/ntlmssp_client.c b/source4/auth/ntlmssp/ntlmssp_client.c index d2f28a394c..f988facb60 100644 --- a/source4/auth/ntlmssp/ntlmssp_client.c +++ b/source4/auth/ntlmssp/ntlmssp_client.c @@ -66,7 +66,7 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security, "NTLMSSP", NTLMSSP_NEGOTIATE, gensec_ntlmssp_state->neg_flags, - gensec_ntlmssp_state->get_domain(), + gensec_ntlmssp_state->domain, cli_credentials_get_workstation(gensec_security->credentials)); gensec_ntlmssp_state->expected_state = NTLMSSP_CHALLENGE; @@ -181,7 +181,7 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, if (gensec_ntlmssp_state->use_nt_response) { flags |= CLI_CRED_NTLM_AUTH; } - if (lp_client_lanman_auth()) { + if (lp_client_lanman_auth(global_loadparm)) { flags |= CLI_CRED_LANMAN_AUTH; } @@ -206,7 +206,7 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security, } if ((gensec_ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_LM_KEY) - && lp_client_lanman_auth() && lm_session_key.length == 16) { + && lp_client_lanman_auth(global_loadparm) && lm_session_key.length == 16) { DATA_BLOB new_session_key = data_blob_talloc(mem_ctx, NULL, 16); if (lm_response.length == 24) { SMBsesskeygen_lm_sess_key(lm_session_key.data, lm_response.data, @@ -297,17 +297,17 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security) gensec_ntlmssp_state->role = NTLMSSP_CLIENT; - gensec_ntlmssp_state->get_domain = lp_workgroup; + gensec_ntlmssp_state->domain = lp_workgroup(global_loadparm); gensec_ntlmssp_state->unicode = lp_parm_bool(NULL, "ntlmssp_client", "unicode", true); gensec_ntlmssp_state->use_nt_response = lp_parm_bool(NULL, "ntlmssp_client", "send_nt_reponse", true); - gensec_ntlmssp_state->allow_lm_key = (lp_client_lanman_auth() + gensec_ntlmssp_state->allow_lm_key = (lp_client_lanman_auth(global_loadparm) && (lp_parm_bool(NULL, "ntlmssp_client", "allow_lm_key", false) || lp_parm_bool(NULL, "ntlmssp_client", "lm_key", false))); - gensec_ntlmssp_state->use_ntlmv2 = lp_client_ntlmv2_auth(); + gensec_ntlmssp_state->use_ntlmv2 = lp_client_ntlmv2_auth(global_loadparm); gensec_ntlmssp_state->expected_state = NTLMSSP_INITIAL; diff --git a/source4/auth/ntlmssp/ntlmssp_server.c b/source4/auth/ntlmssp/ntlmssp_server.c index 954c9ea2ac..dcef5035cb 100644 --- a/source4/auth/ntlmssp/ntlmssp_server.c +++ b/source4/auth/ntlmssp/ntlmssp_server.c @@ -98,7 +98,7 @@ static const char *ntlmssp_target_name(struct gensec_ntlmssp_state *gensec_ntlms return gensec_ntlmssp_state->server_name; } else { *chal_flags |= NTLMSSP_TARGET_TYPE_DOMAIN; - return gensec_ntlmssp_state->get_domain(); + return gensec_ntlmssp_state->domain; }; } else { return ""; @@ -744,13 +744,13 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security) gensec_ntlmssp_state->role = NTLMSSP_SERVER; gensec_ntlmssp_state->workstation = NULL; - gensec_ntlmssp_state->server_name = lp_netbios_name(); + gensec_ntlmssp_state->server_name = lp_netbios_name(global_loadparm); - gensec_ntlmssp_state->get_domain = lp_workgroup; + gensec_ntlmssp_state->domain = lp_workgroup(global_loadparm); gensec_ntlmssp_state->expected_state = NTLMSSP_NEGOTIATE; - gensec_ntlmssp_state->allow_lm_key = (lp_lanman_auth() + gensec_ntlmssp_state->allow_lm_key = (lp_lanman_auth(global_loadparm) && lp_parm_bool(NULL, "ntlmssp_server", "allow_lm_key", false)); gensec_ntlmssp_state->server_multiple_authentications = False; @@ -799,7 +799,7 @@ NTSTATUS gensec_ntlmssp_server_start(struct gensec_security *gensec_security) gensec_ntlmssp_state->may_set_challenge = auth_ntlmssp_may_set_challenge; gensec_ntlmssp_state->set_challenge = auth_ntlmssp_set_challenge; gensec_ntlmssp_state->check_password = auth_ntlmssp_check_password; - gensec_ntlmssp_state->server_role = lp_server_role(); + gensec_ntlmssp_state->server_role = lp_server_role(global_loadparm); return NT_STATUS_OK; } diff --git a/source4/auth/sam.c b/source4/auth/sam.c index ed01c0bd93..ec019b3fe6 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -344,7 +344,7 @@ _PUBLIC_ NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, struct ldb_conte server_info->home_drive = talloc_strdup(server_info, str); NT_STATUS_HAVE_NO_MEMORY(server_info->home_drive); - server_info->logon_server = talloc_strdup(server_info, lp_netbios_name()); + server_info->logon_server = talloc_strdup(server_info, lp_netbios_name(global_loadparm)); NT_STATUS_HAVE_NO_MEMORY(server_info->logon_server); server_info->last_logon = samdb_result_nttime(msg, "lastLogon", 0); diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index fbf6f786db..466444ace8 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -95,7 +95,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr NT_STATUS_HAVE_NO_MEMORY(cldapsock); socket_address = socket_address_from_strings(cldapsock, cldapsock->sock->backend_name, - address, lp_cldap_port()); + address, lp_cldap_port(global_loadparm)); if (!socket_address) { talloc_free(cldapsock); return NT_STATUS_NO_MEMORY; @@ -104,7 +104,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr status = socket_listen(cldapsock->sock, socket_address, 0, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to bind to %s:%d - %s\n", - address, lp_cldap_port(), nt_errstr(status))); + address, lp_cldap_port(global_loadparm), nt_errstr(status))); talloc_free(cldapsock); return status; } @@ -128,7 +128,7 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd) /* if we are allowing incoming packets from any address, then we need to bind to the wildcard address */ - if (!lp_bind_interfaces_only()) { + if (!lp_bind_interfaces_only(global_loadparm)) { status = cldapd_add_socket(cldapd, "0.0.0.0"); NT_STATUS_NOT_OK_RETURN(status); } else { diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 5eef4de4cd..6b398a4144 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -51,7 +51,7 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, const char *dom_attrs[] = {"objectGUID", NULL}; struct ldb_message **ref_res, **dom_res; int ret, count = 0; - const char **services = lp_server_services(); + const char **services = lp_server_services(global_loadparm); uint32_t server_type; const char *pdc_name; struct GUID domain_uuid; @@ -136,15 +136,17 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, server_type |= NBT_SERVER_KDC; } - pdc_name = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name()); + pdc_name = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name(global_loadparm)); domain_uuid = samdb_result_guid(dom_res[0], "objectGUID"); - realm = samdb_result_string(ref_res[0], "dnsRoot", lp_realm()); - dns_domain = samdb_result_string(ref_res[0], "dnsRoot", lp_realm()); + realm = samdb_result_string(ref_res[0], "dnsRoot", lp_realm(global_loadparm)); + dns_domain = samdb_result_string(ref_res[0], "dnsRoot", lp_realm(global_loadparm)); pdc_dns_name = talloc_asprintf(mem_ctx, "%s.%s", - strlower_talloc(mem_ctx, lp_netbios_name()), + strlower_talloc(mem_ctx, + lp_netbios_name(global_loadparm)), dns_domain); - flatname = samdb_result_string(ref_res[0], "nETBIOSName", lp_workgroup()); + flatname = samdb_result_string(ref_res[0], "nETBIOSName", + lp_workgroup(global_loadparm)); server_site = "Default-First-Site-Name"; client_site = "Default-First-Site-Name"; pdc_ip = iface_best_ip(src_address); @@ -188,7 +190,7 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, netlogon->logon5.dns_domain = dns_domain; netlogon->logon5.pdc_dns_name = pdc_dns_name; netlogon->logon5.domain = flatname; - netlogon->logon5.pdc_name = lp_netbios_name(); + netlogon->logon5.pdc_name = lp_netbios_name(global_loadparm); netlogon->logon5.user_name = user; netlogon->logon5.server_site = server_site; netlogon->logon5.client_site = client_site; @@ -203,7 +205,7 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, netlogon->logon13.dns_domain = dns_domain; netlogon->logon13.pdc_dns_name = pdc_dns_name; netlogon->logon13.domain = flatname; - netlogon->logon13.pdc_name = lp_netbios_name(); + netlogon->logon13.pdc_name = lp_netbios_name(global_loadparm); netlogon->logon13.user_name = user; netlogon->logon13.server_site = server_site; netlogon->logon13.client_site = client_site; @@ -287,7 +289,7 @@ void cldapd_netlogon_request(struct cldap_socket *cldap, } if (domain_guid == NULL && domain == NULL) { - domain = lp_realm(); + domain = lp_realm(global_loadparm); } if (version == -1) { diff --git a/source4/client/cifsdd.c b/source4/client/cifsdd.c index cb42e992ce..b4407a7902 100644 --- a/source4/client/cifsdd.c +++ b/source4/client/cifsdd.c @@ -429,7 +429,7 @@ static int copy_files(void) set_max_xmit(MAX(ibs, obs)); DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n", - (unsigned long long)iomax, lp_max_xmit())); + (unsigned long long)iomax, lp_max_xmit(global_loadparm))); if (!(ifile = open_file("if"))) { return(FILESYS_EXIT_CODE); @@ -443,7 +443,7 @@ static int copy_files(void) ifile->io_seek(ifile, check_arg_numeric("skip") * ibs); ofile->io_seek(ofile, check_arg_numeric("seek") * obs); - DEBUG(4, ("max xmit was negotiated to be %d\n", lp_max_xmit())); + DEBUG(4, ("max xmit was negotiated to be %d\n", lp_max_xmit(global_loadparm))); for (data_size = 0;;) { diff --git a/source4/client/client.c b/source4/client/client.c index f63315a05b..60030a1d27 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -3072,7 +3072,7 @@ static int do_message_op(const char *desthost, const char *destip, int name_type const char *server_name; struct smbcli_state *cli; - make_nbt_name_client(&calling, lp_netbios_name()); + make_nbt_name_client(&calling, lp_netbios_name(global_loadparm)); nbt_choose_called_name(NULL, &called, desthost, name_type); @@ -3219,7 +3219,7 @@ static int do_message_op(const char *desthost, const char *destip, int name_type } if (query_host) { - return do_host_query(query_host, lp_workgroup()); + return do_host_query(query_host, lp_workgroup(global_loadparm)); } if (message) { diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c index 7bd42b84cf..9d505be4a6 100644 --- a/source4/client/smbmount.c +++ b/source4/client/smbmount.c @@ -893,7 +893,7 @@ static void parse_mount_smb(int argc, char **argv) pstrcpy(username,getenv("LOGNAME")); } - if (!lp_load()) { + if (!lp_load(dyn_CONFIGFILE)) { fprintf(stderr, "Can't load %s - run testparm to debug it\n", lp_config_file()); } diff --git a/source4/client/smbspool.c b/source4/client/smbspool.c index 45407b1acc..7270942037 100644 --- a/source4/client/smbspool.c +++ b/source4/client/smbspool.c @@ -176,7 +176,7 @@ static int smb_print(struct smbcli_state *, char *, FILE *); setup_logging(argv[0], DEBUG_STDOUT); - if (!lp_load()) { + if (!lp_load(dyn_CONFIGFILE)) { fprintf(stderr, "ERROR: Can't load %s - run testparm to debug it\n", lp_config_file()); return (1); } diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 2896050ddc..f4ee5445f9 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -118,7 +118,7 @@ static void dreplsrv_task_init(struct task_server *task) struct dreplsrv_service *service; uint32_t periodic_startup_interval; - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: task_server_terminate(task, "dreplsrv: no DSDB replication required in standalone configuration"); return; diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c index 8fb1a0a25f..27b50a453a 100644 --- a/source4/dsdb/samdb/ldb_modules/update_keytab.c +++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c @@ -32,6 +32,7 @@ #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" #include "system/kerberos.h" +#include "param/param.h" struct dn_list { struct cli_credentials *creds; @@ -88,7 +89,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, BOOL delet return LDB_ERR_OPERATIONS_ERROR; } - cli_credentials_set_conf(item->creds); + cli_credentials_set_conf(item->creds, global_loadparm); status = cli_credentials_set_secrets(item->creds, module->ldb, NULL, filter); talloc_free(filter); if (NT_STATUS_IS_OK(status)) { diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 01c311b1dc..38be2825ea 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -45,7 +45,7 @@ struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx, struct auth_session_info *session_info) { struct ldb_context *ldb; - ldb = ldb_wrap_connect(mem_ctx, lp_sam_url(), session_info, + ldb = ldb_wrap_connect(mem_ctx, lp_sam_url(global_loadparm), session_info, NULL, 0, NULL); if (!ldb) { return NULL; diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c index b3d5ccdb5e..04540e3ef1 100644 --- a/source4/kdc/kdc.c +++ b/source4/kdc/kdc.c @@ -526,8 +526,8 @@ static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc) for (i=0; i<num_interfaces; i++) { const char *address = talloc_strdup(tmp_ctx, iface_n_ip(i)); - status = kdc_add_socket(kdc, address, lp_krb5_port(), - lp_kpasswd_port()); + status = kdc_add_socket(kdc, address, lp_krb5_port(global_loadparm), + lp_kpasswd_port(global_loadparm)); NT_STATUS_NOT_OK_RETURN(status); } @@ -555,7 +555,7 @@ static void kdc_task_init(struct task_server *task) NTSTATUS status; krb5_error_code ret; - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: task_server_terminate(task, "kdc: no KDC required in standalone configuration"); return; diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index 7c26675713..b4608c5983 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -38,6 +38,7 @@ #include "rpc_server/dcerpc_server.h" #include "rpc_server/samr/proto.h" #include "libcli/security/security.h" +#include "param/param.h" /* hold information about one kdc socket */ struct kpasswd_socket { @@ -472,7 +473,7 @@ BOOL kpasswdd_process(struct kdc_server *kdc, /* We want the credentials subsystem to use the krb5 context * we already have, rather than a new context */ cli_credentials_set_krb5_context(server_credentials, kdc->smb_krb5_context); - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); nt_status = cli_credentials_set_stored_principal(server_credentials, "kadmin/changepw"); if (!NT_STATUS_IS_OK(nt_status)) { ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx, diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 5afcf8cd12..e81c5bf445 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -55,7 +55,7 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin */ NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) { - conn->ldb = ldb_wrap_connect(conn, lp_sam_url(), conn->session_info, + conn->ldb = ldb_wrap_connect(conn, lp_sam_url(global_loadparm), conn->session_info, NULL, conn->global_catalog ? LDB_FLG_RDONLY : 0, NULL); if (conn->ldb == NULL) { return NT_STATUS_INTERNAL_DB_CORRUPTION; diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index f2ffc401cb..8522c59de4 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -396,7 +396,7 @@ static void ldapsrv_accept(struct stream_connection *c) return; } - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(status)) { stream_terminate_connection(c, talloc_asprintf(conn, "Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status))); @@ -513,7 +513,7 @@ static void ldapsrv_task_init(struct task_server *task) NTSTATUS status; const struct model_ops *model_ops; - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: task_server_terminate(task, "ldap_server: no LDAP server required in standalone configuration"); return; @@ -537,7 +537,7 @@ static void ldapsrv_task_init(struct task_server *task) ldap_service->tls_params = tls_initialise(ldap_service); if (ldap_service->tls_params == NULL) goto failed; - if (lp_interfaces() && lp_bind_interfaces_only()) { + if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) { int num_interfaces = iface_count(); int i; @@ -552,7 +552,7 @@ static void ldapsrv_task_init(struct task_server *task) } } else { status = add_socket(task->event_ctx, model_ops, - lp_socket_address(), ldap_service); + lp_socket_address(global_loadparm), ldap_service); if (!NT_STATUS_IS_OK(status)) goto failed; } diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index 6e0573e7ef..41eb70094e 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -23,6 +23,7 @@ #include "version.h" #include "lib/cmdline/popt_common.h" #include "param/param.h" +#include "dynconfig.h" /* Handle command line options: * -d,--debuglevel @@ -40,8 +41,6 @@ enum {OPT_OPTION=1,OPT_LEAK_REPORT,OPT_LEAK_REPORT_FULL,OPT_DEBUG_STDERR}; struct cli_credentials *cmdline_credentials = NULL; -static bool PrintSambaVersionString; - static void popt_common_callback(poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, @@ -50,12 +49,12 @@ static void popt_common_callback(poptContext con, const char *pname; if (reason == POPT_CALLBACK_REASON_POST) { - if (PrintSambaVersionString) { - printf( "Version %s\n", SAMBA_VERSION_STRING ); - exit(0); + if (!lp_loaded()) { + if (getenv("SMB_CONF_PATH")) + lp_load(getenv("SMB_CONF_PATH")); + else + lp_load(dyn_CONFIGFILE); } - - lp_load(); /* Hook any 'every Samba program must do this, after * the smb.conf is setup' functions here */ return; @@ -77,9 +76,6 @@ static void popt_common_callback(poptContext con, /* and logging */ setup_logging(pname, DEBUG_STDOUT); - if (getenv("SMB_CONF_PATH")) { - lp_set_cmdline(global_loadparm, "config file", getenv("SMB_CONF_PATH")); - } return; } @@ -93,8 +89,8 @@ static void popt_common_callback(poptContext con, break; case 'V': - PrintSambaVersionString = true; - break; + printf("Version %s\n", SAMBA_VERSION_STRING ); + exit(0); case 'O': if (arg) { @@ -104,7 +100,7 @@ static void popt_common_callback(poptContext con, case 's': if (arg) { - lp_set_cmdline(global_loadparm, "config file", arg); + lp_load(arg); } break; diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c index 92e4758f44..82521f2e7e 100644 --- a/source4/lib/db_wrap.c +++ b/source4/lib/db_wrap.c @@ -121,7 +121,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, } ldb_set_modules_dir(ldb, - talloc_asprintf(ldb, "%s/ldb", lp_modulesdir())); + talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(global_loadparm))); /* we want to use the existing event context if possible. This relies on the fact that in smbd, everything is a child of @@ -143,7 +143,7 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, return NULL; } - if (strcmp(lp_sam_url(), url) == 0) { + if (strcmp(lp_sam_url(global_loadparm), url) == 0) { dsdb_set_global_schema(ldb); } diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index dfb69abb33..48eb043306 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -35,7 +35,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx, struct hive_key *hive; const char *location; - location = talloc_asprintf(ctx, "%s/%s.ldb", lp_private_dir(), name); + location = talloc_asprintf(ctx, "%s/%s.ldb", lp_private_dir(global_loadparm), name); error = reg_open_hive(ctx, location, auth_info, creds, &hive); diff --git a/source4/lib/socket/connect.c b/source4/lib/socket/connect.c index fe8bc5cf13..eca2067df1 100644 --- a/source4/lib/socket/connect.c +++ b/source4/lib/socket/connect.c @@ -127,7 +127,7 @@ struct composite_context *socket_connect_send(struct socket_context *sock, struct composite_context *creq; make_nbt_name_client(&name, server_address->addr); creq = resolve_name_send(&name, result->event_ctx, - lp_name_resolve_order()); + lp_name_resolve_order(global_loadparm)); if (composite_nomem(creq, result)) return result; composite_continue(result, creq, continue_resolve_name, result); return result; diff --git a/source4/lib/socket/connect_multi.c b/source4/lib/socket/connect_multi.c index 445a1da782..6d30141459 100644 --- a/source4/lib/socket/connect_multi.c +++ b/source4/lib/socket/connect_multi.c @@ -104,7 +104,7 @@ _PUBLIC_ struct composite_context *socket_connect_multi_send( struct composite_context *creq; make_nbt_name_client(&name, server_address); creq = resolve_name_send(&name, result->event_ctx, - lp_name_resolve_order()); + lp_name_resolve_order(global_loadparm)); if (composite_nomem(creq, result)) goto failed; composite_continue(result, creq, continue_resolve_name, result); return result; diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c index 992476fe22..a30e4b8af7 100644 --- a/source4/lib/socket/interface.c +++ b/source4/lib/socket/interface.c @@ -200,7 +200,7 @@ static void load_interfaces(void) return; } - ptr = lp_interfaces(); + ptr = lp_interfaces(global_loadparm); loopback_ip = interpret_addr2("127.0.0.1"); /* probe the kernel for interfaces */ diff --git a/source4/lib/tls/tls.c b/source4/lib/tls/tls.c index 71b120dc3c..8be818433d 100644 --- a/source4/lib/tls/tls.c +++ b/source4/lib/tls/tls.c @@ -357,11 +357,11 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx) struct tls_params *params; int ret; TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); - const char *keyfile = private_path(tmp_ctx, lp_tls_keyfile()); - const char *certfile = private_path(tmp_ctx, lp_tls_certfile()); - const char *cafile = private_path(tmp_ctx, lp_tls_cafile()); - const char *crlfile = private_path(tmp_ctx, lp_tls_crlfile()); - const char *dhpfile = private_path(tmp_ctx, lp_tls_dhpfile()); + const char *keyfile = private_path(tmp_ctx, lp_tls_keyfile(global_loadparm)); + const char *certfile = private_path(tmp_ctx, lp_tls_certfile(global_loadparm)); + const char *cafile = private_path(tmp_ctx, lp_tls_cafile(global_loadparm)); + const char *crlfile = private_path(tmp_ctx, lp_tls_crlfile(global_loadparm)); + const char *dhpfile = private_path(tmp_ctx, lp_tls_dhpfile(global_loadparm)); void tls_cert_generate(TALLOC_CTX *, const char *, const char *, const char *); params = talloc(mem_ctx, struct tls_params); @@ -370,7 +370,7 @@ struct tls_params *tls_initialise(TALLOC_CTX *mem_ctx) return NULL; } - if (!lp_tls_enabled() || keyfile == NULL || *keyfile == 0) { + if (!lp_tls_enabled(global_loadparm) || keyfile == NULL || *keyfile == 0) { params->tls_enabled = False; talloc_free(tmp_ctx); return params; @@ -565,7 +565,7 @@ struct socket_context *tls_init_client(struct socket_context *socket, } new_sock->private_data = tls; - cafile = private_path(tls, lp_tls_cafile()); + cafile = private_path(tls, lp_tls_cafile(global_loadparm)); if (!cafile || !*cafile) { goto failed; } diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c index 9381e80934..8ef511ed79 100644 --- a/source4/libcli/cldap/cldap.c +++ b/source4/libcli/cldap/cldap.c @@ -317,7 +317,7 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap, req->dest = socket_address_from_strings(req, cldap->sock->backend_name, io->in.dest_address, - lp_cldap_port()); + lp_cldap_port(global_loadparm)); if (!req->dest) goto failed; req->message_id = idr_get_new_random(cldap->idr, req, UINT16_MAX); diff --git a/source4/libcli/cliconnect.c b/source4/libcli/cliconnect.c index a91157cf5d..715eb875fe 100644 --- a/source4/libcli/cliconnect.c +++ b/source4/libcli/cliconnect.c @@ -57,7 +57,7 @@ BOOL smbcli_transport_establish(struct smbcli_state *cli, /* wrapper around smb_raw_negotiate() */ NTSTATUS smbcli_negprot(struct smbcli_state *cli) { - return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol()); + return smb_raw_negotiate(cli->transport, lp_cli_maxprotocol(global_loadparm)); } /* wrapper around smb_raw_sesssetup() */ @@ -73,7 +73,7 @@ NTSTATUS smbcli_session_setup(struct smbcli_state *cli, setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; setup.in.credentials = credentials; - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); status = smb_composite_sesssetup(cli->session, &setup); diff --git a/source4/libcli/dgram/browse.c b/source4/libcli/dgram/browse.c index 78bd4319ee..fc1162e644 100644 --- a/source4/libcli/dgram/browse.c +++ b/source4/libcli/dgram/browse.c @@ -70,7 +70,7 @@ NTSTATUS dgram_mailslot_browse_reply(struct nbt_dgram_socket *dgmsock, return status; } - make_nbt_name_client(&myname, lp_netbios_name()); + make_nbt_name_client(&myname, lp_netbios_name(global_loadparm)); dest = socket_address_from_strings(tmp_ctx, dgmsock->sock->backend_name, request->src_addr, request->src_port); diff --git a/source4/libcli/dgram/mailslot.c b/source4/libcli/dgram/mailslot.c index 7a325ebe38..4e94e5ee5b 100644 --- a/source4/libcli/dgram/mailslot.c +++ b/source4/libcli/dgram/mailslot.c @@ -165,7 +165,7 @@ NTSTATUS dgram_mailslot_send(struct nbt_dgram_socket *dgmsock, if (_dest->port == 0) { dest = socket_address_from_strings(tmp_ctx, _dest->family, - _dest->addr, lp_dgram_port()); + _dest->addr, lp_dgram_port(global_loadparm)); } else { dest = _dest; } diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 79acf609f6..46f6e50e7b 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -77,7 +77,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, return status; } - make_nbt_name_client(&myname, lp_netbios_name()); + make_nbt_name_client(&myname, lp_netbios_name(global_loadparm)); dest = socket_address_from_strings(tmp_ctx, dgmsock->sock->backend_name, request->src_addr, request->src_port); diff --git a/source4/libcli/dgram/ntlogon.c b/source4/libcli/dgram/ntlogon.c index 6b9b17485d..25f767688a 100644 --- a/source4/libcli/dgram/ntlogon.c +++ b/source4/libcli/dgram/ntlogon.c @@ -78,7 +78,7 @@ NTSTATUS dgram_mailslot_ntlogon_reply(struct nbt_dgram_socket *dgmsock, return status; } - make_nbt_name_client(&myname, lp_netbios_name()); + make_nbt_name_client(&myname, lp_netbios_name(global_loadparm)); dest = socket_address_from_strings(tmp_ctx, dgmsock->sock->backend_name, diff --git a/source4/libcli/finddcs.c b/source4/libcli/finddcs.c index edd9a92693..2ac1358197 100644 --- a/source4/libcli/finddcs.c +++ b/source4/libcli/finddcs.c @@ -145,9 +145,9 @@ static void finddcs_name_resolved(struct composite_context *ctx) state->r.in.domainname = state->domain_name; state->r.in.ip_address = state->dcs[0].address; - state->r.in.my_computername = lp_netbios_name(); + state->r.in.my_computername = lp_netbios_name(global_loadparm); state->r.in.my_accountname = talloc_asprintf(state, "%s$", - lp_netbios_name()); + lp_netbios_name(global_loadparm)); if (composite_nomem(state->r.in.my_accountname, state->ctx)) return; state->r.in.account_control = ACB_WSTRUST; state->r.in.domain_sid = state->domain_sid; diff --git a/source4/libcli/nbt/namequery.c b/source4/libcli/nbt/namequery.c index ab26a7b2d2..a55d743efb 100644 --- a/source4/libcli/nbt/namequery.c +++ b/source4/libcli/nbt/namequery.c @@ -54,7 +54,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nb packet->questions[0].question_class = NBT_QCLASS_IP; dest = socket_address_from_strings(packet, nbtsock->sock->backend_name, - io->in.dest_addr, lp_nbt_port()); + io->in.dest_addr, lp_nbt_port(global_loadparm)); if (dest == NULL) goto failed; req = nbt_name_request_send(nbtsock, dest, packet, io->in.timeout, io->in.retries, False); @@ -158,7 +158,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *n packet->questions[0].question_class = NBT_QCLASS_IP; dest = socket_address_from_strings(packet, nbtsock->sock->backend_name, - io->in.dest_addr, lp_nbt_port()); + io->in.dest_addr, lp_nbt_port(global_loadparm)); if (dest == NULL) goto failed; req = nbt_name_request_send(nbtsock, dest, packet, io->in.timeout, io->in.retries, False); diff --git a/source4/libcli/nbt/namerefresh.c b/source4/libcli/nbt/namerefresh.c index d68cdb5365..3114cb2b10 100644 --- a/source4/libcli/nbt/namerefresh.c +++ b/source4/libcli/nbt/namerefresh.c @@ -69,7 +69,7 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock, dest = socket_address_from_strings(nbtsock, nbtsock->sock->backend_name, - io->in.dest_addr, lp_nbt_port()); + io->in.dest_addr, lp_nbt_port(global_loadparm)); if (dest == NULL) goto failed; req = nbt_name_request_send(nbtsock, dest, packet, io->in.timeout, io->in.retries, False); diff --git a/source4/libcli/nbt/nameregister.c b/source4/libcli/nbt/nameregister.c index 62c4a19b29..b8fe362694 100644 --- a/source4/libcli/nbt/nameregister.c +++ b/source4/libcli/nbt/nameregister.c @@ -77,7 +77,7 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock, if (packet->additional[0].rdata.netbios.addresses[0].ipaddr == NULL) goto failed; dest = socket_address_from_strings(packet, nbtsock->sock->backend_name, - io->in.dest_addr, lp_nbt_port()); + io->in.dest_addr, lp_nbt_port(global_loadparm)); if (dest == NULL) goto failed; req = nbt_name_request_send(nbtsock, dest, packet, io->in.timeout, io->in.retries, False); diff --git a/source4/libcli/nbt/namerelease.c b/source4/libcli/nbt/namerelease.c index efc31b1501..a72a5c706f 100644 --- a/source4/libcli/nbt/namerelease.c +++ b/source4/libcli/nbt/namerelease.c @@ -67,7 +67,7 @@ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *nbtsock, talloc_strdup(packet->additional, io->in.address); dest = socket_address_from_strings(packet, nbtsock->sock->backend_name, - io->in.dest_addr, lp_nbt_port()); + io->in.dest_addr, lp_nbt_port(global_loadparm)); if (dest == NULL) goto failed; req = nbt_name_request_send(nbtsock, dest, packet, io->in.timeout, io->in.retries, False); diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 51f631eb67..a748b40a32 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -73,7 +73,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx, if (state->host_name == NULL) goto failed; if (port == 0) { - const char **ports = lp_smb_ports(); + const char **ports = lp_smb_ports(global_loadparm); int i; for (i=0;ports[i];i++) /* noop */ ; @@ -120,7 +120,7 @@ static void smbcli_sock_connect_recv_conn(struct composite_context *ctx) if (!composite_is_ok(state->ctx)) return; state->ctx->status = - socket_set_option(sock, lp_socket_options(), NULL); + socket_set_option(sock, lp_socket_options(global_loadparm), NULL); if (!composite_is_ok(state->ctx)) return; diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 90f51b2969..6b2c4c37fe 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -85,9 +85,10 @@ struct smbcli_transport *smbcli_transport_init(struct smbcli_socket *sock, transport->socket = talloc_reference(transport, sock); } transport->negotiate.protocol = PROTOCOL_NT1; - transport->options.use_spnego = lp_use_spnego() && lp_nt_status_support(); - transport->options.max_xmit = lp_max_xmit(); - transport->options.max_mux = lp_maxmux(); + transport->options.use_spnego = lp_use_spnego(global_loadparm) && + lp_nt_status_support(global_loadparm); + transport->options.max_xmit = lp_max_xmit(global_loadparm); + transport->options.max_mux = lp_maxmux(global_loadparm); transport->options.request_timeout = SMB_REQUEST_TIMEOUT; transport->negotiate.max_xmit = transport->options.max_xmit; diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index 6a15c25eb9..4ff11f3a69 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -190,7 +190,7 @@ NTSTATUS smbcli_tree_full_connection(TALLOC_CTX *parent_ctx, io.in.service_type = service_type; io.in.credentials = credentials; io.in.fallback_to_anonymous = False; - io.in.workgroup = lp_workgroup(); + io.in.workgroup = lp_workgroup(global_loadparm); status = smb_composite_connect(&io, parent_ctx, ev); if (NT_STATUS_IS_OK(status)) { diff --git a/source4/libcli/raw/rawnegotiate.c b/source4/libcli/raw/rawnegotiate.c index eff22ee8bc..c58ac1f0df 100644 --- a/source4/libcli/raw/rawnegotiate.c +++ b/source4/libcli/raw/rawnegotiate.c @@ -58,7 +58,7 @@ struct smbcli_request *smb_raw_negotiate_send(struct smbcli_transport *transport } flags2 |= FLAGS2_32_BIT_ERROR_CODES; - if (lp_unicode()) { + if (lp_unicode(global_loadparm)) { flags2 |= FLAGS2_UNICODE_STRINGS; } flags2 |= FLAGS2_EXTENDED_ATTRIBUTES; @@ -174,11 +174,11 @@ NTSTATUS smb_raw_negotiate_recv(struct smbcli_request *req) } /* a way to force ascii SMB */ - if (!lp_unicode()) { + if (!lp_unicode(global_loadparm)) { transport->negotiate.capabilities &= ~CAP_UNICODE; } - if (!lp_nt_status_support()) { + if (!lp_nt_status_support(global_loadparm)) { transport->negotiate.capabilities &= ~CAP_STATUS32; } diff --git a/source4/libcli/raw/smb_signing.c b/source4/libcli/raw/smb_signing.c index 1a82ea0536..59c13bbeb6 100644 --- a/source4/libcli/raw/smb_signing.c +++ b/source4/libcli/raw/smb_signing.c @@ -383,7 +383,7 @@ bool smbcli_init_signing(struct smbcli_transport *transport) return False; } - switch (lp_client_signing()) { + switch (lp_client_signing(global_loadparm)) { case SMB_SIGNING_OFF: transport->negotiate.sign_info.allow_smb_signing = False; break; diff --git a/source4/libcli/resolve/resolve.c b/source4/libcli/resolve/resolve.c index 9315c0f354..02e1fbdc04 100644 --- a/source4/libcli/resolve/resolve.c +++ b/source4/libcli/resolve/resolve.c @@ -190,7 +190,7 @@ NTSTATUS resolve_name(struct nbt_name *name, TALLOC_CTX *mem_ctx, const char **r struct event_context *ev) { struct composite_context *c = resolve_name_send(name, ev, - lp_name_resolve_order()); + lp_name_resolve_order(global_loadparm)); return resolve_name_recv(c, mem_ctx, reply_addr); } diff --git a/source4/libcli/resolve/wins.c b/source4/libcli/resolve/wins.c index 8c88950f53..05a2d4da31 100644 --- a/source4/libcli/resolve/wins.c +++ b/source4/libcli/resolve/wins.c @@ -32,7 +32,7 @@ struct composite_context *resolve_name_wins_send( struct event_context *event_ctx, struct nbt_name *name) { - const char **address_list = lp_wins_server_list(); + const char **address_list = lp_wins_server_list(global_loadparm); if (address_list == NULL) return NULL; return resolve_name_nbtlist_send(mem_ctx, event_ctx, name, address_list, False, True); } diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index 0edf64c5df..6a2e9d09e9 100644 --- a/source4/libcli/smb2/connect.c +++ b/source4/libcli/smb2/connect.c @@ -187,7 +187,7 @@ struct composite_context *smb2_connect_send(TALLOC_CTX *mem_ctx, ZERO_STRUCT(name); name.name = host; - creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order()); + creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order(global_loadparm)); composite_continue(c, creq, continue_resolve, c); return c; } diff --git a/source4/libcli/smb_composite/connect.c b/source4/libcli/smb_composite/connect.c index 27b16ecc41..22b2cdb0e2 100644 --- a/source4/libcli/smb_composite/connect.c +++ b/source4/libcli/smb_composite/connect.c @@ -63,7 +63,7 @@ static NTSTATUS connect_send_negprot(struct composite_context *c, { struct connect_state *state = talloc_get_type(c->private_data, struct connect_state); - state->req = smb_raw_negotiate_send(state->transport, lp_cli_maxprotocol()); + state->req = smb_raw_negotiate_send(state->transport, lp_cli_maxprotocol(global_loadparm)); NT_STATUS_HAVE_NO_MEMORY(state->req); state->req->async.fn = request_handler; @@ -172,7 +172,7 @@ static NTSTATUS connect_session_setup(struct composite_context *c, state->io_setup->in.credentials = cli_credentials_init(state); NT_STATUS_HAVE_NO_MEMORY(state->io_setup->in.credentials); - cli_credentials_set_conf(state->io_setup->in.credentials); + cli_credentials_set_conf(state->io_setup->in.credentials, global_loadparm); cli_credentials_set_anonymous(state->io_setup->in.credentials); /* If the preceding attempt was with extended security, we @@ -459,7 +459,7 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec state->stage = CONNECT_RESOLVE; make_nbt_name_server(&name, io->in.dest_host); - state->creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order()); + state->creq = resolve_name_send(&name, c->event_ctx, lp_name_resolve_order(global_loadparm)); if (state->creq == NULL) goto failed; state->creq->async.private_data = c; diff --git a/source4/libcli/smb_composite/sesssetup.c b/source4/libcli/smb_composite/sesssetup.c index 6a14e57ad0..6f9e6b0de3 100644 --- a/source4/libcli/smb_composite/sesssetup.c +++ b/source4/libcli/smb_composite/sesssetup.c @@ -223,14 +223,14 @@ static NTSTATUS session_setup_nt1(struct composite_context *c, NTSTATUS nt_status; struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state); const char *password = cli_credentials_get_password(io->in.credentials); - DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, lp_workgroup()); + DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, lp_workgroup(global_loadparm)); DATA_BLOB session_key; int flags = CLI_CRED_NTLM_AUTH; - if (lp_client_lanman_auth()) { + if (lp_client_lanman_auth(global_loadparm)) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth()) { + if (lp_client_ntlmv2_auth(global_loadparm)) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -263,7 +263,7 @@ static NTSTATUS session_setup_nt1(struct composite_context *c, set_user_session_key(session, &session_key); data_blob_free(&session_key); - } else if (lp_client_plaintext_auth()) { + } else if (lp_client_plaintext_auth(global_loadparm)) { state->setup.nt1.in.password1 = data_blob_talloc(state, password, strlen(password)); state->setup.nt1.in.password2 = data_blob(NULL, 0); } else { @@ -290,14 +290,14 @@ static NTSTATUS session_setup_old(struct composite_context *c, NTSTATUS nt_status; struct sesssetup_state *state = talloc_get_type(c->private_data, struct sesssetup_state); const char *password = cli_credentials_get_password(io->in.credentials); - DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, lp_workgroup()); + DATA_BLOB names_blob = NTLMv2_generate_names_blob(state, session->transport->socket->hostname, lp_workgroup(global_loadparm)); DATA_BLOB session_key; int flags = 0; - if (lp_client_lanman_auth()) { + if (lp_client_lanman_auth(global_loadparm)) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth()) { + if (lp_client_ntlmv2_auth(global_loadparm)) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -324,7 +324,7 @@ static NTSTATUS session_setup_old(struct composite_context *c, set_user_session_key(session, &session_key); data_blob_free(&session_key); - } else if (lp_client_plaintext_auth()) { + } else if (lp_client_plaintext_auth(global_loadparm)) { state->setup.old.in.password = data_blob_talloc(state, password, strlen(password)); } else { /* could match windows client and return 'cannot logon from this workstation', but it just confuses everybody */ diff --git a/source4/libcli/util/errormap.c b/source4/libcli/util/errormap.c index 347d513e9c..49384817b6 100644 --- a/source4/libcli/util/errormap.c +++ b/source4/libcli/util/errormap.c @@ -1168,7 +1168,7 @@ BOOL ntstatus_dos_equal(NTSTATUS status1, NTSTATUS status2) the mapping of dos codes, as we want to catch the cases where a forced dos code is needed */ - if (lp_nt_status_support()) { + if (lp_nt_status_support(global_loadparm)) { return NT_STATUS_V(status1) == NT_STATUS_V(status2); } diff --git a/source4/libnet/libnet.c b/source4/libnet/libnet.c index 1994b68df0..86804df1ea 100644 --- a/source4/libnet/libnet.c +++ b/source4/libnet/libnet.c @@ -43,7 +43,7 @@ struct libnet_context *libnet_context_init(struct event_context *ev) ctx->event_ctx = ev; /* name resolution methods */ - ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order()); + ctx->name_res_methods = str_list_copy(ctx, lp_name_resolve_order(global_loadparm)); /* connected services' params */ ZERO_STRUCT(ctx->samr); diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 9404bc874d..553bde615b 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -535,8 +535,8 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru connect_with_info->out.domain_name = talloc_strdup(tmp_ctx, r->in.domain_name); } else { /* Bugger, we just lost our way to automaticly find the domain name */ - connect_with_info->out.domain_name = talloc_strdup(tmp_ctx, lp_workgroup()); - connect_with_info->out.realm = talloc_strdup(tmp_ctx, lp_realm()); + connect_with_info->out.domain_name = talloc_strdup(tmp_ctx, lp_workgroup(global_loadparm)); + connect_with_info->out.realm = talloc_strdup(tmp_ctx, lp_realm(global_loadparm)); } } @@ -888,7 +888,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, if (r->in.netbios_name != NULL) { netbios_name = r->in.netbios_name; } else { - netbios_name = talloc_reference(tmp_mem, lp_netbios_name()); + netbios_name = talloc_reference(tmp_mem, lp_netbios_name(global_loadparm)); if (!netbios_name) { r->out.error_string = NULL; talloc_free(tmp_mem); diff --git a/source4/libnet/libnet_samdump_keytab.c b/source4/libnet/libnet_samdump_keytab.c index 0eae9de039..c235df6d25 100644 --- a/source4/libnet/libnet_samdump_keytab.c +++ b/source4/libnet/libnet_samdump_keytab.c @@ -25,6 +25,7 @@ #include "system/kerberos.h" #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" +#include "param/param.h" static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx, const char *keytab_name, @@ -44,7 +45,7 @@ static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx, if (!credentials) { return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(credentials); + cli_credentials_set_conf(credentials, global_loadparm); cli_credentials_set_username(credentials, username, CRED_SPECIFIED); /* We really should consult ldap in the main SamSync code, and diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index 1fa4aece19..9511989e8c 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -1217,7 +1217,7 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str state->secrets = NULL; state->trusted_domains = NULL; - state->sam_ldb = ldb_wrap_connect(mem_ctx, lp_sam_url(), + state->sam_ldb = ldb_wrap_connect(mem_ctx, lp_sam_url(global_loadparm), r->in.session_info, ctx->cred, 0, NULL); diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index e21976cb02..c6f85d5b5f 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -28,6 +28,7 @@ #include "auth/gensec/schannel_proto.h" #include "librpc/gen_ndr/ndr_netlogon.h" #include "librpc/gen_ndr/ndr_netlogon_c.h" +#include "param/param.h" /** @@ -184,7 +185,7 @@ NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx talloc_free(samsync_ctx); return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(machine_account); + cli_credentials_set_conf(machine_account, global_loadparm); nt_status = cli_credentials_set_machine_account(machine_account); if (!NT_STATUS_IS_OK(nt_status)) { r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain machine account password - are we joined to the domain?"); diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c index edd86b8df4..2d6237634d 100644 --- a/source4/librpc/rpc/dcerpc_connect.c +++ b/source4/librpc/rpc/dcerpc_connect.c @@ -117,7 +117,7 @@ static struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CT conn->in.called_name = s->io.binding->target_hostname; conn->in.service = "IPC$"; conn->in.service_type = NULL; - conn->in.workgroup = lp_workgroup(); + conn->in.workgroup = lp_workgroup(global_loadparm); /* * provide proper credentials - user supplied, but allow a diff --git a/source4/librpc/rpc/dcerpc_sock.c b/source4/librpc/rpc/dcerpc_sock.c index e9c0c96be6..f7ae377e7b 100644 --- a/source4/librpc/rpc/dcerpc_sock.c +++ b/source4/librpc/rpc/dcerpc_sock.c @@ -479,7 +479,7 @@ struct composite_context* dcerpc_pipe_open_tcp_send(struct dcerpc_connection *co make_nbt_name_server(&name, server); resolve_req = resolve_name_send(&name, c->event_ctx, - lp_name_resolve_order()); + lp_name_resolve_order(global_loadparm)); composite_continue(c, resolve_req, continue_ip_resolve_name, c); return c; } @@ -619,7 +619,7 @@ struct composite_context* dcerpc_pipe_open_pipe_send(struct dcerpc_connection *c s->conn = conn; string_replace(canon, '/', '\\'); - s->full_path = talloc_asprintf(canon, "%s/%s", lp_ncalrpc_dir(), canon); + s->full_path = talloc_asprintf(canon, "%s/%s", lp_ncalrpc_dir(global_loadparm), canon); if (composite_nomem(s->full_path, c)) return c; /* prepare server address using path and transport name */ diff --git a/source4/librpc/rpc/dcerpc_util.c b/source4/librpc/rpc/dcerpc_util.c index dffba4aedf..408860c9ed 100644 --- a/source4/librpc/rpc/dcerpc_util.c +++ b/source4/librpc/rpc/dcerpc_util.c @@ -930,7 +930,7 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx, /* anonymous credentials for rpc connection used to get endpoint mapping */ anon_creds = cli_credentials_init(mem_ctx); cli_credentials_set_event_context(anon_creds, ev); - cli_credentials_set_conf(anon_creds); + cli_credentials_set_conf(anon_creds, global_loadparm); cli_credentials_set_anonymous(anon_creds); /* @@ -1363,7 +1363,7 @@ void dcerpc_log_packet(const struct ndr_interface_table *ndr, for (i=0;i<num_examples;i++) { char *name=NULL; asprintf(&name, "%s/rpclog/%s-%u.%d.%s", - lp_lockdir(), ndr->name, opnum, i, + lp_lockdir(global_loadparm), ndr->name, opnum, i, (flags&NDR_IN)?"in":"out"); if (name == NULL) { return; diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index eb06abd74a..ba32bb123e 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -75,7 +75,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot, reply.command = NETLOGON_RESPONSE_FROM_PDC; pdc = &reply.req.response; - pdc->pdc_name = lp_netbios_name(); + pdc->pdc_name = lp_netbios_name(global_loadparm); pdc->unicode_pdc_name = pdc->pdc_name; pdc->domain_name = samdb_result_string(ref_res[0], "nETBIOSName", name->name);; pdc->nt_version = 1; @@ -110,7 +110,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, const char *dom_attrs[] = {"objectGUID", NULL}; struct ldb_message **ref_res, **dom_res; int ret; - const char **services = lp_server_services(); + const char **services = lp_server_services(global_loadparm); const char *my_ip = reply_iface->ip_address; struct ldb_dn *partitions_basedn; if (!my_ip) { @@ -183,15 +183,18 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot, } pdc->domain_uuid = samdb_result_guid(dom_res[0], "objectGUID"); - pdc->forest = samdb_result_string(ref_res[0], "dnsRoot", lp_realm()); - pdc->dns_domain = samdb_result_string(ref_res[0], "dnsRoot", lp_realm()); + pdc->forest = samdb_result_string(ref_res[0], "dnsRoot", + lp_realm(global_loadparm)); + pdc->dns_domain = samdb_result_string(ref_res[0], "dnsRoot", + lp_realm(global_loadparm)); /* TODO: get our full DNS name from somewhere else */ pdc->pdc_dns_name = talloc_asprintf(packet, "%s.%s", - strlower_talloc(packet, lp_netbios_name()), + strlower_talloc(packet, + lp_netbios_name(global_loadparm)), pdc->dns_domain); pdc->domain = samdb_result_string(ref_res[0], "nETBIOSName", name->name);; - pdc->pdc_name = lp_netbios_name(); + pdc->pdc_name = lp_netbios_name(global_loadparm); pdc->user_name = netlogon->req.pdc2.user_name; /* TODO: we need to make sure these are in our DNS zone */ pdc->server_site = "Default-First-Site-Name"; diff --git a/source4/nbt_server/dgram/ntlogon.c b/source4/nbt_server/dgram/ntlogon.c index e24dffb4f4..9d80a44ce6 100644 --- a/source4/nbt_server/dgram/ntlogon.c +++ b/source4/nbt_server/dgram/ntlogon.c @@ -49,9 +49,10 @@ static void nbtd_ntlogon_sam_logon(struct dgram_mailslot_handler *dgmslot, reply.command = NTLOGON_SAM_LOGON_REPLY; logon = &reply.req.reply; - logon->server = talloc_asprintf(packet, "\\\\%s", lp_netbios_name()); + logon->server = talloc_asprintf(packet, "\\\\%s", + lp_netbios_name(global_loadparm)); logon->user_name = ntlogon->req.logon.user_name; - logon->domain = lp_workgroup(); + logon->domain = lp_workgroup(global_loadparm); logon->nt_version = 1; logon->lmnt_token = 0xFFFF; logon->lm20_token = 0xFFFF; diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index da15340305..48d6e4cb3a 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -80,7 +80,8 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, - iface->bcast_address, lp_dgram_port()); + iface->bcast_address, + lp_dgram_port(global_loadparm)); if (!bcast_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -90,7 +91,8 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - iface->bcast_address, lp_dgram_port(), nt_errstr(status))); + iface->bcast_address, lp_dgram_port(global_loadparm), + nt_errstr(status))); return status; } @@ -105,7 +107,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } bind_addr = socket_address_from_strings(tmp_ctx, iface->dgmsock->sock->backend_name, - bind_address, lp_dgram_port()); + bind_address, lp_dgram_port(global_loadparm)); if (!bind_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -115,7 +117,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - bind_address, lp_dgram_port(), nt_errstr(status))); + bind_address, lp_dgram_port(global_loadparm), nt_errstr(status))); return status; } diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c index 40fa605e11..27d733aeff 100644 --- a/source4/nbt_server/interfaces.c +++ b/source4/nbt_server/interfaces.c @@ -136,7 +136,7 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv, } bcast_address = socket_address_from_strings(bcast_nbtsock, bcast_nbtsock->sock->backend_name, - bcast, lp_nbt_port()); + bcast, lp_nbt_port(global_loadparm)); if (!bcast_address) { talloc_free(iface); return NT_STATUS_NO_MEMORY; @@ -145,7 +145,7 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv, status = socket_listen(bcast_nbtsock->sock, bcast_address, 0, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to bind to %s:%d - %s\n", - bcast, lp_nbt_port(), nt_errstr(status))); + bcast, lp_nbt_port(global_loadparm), nt_errstr(status))); talloc_free(iface); return status; } @@ -161,13 +161,14 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv, return NT_STATUS_NO_MEMORY; } - unicast_address = socket_address_from_strings(iface->nbtsock, iface->nbtsock->sock->backend_name, - bind_address, lp_nbt_port()); + unicast_address = socket_address_from_strings(iface->nbtsock, + iface->nbtsock->sock->backend_name, + bind_address, lp_nbt_port(global_loadparm)); status = socket_listen(iface->nbtsock->sock, unicast_address, 0, 0); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to bind to %s:%d - %s\n", - bind_address, lp_nbt_port(), nt_errstr(status))); + bind_address, lp_nbt_port(global_loadparm), nt_errstr(status))); talloc_free(iface); return status; } @@ -223,7 +224,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv) /* if we are allowing incoming packets from any address, then we also need to bind to the wildcard address */ - if (!lp_bind_interfaces_only()) { + if (!lp_bind_interfaces_only(global_loadparm)) { const char *primary_address; /* the primary address is the address we will return @@ -233,7 +234,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv) primary_address = iface_n_ip(0); } else { primary_address = sys_inet_ntoa(interpret_addr2( - lp_netbios_name())); + lp_netbios_name(global_loadparm))); } primary_address = talloc_strdup(tmp_ctx, primary_address); NT_STATUS_HAVE_NO_MEMORY(primary_address); @@ -261,7 +262,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv) NT_STATUS_NOT_OK_RETURN(status); } - if (lp_wins_server_list()) { + if (lp_wins_server_list(global_loadparm)) { status = nbtd_add_wins_socket(nbtsrv); NT_STATUS_NOT_OK_RETURN(status); } diff --git a/source4/nbt_server/packet.c b/source4/nbt_server/packet.c index 747b41076c..5a220d1546 100644 --- a/source4/nbt_server/packet.c +++ b/source4/nbt_server/packet.c @@ -78,7 +78,7 @@ BOOL nbtd_self_packet(struct nbt_name_socket *nbtsock, struct nbtd_server *nbtsrv = iface->nbtsrv; /* if its not from the nbt port, then it wasn't a broadcast from us */ - if (src->port != lp_nbt_port()) { + if (src->port != lp_nbt_port(global_loadparm)) { return False; } diff --git a/source4/nbt_server/query.c b/source4/nbt_server/query.c index 30b3c5f9ce..f57cb7bf76 100644 --- a/source4/nbt_server/query.c +++ b/source4/nbt_server/query.c @@ -81,7 +81,7 @@ void nbtd_request_query(struct nbt_name_socket *nbtsock, if (!(packet->operation & NBT_FLAG_BROADCAST) && (packet->operation & NBT_FLAG_RECURSION_DESIRED) && (iname->nb_flags & NBT_NM_GROUP) && - lp_wins_support()) { + lp_wins_support(global_loadparm)) { nbtd_winsserver_request(nbtsock, packet, src); return; } diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c index af067d071c..cb831f3443 100644 --- a/source4/nbt_server/register.c +++ b/source4/nbt_server/register.c @@ -170,7 +170,7 @@ static void nbtd_register_name_iface(struct nbtd_interface *iface, uint16_t nb_flags) { struct nbtd_iface_name *iname; - const char *scope = lp_netbios_scope(); + const char *scope = lp_netbios_scope(global_loadparm); struct nbt_name_register_bcast io; struct composite_context *creq; struct nbtd_server *nbtsrv = iface->nbtsrv; @@ -260,29 +260,29 @@ void nbtd_register_names(struct nbtd_server *nbtsrv) /* note that we don't initially mark the names "ACTIVE". They are marked active once registration is successful */ - nbtd_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_CLIENT, nb_flags); - nbtd_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_USER, nb_flags); - nbtd_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_SERVER, nb_flags); + nbtd_register_name(nbtsrv, lp_netbios_name(global_loadparm), NBT_NAME_CLIENT, nb_flags); + nbtd_register_name(nbtsrv, lp_netbios_name(global_loadparm), NBT_NAME_USER, nb_flags); + nbtd_register_name(nbtsrv, lp_netbios_name(global_loadparm), NBT_NAME_SERVER, nb_flags); - aliases = lp_netbios_aliases(); + aliases = lp_netbios_aliases(global_loadparm); while (aliases && aliases[0]) { nbtd_register_name(nbtsrv, aliases[0], NBT_NAME_CLIENT, nb_flags); nbtd_register_name(nbtsrv, aliases[0], NBT_NAME_SERVER, nb_flags); aliases++; } - if (lp_server_role() == ROLE_DOMAIN_CONTROLLER) { - BOOL is_pdc = samdb_is_pdc(nbtsrv->sam_ctx); + if (lp_server_role(global_loadparm) == ROLE_DOMAIN_CONTROLLER) { + bool is_pdc = samdb_is_pdc(nbtsrv->sam_ctx); if (is_pdc) { - nbtd_register_name(nbtsrv, lp_workgroup(), + nbtd_register_name(nbtsrv, lp_workgroup(global_loadparm), NBT_NAME_PDC, nb_flags); } - nbtd_register_name(nbtsrv, lp_workgroup(), + nbtd_register_name(nbtsrv, lp_workgroup(global_loadparm), NBT_NAME_LOGON, nb_flags | NBT_NM_GROUP); } nb_flags |= NBT_NM_GROUP; - nbtd_register_name(nbtsrv, lp_workgroup(), NBT_NAME_CLIENT, nb_flags); + nbtd_register_name(nbtsrv, lp_workgroup(global_loadparm), NBT_NAME_CLIENT, nb_flags); nb_flags |= NBT_NM_PERMANENT; nbtd_register_name(nbtsrv, "__SAMBA__", NBT_NAME_CLIENT, nb_flags); diff --git a/source4/nbt_server/wins/wins_hook.c b/source4/nbt_server/wins/wins_hook.c index 090621d890..768f9477f6 100644 --- a/source4/nbt_server/wins/wins_hook.c +++ b/source4/nbt_server/wins/wins_hook.c @@ -40,7 +40,7 @@ static const char *wins_hook_action_string(enum wins_hook_action action) void wins_hook(struct winsdb_handle *h, const struct winsdb_record *rec, enum wins_hook_action action) { - const char *script = lp_wins_hook(); + const char *script = lp_wins_hook(global_loadparm); uint32_t i, length; int child; char *cmd = NULL; diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index e18885c327..1dd934cc92 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -236,7 +236,7 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) /* setup a wins name register request */ io.in.name = iname->name; - io.in.wins_servers = lp_wins_server_list(); + io.in.wins_servers = lp_wins_server_list(global_loadparm); io.in.addresses = nbtd_address_list(iface, iname); io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 6b26ba2d63..f7d149126b 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -992,7 +992,7 @@ static BOOL winsdb_check_or_add_module_list(struct winsdb_handle *h) flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, lock_path(h, lp_wins_url()), + h->ldb = ldb_wrap_connect(h, lock_path(h, lp_wins_url(global_loadparm)), NULL, NULL, flags, NULL); if (!h->ldb) goto failed; @@ -1025,7 +1025,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, enum winsdb_handle_cal flags |= LDB_FLG_NOSYNC; } - h->ldb = ldb_wrap_connect(h, lock_path(h, lp_wins_url()), + h->ldb = ldb_wrap_connect(h, lock_path(h, lp_wins_url(global_loadparm)), NULL, NULL, flags, NULL); if (!h->ldb) goto failed; diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c index fd0188cbf0..698d432c75 100644 --- a/source4/nbt_server/wins/winsserver.c +++ b/source4/nbt_server/wins/winsserver.c @@ -706,7 +706,7 @@ static void nbtd_winsserver_query(struct nbt_name_socket *nbtsock, status = winsdb_lookup(winssrv->wins_db, name, packet, &rec); if (!NT_STATUS_IS_OK(status)) { - if (!lp_wins_dns_proxy()) { + if (!lp_wins_dns_proxy(global_loadparm)) { goto notfound; } @@ -957,7 +957,7 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv) { uint32_t tmp; - if (!lp_wins_support()) { + if (!lp_wins_support(global_loadparm)) { nbtsrv->winssrv = NULL; return NT_STATUS_OK; } @@ -965,8 +965,8 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv) nbtsrv->winssrv = talloc_zero(nbtsrv, struct wins_server); NT_STATUS_HAVE_NO_MEMORY(nbtsrv->winssrv); - nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl(); - nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl(); + nbtsrv->winssrv->config.max_renew_interval = lp_max_wins_ttl(global_loadparm); + nbtsrv->winssrv->config.min_renew_interval = lp_min_wins_ttl(global_loadparm); tmp = lp_parm_int(NULL, "wreplsrv", "tombstone_interval", 6*24*60*60); nbtsrv->winssrv->config.tombstone_interval = tmp; tmp = lp_parm_int(NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60); diff --git a/source4/nsswitch/wbinfo.c b/source4/nsswitch/wbinfo.c index b4d7b95b6d..cf4dceec6d 100644 --- a/source4/nsswitch/wbinfo.c +++ b/source4/nsswitch/wbinfo.c @@ -52,7 +52,7 @@ static char winbind_separator_int(BOOL strict) return 0; } /* HACK: (this module should not call lp_ funtions) */ - return *lp_winbind_separator(); + return *lp_winbind_separator(global_loadparm); } sep = response.data.info.winbind_separator; @@ -64,7 +64,7 @@ static char winbind_separator_int(BOOL strict) return 0; } /* HACK: (this module should not call lp_ funtions) */ - sep = *lp_winbind_separator(); + sep = *lp_winbind_separator(global_loadparm); } return sep; @@ -89,7 +89,7 @@ static const char *get_winbind_domain(void) d_fprintf(stderr, "could not obtain winbind domain name!\n"); /* HACK: (this module should not call lp_ funtions) */ - return lp_workgroup(); + return lp_workgroup(global_loadparm); } fstrcpy(winbind_domain, response.data.domain_name); @@ -819,7 +819,7 @@ static BOOL wbinfo_auth_crap(char *username) generate_random_buffer(request.data.auth_crap.chal, 8); - if (lp_client_ntlmv2_auth()) { + if (lp_client_ntlmv2_auth(global_loadparm)) { DATA_BLOB server_chal; DATA_BLOB names_blob; @@ -836,7 +836,7 @@ static BOOL wbinfo_auth_crap(char *username) server_chal = data_blob(request.data.auth_crap.chal, 8); /* Pretend this is a login to 'us', for blob purposes */ - names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(), lp_workgroup()); + names_blob = NTLMv2_generate_names_blob(mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm)); if (!SMBNTLMv2encrypt(mem_ctx, name_user, name_domain, pass, &server_chal, &names_blob, @@ -862,7 +862,7 @@ static BOOL wbinfo_auth_crap(char *username) data_blob_free(&lm_response); } else { - if (lp_client_lanman_auth() + if (lp_client_lanman_auth(global_loadparm) && SMBencrypt(pass, request.data.auth_crap.chal, (unsigned char *)request.data.auth_crap.lm_resp)) { request.data.auth_crap.lm_resp_len = 24; diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index f0edd47206..02808bfbc8 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -43,7 +43,7 @@ */ static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx) { - return ldb_wrap_connect(mem_ctx, lp_spoolss_url(), system_session(mem_ctx), + return ldb_wrap_connect(mem_ctx, lp_spoolss_url(global_loadparm), system_session(mem_ctx), NULL, 0, NULL); } @@ -203,12 +203,12 @@ static WERROR sptr_GetPrintServerData(struct ntptr_GenericHandle *server, TALLOC r->out.data.binary = blob; return WERR_OK; } else if (strcmp("DNSMachineName", r->in.value_name) == 0) { - if (!lp_realm()) return WERR_INVALID_PARAM; + if (!lp_realm(global_loadparm)) return WERR_INVALID_PARAM; r->out.type = SPOOLSS_PRINTER_DATA_TYPE_STRING; r->out.data.string = talloc_asprintf(mem_ctx, "%s.%s", - lp_netbios_name(), - lp_realm()); + lp_netbios_name(global_loadparm), + lp_realm(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(r->out.data.string); return WERR_OK; } diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c index d248bd7552..ed7065b3bd 100644 --- a/source4/ntvfs/cifs/vfs_cifs.c +++ b/source4/ntvfs/cifs/vfs_cifs.c @@ -166,7 +166,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, return NT_STATUS_NO_MEMORY; } cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx); - cli_credentials_set_conf(credentials); + cli_credentials_set_conf(credentials, global_loadparm); cli_credentials_set_username(credentials, user, CRED_SPECIFIED); if (domain) { cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); @@ -176,7 +176,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, DEBUG(5, ("CIFS backend: Using machine account\n")); credentials = cli_credentials_init(private); cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx); - cli_credentials_set_conf(credentials); + cli_credentials_set_conf(credentials, global_loadparm); if (domain) { cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); } @@ -198,7 +198,7 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs, io.in.called_name = host; io.in.credentials = credentials; io.in.fallback_to_anonymous = False; - io.in.workgroup = lp_workgroup(); + io.in.workgroup = lp_workgroup(global_loadparm); io.in.service = remote_share; io.in.service_type = "?????"; diff --git a/source4/ntvfs/print/vfs_print.c b/source4/ntvfs/print/vfs_print.c index 120f88373c..f9d3235116 100644 --- a/source4/ntvfs/print/vfs_print.c +++ b/source4/ntvfs/print/vfs_print.c @@ -83,7 +83,7 @@ static NTSTATUS print_ioctl(struct ntvfs_module_context *ntvfs, p = (char *)io->ioctl.out.blob.data; SSVAL(p,0, 1 /* REWRITE: fsp->rap_print_jobid */); - push_string(p+2, lp_netbios_name(), 15, STR_TERMINATE|STR_ASCII); + push_string(p+2, lp_netbios_name(global_loadparm), 15, STR_TERMINATE|STR_ASCII); push_string(p+18, ntvfs->ctx->config->name, 13, STR_TERMINATE|STR_ASCII); return NT_STATUS_OK; } diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 90abc4abcd..cd990ab088 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -66,8 +66,6 @@ static bool bLoaded = false; -struct loadparm_context *global_loadparm = NULL; - #define standard_sub_basic talloc_strdup static bool do_parameter(const char *, const char *, void *); @@ -87,7 +85,7 @@ struct loadparm_global { enum server_role server_role; - char **smb_ports; + const char **smb_ports; char *ncalrpc_dir; char *szLockDir; char *szModulesDir; @@ -96,7 +94,7 @@ struct loadparm_global char *szServerString; char *szAutoServices; char *szPasswdChat; - char *szConfigFile; + const char *szConfigFile; char *szShareBackend; char *szSAM_URL; char *szSECRETS_URL; @@ -104,23 +102,23 @@ struct loadparm_global char *szWINS_CONFIG_URL; char *szWINS_URL; char *szPrivateDir; - char **jsInclude; + const char **jsInclude; char *jsonrpcServicesDir; - char **szPasswordServers; + const char **szPasswordServers; char *szSocketOptions; char *szRealm; - char **szWINSservers; - char **szInterfaces; + const char **szWINSservers; + const char **szInterfaces; char *szSocketAddress; char *szAnnounceVersion; /* This is initialised in init_globals */ char *szWorkgroup; char *szNetbiosName; - char **szNetbiosAliases; + const char **szNetbiosAliases; char *szNetbiosScope; char *szDomainOtherSIDs; - char **szNameResolveOrder; - char **dcerpc_ep_servers; - char **server_services; + const char **szNameResolveOrder; + const char **dcerpc_ep_servers; + const char **server_services; char *ntptr_providor; char *szWinbindSeparator; char *szWinbinddSocketDirectory; @@ -277,13 +275,9 @@ static struct loadparm_context { char *subfname; time_t modtime; } *file_lists; -} loadparm = { - .iNumServices = 0, - .currentService = NULL, - .bInGlobalSection = true, - .ServicePtrs = NULL, - .file_lists = NULL, -}; +} loadparm; + +struct loadparm_context *global_loadparm = &loadparm; #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct)) @@ -386,6 +380,8 @@ static const struct enum_list enum_server_role[] = { static struct parm_struct parm_table[] = { {"Base Options", P_SEP, P_SEPARATOR}, + {"config file", P_STRING, P_GLOBAL, &loadparm.Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, + {"server role", P_ENUM, P_GLOBAL, &loadparm.Globals.server_role, NULL, enum_server_role, FLAG_BASIC}, {"dos charset", P_STRING, P_GLOBAL, &dos_charset, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, @@ -541,7 +537,6 @@ static struct parm_struct parm_table[] = { {"Miscellaneous Options", P_SEP, P_SEPARATOR}, - {"config file", P_STRING, P_GLOBAL, &loadparm.Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, {"share backend", P_STRING, P_GLOBAL, &loadparm.Globals.szShareBackend, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, {"preload", P_STRING, P_GLOBAL, &loadparm.Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, {"auto services", P_STRING, P_GLOBAL, &loadparm.Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED | FLAG_DEVELOPER}, @@ -648,20 +643,20 @@ static const char *lp_string(const char *s) parameters from the rest of the program are defined */ -#define FN_GLOBAL_STRING(fn_name,ptr) \ - const char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));} -#define FN_GLOBAL_CONST_STRING(fn_name,ptr) \ - const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");} -#define FN_GLOBAL_LIST(fn_name,ptr) \ - const char **fn_name(void) {return(*(const char ***)(ptr));} -#define FN_GLOBAL_BOOL(fn_name,ptr) \ - bool fn_name(void) {return((bool)*(int *)(ptr));} +#define FN_GLOBAL_STRING(fn_name,var_name) \ + const char *fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return NULL; return lp_ctx->Globals.var_name ? lp_string(lp_ctx->Globals.var_name) : "";} +#define FN_GLOBAL_CONST_STRING(fn_name,var_name) \ + const char *fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return NULL; return lp_ctx->Globals.var_name ? lp_ctx->Globals.var_name : "";} +#define FN_GLOBAL_LIST(fn_name,var_name) \ + const char **fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return NULL; return lp_ctx->Globals.var_name;} +#define FN_GLOBAL_BOOL(fn_name,var_name) \ + bool fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return false; return lp_ctx->Globals.var_name;} #if 0 /* unused */ #define FN_GLOBAL_CHAR(fn_name,ptr) \ char fn_name(void) {return(*(char *)(ptr));} #endif -#define FN_GLOBAL_INTEGER(fn_name,ptr) \ - int fn_name(void) {return(*(int *)(ptr));} +#define FN_GLOBAL_INTEGER(fn_name,var_name) \ + int fn_name(struct loadparm_context *lp_ctx) {if (lp_ctx == NULL) return 0; return lp_ctx->Globals.var_name;} #define FN_LOCAL_STRING(fn_name,val) \ const char *fn_name(struct loadparm_service *service) {return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault.val)));} @@ -674,98 +669,95 @@ static const char *lp_string(const char *s) #define FN_LOCAL_INTEGER(fn_name,val) \ int fn_name(struct loadparm_service *service) {return((service != NULL)? service->val : sDefault.val);} -_PUBLIC_ FN_GLOBAL_INTEGER(lp_server_role, &loadparm.Globals.server_role) -_PUBLIC_ FN_GLOBAL_LIST(lp_smb_ports, &loadparm.Globals.smb_ports) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_nbt_port, &loadparm.Globals.nbt_port) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_dgram_port, &loadparm.Globals.dgram_port) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_cldap_port, &loadparm.Globals.cldap_port) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_krb5_port, &loadparm.Globals.krb5_port) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_kpasswd_port, &loadparm.Globals.kpasswd_port) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_web_port, &loadparm.Globals.web_port) -_PUBLIC_ FN_GLOBAL_STRING(lp_dos_charset, &dos_charset) -_PUBLIC_ FN_GLOBAL_STRING(lp_swat_directory, &loadparm.Globals.swat_directory) -_PUBLIC_ FN_GLOBAL_BOOL(lp_tls_enabled, &loadparm.Globals.tls_enabled) -_PUBLIC_ FN_GLOBAL_STRING(lp_tls_keyfile, &loadparm.Globals.tls_keyfile) -_PUBLIC_ FN_GLOBAL_STRING(lp_tls_certfile, &loadparm.Globals.tls_certfile) -_PUBLIC_ FN_GLOBAL_STRING(lp_tls_cafile, &loadparm.Globals.tls_cafile) -_PUBLIC_ FN_GLOBAL_STRING(lp_tls_crlfile, &loadparm.Globals.tls_crlfile) -_PUBLIC_ FN_GLOBAL_STRING(lp_tls_dhpfile, &loadparm.Globals.tls_dhpfile) -_PUBLIC_ FN_GLOBAL_STRING(lp_unix_charset, &unix_charset) -_PUBLIC_ FN_GLOBAL_STRING(lp_display_charset, &display_charset) -_PUBLIC_ FN_GLOBAL_STRING(lp_configfile, &loadparm.Globals.szConfigFile) -_PUBLIC_ FN_GLOBAL_STRING(lp_share_backend, &loadparm.Globals.szShareBackend) -_PUBLIC_ FN_GLOBAL_STRING(lp_sam_url, &loadparm.Globals.szSAM_URL) -_PUBLIC_ FN_GLOBAL_STRING(lp_secrets_url, &loadparm.Globals.szSECRETS_URL) -_PUBLIC_ FN_GLOBAL_STRING(lp_spoolss_url, &loadparm.Globals.szSPOOLSS_URL) -_PUBLIC_ FN_GLOBAL_STRING(lp_wins_config_url, &loadparm.Globals.szWINS_CONFIG_URL) -_PUBLIC_ FN_GLOBAL_STRING(lp_wins_url, &loadparm.Globals.szWINS_URL) -_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_winbind_separator, &loadparm.Globals.szWinbindSeparator) -_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_winbindd_socket_directory, &loadparm.Globals.szWinbinddSocketDirectory) -_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_template_shell, &loadparm.Globals.szTemplateShell) -_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_template_homedir, &loadparm.Globals.szTemplateHomedir) -_PUBLIC_ FN_GLOBAL_BOOL(lp_winbind_sealed_pipes, &loadparm.Globals.bWinbindSealedPipes) -_PUBLIC_ FN_GLOBAL_STRING(lp_private_dir, &loadparm.Globals.szPrivateDir) -_PUBLIC_ FN_GLOBAL_STRING(lp_serverstring, &loadparm.Globals.szServerString) -_PUBLIC_ FN_GLOBAL_STRING(lp_lockdir, &loadparm.Globals.szLockDir) -_PUBLIC_ FN_GLOBAL_STRING(lp_modulesdir, &loadparm.Globals.szModulesDir) -_PUBLIC_ FN_GLOBAL_STRING(lp_setupdir, &loadparm.Globals.szSetupDir) -_PUBLIC_ FN_GLOBAL_STRING(lp_ncalrpc_dir, &loadparm.Globals.ncalrpc_dir) -_PUBLIC_ FN_GLOBAL_STRING(lp_piddir, &loadparm.Globals.szPidDir) -_PUBLIC_ FN_GLOBAL_LIST(lp_dcerpc_endpoint_servers, &loadparm.Globals.dcerpc_ep_servers) -_PUBLIC_ FN_GLOBAL_LIST(lp_server_services, &loadparm.Globals.server_services) -_PUBLIC_ FN_GLOBAL_STRING(lp_ntptr_providor, &loadparm.Globals.ntptr_providor) -_PUBLIC_ FN_GLOBAL_STRING(lp_auto_services, &loadparm.Globals.szAutoServices) -_PUBLIC_ FN_GLOBAL_STRING(lp_passwd_chat, &loadparm.Globals.szPasswdChat) -_PUBLIC_ FN_GLOBAL_LIST(lp_passwordserver, &loadparm.Globals.szPasswordServers) -_PUBLIC_ FN_GLOBAL_LIST(lp_name_resolve_order, &loadparm.Globals.szNameResolveOrder) -_PUBLIC_ FN_GLOBAL_STRING(lp_realm, &loadparm.Globals.szRealm) -_PUBLIC_ FN_GLOBAL_STRING(lp_socket_options, &loadparm.Globals.socket_options) -_PUBLIC_ FN_GLOBAL_STRING(lp_workgroup, &loadparm.Globals.szWorkgroup) -_PUBLIC_ FN_GLOBAL_STRING(lp_netbios_name, &loadparm.Globals.szNetbiosName) -_PUBLIC_ FN_GLOBAL_STRING(lp_netbios_scope, &loadparm.Globals.szNetbiosScope) -_PUBLIC_ FN_GLOBAL_LIST(lp_wins_server_list, &loadparm.Globals.szWINSservers) -_PUBLIC_ FN_GLOBAL_LIST(lp_interfaces, &loadparm.Globals.szInterfaces) -_PUBLIC_ FN_GLOBAL_STRING(lp_socket_address, &loadparm.Globals.szSocketAddress) -_PUBLIC_ FN_GLOBAL_LIST(lp_netbios_aliases, &loadparm.Globals.szNetbiosAliases) - -_PUBLIC_ FN_GLOBAL_BOOL(lp_disable_netbios, &loadparm.Globals.bDisableNetbios) -_PUBLIC_ FN_GLOBAL_BOOL(lp_wins_support, &loadparm.Globals.bWINSsupport) -_PUBLIC_ FN_GLOBAL_BOOL(lp_wins_dns_proxy, &loadparm.Globals.bWINSdnsProxy) -_PUBLIC_ FN_GLOBAL_STRING(lp_wins_hook, &loadparm.Globals.szWINSHook) -_PUBLIC_ FN_GLOBAL_BOOL(lp_local_master, &loadparm.Globals.bLocalMaster) -_PUBLIC_ FN_GLOBAL_BOOL(lp_readraw, &loadparm.Globals.bReadRaw) -_PUBLIC_ FN_GLOBAL_BOOL(lp_large_readwrite, &loadparm.Globals.bLargeReadwrite) -_PUBLIC_ FN_GLOBAL_BOOL(lp_writeraw, &loadparm.Globals.bWriteRaw) -_PUBLIC_ FN_GLOBAL_BOOL(lp_null_passwords, &loadparm.Globals.bNullPasswords) -_PUBLIC_ FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &loadparm.Globals.bObeyPamRestrictions) -_PUBLIC_ FN_GLOBAL_BOOL(lp_encrypted_passwords, &loadparm.Globals.bEncryptPasswords) -_PUBLIC_ FN_GLOBAL_BOOL(lp_time_server, &loadparm.Globals.bTimeServer) -_PUBLIC_ FN_GLOBAL_BOOL(lp_bind_interfaces_only, &loadparm.Globals.bBindInterfacesOnly) -_PUBLIC_ FN_GLOBAL_BOOL(lp_unicode, &loadparm.Globals.bUnicode) -_PUBLIC_ FN_GLOBAL_BOOL(lp_nt_status_support, &loadparm.Globals.bNTStatusSupport) -_PUBLIC_ FN_GLOBAL_BOOL(lp_lanman_auth, &loadparm.Globals.bLanmanAuth) -_PUBLIC_ FN_GLOBAL_BOOL(lp_ntlm_auth, &loadparm.Globals.bNTLMAuth) -_PUBLIC_ FN_GLOBAL_BOOL(lp_client_plaintext_auth, &loadparm.Globals.bClientPlaintextAuth) -_PUBLIC_ FN_GLOBAL_BOOL(lp_client_lanman_auth, &loadparm.Globals.bClientLanManAuth) -_PUBLIC_ FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &loadparm.Globals.bClientNTLMv2Auth) -_PUBLIC_ FN_GLOBAL_BOOL(lp_client_use_spnego_principal, &loadparm.Globals.client_use_spnego_principal) -_PUBLIC_ FN_GLOBAL_BOOL(lp_host_msdfs, &loadparm.Globals.bHostMSDfs) -_PUBLIC_ FN_GLOBAL_BOOL(lp_unix_extensions, &loadparm.Globals.bUnixExtensions) -_PUBLIC_ FN_GLOBAL_BOOL(lp_use_spnego, &loadparm.Globals.bUseSpnego) -_PUBLIC_ FN_GLOBAL_BOOL(lp_rpc_big_endian, &loadparm.Globals.bRpcBigEndian) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_max_wins_ttl, &loadparm.Globals.max_wins_ttl) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_min_wins_ttl, &loadparm.Globals.min_wins_ttl) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_maxmux, &loadparm.Globals.max_mux) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_max_xmit, &loadparm.Globals.max_xmit) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_passwordlevel, &loadparm.Globals.pwordlevel) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_srv_maxprotocol, &loadparm.Globals.srv_maxprotocol) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_srv_minprotocol, &loadparm.Globals.srv_minprotocol) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_cli_maxprotocol, &loadparm.Globals.cli_maxprotocol) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_cli_minprotocol, &loadparm.Globals.cli_minprotocol) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_security, &loadparm.Globals.security) -_PUBLIC_ FN_GLOBAL_BOOL(lp_paranoid_server_security, &loadparm.Globals.paranoid_server_security) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_announce_as, &loadparm.Globals.announce_as) -_PUBLIC_ FN_GLOBAL_LIST(lp_js_include, &loadparm.Globals.jsInclude) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_server_role, server_role) +_PUBLIC_ FN_GLOBAL_LIST(lp_smb_ports, smb_ports) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_nbt_port, nbt_port) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_dgram_port, dgram_port) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_cldap_port, cldap_port) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_krb5_port, krb5_port) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_kpasswd_port, kpasswd_port) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_web_port, web_port) +_PUBLIC_ FN_GLOBAL_STRING(lp_swat_directory, swat_directory) +_PUBLIC_ FN_GLOBAL_BOOL(lp_tls_enabled, tls_enabled) +_PUBLIC_ FN_GLOBAL_STRING(lp_tls_keyfile, tls_keyfile) +_PUBLIC_ FN_GLOBAL_STRING(lp_tls_certfile, tls_certfile) +_PUBLIC_ FN_GLOBAL_STRING(lp_tls_cafile, tls_cafile) +_PUBLIC_ FN_GLOBAL_STRING(lp_tls_crlfile, tls_crlfile) +_PUBLIC_ FN_GLOBAL_STRING(lp_tls_dhpfile, tls_dhpfile) +_PUBLIC_ FN_GLOBAL_STRING(lp_share_backend, szShareBackend) +_PUBLIC_ FN_GLOBAL_STRING(lp_sam_url, szSAM_URL) +_PUBLIC_ FN_GLOBAL_STRING(lp_secrets_url, szSECRETS_URL) +_PUBLIC_ FN_GLOBAL_STRING(lp_spoolss_url, szSPOOLSS_URL) +_PUBLIC_ FN_GLOBAL_STRING(lp_wins_config_url, szWINS_CONFIG_URL) +_PUBLIC_ FN_GLOBAL_STRING(lp_wins_url, szWINS_URL) +_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_winbind_separator, szWinbindSeparator) +_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_winbindd_socket_directory, szWinbinddSocketDirectory) +_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_template_shell, szTemplateShell) +_PUBLIC_ FN_GLOBAL_CONST_STRING(lp_template_homedir, szTemplateHomedir) +_PUBLIC_ FN_GLOBAL_BOOL(lp_winbind_sealed_pipes, bWinbindSealedPipes) +_PUBLIC_ FN_GLOBAL_STRING(lp_private_dir, szPrivateDir) +_PUBLIC_ FN_GLOBAL_STRING(lp_serverstring, szServerString) +_PUBLIC_ FN_GLOBAL_STRING(lp_lockdir, szLockDir) +_PUBLIC_ FN_GLOBAL_STRING(lp_modulesdir, szModulesDir) +_PUBLIC_ FN_GLOBAL_STRING(lp_setupdir, szSetupDir) +_PUBLIC_ FN_GLOBAL_STRING(lp_ncalrpc_dir, ncalrpc_dir) +_PUBLIC_ FN_GLOBAL_STRING(lp_piddir, szPidDir) +_PUBLIC_ FN_GLOBAL_LIST(lp_dcerpc_endpoint_servers, dcerpc_ep_servers) +_PUBLIC_ FN_GLOBAL_LIST(lp_server_services, server_services) +_PUBLIC_ FN_GLOBAL_STRING(lp_ntptr_providor, ntptr_providor) +_PUBLIC_ FN_GLOBAL_STRING(lp_auto_services, szAutoServices) +_PUBLIC_ FN_GLOBAL_STRING(lp_passwd_chat, szPasswdChat) +_PUBLIC_ FN_GLOBAL_LIST(lp_passwordserver, szPasswordServers) +_PUBLIC_ FN_GLOBAL_LIST(lp_name_resolve_order, szNameResolveOrder) +_PUBLIC_ FN_GLOBAL_STRING(lp_realm, szRealm) +_PUBLIC_ FN_GLOBAL_STRING(lp_socket_options, socket_options) +_PUBLIC_ FN_GLOBAL_STRING(lp_workgroup, szWorkgroup) +_PUBLIC_ FN_GLOBAL_STRING(lp_netbios_name, szNetbiosName) +_PUBLIC_ FN_GLOBAL_STRING(lp_netbios_scope, szNetbiosScope) +_PUBLIC_ FN_GLOBAL_LIST(lp_wins_server_list, szWINSservers) +_PUBLIC_ FN_GLOBAL_LIST(lp_interfaces, szInterfaces) +_PUBLIC_ FN_GLOBAL_STRING(lp_socket_address, szSocketAddress) +_PUBLIC_ FN_GLOBAL_LIST(lp_netbios_aliases, szNetbiosAliases) + +_PUBLIC_ FN_GLOBAL_BOOL(lp_disable_netbios, bDisableNetbios) +_PUBLIC_ FN_GLOBAL_BOOL(lp_wins_support, bWINSsupport) +_PUBLIC_ FN_GLOBAL_BOOL(lp_wins_dns_proxy, bWINSdnsProxy) +_PUBLIC_ FN_GLOBAL_STRING(lp_wins_hook, szWINSHook) +_PUBLIC_ FN_GLOBAL_STRING(lp_configfile, szConfigFile) +_PUBLIC_ FN_GLOBAL_BOOL(lp_local_master, bLocalMaster) +_PUBLIC_ FN_GLOBAL_BOOL(lp_readraw, bReadRaw) +_PUBLIC_ FN_GLOBAL_BOOL(lp_large_readwrite, bLargeReadwrite) +_PUBLIC_ FN_GLOBAL_BOOL(lp_writeraw, bWriteRaw) +_PUBLIC_ FN_GLOBAL_BOOL(lp_null_passwords, bNullPasswords) +_PUBLIC_ FN_GLOBAL_BOOL(lp_obey_pam_restrictions, bObeyPamRestrictions) +_PUBLIC_ FN_GLOBAL_BOOL(lp_encrypted_passwords, bEncryptPasswords) +_PUBLIC_ FN_GLOBAL_BOOL(lp_time_server, bTimeServer) +_PUBLIC_ FN_GLOBAL_BOOL(lp_bind_interfaces_only, bBindInterfacesOnly) +_PUBLIC_ FN_GLOBAL_BOOL(lp_unicode, bUnicode) +_PUBLIC_ FN_GLOBAL_BOOL(lp_nt_status_support, bNTStatusSupport) +_PUBLIC_ FN_GLOBAL_BOOL(lp_lanman_auth, bLanmanAuth) +_PUBLIC_ FN_GLOBAL_BOOL(lp_ntlm_auth, bNTLMAuth) +_PUBLIC_ FN_GLOBAL_BOOL(lp_client_plaintext_auth, bClientPlaintextAuth) +_PUBLIC_ FN_GLOBAL_BOOL(lp_client_lanman_auth, bClientLanManAuth) +_PUBLIC_ FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, bClientNTLMv2Auth) +_PUBLIC_ FN_GLOBAL_BOOL(lp_client_use_spnego_principal, client_use_spnego_principal) +_PUBLIC_ FN_GLOBAL_BOOL(lp_host_msdfs, bHostMSDfs) +_PUBLIC_ FN_GLOBAL_BOOL(lp_unix_extensions, bUnixExtensions) +_PUBLIC_ FN_GLOBAL_BOOL(lp_use_spnego, bUseSpnego) +_PUBLIC_ FN_GLOBAL_BOOL(lp_rpc_big_endian, bRpcBigEndian) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_max_wins_ttl, max_wins_ttl) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_min_wins_ttl, min_wins_ttl) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_maxmux, max_mux) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_max_xmit, max_xmit) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_passwordlevel, pwordlevel) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_srv_maxprotocol, srv_maxprotocol) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_srv_minprotocol, srv_minprotocol) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_cli_maxprotocol, cli_maxprotocol) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_cli_minprotocol, cli_minprotocol) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_security, security) +_PUBLIC_ FN_GLOBAL_BOOL(lp_paranoid_server_security, paranoid_server_security) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_announce_as, announce_as) +_PUBLIC_ FN_GLOBAL_LIST(lp_js_include, jsInclude) _PUBLIC_ FN_LOCAL_STRING(lp_servicename, szService) _PUBLIC_ FN_LOCAL_CONST_STRING(lp_const_servicename, szService) _PUBLIC_ FN_LOCAL_STRING(lp_pathname, szPath) @@ -792,8 +784,8 @@ _PUBLIC_ FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask) _PUBLIC_ FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode) _PUBLIC_ FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask) _PUBLIC_ FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_server_signing, &loadparm.Globals.server_signing) -_PUBLIC_ FN_GLOBAL_INTEGER(lp_client_signing, &loadparm.Globals.client_signing) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_server_signing, server_signing) +_PUBLIC_ FN_GLOBAL_INTEGER(lp_client_signing, client_signing) /* local prototypes */ static int map_parameter(const char *pszParmName); @@ -2314,8 +2306,6 @@ bool loadparm_init(struct loadparm_context *lp_ctx) } } - lp_do_global_parameter(lp_ctx, "config file", dyn_CONFIGFILE); - lp_do_global_parameter(lp_ctx, "share backend", "classic"); lp_do_global_parameter(lp_ctx, "server role", "standalone"); @@ -2460,16 +2450,16 @@ bool loadparm_init(struct loadparm_context *lp_ctx) False on failure. ***************************************************************************/ -bool lp_load(void) +bool lp_load(const char *filename) { char *n2; bool bRetval; struct param_opt *data; struct loadparm_context *lp_ctx = &loadparm; - global_loadparm = lp_ctx; + filename = talloc_strdup(talloc_autofree_context(), filename); - bRetval = false; + global_loadparm = lp_ctx; if (lp_ctx->Globals.param_opt != NULL) { struct param_opt *next; @@ -2483,12 +2473,14 @@ bool lp_load(void) if (!loadparm_init(lp_ctx)) return false; + + lp_ctx->Globals.szConfigFile = filename; lp_ctx->bInGlobalSection = true; - n2 = standard_sub_basic(talloc_autofree_context(), lp_configfile()); + n2 = standard_sub_basic(talloc_autofree_context(), lp_ctx->Globals.szConfigFile); DEBUG(2, ("lp_load: refreshing parameters from %s\n", n2)); - add_to_file_list(lp_ctx, lp_configfile(), n2); + add_to_file_list(lp_ctx, lp_ctx->Globals.szConfigFile, n2); /* We get sections first, so have to start 'behind' to make up */ lp_ctx->currentService = NULL; @@ -2500,7 +2492,7 @@ bool lp_load(void) if (lp_ctx->currentService != NULL) bRetval = service_ok(lp_ctx->currentService); - lp_add_auto_services(lp_ctx, lp_auto_services()); + lp_add_auto_services(lp_ctx, lp_auto_services(lp_ctx)); lp_add_hidden(lp_ctx, "IPC$", "IPC"); lp_add_hidden(lp_ctx, "ADMIN$", "DISK"); @@ -2606,9 +2598,9 @@ const char *volume_label(struct loadparm_service *service) If we are PDC then prefer us as DMB ************************************************************/ -bool lp_domain_logons(void) +bool lp_domain_logons(struct loadparm_context *lp_ctx) { - return (lp_server_role() == ROLE_DOMAIN_CONTROLLER); + return (lp_server_role(lp_ctx) == ROLE_DOMAIN_CONTROLLER); } const char *lp_printername(struct loadparm_service *service) diff --git a/source4/param/secrets.c b/source4/param/secrets.c index 657d2f7998..4107526d75 100644 --- a/source4/param/secrets.c +++ b/source4/param/secrets.c @@ -56,22 +56,22 @@ void secrets_shutdown(void) } /* open up the secrets database */ -BOOL secrets_init(void) +bool secrets_init(void) { char *fname; uint8_t dummy; if (tdb) - return True; + return true; - asprintf(&fname, "%s/secrets.tdb", lp_private_dir()); + asprintf(&fname, "%s/secrets.tdb", lp_private_dir(global_loadparm)); tdb = tdb_wrap_open(talloc_autofree_context(), fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open %s\n", fname)); SAFE_FREE(fname); - return False; + return false; } SAFE_FREE(fname); @@ -103,7 +103,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx) "computerName: CASE_INSENSITIVE\n" \ "flatname: CASE_INSENSITIVE\n"; - url = lp_secrets_url(); + url = lp_secrets_url(global_loadparm); if (!url || !url[0]) { return NULL; } diff --git a/source4/param/share.c b/source4/param/share.c index abc5e2ebeb..dabd4e8d26 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -134,7 +134,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, ops = share_backend_by_name(backend_name); if (!ops) { - DEBUG(0, ("share_init_connection: share backend [%s] not found!\n", lp_share_backend())); + DEBUG(0, ("share_init_connection: share backend [%s] not found!\n", lp_share_backend(global_loadparm))); return NT_STATUS_INTERNAL_ERROR; } @@ -143,7 +143,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, NTSTATUS share_get_context(TALLOC_CTX *mem_ctx, struct share_context **ctx) { - return share_get_context_by_name(mem_ctx, lp_share_backend(), ctx); + return share_get_context_by_name(mem_ctx, lp_share_backend(global_loadparm), ctx); } /* diff --git a/source4/param/util.c b/source4/param/util.c index 308d4bfc2b..25959c4919 100644 --- a/source4/param/util.c +++ b/source4/param/util.c @@ -44,11 +44,11 @@ _PUBLIC_ bool is_myname(const char *name) const char **aliases; int i; - if (strcasecmp(name, lp_netbios_name()) == 0) { + if (strcasecmp(name, lp_netbios_name(global_loadparm)) == 0) { return True; } - aliases = lp_netbios_aliases(); + aliases = lp_netbios_aliases(global_loadparm); for (i=0; aliases && aliases[i]; i++) { if (strcasecmp(name, aliases[i]) == 0) { return True; @@ -72,7 +72,7 @@ _PUBLIC_ char *lock_path(TALLOC_CTX* mem_ctx, const char *name) return talloc_strdup(mem_ctx, name); } - dname = talloc_strdup(mem_ctx, lp_lockdir()); + dname = talloc_strdup(mem_ctx, lp_lockdir(global_loadparm)); trim_string(dname,"","/"); if (!directory_exist(dname)) { @@ -94,7 +94,7 @@ static char *pid_path(TALLOC_CTX* mem_ctx, const char *name) { char *fname, *dname; - dname = talloc_strdup(mem_ctx, lp_piddir()); + dname = talloc_strdup(mem_ctx, lp_piddir(global_loadparm)); trim_string(dname,"","/"); if (!directory_exist(dname)) { @@ -135,7 +135,7 @@ _PUBLIC_ char *data_path(TALLOC_CTX* mem_ctx, const char *name) _PUBLIC_ char *config_path(TALLOC_CTX* mem_ctx, const char *name) { char *fname, *config_dir, *p; - config_dir = talloc_strdup(mem_ctx, lp_configfile()); + config_dir = talloc_strdup(mem_ctx, lp_configfile(global_loadparm)); p = strrchr(config_dir, '/'); if (!p) { return NULL; @@ -163,7 +163,7 @@ _PUBLIC_ char *private_path(TALLOC_CTX* mem_ctx, const char *name) if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) { return talloc_strdup(mem_ctx, name); } - fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(), name); + fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(global_loadparm), name); return fname; } @@ -280,7 +280,7 @@ static char *modules_path(TALLOC_CTX* mem_ctx, const char *name) { const char *env_moduledir = getenv("LD_SAMBA_MODULE_PATH"); return talloc_asprintf(mem_ctx, "%s/%s", - env_moduledir?env_moduledir:lp_modulesdir(), + env_moduledir?env_moduledir:lp_modulesdir(global_loadparm), name); } diff --git a/source4/rpc_server/common/server_info.c b/source4/rpc_server/common/server_info.c index 8848dcd1df..a046f1e29f 100644 --- a/source4/rpc_server/common/server_info.c +++ b/source4/rpc_server/common/server_info.c @@ -47,7 +47,7 @@ _PUBLIC_ const char *dcesrv_common_get_server_name(TALLOC_CTX *mem_ctx, struct d /* if there's no string return our NETBIOS name */ if (!p) { - return talloc_strdup(mem_ctx, lp_netbios_name()); + return talloc_strdup(mem_ctx, lp_netbios_name(global_loadparm)); } /* if there're '\\\\' in front remove them otherwise just pass the string */ @@ -60,7 +60,7 @@ _PUBLIC_ const char *dcesrv_common_get_server_name(TALLOC_CTX *mem_ctx, struct d const char *dcesrv_common_get_domain_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx) { - return talloc_strdup(mem_ctx, lp_workgroup()); + return talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); } /* This hardcoded value should go into a ldb database! */ @@ -89,7 +89,7 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces default_server_announce |= SV_TYPE_SERVER; default_server_announce |= SV_TYPE_SERVER_UNIX; - switch (lp_announce_as()) { + switch (lp_announce_as(global_loadparm)) { case ANNOUNCE_AS_NT_SERVER: default_server_announce |= SV_TYPE_SERVER_NT; /* fall through... */ @@ -106,7 +106,7 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces break; } - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_DOMAIN_MEMBER: default_server_announce |= SV_TYPE_DOMAIN_MEMBER; break; @@ -138,10 +138,10 @@ _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dces default: break; } - if (lp_time_server()) + if (lp_time_server(global_loadparm)) default_server_announce |= SV_TYPE_TIME_SOURCE; - if (lp_host_msdfs()) + if (lp_host_msdfs(global_loadparm)) default_server_announce |= SV_TYPE_DFS_SERVER; diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index c3de00d8d0..02f38a15fd 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -390,7 +390,7 @@ static void dcesrv_init_hdr(struct ncacn_packet *pkt) { pkt->rpc_vers = 5; pkt->rpc_vers_minor = 0; - if (lp_rpc_big_endian()) { + if (lp_rpc_big_endian(global_loadparm)) { pkt->drep[0] = 0; } else { pkt->drep[0] = DCERPC_DREP_LE; @@ -892,7 +892,7 @@ _PUBLIC_ NTSTATUS dcesrv_reply(struct dcesrv_call_state *call) pointers */ push->ptr_count = call->ndr_pull->ptr_count; - if (lp_rpc_big_endian()) { + if (lp_rpc_big_endian(global_loadparm)) { push->flags |= LIBNDR_FLAG_BIGENDIAN; } @@ -1372,7 +1372,7 @@ _PUBLIC_ NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct dcesrv_con NTSTATUS status; struct dcesrv_context *dce_ctx; - status = dcesrv_init_context(mem_ctx, lp_dcerpc_endpoint_servers(), &dce_ctx); + status = dcesrv_init_context(mem_ctx, lp_dcerpc_endpoint_servers(global_loadparm), &dce_ctx); NT_STATUS_NOT_OK_RETURN(status); *_dce_ctx = dce_ctx; diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c index 49a4c3de13..0843a43761 100644 --- a/source4/rpc_server/dcesrv_auth.c +++ b/source4/rpc_server/dcesrv_auth.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/ndr_dcerpc.h" #include "auth/credentials/credentials.h" #include "auth/gensec/gensec.h" +#include "param/param.h" /* parse any auth information from a dcerpc bind request @@ -70,7 +71,7 @@ BOOL dcesrv_auth_bind(struct dcesrv_call_state *call) return False; } - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(status))); diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 8a695bdedf..a580487b6f 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -262,7 +262,7 @@ static WERROR dcesrv_dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_cal ZERO_STRUCT(domain_guid); - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: role = DS_ROLE_STANDALONE_SERVER; break; @@ -278,13 +278,13 @@ static WERROR dcesrv_dssetup_DsRoleGetPrimaryDomainInformation(struct dcesrv_cal break; } - switch (lp_server_role()) { + switch (lp_server_role(global_loadparm)) { case ROLE_STANDALONE: - domain = talloc_strdup(mem_ctx, lp_workgroup()); + domain = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(domain); break; case ROLE_DOMAIN_MEMBER: - domain = talloc_strdup(mem_ctx, lp_workgroup()); + domain = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(domain); /* TODO: what is with dns_domain and forest and guid? */ break; diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 14a724a6f6..2d551da4d1 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -165,7 +165,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca creds->account_name = talloc_steal(creds, r->in.account_name); creds->computer_name = talloc_steal(creds, r->in.computer_name); - creds->domain = talloc_strdup(creds, lp_workgroup()); + creds->domain = talloc_strdup(creds, lp_workgroup(global_loadparm)); creds->secure_channel_type = r->in.secure_channel_type; @@ -259,7 +259,8 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(const char *computer_name, * disconnects) we must update the database every time we * update the structure */ - nt_status = schannel_fetch_session_key_ldb(ldb, ldb, computer_name, lp_workgroup(), + nt_status = schannel_fetch_session_key_ldb(ldb, ldb, computer_name, + lp_workgroup(global_loadparm), &creds); if (NT_STATUS_IS_OK(nt_status)) { nt_status = creds_server_step_check(creds, @@ -528,7 +529,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogon_base(struct dcesrv_call_state *dce_cal sam6 = talloc_zero(mem_ctx, struct netr_SamInfo6); NT_STATUS_HAVE_NO_MEMORY(sam6); sam6->base = *sam; - sam6->forest.string = lp_realm(); + sam6->forest.string = lp_realm(global_loadparm); sam6->principle.string = talloc_asprintf(mem_ctx, "%s@%s", sam->account_name.string, sam6->forest.string); NT_STATUS_HAVE_NO_MEMORY(sam6->principle.string); @@ -552,7 +553,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call, { NTSTATUS nt_status; struct creds_CredentialState *creds; - nt_status = schannel_fetch_session_key(mem_ctx, r->in.computer_name, lp_workgroup(), &creds); + nt_status = schannel_fetch_session_key(mem_ctx, r->in.computer_name, lp_workgroup(global_loadparm), &creds); if (!NT_STATUS_IS_OK(nt_status)) { return nt_status; } @@ -1004,7 +1005,9 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA /* TODO: - return real IP address * - check all r->in.* parameters (server_unc is ignored by w2k3!) */ - r->out.info->dc_unc = talloc_asprintf(mem_ctx, "\\\\%s.%s", lp_netbios_name(),lp_realm()); + r->out.info->dc_unc = talloc_asprintf(mem_ctx, "\\\\%s.%s", + lp_netbios_name(global_loadparm), + lp_realm(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_unc); r->out.info->dc_address = talloc_strdup(mem_ctx, "\\\\0.0.0.0"); W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_address); diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c index 2b481919d1..7434a32128 100644 --- a/source4/rpc_server/remote/dcesrv_remote.c +++ b/source4/rpc_server/remote/dcesrv_remote.c @@ -76,7 +76,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct if (!credentials) { return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(credentials); + cli_credentials_set_conf(credentials, global_loadparm); cli_credentials_set_username(credentials, user, CRED_SPECIFIED); if (domain) { cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); @@ -85,7 +85,7 @@ static NTSTATUS remote_op_bind(struct dcesrv_call_state *dce_call, const struct } else if (machine_account) { DEBUG(5, ("dcerpc_remote: RPC Proxy: Using machine account\n")); credentials = cli_credentials_init(private); - cli_credentials_set_conf(credentials); + cli_credentials_set_conf(credentials, global_loadparm); if (domain) { cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); } diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 475925e865..0ec979b81f 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -498,7 +498,7 @@ static NTSTATUS dcesrv_samr_info_DomInfo2(struct samr_domain_state *state, TALLO struct ldb_message **dom_msgs, struct samr_DomInfo2 *info) { - enum server_role role = lp_server_role(); + enum server_role role = lp_server_role(global_loadparm); /* This pulls the NetBIOS name from the cn=NTDS Settings,cn=<NETBIOS name of PDC>,.... @@ -611,7 +611,7 @@ static NTSTATUS dcesrv_samr_info_DomInfo7(struct samr_domain_state *state, struct samr_DomInfo7 *info) { - enum server_role role = lp_server_role(); + enum server_role role = lp_server_role(global_loadparm); switch (role) { case ROLE_DOMAIN_CONTROLLER: diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index 6875ff88ff..62666b09ba 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -256,7 +256,8 @@ static NTSTATUS dcesrv_add_ep_ncalrpc(struct dcesrv_context *dce_ctx, struct dce e->ep_description->endpoint = talloc_strdup(dce_ctx, "DEFAULT"); } - full_path = talloc_asprintf(dce_ctx, "%s/%s", lp_ncalrpc_dir(), e->ep_description->endpoint); + full_path = talloc_asprintf(dce_ctx, "%s/%s", lp_ncalrpc_dir(global_loadparm), + e->ep_description->endpoint); dcesrv_sock = talloc(event_ctx, struct dcesrv_socket_context); NT_STATUS_HAVE_NO_MEMORY(dcesrv_sock); @@ -362,7 +363,7 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx, struct dcesrv_ NTSTATUS status; /* Add TCP/IP sockets */ - if (lp_interfaces() && lp_bind_interfaces_only()) { + if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) { int num_interfaces = iface_count(); int i; for(i = 0; i < num_interfaces; i++) { @@ -371,7 +372,8 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx, struct dcesrv_ NT_STATUS_NOT_OK_RETURN(status); } } else { - status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops, lp_socket_address()); + status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops, + lp_socket_address(global_loadparm)); NT_STATUS_NOT_OK_RETURN(status); } @@ -412,13 +414,13 @@ static void dcesrv_task_init(struct task_server *task) task_server_set_title(task, "task[dcesrv]"); status = dcesrv_init_context(task->event_ctx, - lp_dcerpc_endpoint_servers(), + lp_dcerpc_endpoint_servers(global_loadparm), &dce_ctx); if (!NT_STATUS_IS_OK(status)) goto failed; /* Make sure the directory for NCALRPC exists */ - if (!directory_exist(lp_ncalrpc_dir())) { - mkdir(lp_ncalrpc_dir(), 0755); + if (!directory_exist(lp_ncalrpc_dir(global_loadparm))) { + mkdir(lp_ncalrpc_dir(global_loadparm), 0755); } for (e=dce_ctx->endpoint_list;e;e=e->next) { diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index d6c8d864aa..3d7a5319ca 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -174,10 +174,10 @@ static WERROR dcesrv_spoolss_check_server_name(struct dcesrv_call_state *dce_cal server_name += 2; /* NETBIOS NAME is ok */ - ret = strequal(lp_netbios_name(), server_name); + ret = strequal(lp_netbios_name(global_loadparm), server_name); if (ret) return WERR_OK; - aliases = lp_netbios_aliases(); + aliases = lp_netbios_aliases(global_loadparm); for (i=0; aliases && aliases[i]; i++) { if (strequal(aliases[i], server_name)) { @@ -188,12 +188,12 @@ static WERROR dcesrv_spoolss_check_server_name(struct dcesrv_call_state *dce_cal /* DNS NAME is ok * TODO: we need to check if aliases are also ok */ - if (lp_realm()) { + if (lp_realm(global_loadparm)) { char *str; str = talloc_asprintf(mem_ctx, "%s.%s", - lp_netbios_name(), - lp_realm()); + lp_netbios_name(global_loadparm), + lp_realm(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(str); ret = strequal(str, server_name); @@ -216,7 +216,7 @@ static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const st NTSTATUS status; struct ntptr_context *ntptr; - status = ntptr_init_context(dce_call->context, lp_ntptr_providor(), &ntptr); + status = ntptr_init_context(dce_call->context, lp_ntptr_providor(global_loadparm), &ntptr); NT_STATUS_NOT_OK_RETURN(status); dce_call->context->private = ntptr; @@ -1163,7 +1163,7 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_ } ZERO_STRUCT(rop); - rop.in.server_name = lp_netbios_name(); + rop.in.server_name = lp_netbios_name(global_loadparm); W_ERROR_HAVE_NO_MEMORY(rop.in.server_name); rop.in.printer_local = 0; rop.in.type = REG_NONE; diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 6e8732f788..aee88d915c 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info101->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); info101->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); info101->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); - info101->comment = talloc_strdup(mem_ctx, lp_serverstring()); + info101->comment = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(info101->comment); r->out.info.info101 = info101; @@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA info102->version_major = dcesrv_common_get_version_major(mem_ctx, dce_ctx); info102->version_minor = dcesrv_common_get_version_minor(mem_ctx, dce_ctx); info102->server_type = dcesrv_common_get_server_type(mem_ctx, dce_ctx); - info102->comment = talloc_strdup(mem_ctx, lp_serverstring()); + info102->comment = talloc_strdup(mem_ctx, lp_serverstring(global_loadparm)); W_ERROR_HAVE_NO_MEMORY(info102->comment); info102->users = dcesrv_common_get_users(mem_ctx, dce_ctx); diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl index 5c4f71e8a4..5e434d843a 100755 --- a/source4/script/mkproto.pl +++ b/source4/script/mkproto.pl @@ -142,7 +142,7 @@ sub handle_loadparm($$) ); my %smap = ( - "GLOBAL" => "void", + "GLOBAL" => "struct loadparm_context *", "LOCAL" => "struct loadparm_service *" ); diff --git a/source4/scripting/ejs/ejsnet/net_ctx.c b/source4/scripting/ejs/ejsnet/net_ctx.c index a2a3821082..5fdfe51887 100644 --- a/source4/scripting/ejs/ejsnet/net_ctx.c +++ b/source4/scripting/ejs/ejsnet/net_ctx.c @@ -68,7 +68,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv) talloc_free(ctx); return -1; } - cli_credentials_set_conf(creds); + cli_credentials_set_conf(creds, global_loadparm); cli_credentials_set_anonymous(creds); mprCreds = mprCredentials(creds); diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c index 3cb860b9e3..91e58873df 100644 --- a/source4/scripting/ejs/smbcalls.c +++ b/source4/scripting/ejs/smbcalls.c @@ -111,7 +111,7 @@ static int ejs_typeof_native(MprVarHandle eid, int argc, struct MprVar **argv) static int ejs_libinclude(int eid, int argc, char **argv) { int i, j; - const char **js_include = lp_js_include(); + const char **js_include = lp_js_include(global_loadparm); if (js_include == NULL || js_include[0] == NULL) { ejsSetErrorMsg(eid, "js include path not set"); diff --git a/source4/scripting/ejs/smbcalls_cli.c b/source4/scripting/ejs/smbcalls_cli.c index 02b948182a..af86be9432 100644 --- a/source4/scripting/ejs/smbcalls_cli.c +++ b/source4/scripting/ejs/smbcalls_cli.c @@ -431,7 +431,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv) /* Set up credentials */ creds = cli_credentials_init(NULL); - cli_credentials_set_conf(creds); + cli_credentials_set_conf(creds, global_loadparm); cli_credentials_parse_string(creds, argv[1], CRED_SPECIFIED); /* Do connect */ @@ -443,7 +443,7 @@ static int ejs_tree_connect(MprVarHandle eid, int argc, char **argv) io.in.service_type = "?????"; io.in.credentials = creds; io.in.fallback_to_anonymous = False; - io.in.workgroup = lp_workgroup(); + io.in.workgroup = lp_workgroup(global_loadparm); result = smb_composite_connect(&io, mem_ctx, NULL); tree = io.out.tree; diff --git a/source4/scripting/ejs/smbcalls_config.c b/source4/scripting/ejs/smbcalls_config.c index f488b0745f..45c197834a 100644 --- a/source4/scripting/ejs/smbcalls_config.c +++ b/source4/scripting/ejs/smbcalls_config.c @@ -211,7 +211,7 @@ static int ejs_lpSet(MprVarHandle eid, int argc, char **argv) */ static int ejs_lpReload(MprVarHandle eid, int argc, char **argv) { - BOOL ret = lp_load(); + BOOL ret = lp_load(lp_configfile(global_loadparm)); if (ret) { unload_interfaces(); } diff --git a/source4/scripting/ejs/smbcalls_creds.c b/source4/scripting/ejs/smbcalls_creds.c index b469f2c9fe..730753d158 100644 --- a/source4/scripting/ejs/smbcalls_creds.c +++ b/source4/scripting/ejs/smbcalls_creds.c @@ -248,7 +248,7 @@ static int ejs_credentials_init(MprVarHandle eid, int argc, struct MprVar **argv return -1; } - cli_credentials_set_conf(creds); + cli_credentials_set_conf(creds, global_loadparm); return ejs_credentials_obj(obj, creds); } diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c index 9f7e048fc0..29ce763f96 100644 --- a/source4/scripting/ejs/smbscript.c +++ b/source4/scripting/ejs/smbscript.c @@ -26,6 +26,7 @@ #include "scripting/ejs/smbcalls.h" #include "auth/gensec/gensec.h" #include "ldb/include/ldb.h" +#include "dynconfig.h" static EjsId eid; @@ -52,7 +53,9 @@ int main(int argc, const char **argv) fault_setup(argv[0]); if (getenv("SMB_CONF_PATH")) { - lp_set_cmdline(global_loadparm, "config file", getenv("SMB_CONF_PATH")); + lp_load(getenv("SMB_CONF_PATH")); + } else { + lp_load(dyn_CONFIGFILE); } ldb_global_init(); @@ -60,7 +63,6 @@ int main(int argc, const char **argv) gensec_init(); mprSetCtx(mem_ctx); - lp_load(); if (argc < 2) { fprintf(stderr, "You must supply a script name\n"); diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c index f5ae0aa507..a35f86367b 100644 --- a/source4/smb_server/smb/negprot.c +++ b/source4/smb_server/smb/negprot.c @@ -91,7 +91,7 @@ this any more it probably doesn't matter ****************************************************************************/ static void reply_coreplus(struct smbsrv_request *req, uint16_t choice) { - uint16_t raw = (lp_readraw()?1:0) | (lp_writeraw()?2:0); + uint16_t raw = (lp_readraw(global_loadparm)?1:0) | (lp_writeraw(global_loadparm)?2:0); smbsrv_setup_reply(req, 13, 0); @@ -122,13 +122,13 @@ static void reply_coreplus(struct smbsrv_request *req, uint16_t choice) ****************************************************************************/ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice) { - int raw = (lp_readraw()?1:0) | (lp_writeraw()?2:0); + int raw = (lp_readraw(global_loadparm)?1:0) | (lp_writeraw(global_loadparm)?2:0); int secword=0; time_t t = req->request_time.tv_sec; - req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(); + req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(global_loadparm); - if (lp_security() != SEC_SHARE) + if (lp_security(global_loadparm) != SEC_SHARE) secword |= NEGOTIATE_SECURITY_USER_LEVEL; if (req->smb_conn->negotiate.encrypted_passwords) @@ -145,7 +145,7 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice) SSVAL(req->out.vwv, VWV(0), choice); SSVAL(req->out.vwv, VWV(1), secword); SSVAL(req->out.vwv, VWV(2), req->smb_conn->negotiate.max_recv); - SSVAL(req->out.vwv, VWV(3), lp_maxmux()); + SSVAL(req->out.vwv, VWV(3), lp_maxmux(global_loadparm)); SSVAL(req->out.vwv, VWV(4), 1); SSVAL(req->out.vwv, VWV(5), raw); SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.id); @@ -180,13 +180,13 @@ static void reply_lanman1(struct smbsrv_request *req, uint16_t choice) ****************************************************************************/ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice) { - int raw = (lp_readraw()?1:0) | (lp_writeraw()?2:0); + int raw = (lp_readraw(global_loadparm)?1:0) | (lp_writeraw(global_loadparm)?2:0); int secword=0; time_t t = req->request_time.tv_sec; - req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(); + req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(global_loadparm); - if (lp_security() != SEC_SHARE) + if (lp_security(global_loadparm) != SEC_SHARE) secword |= NEGOTIATE_SECURITY_USER_LEVEL; if (req->smb_conn->negotiate.encrypted_passwords) @@ -199,7 +199,7 @@ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice) SSVAL(req->out.vwv, VWV(0), choice); SSVAL(req->out.vwv, VWV(1), secword); SSVAL(req->out.vwv, VWV(2), req->smb_conn->negotiate.max_recv); - SSVAL(req->out.vwv, VWV(3), lp_maxmux()); + SSVAL(req->out.vwv, VWV(3), lp_maxmux(global_loadparm)); SSVAL(req->out.vwv, VWV(4), 1); SSVAL(req->out.vwv, VWV(5), raw); SIVAL(req->out.vwv, VWV(6), req->smb_conn->connection->server_id.id); @@ -214,7 +214,7 @@ static void reply_lanman2(struct smbsrv_request *req, uint16_t choice) get_challenge(req->smb_conn, req->out.data); } - req_push_str(req, NULL, lp_workgroup(), -1, STR_TERMINATE); + req_push_str(req, NULL, lp_workgroup(global_loadparm), -1, STR_TERMINATE); if (req->smb_conn->signing.mandatory_signing) { smbsrv_terminate_connection(req->smb_conn, @@ -236,8 +236,8 @@ static void reply_nt1_orig(struct smbsrv_request *req) req->out.ptr += 8; SCVAL(req->out.vwv+1, VWV(16), 8); } - req_push_str(req, NULL, lp_workgroup(), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); - req_push_str(req, NULL, lp_netbios_name(), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); + req_push_str(req, NULL, lp_workgroup(global_loadparm), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); + req_push_str(req, NULL, lp_netbios_name(global_loadparm), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); DEBUG(3,("not using extended security (SPNEGO or NTLMSSP)\n")); } @@ -260,24 +260,24 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) CAP_NT_FIND | CAP_LOCK_AND_READ | CAP_LEVEL_II_OPLOCKS | CAP_NT_SMBS | CAP_RPC_REMOTE_APIS; - req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(); + req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(global_loadparm); /* do spnego in user level security if the client supports it and we can do encrypted passwords */ if (req->smb_conn->negotiate.encrypted_passwords && - (lp_security() != SEC_SHARE) && - lp_use_spnego() && + (lp_security(global_loadparm) != SEC_SHARE) && + lp_use_spnego(global_loadparm) && (req->flags2 & FLAGS2_EXTENDED_SECURITY)) { negotiate_spnego = True; capabilities |= CAP_EXTENDED_SECURITY; } - if (lp_unix_extensions()) { + if (lp_unix_extensions(global_loadparm)) { capabilities |= CAP_UNIX; } - if (lp_large_readwrite()) { + if (lp_large_readwrite(global_loadparm)) { capabilities |= CAP_LARGE_READX | CAP_LARGE_WRITEX | CAP_W2K_SMBS; } @@ -286,24 +286,24 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) capabilities |= CAP_LARGE_FILES; } - if (lp_readraw() && lp_writeraw()) { + if (lp_readraw(global_loadparm) && lp_writeraw(global_loadparm)) { capabilities |= CAP_RAW_MODE; } /* allow for disabling unicode */ - if (lp_unicode()) { + if (lp_unicode(global_loadparm)) { capabilities |= CAP_UNICODE; } - if (lp_nt_status_support()) { + if (lp_nt_status_support(global_loadparm)) { capabilities |= CAP_STATUS32; } - if (lp_host_msdfs()) { + if (lp_host_msdfs(global_loadparm)) { capabilities |= CAP_DFS; } - if (lp_security() != SEC_SHARE) { + if (lp_security(global_loadparm) != SEC_SHARE) { secword |= NEGOTIATE_SECURITY_USER_LEVEL; } @@ -330,7 +330,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) this is the one and only SMB packet that is malformed in the specification - all the command words after the secword are offset by 1 byte */ - SSVAL(req->out.vwv+1, VWV(1), lp_maxmux()); + SSVAL(req->out.vwv+1, VWV(1), lp_maxmux(global_loadparm)); SSVAL(req->out.vwv+1, VWV(2), 1); /* num vcs */ SIVAL(req->out.vwv+1, VWV(3), req->smb_conn->negotiate.max_recv); SIVAL(req->out.vwv+1, VWV(5), 0x10000); /* raw size. full 64k */ @@ -371,7 +371,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) return; } - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); nt_status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(nt_status))); @@ -517,8 +517,10 @@ void smbsrv_reply_negprot(struct smbsrv_request *req) for (protocol = 0; supported_protocols[protocol].proto_name; protocol++) { int i; - if (supported_protocols[protocol].protocol_level > lp_srv_maxprotocol()) continue; - if (supported_protocols[protocol].protocol_level < lp_srv_minprotocol()) continue; + if (supported_protocols[protocol].protocol_level > lp_srv_maxprotocol(global_loadparm)) + continue; + if (supported_protocols[protocol].protocol_level < lp_srv_minprotocol(global_loadparm)) + continue; for (i = 0; i < protos_count; i++) { if (strcmp(supported_protocols[protocol].proto_name, protos[i]) != 0) continue; diff --git a/source4/smb_server/smb/receive.c b/source4/smb_server/smb/receive.c index b29b86e6ea..973b6b993e 100644 --- a/source4/smb_server/smb/receive.c +++ b/source4/smb_server/smb/receive.c @@ -652,12 +652,12 @@ NTSTATUS smbsrv_init_smb_connection(struct smbsrv_connection *smb_conn) /* this is the size that w2k uses, and it appears to be important for good performance */ - smb_conn->negotiate.max_recv = lp_max_xmit(); + smb_conn->negotiate.max_recv = lp_max_xmit(global_loadparm); smb_conn->negotiate.zone_offset = get_time_zone(time(NULL)); - smb_conn->config.security = lp_security(); - smb_conn->config.nt_status_support = lp_nt_status_support(); + smb_conn->config.security = lp_security(global_loadparm); + smb_conn->config.nt_status_support = lp_nt_status_support(global_loadparm); status = smbsrv_init_sessions(smb_conn, UINT16_MAX); NT_STATUS_NOT_OK_RETURN(status); diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c index 8a99223d8b..558f30307b 100644 --- a/source4/smb_server/smb/service.c +++ b/source4/smb_server/smb/service.c @@ -201,7 +201,7 @@ NTSTATUS smbsrv_tcon_backend(struct smbsrv_request *req, union smb_tcon *con) con->tconx.out.dev_type = talloc_strdup(req, req->tcon->ntvfs->dev_type); con->tconx.out.fs_type = talloc_strdup(req, req->tcon->ntvfs->fs_type); con->tconx.out.options = SMB_SUPPORT_SEARCH_BITS | (share_int_option(req->tcon->ntvfs->config, SHARE_CSC_POLICY, SHARE_CSC_POLICY_DEFAULT) << 2); - if (share_bool_option(req->tcon->ntvfs->config, SHARE_MSDFS_ROOT, SHARE_MSDFS_ROOT_DEFAULT) && lp_host_msdfs()) { + if (share_bool_option(req->tcon->ntvfs->config, SHARE_MSDFS_ROOT, SHARE_MSDFS_ROOT_DEFAULT) && lp_host_msdfs(global_loadparm)) { con->tconx.out.options |= SMB_SHARE_IN_DFS; } diff --git a/source4/smb_server/smb/sesssetup.c b/source4/smb_server/smb/sesssetup.c index b3664ab7fe..29d14016e7 100644 --- a/source4/smb_server/smb/sesssetup.c +++ b/source4/smb_server/smb/sesssetup.c @@ -40,7 +40,7 @@ static void sesssetup_common_strings(struct smbsrv_request *req, { (*os) = talloc_asprintf(req, "Unix"); (*lanman) = talloc_asprintf(req, "Samba %s", SAMBA_VERSION_STRING); - (*domain) = talloc_asprintf(req, "%s", lp_workgroup()); + (*domain) = talloc_asprintf(req, "%s", lp_workgroup(global_loadparm)); } static void smbsrv_sesssetup_backend_send(struct smbsrv_request *req, diff --git a/source4/smb_server/smb/signing.c b/source4/smb_server/smb/signing.c index 120bc01c3e..eaffaa33dd 100644 --- a/source4/smb_server/smb/signing.c +++ b/source4/smb_server/smb/signing.c @@ -102,7 +102,7 @@ BOOL smbsrv_init_signing(struct smbsrv_connection *smb_conn) return False; } - switch (lp_server_signing()) { + switch (lp_server_signing(global_loadparm)) { case SMB_SIGNING_OFF: smb_conn->signing.allow_smb_signing = False; break; @@ -114,7 +114,7 @@ BOOL smbsrv_init_signing(struct smbsrv_connection *smb_conn) smb_conn->signing.mandatory_signing = True; break; case SMB_SIGNING_AUTO: - if (lp_domain_logons()) { + if (lp_domain_logons(global_loadparm)) { smb_conn->signing.allow_smb_signing = True; } else { smb_conn->signing.allow_smb_signing = False; diff --git a/source4/smb_server/smb2/negprot.c b/source4/smb_server/smb2/negprot.c index 8aa652e27e..3035f77396 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -27,6 +27,7 @@ #include "smb_server/service_smb_proto.h" #include "smb_server/smb2/smb2_server.h" #include "smbd/service_stream.h" +#include "param/param.h" static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB *_blob) { @@ -52,7 +53,7 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB * return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(server_credentials); + cli_credentials_set_conf(server_credentials, global_loadparm); nt_status = cli_credentials_set_machine_account(server_credentials); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(10, ("Failed to obtain server credentials, perhaps a standalone server?: %s\n", nt_errstr(nt_status))); diff --git a/source4/smb_server/smb2/receive.c b/source4/smb_server/smb2/receive.c index e783620e52..31b7f72cca 100644 --- a/source4/smb_server/smb2/receive.c +++ b/source4/smb_server/smb2/receive.c @@ -516,7 +516,7 @@ NTSTATUS smbsrv_init_smb2_connection(struct smbsrv_connection *smb_conn) /* this is the size that w2k uses, and it appears to be important for good performance */ - smb_conn->negotiate.max_recv = lp_max_xmit(); + smb_conn->negotiate.max_recv = lp_max_xmit(global_loadparm); smb_conn->negotiate.zone_offset = get_time_zone(time(NULL)); diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 3ac7ca5ede..691934f71c 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -63,7 +63,7 @@ static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob) packet_set_callback(smb_conn->packet, smbsrv_recv_smb_request); return smbsrv_recv_smb_request(smb_conn, blob); case SMB2_MAGIC: - if (lp_srv_maxprotocol() < PROTOCOL_SMB2) break; + if (lp_srv_maxprotocol(global_loadparm) < PROTOCOL_SMB2) break; status = smbsrv_init_smb2_connection(smb_conn); NT_STATUS_NOT_OK_RETURN(status); packet_set_callback(smb_conn->packet, smbsrv_recv_smb2_request); @@ -178,7 +178,7 @@ _PUBLIC_ NTSTATUS smbsrv_add_socket(struct event_context *event_context, const struct model_ops *model_ops, const char *address) { - const char **ports = lp_smb_ports(); + const char **ports = lp_smb_ports(global_loadparm); int i; NTSTATUS status; @@ -215,7 +215,7 @@ static void smbsrv_task_init(struct task_server *task) task_server_set_title(task, "task[smbsrv]"); - if (lp_interfaces() && lp_bind_interfaces_only()) { + if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) { int num_interfaces = iface_count(); int i; @@ -230,7 +230,8 @@ static void smbsrv_task_init(struct task_server *task) } } else { /* Just bind to lp_socket_address() (usually 0.0.0.0) */ - status = smbsrv_add_socket(task->event_ctx, task->model_ops, lp_socket_address()); + status = smbsrv_add_socket(task->event_ctx, task->model_ops, + lp_socket_address(global_loadparm)); if (!NT_STATUS_IS_OK(status)) goto failed; } diff --git a/source4/smbd/pidfile.c b/source4/smbd/pidfile.c index 57ff68709f..9a8b095f15 100644 --- a/source4/smbd/pidfile.c +++ b/source4/smbd/pidfile.c @@ -40,7 +40,7 @@ pid_t pidfile_pid(const char *name) pid_t ret; char *pidFile; - asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name); + asprintf(&pidFile, "%s/%s.pid", lp_piddir(global_loadparm), name); fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644); @@ -87,7 +87,7 @@ void pidfile_create(const char *name) char *pidFile; pid_t pid; - asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name); + asprintf(&pidFile, "%s/%s.pid", lp_piddir(global_loadparm), name); pid = pidfile_pid(name); if (pid != 0) { diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 23d996bf2e..7d84ffe812 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -269,8 +269,8 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ cleanup_tmp_files(); - if (!directory_exist(lp_lockdir())) { - mkdir(lp_lockdir(), 0755); + if (!directory_exist(lp_lockdir(global_loadparm))) { + mkdir(lp_lockdir(global_loadparm), 0755); } pidfile_create(binary_name); @@ -329,7 +329,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ } DEBUG(0,("%s: using '%s' process model\n", binary_name, model)); - status = server_service_startup(event_ctx, model, lp_server_services()); + status = server_service_startup(event_ctx, model, lp_server_services(global_loadparm)); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Starting Services failed - %s\n", nt_errstr(status))); return 1; diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c index 794fd4f5b1..1f1f92b495 100644 --- a/source4/smbd/service_stream.c +++ b/source4/smbd/service_stream.c @@ -258,7 +258,8 @@ NTSTATUS stream_setup_socket(struct event_context *event_context, status = socket_set_option(stream_socket->sock, "SO_KEEPALIVE", NULL); NT_STATUS_NOT_OK_RETURN(status); - status = socket_set_option(stream_socket->sock, lp_socket_options(), NULL); + status = socket_set_option(stream_socket->sock, lp_socket_options(global_loadparm), + NULL); NT_STATUS_NOT_OK_RETURN(status); /* TODO: set socket ACL's here when they're implemented */ diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c index 7c9339dedc..303cbee62f 100644 --- a/source4/torture/basic/base.c +++ b/source4/torture/basic/base.c @@ -41,7 +41,7 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx) struct smbcli_state *cli; const char *host = torture_setting_string(tctx, "host", NULL); - make_nbt_name_client(&calling, lp_netbios_name()); + make_nbt_name_client(&calling, lp_netbios_name(global_loadparm)); nbt_choose_called_name(NULL, &called, host, NBT_NAME_SERVER); @@ -1443,7 +1443,7 @@ static BOOL torture_samba3_errorpaths(struct torture_context *tctx) return False; } - nt_status_support = lp_nt_status_support(); + nt_status_support = lp_nt_status_support(global_loadparm); if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) { torture_comment(tctx, "Could not set 'nt status support = yes'\n"); diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c index d493aa819e..19eef87f6f 100644 --- a/source4/torture/basic/misc.c +++ b/source4/torture/basic/misc.c @@ -442,7 +442,7 @@ static int init_benchrw_params(struct torture_context *tctx, lpar->writeratio = torture_setting_int(tctx, "writeratio",5); lpar->num_parallel_requests = torture_setting_int( tctx, "parallel_requests", 5); - lpar->workgroup = lp_workgroup(); + lpar->workgroup = lp_workgroup(global_loadparm); p = torture_setting_string(tctx, "unclist", NULL); if (p) { diff --git a/source4/torture/basic/secleak.c b/source4/torture/basic/secleak.c index 030a4f5f67..75d3117967 100644 --- a/source4/torture/basic/secleak.c +++ b/source4/torture/basic/secleak.c @@ -38,10 +38,10 @@ static BOOL try_failed_login(struct smbcli_state *cli) session = smbcli_session_init(cli->transport, cli, False); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cli_credentials_init(session); - cli_credentials_set_conf(setup.in.credentials); + cli_credentials_set_conf(setup.in.credentials, global_loadparm); cli_credentials_set_domain(setup.in.credentials, "INVALID-DOMAIN", CRED_SPECIFIED); cli_credentials_set_username(setup.in.credentials, "INVALID-USERNAME", CRED_SPECIFIED); cli_credentials_set_password(setup.in.credentials, "INVALID-PASSWORD", CRED_SPECIFIED); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 23c52bb446..a03f8a0825 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -27,6 +27,7 @@ #include "auth/credentials/credentials.h" #include "auth/gensec/gensec.h" #include "param/param.h" +#include "dynconfig.h" #define NSERVERS 2 #define NINSTANCES 2 @@ -2195,7 +2196,7 @@ static BOOL split_unc_name(const char *unc, char **server, char **share) argc -= NSERVERS; argv += NSERVERS; - lp_load(); + lp_load(dyn_CONFIGFILE); servers[0].credentials = cli_credentials_init(talloc_autofree_context()); servers[1].credentials = cli_credentials_init(talloc_autofree_context()); diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index cfd3c10968..329c8a1d23 100644 --- a/source4/torture/libnet/domain.c +++ b/source4/torture/libnet/domain.c @@ -93,7 +93,7 @@ BOOL torture_domainopen(struct torture_context *torture) return False; } - name.string = lp_workgroup(); + name.string = lp_workgroup(global_loadparm); /* * Testing synchronous version diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c index 3efd3f2e85..31b49ef70e 100644 --- a/source4/torture/libnet/groupinfo.c +++ b/source4/torture/libnet/groupinfo.c @@ -91,7 +91,7 @@ BOOL torture_groupinfo(struct torture_context *torture) return False; } - name.string = lp_workgroup(); + name.string = lp_workgroup(global_loadparm); /* * Testing synchronous version diff --git a/source4/torture/libnet/groupman.c b/source4/torture/libnet/groupman.c index 0db89f4960..a812f59aea 100644 --- a/source4/torture/libnet/groupman.c +++ b/source4/torture/libnet/groupman.c @@ -71,7 +71,7 @@ BOOL torture_groupadd(struct torture_context *torture) return False; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { ret = False; goto done; diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index c4b1a57ff1..5338d480bc 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -163,7 +163,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data, DEBUG(0,("Pathes under PRIVATEDIR[%s]\n" "SAMDB[%s] SECRETS[%s] KEYTAB[%s]\n", - lp_private_dir(), + lp_private_dir(global_loadparm), s->path.samdb_ldb, s->path.secrets_ldb, s->path.secrets_keytab)); diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index 1bcbfbbe4f..a2c0967faa 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -134,7 +134,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) /* we're accessing domain controller so the domain name should be passed (it's going to be resolved to dc name and address) instead of specific server name. */ - domain_name = lp_workgroup(); + domain_name = lp_workgroup(global_loadparm); ctx = libnet_context_init(NULL); if (ctx == NULL) { @@ -208,7 +208,7 @@ BOOL torture_domain_close_lsa(struct torture_context *torture) goto done; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain_lsa(p, torture, &h, &domain_name, &access_mask)) { d_printf("failed to open domain on lsa service\n"); @@ -261,7 +261,7 @@ BOOL torture_domain_open_samr(struct torture_context *torture) /* we're accessing domain controller so the domain name should be passed (it's going to be resolved to dc name and address) instead of specific server name. */ - domain_name = lp_workgroup(); + domain_name = lp_workgroup(global_loadparm); /* * Testing synchronous version @@ -338,7 +338,7 @@ BOOL torture_domain_close_samr(struct torture_context *torture) goto done; } - domain_name.string = talloc_strdup(mem_ctx, lp_workgroup()); + domain_name.string = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); if (!test_opendomain_samr(p, torture, &h, &domain_name, &access_mask, &sid)) { d_printf("failed to open domain on samr service\n"); diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index bc51c4242a..7089bd83fc 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -226,7 +226,7 @@ BOOL torture_groupinfo_api(struct torture_context *torture) return False; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { ret = False; goto done; diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index a98781bc17..0d4389c54a 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.c @@ -138,7 +138,7 @@ BOOL torture_lookup_pdc(struct torture_context *torture) goto done; } - lookup->in.domain_name = lp_workgroup(); + lookup->in.domain_name = lp_workgroup(global_loadparm); lookup->in.name_type = NBT_NAME_PDC; status = libnet_LookupDCs(ctx, mem_ctx, lookup); @@ -178,7 +178,7 @@ BOOL torture_lookup_sam_name(struct torture_context *torture) if (mem_ctx == NULL) return False; r.in.name = "Administrator"; - r.in.domain_name = lp_workgroup(); + r.in.domain_name = lp_workgroup(global_loadparm); status = libnet_LookupName(ctx, mem_ctx, &r); diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index 1509324b65..bb9a8d2f34 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.c @@ -163,7 +163,7 @@ BOOL torture_rpc_connect_pdc(struct torture_context *torture) /* we're accessing domain controller so the domain name should be passed (it's going to be resolved to dc name and address) instead of specific server name. */ - domain_name = lp_workgroup(); + domain_name = lp_workgroup(global_loadparm); return torture_rpc_connect(torture, level, NULL, domain_name); } @@ -183,7 +183,7 @@ BOOL torture_rpc_connect_dc(struct torture_context *torture) /* we're accessing domain controller so the domain name should be passed (it's going to be resolved to dc name and address) instead of specific server name. */ - domain_name = lp_workgroup(); + domain_name = lp_workgroup(global_loadparm); return torture_rpc_connect(torture, level, NULL, domain_name); } @@ -203,7 +203,7 @@ BOOL torture_rpc_connect_dc_info(struct torture_context *torture) /* we're accessing domain controller so the domain name should be passed (it's going to be resolved to dc name and address) instead of specific server name. */ - domain_name = lp_workgroup(); + domain_name = lp_workgroup(global_loadparm); return torture_rpc_connect(torture, level, NULL, domain_name); } diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index a642d4bf52..640816b891 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -245,7 +245,7 @@ BOOL torture_createuser(struct torture_context *torture) ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; - req.in.domain_name = lp_workgroup(); + req.in.domain_name = lp_workgroup(global_loadparm); req.out.error_string = NULL; status = libnet_CreateUser(ctx, mem_ctx, &req); @@ -291,7 +291,7 @@ BOOL torture_deleteuser(struct torture_context *torture) ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; - req.in.domain_name = lp_workgroup(); + req.in.domain_name = lp_workgroup(global_loadparm); status = torture_rpc_connection(torture, &p, @@ -301,7 +301,7 @@ BOOL torture_deleteuser(struct torture_context *torture) goto done; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { ret = False; goto done; @@ -488,7 +488,7 @@ BOOL torture_modifyuser(struct torture_context *torture) name = talloc_strdup(prep_mem_ctx, TEST_USERNAME); - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { ret = False; goto done; @@ -511,7 +511,7 @@ BOOL torture_modifyuser(struct torture_context *torture) for (fld = 1; fld < FIELDS_NUM - 1; fld++) { ZERO_STRUCT(req); - req.in.domain_name = lp_workgroup(); + req.in.domain_name = lp_workgroup(global_loadparm); req.in.user_name = name; set_test_changes(mem_ctx, &req, 1, &name, fld); @@ -524,7 +524,7 @@ BOOL torture_modifyuser(struct torture_context *torture) } ZERO_STRUCT(user_req); - user_req.in.domain_name = lp_workgroup(); + user_req.in.domain_name = lp_workgroup(global_loadparm); user_req.in.user_name = name; status = libnet_UserInfo(ctx, mem_ctx, &user_req); @@ -563,7 +563,7 @@ BOOL torture_modifyuser(struct torture_context *torture) /* restore original testing username - it's useful when test fails because it prevents from problems with recreating account */ ZERO_STRUCT(req); - req.in.domain_name = lp_workgroup(); + req.in.domain_name = lp_workgroup(global_loadparm); req.in.user_name = name; req.in.account_name = TEST_USERNAME; @@ -624,7 +624,7 @@ BOOL torture_userinfo_api(struct torture_context *torture) return False; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, prep_mem_ctx, &h, &domain_name)) { ret = False; goto done; @@ -682,7 +682,7 @@ BOOL torture_userlist(struct torture_context *torture) ctx = libnet_context_init(NULL); ctx->cred = cmdline_credentials; - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); mem_ctx = talloc_init("torture user list"); ZERO_STRUCT(req); diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index b53965b91e..731731865b 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -148,7 +148,7 @@ bool torture_userinfo(struct torture_context *torture) return False; } - name.string = lp_workgroup(); + name.string = lp_workgroup(global_loadparm); /* * Testing synchronous version diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index fbd0a124f0..ff2f2d5265 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -325,7 +325,7 @@ BOOL torture_useradd(struct torture_context *torture) return False; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { ret = False; goto done; @@ -384,7 +384,7 @@ bool torture_userdel(struct torture_context *torture) return False; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { ret = False; goto done; @@ -430,7 +430,7 @@ BOOL torture_usermod(struct torture_context *torture) goto done; } - domain_name.string = lp_workgroup(); + domain_name.string = lp_workgroup(global_loadparm); name = talloc_strdup(mem_ctx, TEST_USERNAME); if (!test_opendomain(p, mem_ctx, &h, &domain_name, &sid)) { diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c index e99ff715a2..fc339bfcc5 100644 --- a/source4/torture/locktest.c +++ b/source4/torture/locktest.c @@ -25,6 +25,7 @@ #include "auth/gensec/gensec.h" #include "libcli/libcli.h" #include "param/param.h" +#include "dynconfig.h" static int numops = 1000; static BOOL showall; @@ -560,7 +561,7 @@ static void usage(void) argc -= NSERVERS; argv += NSERVERS; - lp_load(); + lp_load(dyn_CONFIGFILE); servers[0] = cli_credentials_init(talloc_autofree_context()); servers[1] = cli_credentials_init(talloc_autofree_context()); diff --git a/source4/torture/locktest2.c b/source4/torture/locktest2.c index 9d4f0260b1..970873a3a6 100644 --- a/source4/torture/locktest2.c +++ b/source4/torture/locktest2.c @@ -483,7 +483,7 @@ static void usage(void) argc -= 4; argv += 4; - lp_load(); + lp_load(dyn_CONFIGFILE); if (getenv("USER")) { fstrcpy(username,getenv("USER")); diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c index 9019bf913b..153cee2680 100644 --- a/source4/torture/masktest.c +++ b/source4/torture/masktest.c @@ -27,6 +27,7 @@ #include "auth/credentials/credentials.h" #include "auth/gensec/gensec.h" #include "param/param.h" +#include "dynconfig.h" static struct cli_credentials *credentials; static BOOL showall = False; @@ -301,7 +302,7 @@ static void usage(void) argc -= 1; argv += 1; - lp_load(); + lp_load(dyn_CONFIGFILE); credentials = cli_credentials_init(talloc_autofree_context()); cli_credentials_guess(credentials); diff --git a/source4/torture/nbt/dgram.c b/source4/torture/nbt/dgram.c index e3bfaa6db3..e9cfda4b17 100644 --- a/source4/torture/nbt/dgram.c +++ b/source4/torture/nbt/dgram.c @@ -78,7 +78,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) const char *address; struct nbt_name name; - name.name = lp_workgroup(); + name.name = lp_workgroup(global_loadparm); name.type = NBT_NAME_LOGON; name.scope = NULL; @@ -91,7 +91,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx) socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, - myaddress, lp_dgram_port()); + myaddress, lp_dgram_port(global_loadparm)); torture_assert(tctx, socket_address != NULL, "Error getting address"); /* try receiving replies on port 138 first, which will only @@ -157,7 +157,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx) const char *address; struct nbt_name name; - name.name = lp_workgroup(); + name.name = lp_workgroup(global_loadparm); name.type = NBT_NAME_LOGON; name.scope = NULL; @@ -169,7 +169,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx) myaddress = talloc_strdup(dgmsock, iface_best_ip(address)); socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, - myaddress, lp_dgram_port()); + myaddress, lp_dgram_port(global_loadparm)); torture_assert(tctx, socket_address != NULL, "Error getting address"); /* try receiving replies on port 138 first, which will only @@ -266,7 +266,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) const char *address; struct nbt_name name; - name.name = lp_workgroup(); + name.name = lp_workgroup(global_loadparm); name.type = NBT_NAME_LOGON; name.scope = NULL; @@ -278,7 +278,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) myaddress = talloc_strdup(dgmsock, iface_best_ip(address)); socket_address = socket_address_from_strings(dgmsock, dgmsock->sock->backend_name, - myaddress, lp_dgram_port()); + myaddress, lp_dgram_port(global_loadparm)); torture_assert(tctx, socket_address != NULL, "Error getting address"); /* try receiving replies on port 138 first, which will only @@ -299,7 +299,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx) ACB_WSTRUST, &machine_credentials); torture_assert(tctx, join_ctx != NULL, talloc_asprintf(tctx, "Failed to join domain %s as %s\n", - lp_workgroup(), TEST_NAME)); + lp_workgroup(global_loadparm), TEST_NAME)); dom_sid = torture_join_sid(join_ctx); diff --git a/source4/torture/nbt/winsreplication.c b/source4/torture/nbt/winsreplication.c index c829b36e8e..f0b17b9778 100644 --- a/source4/torture/nbt/winsreplication.c +++ b/source4/torture/nbt/winsreplication.c @@ -629,7 +629,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( if (!ctx->nbtsock_srv) return NULL; /* Make a port 137 version of ctx->myaddr */ - nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, ctx->myaddr->addr, lp_nbt_port()); + nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, ctx->myaddr->addr, lp_nbt_port(global_loadparm)); if (!nbt_srv_addr) return NULL; /* And if possible, bind to it. This won't work unless we are root or in sockewrapper */ @@ -654,7 +654,8 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx( /* Make a port 137 version of ctx->myaddr2 */ nbt_srv_addr = socket_address_from_strings(tctx, ctx->nbtsock_srv->sock->backend_name, - ctx->myaddr2->addr, lp_nbt_port()); + ctx->myaddr2->addr, + lp_nbt_port(global_loadparm)); if (!nbt_srv_addr) return NULL; /* And if possible, bind to it. This won't work unless we are root or in sockewrapper */ @@ -9155,7 +9156,7 @@ static bool test_conflict_owned_active_vs_replica(struct torture_context *tctx, if (!ctx->nbtsock_srv) { torture_comment(tctx, "SKIP: Test Replica records vs. owned active records: not bound to port[%d]\n", - lp_nbt_port()); + lp_nbt_port(global_loadparm)); return true; } diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c index 283781205f..ab406f8624 100644 --- a/source4/torture/raw/composite.c +++ b/source4/torture/raw/composite.c @@ -159,7 +159,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io2.in.service_type = "A:"; io2.in.credentials = cmdline_credentials; - io2.in.workgroup = lp_workgroup(); + io2.in.workgroup = lp_workgroup(global_loadparm); io2.in.filename = fname; printf("testing parallel fetchfile with %d ops\n", torture_numops); @@ -346,7 +346,7 @@ static BOOL test_fsinfo(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) io1.in.service = lp_parm_string(NULL, "torture", "share"); io1.in.service_type = "A:"; io1.in.credentials = cmdline_credentials; - io1.in.workgroup = lp_workgroup(); + io1.in.workgroup = lp_workgroup(global_loadparm); io1.in.level = RAW_QFS_OBJECTID_INFORMATION; printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops); diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c index 5b2e0f8af8..af3c56fb27 100644 --- a/source4/torture/raw/context.c +++ b/source4/torture/raw/context.c @@ -92,7 +92,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; @@ -107,7 +107,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session2->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; @@ -134,7 +134,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session3->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */ - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; @@ -148,10 +148,10 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session4->vuid = session->vuid; setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities &= ~CAP_EXTENDED_SECURITY; /* force a non extended security login (should fail) */ - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); anon_creds = cli_credentials_init(mem_ctx); - cli_credentials_set_conf(anon_creds); + cli_credentials_set_conf(anon_creds, global_loadparm); cli_credentials_set_anonymous(anon_creds); setup.in.credentials = anon_creds; @@ -225,7 +225,7 @@ static BOOL test_session(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) for (i=0; i <ARRAY_SIZE(sessions); i++) { setups[i].in.sesskey = cli->transport->negotiate.sesskey; setups[i].in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setups[i].in.workgroup = lp_workgroup(); + setups[i].in.workgroup = lp_workgroup(global_loadparm); setups[i].in.credentials = cmdline_credentials; @@ -392,7 +392,7 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session1 = smbcli_session_init(cli->transport, mem_ctx, False); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session1, &setup); CHECK_STATUS(status, NT_STATUS_OK); @@ -448,7 +448,7 @@ static BOOL test_tree_ulogoff(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) session2 = smbcli_session_init(cli->transport, mem_ctx, False); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session2, &setup); CHECK_STATUS(status, NT_STATUS_OK); @@ -645,7 +645,7 @@ static BOOL test_pid_2sess(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; /* ignored in secondary session setup, except by our libs, which care about the extended security bit */ - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; @@ -890,7 +890,7 @@ bool torture_raw_context(struct torture_context *torture, struct smbcli_state *cli) { bool ret = true; - if (lp_use_spnego()) { + if (lp_use_spnego(global_loadparm)) { ret &= torture_raw_context_int(torture, cli); lp_set_cmdline(global_loadparm, "use spnego", "False"); } diff --git a/source4/torture/raw/lock.c b/source4/torture/raw/lock.c index c47f3c7978..245a15d269 100644 --- a/source4/torture/raw/lock.c +++ b/source4/torture/raw/lock.c @@ -592,7 +592,7 @@ static bool test_async(struct torture_context *tctx, session = smbcli_session_init(cli->transport, tctx, False); setup.in.sesskey = cli->transport->negotiate.sesskey; setup.in.capabilities = cli->transport->negotiate.capabilities; - setup.in.workgroup = lp_workgroup(); + setup.in.workgroup = lp_workgroup(global_loadparm); setup.in.credentials = cmdline_credentials; status = smb_composite_sesssetup(session, &setup); CHECK_STATUS(status, NT_STATUS_OK); diff --git a/source4/torture/raw/lockbench.c b/source4/torture/raw/lockbench.c index 55cab9e117..97509606c3 100644 --- a/source4/torture/raw/lockbench.c +++ b/source4/torture/raw/lockbench.c @@ -190,7 +190,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; io->in.fallback_to_anonymous = False; - io->in.workgroup = lp_workgroup(); + io->in.workgroup = lp_workgroup(global_loadparm); /* kill off the remnants of the old connection */ talloc_free(state->tree); diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c index d412a0406c..dcba73dfff 100644 --- a/source4/torture/raw/openbench.c +++ b/source4/torture/raw/openbench.c @@ -128,7 +128,7 @@ static void reopen_connection(struct event_context *ev, struct timed_event *te, io->in.service_type = state->service_type; io->in.credentials = cmdline_credentials; io->in.fallback_to_anonymous = False; - io->in.workgroup = lp_workgroup(); + io->in.workgroup = lp_workgroup(global_loadparm); /* kill off the remnants of the old connection */ talloc_free(state->tree); diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c index aad13ecd8f..ec53af93e8 100644 --- a/source4/torture/raw/samba3misc.c +++ b/source4/torture/raw/samba3misc.c @@ -344,7 +344,7 @@ bool torture_samba3_badpath(struct torture_context *torture) return False; } - nt_status_support = lp_nt_status_support(); + nt_status_support = lp_nt_status_support(global_loadparm); if (!lp_set_cmdline(global_loadparm, "nt status support", "yes")) { printf("Could not set 'nt status support = yes'\n"); diff --git a/source4/torture/rpc/dssync.c b/source4/torture/rpc/dssync.c index 5ea578e041..79063e86da 100644 --- a/source4/torture/rpc/dssync.c +++ b/source4/torture/rpc/dssync.c @@ -265,7 +265,7 @@ static BOOL test_GetInfo(struct DsSyncTest *ctx) r.in.req.req1.format_flags = DRSUAPI_DS_NAME_FLAG_NO_FLAGS; r.in.req.req1.format_offered = DRSUAPI_DS_NAME_FORMAT_NT4_ACCOUNT; r.in.req.req1.format_desired = DRSUAPI_DS_NAME_FORMAT_FQDN_1779; - names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup()); + names[0].str = talloc_asprintf(ctx, "%s\\", lp_workgroup(global_loadparm)); status = dcerpc_drsuapi_DsCrackNames(ctx->admin.drsuapi.pipe, ctx, &r); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 6352865d98..3ff0561f77 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -452,11 +452,11 @@ bool test_netlogon_ops(struct dcerpc_pipe *p, struct torture_context *tctx, DATA_BLOB names_blob, chal, lm_resp, nt_resp; int i; int flags = CLI_CRED_NTLM_AUTH; - if (lp_client_lanman_auth()) { + if (lp_client_lanman_auth(global_loadparm)) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth()) { + if (lp_client_ntlmv2_auth(global_loadparm)) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -740,7 +740,7 @@ static bool test_GetDcName(struct torture_context *tctx, struct netr_GetDcName r; r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); - r.in.domainname = lp_workgroup(); + r.in.domainname = lp_workgroup(global_loadparm); status = dcerpc_netr_GetDcName(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "GetDcName"); @@ -787,7 +787,7 @@ static bool test_GetAnyDCName(struct torture_context *tctx, struct netr_GetAnyDCName r; r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); - r.in.domainname = lp_workgroup(); + r.in.domainname = lp_workgroup(global_loadparm); status = dcerpc_netr_GetAnyDCName(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName"); @@ -813,7 +813,7 @@ static bool test_LogonControl2(struct torture_context *tctx, r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.function_code = NETLOGON_CONTROL_REDISCOVER; - r.in.data.domain = lp_workgroup(); + r.in.data.domain = lp_workgroup(global_loadparm); for (i=1;i<4;i++) { r.in.level = i; @@ -826,7 +826,7 @@ static bool test_LogonControl2(struct torture_context *tctx, } r.in.function_code = NETLOGON_CONTROL_TC_QUERY; - r.in.data.domain = lp_workgroup(); + r.in.data.domain = lp_workgroup(global_loadparm); for (i=1;i<4;i++) { r.in.level = i; @@ -839,7 +839,7 @@ static bool test_LogonControl2(struct torture_context *tctx, } r.in.function_code = NETLOGON_CONTROL_TRANSPORT_NOTIFY; - r.in.data.domain = lp_workgroup(); + r.in.data.domain = lp_workgroup(global_loadparm); for (i=1;i<4;i++) { r.in.level = i; @@ -932,7 +932,7 @@ static bool test_LogonControl2Ex(struct torture_context *tctx, r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.function_code = NETLOGON_CONTROL_REDISCOVER; - r.in.data.domain = lp_workgroup(); + r.in.data.domain = lp_workgroup(global_loadparm); for (i=1;i<4;i++) { r.in.level = i; @@ -945,7 +945,7 @@ static bool test_LogonControl2Ex(struct torture_context *tctx, } r.in.function_code = NETLOGON_CONTROL_TC_QUERY; - r.in.data.domain = lp_workgroup(); + r.in.data.domain = lp_workgroup(global_loadparm); for (i=1;i<4;i++) { r.in.level = i; @@ -958,7 +958,7 @@ static bool test_LogonControl2Ex(struct torture_context *tctx, } r.in.function_code = NETLOGON_CONTROL_TRANSPORT_NOTIFY; - r.in.data.domain = lp_workgroup(); + r.in.data.domain = lp_workgroup(global_loadparm); for (i=1;i<4;i++) { r.in.level = i; @@ -1090,7 +1090,7 @@ static bool test_netr_DsRGetDCName(struct torture_context *tctx, struct netr_DsRGetDCName r; r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); - r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm()); + r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(global_loadparm)); r.in.domain_guid = NULL; r.in.site_guid = NULL; r.in.flags = DS_RETURN_DNS_NAME; @@ -1113,7 +1113,7 @@ static bool test_netr_DsRGetDCNameEx(struct torture_context *tctx, struct netr_DsRGetDCNameEx r; r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); - r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm()); + r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(global_loadparm)); r.in.domain_guid = NULL; r.in.site_name = NULL; r.in.flags = DS_RETURN_DNS_NAME; @@ -1138,7 +1138,7 @@ static bool test_netr_DsRGetDCNameEx2(struct torture_context *tctx, r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.client_account = NULL; r.in.mask = 0x00000000; - r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm()); + r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(global_loadparm)); r.in.domain_guid = NULL; r.in.site_name = NULL; r.in.flags = DS_RETURN_DNS_NAME; diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index e6f54037bc..75a7d760d9 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -58,7 +58,7 @@ static struct cli_credentials *create_anon_creds(TALLOC_CTX *mem_ctx) return NULL; } - cli_credentials_set_conf(result); + cli_credentials_set_conf(result, global_loadparm); cli_credentials_set_anonymous(result); return result; @@ -1163,7 +1163,7 @@ BOOL torture_netlogon_samba3(struct torture_context *torture) goto done; } - cli_credentials_set_conf(wks_creds); + cli_credentials_set_conf(wks_creds, global_loadparm); cli_credentials_set_secure_channel_type(wks_creds, SEC_CHAN_WKSTA); cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED); cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED); @@ -1244,7 +1244,7 @@ static BOOL test_join3(TALLOC_CTX *mem_ctx, goto done; } - cli_credentials_set_conf(wks_creds); + cli_credentials_set_conf(wks_creds, global_loadparm); cli_credentials_set_secure_channel_type(wks_creds, SEC_CHAN_WKSTA); cli_credentials_set_username(wks_creds, wks_name, CRED_SPECIFIED); cli_credentials_set_workstation(wks_creds, wks_name, CRED_SPECIFIED); @@ -1648,7 +1648,7 @@ BOOL torture_samba3_rpc_getusername(struct torture_context *torture) goto done; } - cli_credentials_set_conf(user_creds); + cli_credentials_set_conf(user_creds, global_loadparm); cli_credentials_set_username(user_creds, "torture_username", CRED_SPECIFIED); cli_credentials_set_password(user_creds, @@ -2435,7 +2435,7 @@ BOOL torture_samba3_rpc_spoolss(struct torture_context *torture) ZERO_STRUCT(userlevel1); userlevel1.client = talloc_asprintf( - mem_ctx, "\\\\%s", lp_netbios_name()); + mem_ctx, "\\\\%s", lp_netbios_name(global_loadparm)); userlevel1.user = cli_credentials_get_username(cmdline_credentials); userlevel1.build = 2600; userlevel1.major = 3; diff --git a/source4/torture/rpc/samlogon.c b/source4/torture/rpc/samlogon.c index 92c4da6321..46ed363423 100644 --- a/source4/torture/rpc/samlogon.c +++ b/source4/torture/rpc/samlogon.c @@ -591,7 +591,7 @@ static BOOL test_lmv2_ntlmv2_broken(struct samlogon_state *samlogon_state, DATA_BLOB lmv2_response = data_blob(NULL, 0); DATA_BLOB lmv2_session_key = data_blob(NULL, 0); DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0); - DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, TEST_MACHINE_NAME, lp_workgroup()); + DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, TEST_MACHINE_NAME, lp_workgroup(global_loadparm)); uint8_t lm_session_key[8]; uint8_t user_session_key[16]; @@ -739,7 +739,7 @@ static BOOL test_lmv2_ntlm_broken(struct samlogon_state *samlogon_state, DATA_BLOB lmv2_response = data_blob(NULL, 0); DATA_BLOB lmv2_session_key = data_blob(NULL, 0); DATA_BLOB ntlmv2_session_key = data_blob(NULL, 0); - DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, lp_netbios_name(), lp_workgroup()); + DATA_BLOB names_blob = NTLMv2_generate_names_blob(samlogon_state->mem_ctx, lp_netbios_name(global_loadparm), lp_workgroup(global_loadparm)); DATA_BLOB ntlm_response = data_blob_talloc(samlogon_state->mem_ctx, NULL, 24); DATA_BLOB ntlm_session_key = data_blob_talloc(samlogon_state->mem_ctx, NULL, 16); @@ -1512,7 +1512,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) return False; } - userdomain = torture_setting_string(torture, "userdomain", lp_workgroup()); + userdomain = torture_setting_string(torture, "userdomain", lp_workgroup(global_loadparm)); user_ctx = torture_create_testuser(torture, TEST_USER_NAME, @@ -1735,7 +1735,7 @@ BOOL torture_rpc_samlogon(struct torture_context *torture) .username = talloc_asprintf(mem_ctx, "%s@%s", TEST_USER_NAME, - lp_realm()), + lp_realm(global_loadparm)), .password = user_password, .network_login = True, .expected_interactive_error = NT_STATUS_OK, diff --git a/source4/torture/rpc/samr_accessmask.c b/source4/torture/rpc/samr_accessmask.c index 9459485674..7d3395c5d0 100644 --- a/source4/torture/rpc/samr_accessmask.c +++ b/source4/torture/rpc/samr_accessmask.c @@ -412,7 +412,7 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, ld.in.connect_handle = &ch; ld.in.domain_name = &dn; - dn.string = lp_workgroup(); + dn.string = lp_workgroup(global_loadparm); status = dcerpc_samr_LookupDomain(p, tctx, &ld); if (!NT_STATUS_IS_OK(status)) { @@ -436,7 +436,7 @@ static bool test_samr_accessmask_LookupDomain(struct torture_context *tctx, ld.in.connect_handle = &ch; ld.in.domain_name = &dn; - dn.string = lp_workgroup(); + dn.string = lp_workgroup(global_loadparm); status = dcerpc_samr_LookupDomain(p, tctx, &ld); if(!NT_STATUS_EQUAL(NT_STATUS_ACCESS_DENIED, status)) { @@ -488,7 +488,7 @@ static bool test_samr_accessmask_OpenDomain(struct torture_context *tctx, ld.in.connect_handle = &ch; ld.in.domain_name = &dn; - dn.string = lp_workgroup(); + dn.string = lp_workgroup(global_loadparm); status = dcerpc_samr_LookupDomain(p, tctx, &ld); if (!NT_STATUS_IS_OK(status)) { printf("LookupDomain failed - %s\n", nt_errstr(status)); @@ -569,14 +569,16 @@ static bool test_samr_connect(struct torture_context *tctx, const struct dom_sid *test_sid; /* create a test user */ - testuser = torture_create_testuser(tctx, TEST_USER_NAME, lp_workgroup(), ACB_NORMAL, &testuser_passwd); + testuser = torture_create_testuser(tctx, TEST_USER_NAME, lp_workgroup(global_loadparm), + ACB_NORMAL, &testuser_passwd); if (!testuser) { printf("Failed to create test user\n"); return False; } test_credentials = cli_credentials_init(tctx); cli_credentials_set_workstation(test_credentials, "localhost", CRED_SPECIFIED); - cli_credentials_set_domain(test_credentials, lp_workgroup(), CRED_SPECIFIED); + cli_credentials_set_domain(test_credentials, lp_workgroup(global_loadparm), + CRED_SPECIFIED); cli_credentials_set_username(test_credentials, TEST_USER_NAME, CRED_SPECIFIED); cli_credentials_set_password(test_credentials, testuser_passwd, CRED_SPECIFIED); test_sid = torture_join_user_sid(testuser); diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c index 013a6db0bb..8494bdb543 100644 --- a/source4/torture/rpc/samsync.c +++ b/source4/torture/rpc/samsync.c @@ -1431,7 +1431,8 @@ BOOL torture_rpc_samsync(struct torture_context *torture) mem_ctx = talloc_init("torture_rpc_netlogon"); test_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_MACHINE_NAME); - join_ctx = torture_create_testuser(torture, test_machine_account, lp_workgroup(), ACB_SVRTRUST, + join_ctx = torture_create_testuser(torture, test_machine_account, + lp_workgroup(global_loadparm), ACB_SVRTRUST, &machine_password); if (!join_ctx) { talloc_free(mem_ctx); @@ -1440,8 +1441,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) } test_wksta_machine_account = talloc_asprintf(mem_ctx, "%s$", TEST_WKSTA_MACHINE_NAME); - join_ctx2 = torture_create_testuser(torture, test_wksta_machine_account, lp_workgroup(), ACB_WSTRUST, - &wksta_machine_password); + join_ctx2 = torture_create_testuser(torture, test_wksta_machine_account, lp_workgroup(global_loadparm), ACB_WSTRUST, &wksta_machine_password); if (!join_ctx2) { talloc_free(mem_ctx); printf("Failed to join as member\n"); @@ -1449,7 +1449,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) } user_ctx = torture_create_testuser(torture, TEST_USER_NAME, - lp_workgroup(), + lp_workgroup(global_loadparm), ACB_NORMAL, NULL); if (!user_ctx) { talloc_free(mem_ctx); @@ -1473,7 +1473,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) goto failed; } - domain_policy = samsync_open_domain(mem_ctx, samsync_state, lp_workgroup(), NULL); + domain_policy = samsync_open_domain(mem_ctx, samsync_state, lp_workgroup(global_loadparm), NULL); if (!domain_policy) { printf("samrsync_open_domain failed\n"); ret = False; @@ -1548,7 +1548,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) credentials = cli_credentials_init(mem_ctx); cli_credentials_set_workstation(credentials, TEST_MACHINE_NAME, CRED_SPECIFIED); - cli_credentials_set_domain(credentials, lp_workgroup(), CRED_SPECIFIED); + cli_credentials_set_domain(credentials, lp_workgroup(global_loadparm), CRED_SPECIFIED); cli_credentials_set_username(credentials, test_machine_account, CRED_SPECIFIED); cli_credentials_set_password(credentials, machine_password, CRED_SPECIFIED); cli_credentials_set_secure_channel_type(credentials, @@ -1585,7 +1585,7 @@ BOOL torture_rpc_samsync(struct torture_context *torture) credentials_wksta = cli_credentials_init(mem_ctx); cli_credentials_set_workstation(credentials_wksta, TEST_WKSTA_MACHINE_NAME, CRED_SPECIFIED); - cli_credentials_set_domain(credentials_wksta, lp_workgroup(), CRED_SPECIFIED); + cli_credentials_set_domain(credentials_wksta, lp_workgroup(global_loadparm), CRED_SPECIFIED); cli_credentials_set_username(credentials_wksta, test_wksta_machine_account, CRED_SPECIFIED); cli_credentials_set_password(credentials_wksta, wksta_machine_password, CRED_SPECIFIED); cli_credentials_set_secure_channel_type(credentials_wksta, diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c index 7d963be1bb..cb70582615 100644 --- a/source4/torture/rpc/schannel.c +++ b/source4/torture/rpc/schannel.c @@ -47,11 +47,11 @@ bool test_netlogon_ex_ops(struct dcerpc_pipe *p, struct torture_context *tctx, DATA_BLOB names_blob, chal, lm_resp, nt_resp; int i; int flags = CLI_CRED_NTLM_AUTH; - if (lp_client_lanman_auth()) { + if (lp_client_lanman_auth(global_loadparm)) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth()) { + if (lp_client_ntlmv2_auth(global_loadparm)) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -122,7 +122,7 @@ static bool test_samr_ops(struct torture_context *tctx, struct policy_handle handle; struct policy_handle domain_handle; - name.string = lp_workgroup(); + name.string = lp_workgroup(global_loadparm); r.in.domain_name = &name; connect.in.system_name = 0; diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index f32d6832a3..79a1b87376 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -276,7 +276,8 @@ again: u.info21.description.string = talloc_asprintf(join, "Samba4 torture account created by host %s: %s", - lp_netbios_name(), timestring(join, time(NULL))); + lp_netbios_name(global_loadparm), + timestring(join, time(NULL))); printf("Resetting ACB flags, force pw change time\n"); @@ -382,7 +383,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, u.info21.description.string = talloc_asprintf(tj, "Samba4 torture account created by host %s: %s", - lp_netbios_name(), timestring(tj, time(NULL))); + lp_netbios_name(global_loadparm), timestring(tj, time(NULL))); status = dcerpc_samr_SetUserInfo(tj->p, tj, &s); if (!NT_STATUS_IS_OK(status)) { @@ -390,7 +391,7 @@ _PUBLIC_ struct test_join *torture_join_domain(const char *machine_name, } *machine_credentials = cli_credentials_init(tj); - cli_credentials_set_conf(*machine_credentials); + cli_credentials_set_conf(*machine_credentials, global_loadparm); cli_credentials_set_workstation(*machine_credentials, machine_name, CRED_SPECIFIED); cli_credentials_set_domain(*machine_credentials, libnet_r->out.domain_name, CRED_SPECIFIED); if (libnet_r->out.realm) { diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index c648273c83..12d6f82643 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -292,7 +292,7 @@ bool wire_bad_flags(struct smb_wire_string *str, int flags, struct smbcli_transp if (flags & STR_TERMINATE) len++; server_unicode = (transport->negotiate.capabilities&CAP_UNICODE)?True:False; - if (getenv("CLI_FORCE_ASCII") || !lp_unicode()) { + if (getenv("CLI_FORCE_ASCII") || !lp_unicode(global_loadparm)) { server_unicode = False; } diff --git a/source4/torture/winbind/struct_based.c b/source4/torture/winbind/struct_based.c index 5fc941f45a..877742a26d 100644 --- a/source4/torture/winbind/struct_based.c +++ b/source4/torture/winbind/struct_based.c @@ -112,7 +112,7 @@ static bool torture_winbind_struct_info(struct torture_context *torture) separator = torture_setting_string(torture, "winbindd separator", - lp_winbind_separator()); + lp_winbind_separator(global_loadparm)); torture_assert_int_equal(torture, rep.data.info.winbind_separator, *separator, @@ -166,7 +166,7 @@ static bool torture_winbind_struct_netbios_name(struct torture_context *torture) expected = torture_setting_string(torture, "winbindd netbios name", - lp_netbios_name()); + lp_netbios_name(global_loadparm)); torture_assert_str_equal(torture, rep.data.netbios_name, expected, @@ -188,7 +188,7 @@ static bool torture_winbind_struct_domain_name(struct torture_context *torture) expected = torture_setting_string(torture, "winbindd netbios domain", - lp_workgroup()); + lp_workgroup(global_loadparm)); torture_assert_str_equal(torture, rep.data.domain_name, expected, diff --git a/source4/utils/net/net_join.c b/source4/utils/net/net_join.c index 59b35d70fa..1352fb7d9b 100644 --- a/source4/utils/net/net_join.c +++ b/source4/utils/net/net_join.c @@ -67,7 +67,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv) return -1; } /* prepare parameters for the join */ - r->in.netbios_name = lp_netbios_name(); + r->in.netbios_name = lp_netbios_name(global_loadparm); r->in.domain_name = domain_name; r->in.join_type = secure_channel_type; r->in.level = LIBNET_JOIN_AUTOMATIC; diff --git a/source4/utils/ntlm_auth.c b/source4/utils/ntlm_auth.c index 72bd94e630..8d9ff4ff0c 100644 --- a/source4/utils/ntlm_auth.c +++ b/source4/utils/ntlm_auth.c @@ -125,7 +125,7 @@ static bool parse_ntlm_auth_domain_user(const char *domuser, fstring domain, fstring user) { - char *p = strchr(domuser,*lp_winbind_separator()); + char *p = strchr(domuser,*lp_winbind_separator(global_loadparm)); if (!p) { return False; @@ -220,7 +220,7 @@ static NTSTATUS local_pw_check_specified(const char *username, if (unix_name) { asprintf(unix_name, "%s%c%s", domain, - *lp_winbind_separator(), + *lp_winbind_separator(global_loadparm), username); } } else { @@ -474,7 +474,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, } creds = cli_credentials_init(state->gensec_state); - cli_credentials_set_conf(creds); + cli_credentials_set_conf(creds, global_loadparm); if (opt_username) { cli_credentials_set_username(creds, opt_username, CRED_SPECIFIED); } @@ -659,7 +659,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode, reply_code = "AF"; reply_arg = talloc_asprintf(state->gensec_state, "%s%s%s", session_info->server_info->domain_name, - lp_winbind_separator(), session_info->server_info->account_name); + lp_winbind_separator(global_loadparm), session_info->server_info->account_name); talloc_free(session_info); } } else if (state->gensec_state->gensec_role == GENSEC_CLIENT) { @@ -710,7 +710,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod } else if (plaintext_password) { /* handle this request as plaintext */ if (!full_username) { - if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(), username) == -1) { + if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(global_loadparm), username) == -1) { mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n"); return; } @@ -745,7 +745,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod } if (!domain) { - domain = smb_xstrdup(lp_workgroup()); + domain = smb_xstrdup(lp_workgroup(global_loadparm)); } if (ntlm_server_1_lm_session_key) @@ -757,7 +757,7 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod if (!NT_STATUS_IS_OK( local_pw_check_specified(username, domain, - lp_netbios_name(), + lp_netbios_name(global_loadparm), &challenge, &lm_response, &nt_response, @@ -1084,7 +1084,7 @@ int main(int argc, const char **argv) gensec_init(); if (opt_domain == NULL) { - opt_domain = lp_workgroup(); + opt_domain = lp_workgroup(global_loadparm); } if (helper_protocol) { @@ -1111,7 +1111,7 @@ int main(int argc, const char **argv) } if (opt_workstation == NULL) { - opt_workstation = lp_netbios_name(); + opt_workstation = lp_netbios_name(global_loadparm); } if (!opt_password) { @@ -1121,7 +1121,7 @@ int main(int argc, const char **argv) { char *user; - asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(), opt_username); + asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(global_loadparm), opt_username); if (!check_plaintext_auth(user, opt_password, True)) { return 1; } diff --git a/source4/utils/testparm.c b/source4/utils/testparm.c index d8b6069791..71ff937a51 100644 --- a/source4/utils/testparm.c +++ b/source4/utils/testparm.c @@ -44,28 +44,28 @@ configuration settings. ************************************************/ -static int do_global_checks(void) +static int do_global_checks(struct loadparm_context *lp_ctx) { int ret = 0; - if (!directory_exist(lp_lockdir())) { + if (!directory_exist(lp_lockdir(lp_ctx))) { fprintf(stderr, "ERROR: lock directory %s does not exist\n", - lp_lockdir()); + lp_lockdir(lp_ctx)); ret = 1; } - if (!directory_exist(lp_piddir())) { + if (!directory_exist(lp_piddir(lp_ctx))) { fprintf(stderr, "ERROR: pid directory %s does not exist\n", - lp_piddir()); + lp_piddir(lp_ctx)); ret = 1; } - if (strlen(lp_winbind_separator()) != 1) { + if (strlen(lp_winbind_separator(lp_ctx)) != 1) { fprintf(stderr,"ERROR: the 'winbind separator' parameter must be a single character.\n"); ret = 1; } - if (*lp_winbind_separator() == '+') { + if (*lp_winbind_separator(lp_ctx) == '+') { fprintf(stderr,"'winbind separator = +' might cause problems with group membership.\n"); } @@ -139,16 +139,16 @@ static int do_global_checks(void) /* We need this to force the output */ lp_set_cmdline(global_loadparm, "log level", "2"); - fprintf(stderr,"Load smb config files from %s\n",lp_configfile()); + fprintf(stderr, "Loaded smb config files from %s\n", lp_configfile(global_loadparm)); - if (!lp_load()) { + if (!lp_load(lp_configfile(global_loadparm))) { fprintf(stderr,"Error loading services.\n"); return(1); } fprintf(stderr,"Loaded services file OK.\n"); - ret = do_global_checks(); + ret = do_global_checks(global_loadparm); for (s=0;s<lp_numservices(global_loadparm);s++) { struct loadparm_service *service = lp_servicebynum(global_loadparm, s); diff --git a/source4/web_server/http.c b/source4/web_server/http.c index d19a26ac0e..77a333f003 100644 --- a/source4/web_server/http.c +++ b/source4/web_server/http.c @@ -174,7 +174,7 @@ static int http_readFileFromSwatDir(EspHandle handle, int *len, const char *path) { - return http_readFile(handle, buf, len, path, lp_swat_directory()); + return http_readFile(handle, buf, len, path, lp_swat_directory(global_loadparm)); } @@ -388,7 +388,7 @@ static void http_simple_request(struct websrv_context *web) const char *path; struct stat st; - path = http_local_path(web, url, lp_swat_directory()); + path = http_local_path(web, url, lp_swat_directory(global_loadparm)); if (path == NULL) goto invalid; /* looks ok */ @@ -470,7 +470,7 @@ static void http_setup_arrays(struct esp_state *esp) talloc_asprintf(esp, "%u", socket_address->port)); } - SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory()); + SETVAR(ESP_SERVER_OBJ, "DOCUMENT_ROOT", lp_swat_directory(global_loadparm)); SETVAR(ESP_SERVER_OBJ, "SERVER_PROTOCOL", tls_enabled(web->conn->socket)?"https":"http"); SETVAR(ESP_SERVER_OBJ, "SERVER_SOFTWARE", "SAMBA"); SETVAR(ESP_SERVER_OBJ, "GATEWAY_INTERFACE", "CGI/1.1"); @@ -515,7 +515,7 @@ static void esp_request(struct esp_state *esp, const char *url) int res; char *emsg = NULL, *buf; - if (http_readFile(web, &buf, &size, url, lp_swat_directory()) != 0) { + if (http_readFile(web, &buf, &size, url, lp_swat_directory(global_loadparm)) != 0) { http_error_unix(web, url); return; } @@ -547,7 +547,7 @@ static BOOL http_preauth(struct esp_state *esp) { const char *path = http_local_path(esp->web, HTTP_PREAUTH_URI, - lp_swat_directory()); + lp_swat_directory(global_loadparm)); int i; if (path == NULL) { http_error(esp->web, 500, "Internal server error"); diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c index 221c792f14..2e80339871 100644 --- a/source4/web_server/web_server.c +++ b/source4/web_server/web_server.c @@ -241,7 +241,7 @@ static const struct stream_server_ops web_stream_ops = { static void websrv_task_init(struct task_server *task) { NTSTATUS status; - uint16_t port = lp_web_port(); + uint16_t port = lp_web_port(global_loadparm); const struct model_ops *model_ops; task_server_set_title(task, "task[websrv]"); @@ -250,7 +250,7 @@ static void websrv_task_init(struct task_server *task) model_ops = process_model_byname("single"); if (!model_ops) goto failed; - if (lp_interfaces() && lp_bind_interfaces_only()) { + if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) { int num_interfaces = iface_count(); int i; for(i = 0; i < num_interfaces; i++) { @@ -264,7 +264,7 @@ static void websrv_task_init(struct task_server *task) } else { status = stream_setup_socket(task->event_ctx, model_ops, &web_stream_ops, - "ipv4", lp_socket_address(), + "ipv4", lp_socket_address(global_loadparm), &port, task); if (!NT_STATUS_IS_OK(status)) goto failed; } diff --git a/source4/winbind/wb_cmd_getpwnam.c b/source4/winbind/wb_cmd_getpwnam.c index 059fae5201..653b598ac3 100644 --- a/source4/winbind/wb_cmd_getpwnam.c +++ b/source4/winbind/wb_cmd_getpwnam.c @@ -124,12 +124,12 @@ static void cmd_getpwnam_recv_user_info(struct composite_context *ctx) WBSRV_SAMBA3_SET_STRING(pw->pw_name, user_info->out.account_name); WBSRV_SAMBA3_SET_STRING(pw->pw_passwd, "*"); WBSRV_SAMBA3_SET_STRING(pw->pw_gecos, user_info->out.full_name); - WBSRV_SAMBA3_SET_STRING(pw->pw_dir, lp_template_homedir()); + WBSRV_SAMBA3_SET_STRING(pw->pw_dir, lp_template_homedir(global_loadparm)); all_string_sub(pw->pw_dir, "%WORKGROUP%", state->workgroup_name, sizeof(fstring) - 1); all_string_sub(pw->pw_dir, "%ACCOUNTNAME%", user_info->out.account_name, sizeof(fstring) - 1); - WBSRV_SAMBA3_SET_STRING(pw->pw_shell, lp_template_shell()); + WBSRV_SAMBA3_SET_STRING(pw->pw_shell, lp_template_shell(global_loadparm)); state->group_sid = dom_sid_dup(state, user_info->out.primary_group_sid); if(composite_nomem(state->group_sid, state->ctx)) return; diff --git a/source4/winbind/wb_cmd_getpwuid.c b/source4/winbind/wb_cmd_getpwuid.c index f47090d2a3..339f7e896c 100644 --- a/source4/winbind/wb_cmd_getpwuid.c +++ b/source4/winbind/wb_cmd_getpwuid.c @@ -148,12 +148,12 @@ static void cmd_getpwuid_recv_user_info(struct composite_context *ctx) WBSRV_SAMBA3_SET_STRING(pw->pw_name, user_info->out.account_name); WBSRV_SAMBA3_SET_STRING(pw->pw_passwd, "*"); WBSRV_SAMBA3_SET_STRING(pw->pw_gecos, user_info->out.full_name); - WBSRV_SAMBA3_SET_STRING(pw->pw_dir, lp_template_homedir()); + WBSRV_SAMBA3_SET_STRING(pw->pw_dir, lp_template_homedir(global_loadparm)); all_string_sub(pw->pw_dir, "%WORKGROUP%", state->workgroup, sizeof(fstring) - 1); all_string_sub(pw->pw_dir, "%ACCOUNTNAME%", user_info->out.account_name, sizeof(fstring) - 1); - WBSRV_SAMBA3_SET_STRING(pw->pw_shell, lp_template_shell()); + WBSRV_SAMBA3_SET_STRING(pw->pw_shell, lp_template_shell(global_loadparm)); pw->pw_uid = state->uid; diff --git a/source4/winbind/wb_dom_info.c b/source4/winbind/wb_dom_info.c index f07daaec9a..13d446897e 100644 --- a/source4/winbind/wb_dom_info.c +++ b/source4/winbind/wb_dom_info.c @@ -68,7 +68,8 @@ struct composite_context *wb_get_dom_info_send(TALLOC_CTX *mem_ctx, if (dom_sid == NULL) goto failed; ctx = finddcs_send(mem_ctx, domain_name, NBT_NAME_LOGON, - dom_sid, lp_name_resolve_order(), service->task->event_ctx, + dom_sid, lp_name_resolve_order(global_loadparm), + service->task->event_ctx, service->task->msg_ctx); if (ctx == NULL) goto failed; diff --git a/source4/winbind/wb_dom_info_trusted.c b/source4/winbind/wb_dom_info_trusted.c index c5e6383c5c..23436fa67a 100644 --- a/source4/winbind/wb_dom_info_trusted.c +++ b/source4/winbind/wb_dom_info_trusted.c @@ -193,7 +193,7 @@ static void trusted_dom_info_recv_dcname(struct rpc_request *req) make_nbt_name(&name, state->info->dcs[0].name, 0x20); ctx = resolve_name_send(&name, state->service->task->event_ctx, - lp_name_resolve_order()); + lp_name_resolve_order(global_loadparm)); composite_continue(state->ctx, ctx, trusted_dom_info_recv_dcaddr, state); diff --git a/source4/winbind/wb_init_domain.c b/source4/winbind/wb_init_domain.c index 21fbb6a2b7..7d050d5c67 100644 --- a/source4/winbind/wb_init_domain.c +++ b/source4/winbind/wb_init_domain.c @@ -151,7 +151,7 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx, cli_credentials_set_event_context(state->domain->libnet_ctx->cred, service->task->event_ctx); - cli_credentials_set_conf(state->domain->libnet_ctx->cred); + cli_credentials_set_conf(state->domain->libnet_ctx->cred, global_loadparm); /* Connect the machine account to the credentials */ state->ctx->status = @@ -163,14 +163,14 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx, state->domain->netlogon_pipe = NULL; if ((!cli_credentials_is_anonymous(state->domain->libnet_ctx->cred)) && - ((lp_server_role() == ROLE_DOMAIN_MEMBER) || - (lp_server_role() == ROLE_DOMAIN_CONTROLLER)) && + ((lp_server_role(global_loadparm) == ROLE_DOMAIN_MEMBER) || + (lp_server_role(global_loadparm) == ROLE_DOMAIN_CONTROLLER)) && (dom_sid_equal(state->domain->info->sid, state->service->primary_sid))) { state->domain->netlogon_binding->flags |= DCERPC_SCHANNEL; /* For debugging, it can be a real pain if all the traffic is encrypted */ - if (lp_winbind_sealed_pipes()) { + if (lp_winbind_sealed_pipes(global_loadparm)) { state->domain->netlogon_binding->flags |= (DCERPC_SIGN | DCERPC_SEAL ); } else { state->domain->netlogon_binding->flags |= (DCERPC_SIGN); @@ -216,7 +216,7 @@ static void init_domain_recv_netlogonpipe(struct composite_context *ctx) state->domain->lsa_binding = init_domain_binding(state, &ndr_table_lsarpc); /* For debugging, it can be a real pain if all the traffic is encrypted */ - if (lp_winbind_sealed_pipes()) { + if (lp_winbind_sealed_pipes(global_loadparm)) { state->domain->lsa_binding->flags |= (DCERPC_SIGN | DCERPC_SEAL ); } else { state->domain->lsa_binding->flags |= (DCERPC_SIGN); diff --git a/source4/winbind/wb_pam_auth.c b/source4/winbind/wb_pam_auth.c index ef19c32331..4a9be62228 100644 --- a/source4/winbind/wb_pam_auth.c +++ b/source4/winbind/wb_pam_auth.c @@ -172,7 +172,7 @@ static void pam_auth_crap_recv_logon(struct composite_context *ctx) state->unix_username = talloc_asprintf(state, "%s%s%s", state->domain_name, - lp_winbind_separator(), + lp_winbind_separator(global_loadparm), state->user_name); if (composite_nomem(state->unix_username, state->ctx)) return; @@ -217,11 +217,11 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx, DATA_BLOB chal, nt_resp, lm_resp, names_blob; int flags = CLI_CRED_NTLM_AUTH; - if (lp_client_lanman_auth()) { + if (lp_client_lanman_auth(global_loadparm)) { flags |= CLI_CRED_LANMAN_AUTH; } - if (lp_client_ntlmv2_auth()) { + if (lp_client_ntlmv2_auth(global_loadparm)) { flags |= CLI_CRED_NTLMv2_AUTH; } @@ -231,7 +231,7 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx, if (!credentials) { return NULL; } - cli_credentials_set_conf(credentials); + cli_credentials_set_conf(credentials, global_loadparm); cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED); cli_credentials_set_username(credentials, user, CRED_SPECIFIED); diff --git a/source4/winbind/wb_samba3_cmd.c b/source4/winbind/wb_samba3_cmd.c index 56a168ebb0..3ca2b02f4a 100644 --- a/source4/winbind/wb_samba3_cmd.c +++ b/source4/winbind/wb_samba3_cmd.c @@ -86,7 +86,7 @@ NTSTATUS wbsrv_samba3_interface_version(struct wbsrv_samba3_call *s3call) NTSTATUS wbsrv_samba3_info(struct wbsrv_samba3_call *s3call) { s3call->response.result = WINBINDD_OK; - s3call->response.data.info.winbind_separator = *lp_winbind_separator(); + s3call->response.data.info.winbind_separator = *lp_winbind_separator(global_loadparm); WBSRV_SAMBA3_SET_STRING(s3call->response.data.info.samba_version, SAMBA_VERSION_STRING); return NT_STATUS_OK; @@ -96,7 +96,7 @@ NTSTATUS wbsrv_samba3_domain_name(struct wbsrv_samba3_call *s3call) { s3call->response.result = WINBINDD_OK; WBSRV_SAMBA3_SET_STRING(s3call->response.data.domain_name, - lp_workgroup()); + lp_workgroup(global_loadparm)); return NT_STATUS_OK; } @@ -104,7 +104,7 @@ NTSTATUS wbsrv_samba3_netbios_name(struct wbsrv_samba3_call *s3call) { s3call->response.result = WINBINDD_OK; WBSRV_SAMBA3_SET_STRING(s3call->response.data.netbios_name, - lp_netbios_name()); + lp_netbios_name(global_loadparm)); return NT_STATUS_OK; } diff --git a/source4/winbind/wb_server.c b/source4/winbind/wb_server.c index 8a3f9e3154..161168e049 100644 --- a/source4/winbind/wb_server.c +++ b/source4/winbind/wb_server.c @@ -129,7 +129,7 @@ static void winbind_task_init(struct task_server *task) } /* Make sure the directory for the Samba3 socket exists, and is of the correct permissions */ - if (!directory_create_or_exist(lp_winbindd_socket_directory(), geteuid(), 0755)) { + if (!directory_create_or_exist(lp_winbindd_socket_directory(global_loadparm), geteuid(), 0755)) { task_server_terminate(task, "Cannot create winbindd pipe directory"); return; @@ -140,7 +140,7 @@ static void winbind_task_init(struct task_server *task) service->task = task; service->primary_sid = secrets_get_domain_sid(service, - lp_workgroup()); + lp_workgroup(global_loadparm)); if (service->primary_sid == NULL) { task_server_terminate( task, nt_errstr(NT_STATUS_CANT_ACCESS_DOMAIN_INFO)); @@ -151,7 +151,7 @@ static void winbind_task_init(struct task_server *task) listen_socket = talloc(service, struct wbsrv_listen_socket); if (!listen_socket) goto nomem; listen_socket->socket_path = talloc_asprintf(listen_socket, "%s/%s", - lp_winbindd_socket_directory(), + lp_winbindd_socket_directory(global_loadparm), WINBINDD_SAMBA3_SOCKET); if (!listen_socket->socket_path) goto nomem; listen_socket->service = service; diff --git a/source4/winbind/wb_sid2domain.c b/source4/winbind/wb_sid2domain.c index d813df00d1..8336449602 100644 --- a/source4/winbind/wb_sid2domain.c +++ b/source4/winbind/wb_sid2domain.c @@ -85,7 +85,7 @@ struct composite_context *wb_sid2domain_send(TALLOC_CTX *mem_ctx, if (dom_sid_equal(service->primary_sid, sid) || dom_sid_in_domain(service->primary_sid, sid)) { - ctx = wb_get_dom_info_send(state, service, lp_workgroup(), + ctx = wb_get_dom_info_send(state, service, lp_workgroup(global_loadparm), service->primary_sid); if (ctx == NULL) goto failed; ctx->async.fn = sid2domain_recv_dom_info; diff --git a/source4/winbind/wb_utils.c b/source4/winbind/wb_utils.c index b9d46af8c2..5fb14c1b4c 100644 --- a/source4/winbind/wb_utils.c +++ b/source4/winbind/wb_utils.c @@ -30,10 +30,10 @@ BOOL wb_samba3_split_username(TALLOC_CTX *mem_ctx, const char *domuser, char **domain, char **user) { - char *p = strchr(domuser, *lp_winbind_separator()); + char *p = strchr(domuser, *lp_winbind_separator(global_loadparm)); if (p == NULL) { - *domain = talloc_strdup(mem_ctx, lp_workgroup()); + *domain = talloc_strdup(mem_ctx, lp_workgroup(global_loadparm)); } else { *domain = talloc_strndup(mem_ctx, domuser, PTR_DIFF(p, domuser)); diff --git a/source4/wrepl_server/wrepl_in_connection.c b/source4/wrepl_server/wrepl_in_connection.c index e90c6fddfb..1178eb766e 100644 --- a/source4/wrepl_server/wrepl_in_connection.c +++ b/source4/wrepl_server/wrepl_in_connection.c @@ -270,7 +270,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service) return NT_STATUS_INTERNAL_ERROR; } - if (lp_interfaces() && lp_bind_interfaces_only()) { + if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) { int num_interfaces = iface_count(); int i; @@ -289,7 +289,7 @@ NTSTATUS wreplsrv_setup_sockets(struct wreplsrv_service *service) } } } else { - address = lp_socket_address(); + address = lp_socket_address(global_loadparm); status = stream_setup_socket(task->event_ctx, model_ops, &wreplsrv_stream_ops, "ipv4", address, &port, service); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index 503034cac1..be01cb3f24 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -35,7 +35,8 @@ static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx) { - return ldb_wrap_connect(mem_ctx, private_path(mem_ctx, lp_wins_config_url()), + return ldb_wrap_connect(mem_ctx, private_path(mem_ctx, + lp_wins_config_url(global_loadparm)), system_session(mem_ctx), NULL, 0, NULL); } @@ -494,7 +495,7 @@ static void wreplsrv_task_init(struct task_server *task) */ static NTSTATUS wreplsrv_init(struct event_context *event_ctx, const struct model_ops *model_ops) { - if (!lp_wins_support()) { + if (!lp_wins_support(global_loadparm)) { return NT_STATUS_OK; } |