]> git.sur5r.net Git - openldap/commitdiff
Add simple configure support for sockbuf max incoming
authorKurt Zeilenga <kurt@openldap.org>
Sat, 5 May 2001 07:29:21 +0000 (07:29 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 5 May 2001 07:29:21 +0000 (07:29 +0000)
servers/slapd/config.c
servers/slapd/connection.c
servers/slapd/proto-slap.h

index 16d1fc126cae9494161b2d0f4a65df56c8798674..761c9707310bdfc6dcd43a6c285e45fc7564f146 100644 (file)
@@ -41,6 +41,8 @@ char          *default_passwd_hash;
 char           *default_search_base = NULL;
 char           *default_search_nbase = NULL;
 
+ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
+
 char   *slapd_pid_file  = NULL;
 char   *slapd_args_file = NULL;
 
@@ -241,6 +243,43 @@ read_config( const char *fname )
 
                        ldap_pvt_thread_set_concurrency( c );
 
+               /* set sockbuf max */
+               } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming" ) == 0 ) {
+                       long max;
+                       if ( cargc < 2 ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                          "%s: line %d: missing max in \"sockbuf_max_incoming <bytes\" line\n",
+                                          fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                          "%s: line %d: missing max in \"sockbuf_max_incoming <bytes\" line\n",
+                                   fname, lineno, 0 );
+#endif
+
+                               return( 1 );
+                       }
+
+                       max = atol( cargv[1] );
+
+                       if( max < 0 ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                          "%s: line %d: invalid max value (%ld) in "
+                                          "\"sockbuf_max_incoming <bytes>\" line.\n",
+                                          fname, lineno, max ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: invalid max value (%ld) in "
+                                       "\"sockbuf_max_incoming <bytes>\" line.\n",
+                                   fname, lineno, max );
+#endif
+
+                               return( 1 );
+                       }
+
+                       sockbuf_max_incoming = max;
+
                /* default search base */
                } else if ( strcasecmp( cargv[0], "defaultSearchBase" ) == 0 ) {
                        if ( cargc < 2 ) {
index 56c4b1bfc0678aa2c84287622e8b45bbb883b926..fe26fee674acaadcb0445aa57e68feb350b66305 100644 (file)
@@ -424,7 +424,7 @@ long connection_init(
                c->c_sb = ber_sockbuf_alloc( );
 
                {
-                       ber_len_t max = SLAP_MAX_INCOMING;
+                       ber_len_t max = sockbuf_max_incoming;
                        ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
                }
 
@@ -635,7 +635,7 @@ connection_destroy( Connection *c )
        c->c_sb = ber_sockbuf_alloc( );
 
        {
-               ber_len_t max = SLAP_MAX_INCOMING;
+               ber_len_t max = sockbuf_max_incoming;
                ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max );
        }
 
index fb731da079e3a68ae92ab6d70e1b40df83428551..0fefcde2573f9b07134e46288f0e56f2340a8cf9 100644 (file)
@@ -792,6 +792,8 @@ LDAP_SLAPD_F (int)  krbv4_ldap_auth();
 /*
  * Other...
  */
+#define SLAP_SB_MAX_INCOMING_DEFAULT (1<<18 - 1)
+LDAP_SLAPD_F (ber_len_t) sockbuf_max_incoming;
 
 LDAP_SLAPD_F (slap_mask_t)     global_restrictops;
 LDAP_SLAPD_F (slap_mask_t)     global_allows;