(ie: not backend specific).
/* assign a default depth limit for alias deref */
be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
- be->be_realm = global_realm != NULL
- ? ch_strdup( global_realm ) : NULL;
-
if(bi->bi_db_init) {
rc = bi->bi_db_init( be );
}
char *replogfile;
int global_lastmod = ON;
int global_idletimeout = 0;
+char *global_host = NULL;
char *global_realm = NULL;
char *ldap_srvtab = "";
char *default_passwd_hash;
default_passwd_hash = ch_strdup( cargv[1] );
}
+ /* set SASL host */
+ } else if ( strcasecmp( cargv[0], "sasl-host" ) == 0 ) {
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing host in \"sasl-host <host>\" line\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
+
+ if ( global_host != NULL ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: already set sasl-host!\n",
+ fname, lineno, 0 );
+ return 1;
+
+ } else {
+ global_host = ch_strdup( cargv[1] );
+ }
+
/* set SASL realm */
} else if ( strcasecmp( cargv[0], "sasl-realm" ) == 0 ) {
if ( cargc < 2 ) {
fname, lineno, 0 );
return( 1 );
}
- if ( be != NULL ) {
- be->be_realm = ch_strdup( cargv[1] );
- } else if ( global_realm != NULL ) {
+ if ( global_realm != NULL ) {
Debug( LDAP_DEBUG_ANY,
- "%s: line %d: already set global realm!\n",
+ "%s: line %d: already set sasl-realm!\n",
fname, lineno, 0 );
return 1;
LDAP_SLAPD_F (int) global_lastmod;
LDAP_SLAPD_F (int) global_idletimeout;
LDAP_SLAPD_F (int) global_schemacheck;
+LDAP_SLAPD_F (char) *global_host;
LDAP_SLAPD_F (char) *global_realm;
LDAP_SLAPD_F (char) *default_passwd_hash;
LDAP_SLAPD_F (int) lber_debug;
#include <lutil.h>
#endif
-static char *sasl_host = NULL;
static sasl_security_properties_t sasl_secprops;
return -1;
}
- if( sasl_host == NULL ) {
- sasl_host = ldap_pvt_get_fqdn( NULL );
- }
-
- Debug( LDAP_DEBUG_TRACE,
- "slap_sasl_init: %s initialized!\n",
- sasl_host, 0, 0 );
+ Debug( LDAP_DEBUG_TRACE, "slap_sasl_init: initialized!\n",
+ 0, 0, 0 );
/* default security properties */
memset( &sasl_secprops, '\0', sizeof(sasl_secprops) );
session_callbacks[2].proc = NULL;
session_callbacks[2].context = NULL;
+ if( global_host == NULL ) {
+ global_host = ldap_pvt_get_fqdn( NULL );
+ }
+
/* create new SASL context */
- sc = sasl_server_new( "ldap", sasl_host, global_realm,
+ sc = sasl_server_new( "ldap", global_host, global_realm,
session_callbacks, SASL_SECURITY_LAYER, &ctx );
if( sc != SASL_OK ) {