summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-07-11 13:56:10 +0200
committerStefan Metzmacher <metze@samba.org>2011-07-11 18:18:28 +0200
commit1f50d04a5cf3ec8909ebf5b7547adef2b16af0cb (patch)
tree60a799be67165339b048eef2992a9db674fdc0ec
parent8c29afe14ecc474d94314c55d730760754f2f067 (diff)
downloadsamba-1f50d04a5cf3ec8909ebf5b7547adef2b16af0cb.tar.gz
samba-1f50d04a5cf3ec8909ebf5b7547adef2b16af0cb.tar.xz
samba-1f50d04a5cf3ec8909ebf5b7547adef2b16af0cb.zip
s3:auth_server: use cli_echo() to check if the server is alive
This works over port 139 and also 445. send_keepalive() would only work on port 139. metze
-rw-r--r--source3/auth/auth_server.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index a942c74bf6..1b7993bb9c 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -158,20 +158,25 @@ static bool send_server_keepalive(const struct timeval *now,
{
struct server_security_state *state = talloc_get_type_abort(
private_data, struct server_security_state);
+ NTSTATUS status;
+ unsigned char garbage[16];
if (!cli_state_is_connected(state->cli)) {
return false;
}
- if (send_keepalive(state->cli->fd)) {
- return True;
+ /* Ping the server to keep the connection alive using SMBecho. */
+ memset(garbage, 0xf0, sizeof(garbage));
+ status = cli_echo(state->cli, 1, data_blob_const(garbage, sizeof(garbage)));
+ if (NT_STATUS_IS_OK(status)) {
+ return true;
}
- DEBUG( 2, ( "send_server_keepalive: password server keepalive "
- "failed.\n"));
+ DEBUG(2,("send_server_keepalive: password server SMBecho failed: %s\n",
+ nt_errstr(status)));
cli_shutdown(state->cli);
state->cli = NULL;
- return False;
+ return false;
}
static int destroy_server_security(struct server_security_state *state)