summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-03-18 09:23:48 +0100
committerStefan Metzmacher <metze@samba.org>2010-03-22 17:15:11 +0100
commit977aa660f452d8ebc8f3a2f4bfbf0dda0bc230a2 (patch)
treee4019e2291fde7cf7f363ab2eb17adc5ee15766f /source3
parent8de8554628bd3b16d9e488adfc31c8014c2eb1db (diff)
downloadsamba-977aa660f452d8ebc8f3a2f4bfbf0dda0bc230a2.tar.gz
samba-977aa660f452d8ebc8f3a2f4bfbf0dda0bc230a2.tar.bz2
samba-977aa660f452d8ebc8f3a2f4bfbf0dda0bc230a2.zip
s3:smbd: smbd_[un]lock_socket() while accessing the socket to the client
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/process.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 3e27c0fa53..aaafad4167 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -65,6 +65,12 @@ bool srv_send_smb(int fd, char *buffer,
size_t nwritten=0;
ssize_t ret;
char *buf_out = buffer;
+ bool ok;
+
+ ok = smbd_lock_socket(smbd_server_conn);
+ if (!ok) {
+ exit_server_cleanly("failed to lock socket");
+ }
if (do_signing) {
/* Sign the outgoing packet if required. */
@@ -95,6 +101,12 @@ bool srv_send_smb(int fd, char *buffer,
srv_free_enc_buffer(buf_out);
out:
SMB_PERFCOUNT_END(pcd);
+
+ ok = smbd_unlock_socket(smbd_server_conn);
+ if (!ok) {
+ exit_server_cleanly("failed to unlock socket");
+ }
+
return true;
}
@@ -2113,14 +2125,25 @@ static void smbd_server_connection_read_handler(struct smbd_server_connection *c
NTSTATUS status;
uint32_t seqnum;
- /* TODO: make this completely nonblocking */
+ bool ok;
+ ok = smbd_lock_socket(conn);
+ if (!ok) {
+ exit_server_cleanly("failed to lock socket");
+ }
+
+ /* TODO: make this completely nonblocking */
status = receive_smb_talloc(mem_ctx, smbd_server_fd(),
(char **)(void *)&inbuf,
0, /* timeout */
&unread_bytes,
&encrypted,
&inbuf_len, &seqnum);
+ ok = smbd_unlock_socket(conn);
+ if (!ok) {
+ exit_server_cleanly("failed to unlock");
+ }
+
if (NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
goto process;
}