From 26139388e1d48d5cf2ae3f6f03fd8cf3e8ae7667 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Thu, 8 Nov 2007 20:30:04 +0000 Subject: [PATCH] ITS#5209 Fix sasl_host may be different from global_host --- CHANGES | 1 + servers/slapd/bconfig.c | 2 +- servers/slapd/config.c | 1 + servers/slapd/main.c | 6 ++++++ servers/slapd/proto-slap.h | 1 + servers/slapd/sasl.c | 8 ++++---- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index f3b3eac589..f196f38770 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log OpenLDAP 2.4.7 Engineering Fixed slapd paged results control handling (ITS#5191) + Fixed slapd sasl-host parsing (ITS#5209) Fixed slapo-syncprov refresh and persist cookie sending (ITS#5210) Fixed slapo-syncprov ignore invalid cookies (ITS#5211) Documentation diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 451045bf93..d76ac9b1af 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -508,7 +508,7 @@ static ConfigTable config_back_cf_table[] = { &config_generic, NULL, NULL, NULL }, { "sasl-host", "host", 2, 2, 0, #ifdef HAVE_CYRUS_SASL - ARG_STRING|ARG_UNIQUE, &global_host, + ARG_STRING|ARG_UNIQUE, &sasl_host, #else ARG_IGNORED, NULL, #endif diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 2bcc5e47f3..4c8c9874e3 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -64,6 +64,7 @@ int global_gentlehup = 0; int global_idletimeout = 0; char *global_host = NULL; char *global_realm = NULL; +char *sasl_host = NULL; char **default_passwd_hash = NULL; struct berval default_search_base = BER_BVNULL; struct berval default_search_nbase = BER_BVNULL; diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 86b61dd0e2..c3de392799 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -832,6 +832,12 @@ unhandled_option:; } #endif +#ifdef HAVE_CYRUS_SASL + if( sasl_host == NULL ) { + sasl_host = ch_strdup( global_host ); + } +#endif + (void) SIGNAL( LDAP_SIGUSR1, slap_sig_wake ); (void) SIGNAL( LDAP_SIGUSR2, slap_sig_shutdown ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 11f05fec56..d53fd93cb0 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1879,6 +1879,7 @@ LDAP_SLAPD_V (int) global_gentlehup; LDAP_SLAPD_V (int) global_idletimeout; LDAP_SLAPD_V (char *) global_host; LDAP_SLAPD_V (char *) global_realm; +LDAP_SLAPD_V (char *) sasl_host; LDAP_SLAPD_V (char **) default_passwd_hash; LDAP_SLAPD_V (int) lber_debug; LDAP_SLAPD_V (int) ldap_syslog; diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 0b3288d2c4..7a757872f6 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -1279,8 +1279,8 @@ int slap_sasl_destroy( void ) #ifdef HAVE_CYRUS_SASL sasl_done(); #endif - free( global_host ); - global_host = NULL; + free( sasl_host ); + sasl_host = NULL; return 0; } @@ -1389,7 +1389,7 @@ int slap_sasl_open( Connection *conn, int reopen ) ipremoteport = slap_sasl_peer2ipport( &conn->c_peer_name ); } - sc = sasl_server_new( "ldap", global_host, global_realm, + sc = sasl_server_new( "ldap", sasl_host, global_realm, iplocalport, ipremoteport, session_callbacks, SASL_SUCCESS_DATA, &ctx ); if ( iplocalport != NULL ) { ch_free( iplocalport ); @@ -1398,7 +1398,7 @@ int slap_sasl_open( Connection *conn, int reopen ) ch_free( ipremoteport ); } #else - sc = sasl_server_new( "ldap", global_host, global_realm, + sc = sasl_server_new( "ldap", sasl_host, global_realm, session_callbacks, SASL_SECURITY_LAYER, &ctx ); #endif -- 2.39.2