summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-11-13 20:32:36 -0800
committerJeremy Allison <jra@samba.org>2010-11-14 05:22:45 +0000
commit52f252064817b4be4d45d9fdbb0ad07748a0f317 (patch)
treecebc18dd44724ff5ff1e03da4a3736f89ec32f06 /source3/nmbd
parent781c4aabb87e63df77c76a360b6ed5f6a20e6d58 (diff)
downloadsamba-52f252064817b4be4d45d9fdbb0ad07748a0f317.tar.gz
samba-52f252064817b4be4d45d9fdbb0ad07748a0f317.tar.bz2
samba-52f252064817b4be4d45d9fdbb0ad07748a0f317.zip
Fix the unexpected.tdb database problem. Change nmbd to store the
transaction id of packets it was requested to send via a client, and only store replies that match these ids. On the client side change clients to always attempt to ask nmbd first for name_query and node_status calls, and then fall back to doing socket calls if we can't talk to nmbd (either nmbd is not running, or we're not root and cannot open the messaging tdb's). Fix readers of unexpected.tdb to delete packets they've successfully read. This should fix a long standing problem of unexpected.tdb growing out of control in noisy NetBIOS envioronments with lots of bradcasts, yet still allow unprivileged client apps to work mostly as well as they already did (nmblookup for example) in an environment when nmbd isn't running. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sun Nov 14 05:22:45 UTC 2010 on sn-devel-104
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c4
-rw-r--r--source3/nmbd/nmbd_packets.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index d6943b19e6..30bbeaadee 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -460,7 +460,9 @@ static void msg_nmbd_send_packet(struct messaging_context *msg,
p->packet.dgram.header.source_port = 138;
}
- send_packet(p);
+ if (store_outstanding_send_packet(p)) {
+ send_packet(p);
+ }
}
/**************************************************************************** **
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index c80bac46b5..401eb25267 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1909,6 +1909,7 @@ bool listen_for_packets(bool run_election)
const char *packet_name;
int client_fd;
int client_port;
+ bool is_requested_send_reply = false;
if (sock_array[i] == -1) {
continue;
@@ -1937,6 +1938,8 @@ bool listen_for_packets(bool run_election)
continue;
}
+ is_requested_send_reply = is_requested_send_packet(packet);
+
/*
* If we got a packet on the broadcast socket and interfaces
* only is set then check it came from one of our local nets.
@@ -1950,7 +1953,8 @@ bool listen_for_packets(bool run_election)
continue;
}
- if ((is_loopback_ip_v4(packet->ip) || ismyip_v4(packet->ip)) &&
+ if (!is_requested_send_reply &&
+ (is_loopback_ip_v4(packet->ip) || ismyip_v4(packet->ip)) &&
packet->port == client_port)
{
if (client_port == DGRAM_PORT) {
@@ -1968,7 +1972,6 @@ bool listen_for_packets(bool run_election)
}
}
-
if (is_processed_packet(processed_packet_list, packet)) {
DEBUG(7,("discarding duplicate packet from %s:%d\n",
inet_ntoa(packet->ip),packet->port));