From 11dbabfeb6128993d1873b32f8e28eb978326e66 Mon Sep 17 00:00:00 2001 From: Francesco Giacomini <francesco.giacomini@cnaf.infn.it> Date: Thu, 11 Nov 2021 15:57:43 +0000 Subject: [PATCH] Rely on the native compiler CentOS provides gcc 4.8.5, which has a decent support for C++14 features, enabled with -std=c++1y. In this way we don't need to bring in the devtoolset software collection. --- config.make | 2 ++ src/ngx_http_voms_module.cpp | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 config.make diff --git a/config.make b/config.make new file mode 100644 index 0000000..37d163e --- /dev/null +++ b/config.make @@ -0,0 +1,2 @@ +echo "objs/addon/src/ngx_http_voms_module.o: CFLAGS += --std=c++1y -Werror" >> $NGX_MAKEFILE + diff --git a/src/ngx_http_voms_module.cpp b/src/ngx_http_voms_module.cpp index bee998f..c76a9f7 100644 --- a/src/ngx_http_voms_module.cpp +++ b/src/ngx_http_voms_module.cpp @@ -328,7 +328,7 @@ static void cache_voms_ac(ngx_http_request_t* r, auto c = r->connection; auto cln = ngx_pool_cleanup_add(c->pool, 0); if (cln) { - auto r = ac_cache.insert({c, std::move(acp)}); + auto r = ac_cache.insert(std::make_pair(c, std::move(acp))); // we insert into the cache exactly once per connection assert(r.second); cln->handler = clean_voms_ac; @@ -353,7 +353,7 @@ static MaybeVomsAc const& get_voms_ac(ngx_http_request_t* r) MaybeVomsAc* acp = get_voms_ac_from_cache(r); if (!acp) { - auto p = std::make_unique<MaybeVomsAc>(retrieve_voms_ac_from_proxy(r)); + std::unique_ptr<MaybeVomsAc> p{new MaybeVomsAc(retrieve_voms_ac_from_proxy(r))}; acp = p.get(); cache_voms_ac(r, std::move(p)); } @@ -624,7 +624,7 @@ static ngx_int_t get_ssl_client_ee_cert_raw(ngx_http_request_t* r, { ngx_log_error(NGX_LOG_DEBUG, r->connection->log, 0, "%s", __func__); - *result = {}; + *result = {0, nullptr}; auto ee_cert = get_ee_cert(r); @@ -661,6 +661,15 @@ static ngx_int_t get_ssl_client_ee_cert_raw(ngx_http_request_t* r, return NGX_OK; } +namespace boost { +template <typename IteratorT, typename IntegerT> +inline iterator_range<IteratorT> make_iterator_range_n(IteratorT first, + IntegerT n) +{ + return iterator_range<IteratorT>(first, boost::next(first, n)); +} +} // namespace boost + static ngx_int_t get_ssl_client_ee_cert(ngx_http_request_t* r, ngx_http_variable_value_t* v, uintptr_t data) @@ -670,7 +679,7 @@ static ngx_int_t get_ssl_client_ee_cert(ngx_http_request_t* r, v->not_found = 1; v->valid = 0; - ngx_str_t cert{}; + ngx_str_t cert{0, nullptr}; if (get_ssl_client_ee_cert_raw(r, &cert) != NGX_OK) { return NGX_ERROR; -- GitLab