Commit 40550776 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Add simple configure support for sockbuf max incoming

parent be26f1a9
......@@ -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 ) {
......
......@@ -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 );
}
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment