From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/smb_server/smb/negprot.c | 54 ++++++++++++++++++++------------------ source4/smb_server/smb/receive.c | 6 ++--- source4/smb_server/smb/service.c | 2 +- source4/smb_server/smb/sesssetup.c | 2 +- source4/smb_server/smb/signing.c | 4 +-- source4/smb_server/smb2/negprot.c | 3 ++- source4/smb_server/smb2/receive.c | 2 +- source4/smb_server/smb_server.c | 9 ++++--- 8 files changed, 43 insertions(+), 39 deletions(-) (limited to 'source4/smb_server') 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; } -- cgit