From 236f1dfa9ae507940a53301f31da7974456c82fe Mon Sep 17 00:00:00 2001 From: "J. Eric Ivancich" Date: Tue, 2 Apr 2024 23:10:12 -0400 Subject: [PATCH] rgw: udpate options yaml file so LDAP uri isn't an invalid example LDAP tries to bind the URI configuration option when RGW starts. The default value is an example used to show the form of the URI and is not itself valid. The default value is used, unless overrideen, and can cause delays in start-up in some situations. The example is now provided in the description and the default is the empty string. Signed-off-by: J. Eric Ivancich --- src/common/options/rgw.yaml.in | 4 ++-- src/rgw/rgw_appmain.cc | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/common/options/rgw.yaml.in b/src/common/options/rgw.yaml.in index 52e69dae959ca..27c76d6803ab6 100644 --- a/src/common/options/rgw.yaml.in +++ b/src/common/options/rgw.yaml.in @@ -913,8 +913,8 @@ options: - name: rgw_ldap_uri type: str level: advanced - desc: Space-separated list of LDAP servers in URI format. - default: ldaps:// + desc: Space-separated list of LDAP servers in URI format, e.g., "ldaps://". + default: services: - rgw with_legacy: true diff --git a/src/rgw/rgw_appmain.cc b/src/rgw/rgw_appmain.cc index b4aa1019a7398..bba32e3dfa8dc 100644 --- a/src/rgw/rgw_appmain.cc +++ b/src/rgw/rgw_appmain.cc @@ -381,6 +381,11 @@ void rgw::AppMain::init_ldap() const string &ldap_dnattr = cct->_conf->rgw_ldap_dnattr; std::string ldap_bindpw = parse_rgw_ldap_bindpw(cct); + if (ldap_uri.empty()) { + derr << "LDAP not started since no server URIs were provided in the configuration." << dendl; + return; + } + ldh.reset(new rgw::LDAPHelper(ldap_uri, ldap_binddn, ldap_bindpw.c_str(), ldap_searchdn, ldap_searchfilter, ldap_dnattr)); ldh->init(); @@ -603,7 +608,7 @@ void rgw::AppMain::shutdown(std::function finalize_async_signals) fe->stop(); } - ldh.reset(nullptr); // deletes + ldh.reset(nullptr); // deletes ldap helper if it was created rgw_log_usage_finalize(); delete olog; -- 2.39.5