summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-24 23:41:43 +0200
committerStefan Metzmacher <metze@samba.org>2012-05-25 11:01:27 +0200
commite17fa58d6ee8bf190adba25462d9d97b26ca2c8f (patch)
treebe86f709e5ad9b52f8381a4aa90700b4b71a51e2 /source3
parent167cccbc1990dbfb2b47f6aeb1168673a8817bd8 (diff)
downloadsamba-e17fa58d6ee8bf190adba25462d9d97b26ca2c8f.tar.gz
samba-e17fa58d6ee8bf190adba25462d9d97b26ca2c8f.tar.bz2
samba-e17fa58d6ee8bf190adba25462d9d97b26ca2c8f.zip
s3:smbd: move global smbd_msg_state to smbXsrv_connection
metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri May 25 11:01:27 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/globals.c2
-rw-r--r--source3/smbd/globals.h3
-rw-r--r--source3/smbd/message.c34
3 files changed, 21 insertions, 18 deletions
diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c
index 807271b320..f107c0e661 100644
--- a/source3/smbd/globals.c
+++ b/source3/smbd/globals.c
@@ -54,8 +54,6 @@ TDB_CONTEXT *tdb_mangled_cache = NULL;
*/
unsigned mangle_prefix = 0;
-struct msg_state *smbd_msg_state = NULL;
-
bool logged_ioctl_message = false;
time_t last_smb_conf_reload_time = 0;
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index b334e2593a..ccf79fe5ff 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -58,7 +58,6 @@ extern struct tdb_context *tdb_mangled_cache;
extern unsigned mangle_prefix;
struct msg_state;
-extern struct msg_state *smbd_msg_state;
extern bool logged_ioctl_message;
@@ -351,6 +350,8 @@ struct smbXsrv_connection {
uint32_t max_write;
} server;
} smb2;
+
+ struct msg_state *msg_state;
};
NTSTATUS smbXsrv_connection_init_tables(struct smbXsrv_connection *conn,
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 63b08e1262..8ae588b511 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -200,11 +200,11 @@ void reply_sendstrt(struct smb_request *req)
return;
}
- TALLOC_FREE(smbd_msg_state);
+ TALLOC_FREE(req->sconn->conn->msg_state);
- smbd_msg_state = talloc_zero(NULL, struct msg_state);
+ req->sconn->conn->msg_state = talloc_zero(NULL, struct msg_state);
- if (smbd_msg_state == NULL) {
+ if (req->sconn->conn->msg_state == NULL) {
reply_nterror(req, NT_STATUS_NO_MEMORY);
END_PROFILE(SMBsendstrt);
return;
@@ -212,14 +212,17 @@ void reply_sendstrt(struct smb_request *req)
p = (const char *)req->buf+1;
p += srvstr_pull_req_talloc(
- smbd_msg_state, req, &smbd_msg_state->from, p,
+ req->sconn->conn->msg_state, req,
+ &req->sconn->conn->msg_state->from, p,
STR_ASCII|STR_TERMINATE) + 1;
p += srvstr_pull_req_talloc(
- smbd_msg_state, req, &smbd_msg_state->to, p,
+ req->sconn->conn->msg_state, req,
+ &req->sconn->conn->msg_state->to, p,
STR_ASCII|STR_TERMINATE) + 1;
- DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", smbd_msg_state->from,
- smbd_msg_state->to ) );
+ DEBUG(3, ("SMBsendstrt (from %s to %s)\n",
+ req->sconn->conn->msg_state->from,
+ req->sconn->conn->msg_state->to));
reply_outbuf(req, 0, 0);
@@ -247,7 +250,7 @@ void reply_sendtxt(struct smb_request *req)
return;
}
- if ((smbd_msg_state == NULL) || (req->buflen < 3)) {
+ if ((req->sconn->conn->msg_state == NULL) || (req->buflen < 3)) {
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBsendtxt);
return;
@@ -255,12 +258,13 @@ void reply_sendtxt(struct smb_request *req)
msg = (const char *)req->buf + 1;
- old_len = talloc_get_size(smbd_msg_state->msg);
+ old_len = talloc_get_size(req->sconn->conn->msg_state->msg);
len = MIN(SVAL(msg, 0), smbreq_bufrem(req, msg+2));
- tmp = talloc_realloc(smbd_msg_state, smbd_msg_state->msg,
- char, old_len + len);
+ tmp = talloc_realloc(req->sconn->conn->msg_state,
+ req->sconn->conn->msg_state->msg,
+ char, old_len + len);
if (tmp == NULL) {
reply_nterror(req, NT_STATUS_NO_MEMORY);
@@ -268,9 +272,9 @@ void reply_sendtxt(struct smb_request *req)
return;
}
- smbd_msg_state->msg = tmp;
+ req->sconn->conn->msg_state->msg = tmp;
- memcpy(&smbd_msg_state->msg[old_len], msg+2, len);
+ memcpy(&req->sconn->conn->msg_state->msg[old_len], msg+2, len);
DEBUG( 3, ( "SMBsendtxt\n" ) );
@@ -297,9 +301,9 @@ void reply_sendend(struct smb_request *req)
DEBUG(3,("SMBsendend\n"));
- msg_deliver(smbd_msg_state);
+ msg_deliver(req->sconn->conn->msg_state);
- TALLOC_FREE(smbd_msg_state);
+ TALLOC_FREE(req->sconn->conn->msg_state);
reply_outbuf(req, 0, 0);