summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2007-09-01 18:34:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:30:28 -0500
commitc3678b45df9faba9680c0a4e790b446bb3e7ac62 (patch)
tree42acce0ad631fe26097a7cc24241a09a5cf94ede /source3
parent00737da4f4e47f43a2fcfcbcecc7d0b44c2dd774 (diff)
downloadsamba-c3678b45df9faba9680c0a4e790b446bb3e7ac62.tar.gz
samba-c3678b45df9faba9680c0a4e790b446bb3e7ac62.tar.bz2
samba-c3678b45df9faba9680c0a4e790b446bb3e7ac62.zip
r24864: - Correct failure of libsmbclient against a version of Windows found on a NAS
device. The device resets a NBT connection on port 139 when it receives a NetBIOS keepalive request. That request should be supported when NetBIOS is in use; Windows is behaving badly. libsmbclient needs a way to determine if a connection is still alive, and was using a NetBIOS keepalive request if port 139 was in use (on the assumption that it was probably NBT), and getpeername() when port 139 was not being used (assuming naked transport). This patch simplifies the code by exclusively using getpeername() to check whether a connection is still alive. The NetBIOS keepalive request is optional anyway (with preference being given to using TCP mechanisms for the same purpose), so this should be both simpler and more reliable. Derrell (This used to be commit 1f122352b02e3f4be9ac2d638b18807dafd05429)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/libsmbclient.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index 8d6ad57d90..f903f37d14 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -502,30 +502,8 @@ smbc_check_server(SMBCCTX * context,
socklen_t size;
struct sockaddr addr;
- /*
- * Although the use of port 139 is not a guarantee that we're using
- * netbios, we assume so. We don't want to send a keepalive packet if
- * not netbios because it's not valid, and Vista, at least,
- * disconnects the client on such a request.
- */
- if (server->cli->port == 139) {
- /* Assuming netbios. Send a keepalive packet */
- if ( send_keepalive(server->cli->fd) == False ) {
- return 1;
- }
- } else {
- /*
- * Assuming not netbios. Try a different method to detect if
- * the connection is still alive.
- */
- size = sizeof(addr);
- if (getpeername(server->cli->fd, &addr, &size) == -1) {
- return 1;
- }
- }
-
- /* connection is ok */
- return 0;
+ size = sizeof(addr);
+ return (getpeername(server->cli->fd, &addr, &size) == -1);
}
/*