Allows changing the maximum number of simultaneous clients in winbindd through an...
authorPierre Carrier <pcarrier@redhat.com>
Tue, 14 Sep 2010 23:43:39 +0000 (16:43 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 24 Oct 2011 17:16:18 +0000 (19:16 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Fix bug #8186 (Allows changing the maximum number of simultaneous clients in
winbindd through an smb.conf option).
(cherry picked from commit b6f691ede0a80aaf7226b6862120b5052e63668d)

docs-xml/smbdotconf/winbind/winbindmaxclients.xml [new file with mode: 0644]
source3/include/local.h
source3/include/proto.h
source3/param/loadparm.c
source3/winbindd/winbindd.c

diff --git a/docs-xml/smbdotconf/winbind/winbindmaxclients.xml b/docs-xml/smbdotconf/winbind/winbindmaxclients.xml
new file mode 100644 (file)
index 0000000..ae49e45
--- /dev/null
@@ -0,0 +1,14 @@
+<samba:parameter name="winbind max clients"
+                 context="G"
+                                type="integer"
+                 advanced="1" developer="1"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+       <para>This parameter specifies the maximum number of clients
+       the <citerefentry><refentrytitle>winbindd</refentrytitle>
+       <manvolnum>8</manvolnum></citerefentry> daemon can connect with.
+       </para>
+</description>
+
+<value type="default">200</value>
+</samba:parameter>
index d65cc001a91d99158885df62120626d973175949..6153a2a00f9902a908f3f42acc8bab7f6d5d9d9c 100644 (file)
 /* Number in seconds for winbindd to wait for the mutex. Make this 2 * smbd wait time. */
 #define WINBIND_SERVER_MUTEX_WAIT_TIME (( ((NUM_CLI_AUTH_CONNECT_RETRIES) * ((CLI_AUTH_TIMEOUT)/1000)) + 5)*2)
 
-/* Max number of simultaneous winbindd socket connections. */
-#define WINBINDD_MAX_SIMULTANEOUS_CLIENTS 200
-
 /* Buffer size to use when printing backtraces */
 #define BACKTRACE_STACK_SIZE 64
 
index c5065e2c17327b98cc06dafd3c75de34fe9b9131..2b20cc4f473ae713056f5f3745d8083772b25aac 100644 (file)
@@ -4264,6 +4264,7 @@ int lp_smb_encrypt(int );
 char lp_magicchar(const struct share_params *p );
 int lp_winbind_cache_time(void);
 int lp_winbind_reconnect_delay(void);
+int lp_winbind_max_clients(void);
 const char **lp_winbind_nss_info(void);
 int lp_algorithmic_rid_base(void);
 int lp_name_cache_timeout(void);
index 1ad067b32c42a3544acbea36cab521fbc501938a..08b6532b52d0f380956d8f8daa094a85ab19c639 100644 (file)
@@ -251,7 +251,7 @@ struct global {
        int oplock_break_wait_time;
        int winbind_cache_time;
        int winbind_reconnect_delay;
-       int winbind_max_idle_children;
+       int winbind_max_clients;
        char **szWinbindNssInfo;
        int iLockSpinTime;
        char *szLdapMachineSuffix;
@@ -4551,6 +4551,15 @@ static struct parm_struct parm_table[] = {
                .enum_list      = NULL,
                .flags          = FLAG_ADVANCED,
        },
+       {
+               .label          = "winbind max clients",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .ptr            = &Globals.winbind_max_clients,
+               .special        = NULL,
+               .enum_list      = NULL,
+               .flags          = FLAG_ADVANCED,
+       },
        {
                .label          = "winbind enum users",
                .type           = P_BOOL,
@@ -5177,6 +5186,7 @@ static void init_globals(bool first_time_only)
 
        Globals.winbind_cache_time = 300;       /* 5 minutes */
        Globals.winbind_reconnect_delay = 30;   /* 30 seconds */
+       Globals.winbind_max_clients = 200;
        Globals.bWinbindEnumUsers = False;
        Globals.bWinbindEnumGroups = False;
        Globals.bWinbindUseDefaultDomain = False;
@@ -5744,6 +5754,7 @@ FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
 FN_LOCAL_CHAR(lp_magicchar, magic_char)
 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
+FN_GLOBAL_INTEGER(lp_winbind_max_clients, &Globals.winbind_max_clients)
 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
index 70749c53afc9e3360cc0543b680ee4a834b9d5e0..034e43be04978f7a9ff677c3a4b0b3e8fc41e95a 100644 (file)
@@ -903,17 +903,15 @@ static void winbindd_listen_fde_handler(struct tevent_context *ev,
        struct winbindd_listen_state *s = talloc_get_type_abort(private_data,
                                          struct winbindd_listen_state);
 
-       while (winbindd_num_clients() >
-              WINBINDD_MAX_SIMULTANEOUS_CLIENTS - 1) {
+       while (winbindd_num_clients() > lp_winbind_max_clients() - 1) {
                DEBUG(5,("winbindd: Exceeding %d client "
                         "connections, removing idle "
-                        "connection.\n",
-                        WINBINDD_MAX_SIMULTANEOUS_CLIENTS));
+                        "connection.\n", lp_winbind_max_clients()));
                if (!remove_idle_client()) {
                        DEBUG(0,("winbindd: Exceeding %d "
                                 "client connections, no idle "
                                 "connection found\n",
-                                WINBINDD_MAX_SIMULTANEOUS_CLIENTS));
+                                lp_winbind_max_clients()));
                        break;
                }
        }