From 9a90cbea83548bffb224151a24005cb916f238f5 Mon Sep 17 00:00:00 2001 From: Steven Danneman Date: Tue, 17 Feb 2009 16:20:18 -0800 Subject: [PATCH] s3: Make change notify immediately return a catch-all packet on underlying error * This allows a problem in the underlying CN backend to be bubbled up to the general CN layer so a catch-all reply can be returned * We now also return a catch-all response immediately if the server-side event queue becomes too big --- source3/smbd/notify.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index e360af9ef5..8ceeaf5f55 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -372,13 +372,26 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name) if ((fsp->notify->num_changes > 1000) || (name == NULL)) { /* * The real number depends on the client buf, just provide a - * guard against a DoS here. + * guard against a DoS here. If name == NULL the CN backend is + * alerting us to a problem. Possibly dropped events. Clear + * queued changes and send the catch-all response to the client + * if a request is pending. */ TALLOC_FREE(fsp->notify->changes); fsp->notify->num_changes = -1; + if (fsp->notify->requests != NULL) { + change_notify_reply(fsp->conn, + fsp->notify->requests->req, + fsp->notify->requests->max_param, + fsp->notify); + change_notify_remove_request(fsp->notify->requests); + } return; } + /* If we've exceeded the server side queue or received a NULL name + * from the underlying CN implementation, don't queue up any more + * requests until we can send a catch-all response to the client */ if (fsp->notify->num_changes == -1) { return; } -- 2.34.1