diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-03 21:25:17 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:47:47 +0100 |
commit | b83a7a135f3247f553cb04173646b2d871b97235 (patch) | |
tree | 4b2ea9eab1a603a6324e78bc98f91e9f3150a348 /source4/smb_server | |
parent | 1f69adddc54d3b4b91df0ce639b3faccb85b2eb7 (diff) | |
download | samba-b83a7a135f3247f553cb04173646b2d871b97235.tar.gz samba-b83a7a135f3247f553cb04173646b2d871b97235.tar.bz2 samba-b83a7a135f3247f553cb04173646b2d871b97235.zip |
r26268: Avoid more use of global_loadparm - put lp_ctx in smb_server and wbsrv_connection.
(This used to be commit 7c008664238ed966cb82adf5b25b22157bb50730)
Diffstat (limited to 'source4/smb_server')
-rw-r--r-- | source4/smb_server/smb/negprot.c | 59 | ||||
-rw-r--r-- | source4/smb_server/smb/service.c | 2 | ||||
-rw-r--r-- | source4/smb_server/smb/sesssetup.c | 13 | ||||
-rw-r--r-- | source4/smb_server/smb/signing.c | 4 | ||||
-rw-r--r-- | source4/smb_server/smb2/negprot.c | 4 | ||||
-rw-r--r-- | source4/smb_server/smb2/receive.c | 2 | ||||
-rw-r--r-- | source4/smb_server/smb2/sesssetup.c | 2 | ||||
-rw-r--r-- | source4/smb_server/smb_server.c | 7 | ||||
-rw-r--r-- | source4/smb_server/smb_server.h | 2 |
9 files changed, 51 insertions, 44 deletions
diff --git a/source4/smb_server/smb/negprot.c b/source4/smb_server/smb/negprot.c index 81cfe43137..f92c542ef6 100644 --- a/source4/smb_server/smb/negprot.c +++ b/source4/smb_server/smb/negprot.c @@ -47,7 +47,7 @@ static NTSTATUS get_challenge(struct smbsrv_connection *smb_conn, uint8_t buff[8 nt_status = auth_context_create(smb_conn, smb_conn->connection->event.ctx, smb_conn->connection->msg_ctx, - global_loadparm, + smb_conn->lp_ctx, &smb_conn->negotiate.auth_context); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("auth_context_create() returned %s", nt_errstr(nt_status))); @@ -92,7 +92,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(global_loadparm)?1:0) | (lp_writeraw(global_loadparm)?2:0); + uint16_t raw = (lp_readraw(req->smb_conn->lp_ctx)?1:0) | (lp_writeraw(req->smb_conn->lp_ctx)?2:0); smbsrv_setup_reply(req, 13, 0); @@ -123,13 +123,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(global_loadparm)?1:0) | (lp_writeraw(global_loadparm)?2:0); + int raw = (lp_readraw(req->smb_conn->lp_ctx)?1:0) | (lp_writeraw(req->smb_conn->lp_ctx)?2:0); int secword=0; time_t t = req->request_time.tv_sec; - req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(global_loadparm); + req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(req->smb_conn->lp_ctx); - if (lp_security(global_loadparm) != SEC_SHARE) + if (lp_security(req->smb_conn->lp_ctx) != SEC_SHARE) secword |= NEGOTIATE_SECURITY_USER_LEVEL; if (req->smb_conn->negotiate.encrypted_passwords) @@ -146,7 +146,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(global_loadparm)); + SSVAL(req->out.vwv, VWV(3), lp_maxmux(req->smb_conn->lp_ctx)); 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); @@ -181,13 +181,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(global_loadparm)?1:0) | (lp_writeraw(global_loadparm)?2:0); + int raw = (lp_readraw(req->smb_conn->lp_ctx)?1:0) | (lp_writeraw(req->smb_conn->lp_ctx)?2:0); int secword=0; time_t t = req->request_time.tv_sec; - req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(global_loadparm); + req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(req->smb_conn->lp_ctx); - if (lp_security(global_loadparm) != SEC_SHARE) + if (lp_security(req->smb_conn->lp_ctx) != SEC_SHARE) secword |= NEGOTIATE_SECURITY_USER_LEVEL; if (req->smb_conn->negotiate.encrypted_passwords) @@ -200,7 +200,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(global_loadparm)); + SSVAL(req->out.vwv, VWV(3), lp_maxmux(req->smb_conn->lp_ctx)); 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); @@ -215,7 +215,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(global_loadparm), -1, STR_TERMINATE); + req_push_str(req, NULL, lp_workgroup(req->smb_conn->lp_ctx), -1, STR_TERMINATE); if (req->smb_conn->signing.mandatory_signing) { smbsrv_terminate_connection(req->smb_conn, @@ -237,8 +237,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(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); + req_push_str(req, NULL, lp_workgroup(req->smb_conn->lp_ctx), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); + req_push_str(req, NULL, lp_netbios_name(req->smb_conn->lp_ctx), -1, STR_UNICODE|STR_TERMINATE|STR_NOALIGN); DEBUG(3,("not using extended security (SPNEGO or NTLMSSP)\n")); } @@ -261,50 +261,51 @@ 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(global_loadparm); + req->smb_conn->negotiate.encrypted_passwords = lp_encrypted_passwords(req->smb_conn->lp_ctx); /* 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(global_loadparm) != SEC_SHARE) && - lp_use_spnego(global_loadparm) && + (lp_security(req->smb_conn->lp_ctx) != SEC_SHARE) && + lp_use_spnego(req->smb_conn->lp_ctx) && (req->flags2 & FLAGS2_EXTENDED_SECURITY)) { negotiate_spnego = true; capabilities |= CAP_EXTENDED_SECURITY; } - if (lp_unix_extensions(global_loadparm)) { + if (lp_unix_extensions(req->smb_conn->lp_ctx)) { capabilities |= CAP_UNIX; } - if (lp_large_readwrite(global_loadparm)) { + if (lp_large_readwrite(req->smb_conn->lp_ctx)) { capabilities |= CAP_LARGE_READX | CAP_LARGE_WRITEX | CAP_W2K_SMBS; } - large_test_path = lock_path(req, global_loadparm, "large_test.dat"); + large_test_path = lock_path(req, req->smb_conn->lp_ctx, "large_test.dat"); if (large_file_support(large_test_path)) { capabilities |= CAP_LARGE_FILES; } - if (lp_readraw(global_loadparm) && lp_writeraw(global_loadparm)) { + if (lp_readraw(req->smb_conn->lp_ctx) && + lp_writeraw(req->smb_conn->lp_ctx)) { capabilities |= CAP_RAW_MODE; } /* allow for disabling unicode */ - if (lp_unicode(global_loadparm)) { + if (lp_unicode(req->smb_conn->lp_ctx)) { capabilities |= CAP_UNICODE; } - if (lp_nt_status_support(global_loadparm)) { + if (lp_nt_status_support(req->smb_conn->lp_ctx)) { capabilities |= CAP_STATUS32; } - if (lp_host_msdfs(global_loadparm)) { + if (lp_host_msdfs(req->smb_conn->lp_ctx)) { capabilities |= CAP_DFS; } - if (lp_security(global_loadparm) != SEC_SHARE) { + if (lp_security(req->smb_conn->lp_ctx) != SEC_SHARE) { secword |= NEGOTIATE_SECURITY_USER_LEVEL; } @@ -331,7 +332,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(global_loadparm)); + SSVAL(req->out.vwv+1, VWV(1), lp_maxmux(req->smb_conn->lp_ctx)); 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 */ @@ -352,7 +353,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) nt_status = gensec_server_start(req->smb_conn, req->smb_conn->connection->event.ctx, - global_loadparm, + req->smb_conn->lp_ctx, req->smb_conn->connection->msg_ctx, &gensec_security); if (!NT_STATUS_IS_OK(nt_status)) { @@ -373,7 +374,7 @@ static void reply_nt1(struct smbsrv_request *req, uint16_t choice) return; } - cli_credentials_set_conf(server_credentials, global_loadparm); + cli_credentials_set_conf(server_credentials, req->smb_conn->lp_ctx); 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))); @@ -519,9 +520,9 @@ 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(global_loadparm)) + if (supported_protocols[protocol].protocol_level > lp_srv_maxprotocol(req->smb_conn->lp_ctx)) continue; - if (supported_protocols[protocol].protocol_level < lp_srv_minprotocol(global_loadparm)) + if (supported_protocols[protocol].protocol_level < lp_srv_minprotocol(req->smb_conn->lp_ctx)) continue; for (i = 0; i < protos_count; i++) { diff --git a/source4/smb_server/smb/service.c b/source4/smb_server/smb/service.c index 558f30307b..0e602f6a8b 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(global_loadparm)) { + if (share_bool_option(req->tcon->ntvfs->config, SHARE_MSDFS_ROOT, SHARE_MSDFS_ROOT_DEFAULT) && lp_host_msdfs(req->smb_conn->lp_ctx)) { 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 8cc16aaa68..de2141b808 100644 --- a/source4/smb_server/smb/sesssetup.c +++ b/source4/smb_server/smb/sesssetup.c @@ -40,7 +40,8 @@ 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(global_loadparm)); + (*domain) = talloc_asprintf(req, "%s", + lp_workgroup(req->smb_conn->lp_ctx)); } static void smbsrv_sesssetup_backend_send(struct smbsrv_request *req, @@ -69,7 +70,8 @@ static void sesssetup_old_send(struct auth_check_password_request *areq, if (!NT_STATUS_IS_OK(status)) goto failed; /* This references server_info into session_info */ - status = auth_generate_session_info(req, global_loadparm, server_info, &session_info); + status = auth_generate_session_info(req, req->smb_conn->lp_ctx, + server_info, &session_info); if (!NT_STATUS_IS_OK(status)) goto failed; /* allocate a new session */ @@ -164,7 +166,8 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq, if (!NT_STATUS_IS_OK(status)) goto failed; /* This references server_info into session_info */ - status = auth_generate_session_info(req, global_loadparm, server_info, &session_info); + status = auth_generate_session_info(req, req->smb_conn->lp_ctx, + server_info, &session_info); if (!NT_STATUS_IS_OK(status)) goto failed; /* allocate a new session */ @@ -246,7 +249,7 @@ static void sesssetup_nt1(struct smbsrv_request *req, union smb_sesssetup *sess) status = auth_context_create(req, req->smb_conn->connection->event.ctx, req->smb_conn->connection->msg_ctx, - global_loadparm, + req->smb_conn->lp_ctx, &auth_context); if (!NT_STATUS_IS_OK(status)) goto failed; } else { @@ -380,7 +383,7 @@ static void sesssetup_spnego(struct smbsrv_request *req, union smb_sesssetup *se status = gensec_server_start(req, req->smb_conn->connection->event.ctx, - global_loadparm, + req->smb_conn->lp_ctx, req->smb_conn->connection->msg_ctx, &gensec_ctx); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/smb_server/smb/signing.c b/source4/smb_server/smb/signing.c index b91a65ab84..146d8c7256 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(global_loadparm)) { + switch (lp_server_signing(smb_conn->lp_ctx)) { 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(global_loadparm)) { + if (lp_domain_logons(smb_conn->lp_ctx)) { 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 30160c9d5d..664079812a 100644 --- a/source4/smb_server/smb2/negprot.c +++ b/source4/smb_server/smb2/negprot.c @@ -39,7 +39,7 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB * nt_status = gensec_server_start(req, req->smb_conn->connection->event.ctx, - global_loadparm, + req->smb_conn->lp_ctx, req->smb_conn->connection->msg_ctx, &gensec_security); if (!NT_STATUS_IS_OK(nt_status)) { @@ -54,7 +54,7 @@ static NTSTATUS smb2srv_negprot_secblob(struct smb2srv_request *req, DATA_BLOB * return NT_STATUS_NO_MEMORY; } - cli_credentials_set_conf(server_credentials, global_loadparm); + cli_credentials_set_conf(server_credentials, req->smb_conn->lp_ctx); 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 a440c33dc0..cfae2dbe52 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(global_loadparm); + smb_conn->negotiate.max_recv = lp_max_xmit(smb_conn->lp_ctx); smb_conn->negotiate.zone_offset = get_time_zone(time(NULL)); diff --git a/source4/smb_server/smb2/sesssetup.c b/source4/smb_server/smb2/sesssetup.c index 5c8d0144be..636f5f0e27 100644 --- a/source4/smb_server/smb2/sesssetup.c +++ b/source4/smb_server/smb2/sesssetup.c @@ -122,7 +122,7 @@ static void smb2srv_sesssetup_backend(struct smb2srv_request *req, union smb_ses status = gensec_server_start(req, req->smb_conn->connection->event.ctx, - global_loadparm, + req->smb_conn->lp_ctx, req->smb_conn->connection->msg_ctx, &gensec_ctx); if (!NT_STATUS_IS_OK(status)) { diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c index 8ba93b9a59..59d9e8f7b3 100644 --- a/source4/smb_server/smb_server.c +++ b/source4/smb_server/smb_server.c @@ -42,7 +42,7 @@ static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob) /* see if its a special NBT packet */ if (CVAL(blob.data,0) != 0) { - status = smbsrv_init_smb_connection(smb_conn, global_loadparm); + status = smbsrv_init_smb_connection(smb_conn, smb_conn->lp_ctx); NT_STATUS_NOT_OK_RETURN(status); packet_set_callback(smb_conn->packet, smbsrv_recv_smb_request); return smbsrv_recv_smb_request(smb_conn, blob); @@ -58,12 +58,12 @@ static NTSTATUS smbsrv_recv_generic_request(void *private, DATA_BLOB blob) switch (protocol_version) { case SMB_MAGIC: - status = smbsrv_init_smb_connection(smb_conn, global_loadparm); + status = smbsrv_init_smb_connection(smb_conn, smb_conn->lp_ctx); NT_STATUS_NOT_OK_RETURN(status); 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(global_loadparm) < PROTOCOL_SMB2) break; + if (lp_srv_maxprotocol(smb_conn->lp_ctx) < 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); @@ -149,6 +149,7 @@ static void smbsrv_accept(struct stream_connection *conn) packet_set_fde(smb_conn->packet, conn->event.fde); packet_set_serialise(smb_conn->packet); + smb_conn->lp_ctx = global_loadparm; smb_conn->connection = conn; conn->private = smb_conn; diff --git a/source4/smb_server/smb_server.h b/source4/smb_server/smb_server.h index 5aa2e0b6ce..5644dfe6fb 100644 --- a/source4/smb_server/smb_server.h +++ b/source4/smb_server/smb_server.h @@ -374,6 +374,8 @@ struct smbsrv_connection { } statistics; struct share_context *share_context; + + struct loadparm_context *lp_ctx; }; struct model_ops; |