summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-03-19 12:02:27 +0100
committerStefan Metzmacher <metze@samba.org>2010-03-22 17:15:11 +0100
commitc1653e3b0e536e835faf82a5aadadaec1cd38d1a (patch)
tree128bd3a739ec9f4906dda0e31ec739885d8b059a
parent977aa660f452d8ebc8f3a2f4bfbf0dda0bc230a2 (diff)
downloadsamba-c1653e3b0e536e835faf82a5aadadaec1cd38d1a.tar.gz
samba-c1653e3b0e536e835faf82a5aadadaec1cd38d1a.tar.bz2
samba-c1653e3b0e536e835faf82a5aadadaec1cd38d1a.zip
s3:smbd: send keepalive packets under the socket lock
metze
-rw-r--r--source3/smbd/process.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index aaafad4167..e1e4e77634 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2234,7 +2234,22 @@ static int client_get_tcp_info(struct sockaddr_storage *server,
*/
static bool keepalive_fn(const struct timeval *now, void *private_data)
{
- if (!send_keepalive(smbd_server_fd())) {
+ bool ok;
+ bool ret;
+
+ ok = smbd_lock_socket(smbd_server_conn);
+ if (!ok) {
+ exit_server_cleanly("failed to lock socket");
+ }
+
+ ret = send_keepalive(smbd_server_fd());
+
+ ok = smbd_unlock_socket(smbd_server_conn);
+ if (!ok) {
+ exit_server_cleanly("failed to unlock socket");
+ }
+
+ if (!ret) {
DEBUG( 2, ( "Keepalive failed - exiting.\n" ) );
return False;
}