summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-01-05 14:35:11 +0100
committerVolker Lendecke <vl@samba.org>2011-01-07 13:28:07 +0100
commitdab6a35f4cf6a7e8a3c05319e891e06887d63998 (patch)
treee97a8aaf88b711b47e46d6eeed173f35d7cbf9e4 /source3/libsmb
parent0cff82e054cea6b473dcfa6de840ece7327ef6ca (diff)
downloadsamba-dab6a35f4cf6a7e8a3c05319e891e06887d63998.tar.gz
samba-dab6a35f4cf6a7e8a3c05319e891e06887d63998.tar.bz2
samba-dab6a35f4cf6a7e8a3c05319e891e06887d63998.zip
s3: Limit the number of unexpected clients to 200
DoS protection like the max winbind clients. Settable by nmbd:unexpected_clients
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/unexpected.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c
index 7ec5800e69..4543ffe7c6 100644
--- a/source3/libsmb/unexpected.c
+++ b/source3/libsmb/unexpected.c
@@ -481,6 +481,15 @@ static void nb_packet_server_listener(struct tevent_context *ev,
DLIST_ADD(server->clients, client);
server->num_clients += 1;
+
+ if (server->num_clients > server->max_clients) {
+ DEBUG(10, ("Too many clients, dropping oldest\n"));
+
+ /*
+ * no TALLOC_FREE here, don't mess with the list structs
+ */
+ talloc_free(server->clients->prev);
+ }
}
static ssize_t nb_packet_client_more(uint8_t *buf, size_t buflen,