The branch, master has been updated
       via  f958867 s3: winbindd: On new client connect, prune idle or hung 
connections older than "winbind request timeout"
       via  2535803 s3: winbindd: Add new parameter "winbind request timeout" 
set to 60 seconds with man page.
      from  6d10418 tests: dnsserver: Add a update test with name set to '.'

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f9588675ea3cb2f1fabd07a4ea8b2138d65aee83
Author: Jeremy Allison <j...@samba.org>
Date:   Fri Jul 25 12:46:46 2014 -0700

    s3: winbindd: On new client connect, prune idle or hung connections older 
than "winbind request timeout"
    
    Bug 3204 winbindd: Exceeding 200 client connections, no idle connection 
found
    
    https://bugzilla.samba.org/show_bug.cgi?id=3204
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Ira Cooper <i...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Tue Jul 29 23:31:14 CEST 2014 on sn-devel-104

commit 2535803627687f390cae6a95e88f70ff4d6cc67a
Author: Jeremy Allison <j...@samba.org>
Date:   Fri Jul 25 12:44:53 2014 -0700

    s3: winbindd: Add new parameter "winbind request timeout" set to 60 seconds 
with man page.
    
    "This parameter specifies the number of seconds the winbindd
    daemon will wait before disconnecting either a client connection
    with no outstanding requests (idle) or a client connection with a
    request that has remained outstanding (hung) for longer than this
    number of seconds."
    
    Bug 3204 winbindd: Exceeding 200 client connections, no idle connection 
found
    
    https://bugzilla.samba.org/show_bug.cgi?id=3204
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Ira Cooper <i...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 .../smbdotconf/winbind/winbindrequesttimeout.xml   |   16 +++++++++
 lib/param/loadparm.c                               |    2 +
 lib/param/param_table.c                            |    9 +++++
 source3/param/loadparm.c                           |    1 +
 source3/winbindd/winbindd.c                        |   36 ++++++++++++++++++++
 5 files changed, 64 insertions(+), 0 deletions(-)
 create mode 100644 docs-xml/smbdotconf/winbind/winbindrequesttimeout.xml


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/winbind/winbindrequesttimeout.xml 
b/docs-xml/smbdotconf/winbind/winbindrequesttimeout.xml
new file mode 100644
index 0000000..3220871
--- /dev/null
+++ b/docs-xml/smbdotconf/winbind/winbindrequesttimeout.xml
@@ -0,0 +1,16 @@
+<samba:parameter name="winbind request timeout"
+                 context="G"
+                                type="integer"
+                 advanced="1" developer="1"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc";>
+<description>
+       <para>This parameter specifies the number of
+       seconds the <citerefentry><refentrytitle>winbindd</refentrytitle>
+       <manvolnum>8</manvolnum></citerefentry> daemon will wait before
+       disconnecting either a client connection with no outstanding
+       requests (idle) or a client connection with a request that has
+       remained outstanding (hung) for longer than this number of 
seconds.</para>
+</description>
+
+<value type="default">60</value>
+</samba:parameter>
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index b58a058..bc96dc3 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2509,6 +2509,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX 
*mem_ctx)
 
        lpcfg_do_global_parameter(lp_ctx, "winbind reconnect delay", "30");
 
+       lpcfg_do_global_parameter(lp_ctx, "winbind request timeout", "60");
+
        lpcfg_do_global_parameter(lp_ctx, "nt acl support", "yes");
 
        lpcfg_do_global_parameter(lp_ctx, "acl check permissions", "yes");
diff --git a/lib/param/param_table.c b/lib/param/param_table.c
index 79b9489..d3f60c3 100644
--- a/lib/param/param_table.c
+++ b/lib/param/param_table.c
@@ -4038,6 +4038,15 @@ struct parm_struct parm_table[] = {
                .flags          = FLAG_ADVANCED,
        },
        {
+               .label          = "winbind request timeout",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(winbind_request_timeout),
+               .special        = NULL,
+               .enum_list      = NULL,
+               .flags          = FLAG_ADVANCED,
+       },
+       {
                .label          = "winbind max clients",
                .type           = P_INTEGER,
                .p_class        = P_GLOBAL,
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index deaba21..13bd9b9 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -913,6 +913,7 @@ static void init_globals(bool reinit_globals)
 
        Globals.winbind_cache_time = 300;       /* 5 minutes */
        Globals.winbind_reconnect_delay = 30;   /* 30 seconds */
+       Globals.winbind_request_timeout = 60;   /* 60 seconds */
        Globals.winbind_max_clients = 200;
        Globals.winbind_enum_users = false;
        Globals.winbind_enum_groups = false;
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index a51a172..caa9ed1 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1031,6 +1031,41 @@ static bool remove_idle_client(void)
        return False;
 }
 
+/*
+ * Terminate all clients whose requests have taken longer than
+ * "winbind request timeout" seconds to process, or have been
+ * idle for more than "winbind request timeout" seconds.
+ */
+
+static void remove_timed_out_clients(void)
+{
+       struct winbindd_cli_state *state, *next = NULL;
+       time_t curr_time = time(NULL);
+       int timeout_val = lp_winbind_request_timeout();
+
+       for (state = winbindd_client_list(); state; state = next) {
+               time_t expiry_time;
+
+               next = state->next;
+               expiry_time = state->last_access + timeout_val;
+
+               if (curr_time > expiry_time) {
+                       if (client_is_idle(state)) {
+                               DEBUG(5,("Idle client timed out, "
+                                       "shutting down sock %d, pid %u\n",
+                                       state->sock,
+                                       (unsigned int)state->pid));
+                       } else {
+                               DEBUG(5,("Client request timed out, "
+                                       "shutting down sock %d, pid %u\n",
+                                       state->sock,
+                                       (unsigned int)state->pid));
+                       }
+                       remove_client(state);
+               }
+       }
+}
+
 struct winbindd_listen_state {
        bool privileged;
        int fd;
@@ -1056,6 +1091,7 @@ static void winbindd_listen_fde_handler(struct 
tevent_context *ev,
                        break;
                }
        }
+       remove_timed_out_clients();
        new_connection(s->fd, s->privileged);
 }
 


-- 
Samba Shared Repository

Reply via email to