char * ldap_int_hostname = NULL;
#endif
+#ifdef LDAP_R_COMPILE
+int ldap_int_stackguard;
+#endif
+
void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
{
if ( gopts->ldo_valid == LDAP_INITIALIZED ) {
return;
}
+#ifdef LDAP_R_COMPILE
+ if( getenv("LDAPSTACKGUARD") != NULL ) {
+ ldap_int_stackguard = 1;
+ }
+#endif
+
#ifdef HAVE_CYRUS_SASL
{
/* set authentication identity to current user name */
#ifdef LDAP_R_COMPILE
LDAP_V ( ldap_pvt_thread_mutex_t ) ldap_int_resolv_mutex;
LDAP_V ( ldap_pvt_thread_mutex_t ) ldap_int_hostname_mutex;
+LDAP_V ( int ) ldap_int_stackguard;
#ifdef HAVE_GSSAPI
LDAP_V( ldap_pvt_thread_mutex_t ) ldap_int_gssapi_mutex;
#include "ldap_thr_debug.h" /* May rename the symbols defined below */
#include <signal.h> /* For pthread_kill() */
+extern int ldap_int_stackguard;
+
#if HAVE_PTHREADS < 6
# define LDAP_INT_THREAD_ATTR_DEFAULT pthread_attr_default
# define LDAP_INT_THREAD_CONDATTR_DEFAULT pthread_condattr_default
#ifdef LDAP_PVT_THREAD_SET_STACK_SIZE
/* this should be tunable */
pthread_attr_setstacksize( &attr, LDAP_PVT_THREAD_STACK_SIZE );
+ if ( ldap_int_stackguard )
+ pthread_attr_setguardsize( &attr, LDAP_PVT_THREAD_STACK_SIZE );
#endif
#if HAVE_PTHREADS > 5