From f388115ef08f3f07288b3b832e96f51310aab8bc Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Thu, 29 Jun 2017 11:31:20 +0000 Subject: [PATCH] Merge r1551611, r1783765, r1788996, r1788998, r1789000, r1795651 from trunk: Log a warning when the LDAP authn provider is configured but an AuthLDAPURL isn't -- IOW, avoid silently skipping a misconfigured [or buggy?] LDAP provider. Follow up to r1772919: update APLOGNO(). Save a few cycles. 'apr_pstrcatv' can compute the length of the new string for us. Improve indentation Group bit field values in order to save some memory. Add an explicit NULL to initialise a field in an authn_provider structure, as done in all other places. PR 60636 Submitted by: covener, ylavic, jailletc36, jailletc36, jailletc36, jailletc36 Reviewed by: jailletc36, jim, ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1800268 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 18 ------------------ modules/aaa/mod_auth_digest.c | 2 +- modules/aaa/mod_authnz_ldap.c | 4 ++++ modules/cache/mod_cache_socache.c | 21 +++++++++++---------- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/STATUS b/STATUS index 1cfd5c5c7d..745963ba63 100644 --- a/STATUS +++ b/STATUS @@ -116,24 +116,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) Easy proposals: - - mod_authnz_ldap: Log a warning when the LDAP authn provider is configured - but an AuthLDAPURL isn't - - mod_auth_digest: Follow up to r1772919: update APLOGNO() - - mod_cache_socache: Save a few cycles - - mod_cache_socache: Improve indentation - - mod_cache_socache: Group bit field values in order to save some memory - - mod_authnz_ldap: Add an explicit NULL to initialise a field in an authn_provider - structure - trunk patch: http://svn.apache.org/r1551611 - http://svn.apache.org/r1783765 - http://svn.apache.org/r1788996 - http://svn.apache.org/r1788998 - http://svn.apache.org/r1789000 - http://svn.apache.org/r1795651 - 2.4.x patch: svn merge -c 1551611,1783765,1788996,1788998,1789000,1795651 ^/httpd/httpd/trunk . - +1: jailletc36, jim, ylavic - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/aaa/mod_auth_digest.c b/modules/aaa/mod_auth_digest.c index d998d322bc..d0c77dc569 100644 --- a/modules/aaa/mod_auth_digest.c +++ b/modules/aaa/mod_auth_digest.c @@ -842,7 +842,7 @@ static long gc(server_rec *s) if (err) { /* Nothing we can really do but log... */ - ap_log_error(APLOG_MARK, APLOG_ERR, err, s, APLOGNO() + ap_log_error(APLOG_MARK, APLOG_ERR, err, s, APLOGNO(10007) "Failed to free auth_digest client allocation"); } } diff --git a/modules/aaa/mod_authnz_ldap.c b/modules/aaa/mod_authnz_ldap.c index 2f987d8c5a..8cee7d47b1 100644 --- a/modules/aaa/mod_authnz_ldap.c +++ b/modules/aaa/mod_authnz_ldap.c @@ -490,6 +490,9 @@ static authn_status authn_ldap_check_password(request_rec *r, const char *user, * Basic sanity checks before any LDAP operations even happen. */ if (!sec->have_ldap_url) { + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02558) + "no AuthLDAPURL"); + return AUTH_GENERAL_ERROR; } @@ -1865,6 +1868,7 @@ static int authnz_ldap_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t * static const authn_provider authn_ldap_provider = { &authn_ldap_check_password, + NULL, }; static const authz_provider authz_ldapuser_provider = diff --git a/modules/cache/mod_cache_socache.c b/modules/cache/mod_cache_socache.c index 09b7823661..11e950285d 100644 --- a/modules/cache/mod_cache_socache.c +++ b/modules/cache/mod_cache_socache.c @@ -77,13 +77,13 @@ typedef struct cache_socache_object_t cache_socache_info_t socache_info; /* Header information. */ apr_size_t body_offset; /* offset to the start of the body */ apr_off_t body_length; /* length of the cached entity body */ - unsigned int newbody :1; /* whether a new body is present */ apr_time_t expire; /* when to expire the entry */ const char *name; /* Requested URI without vary bits - suitable for mortals. */ const char *key; /* On-disk prefix; URI with Vary bits (if present) */ apr_off_t offset; /* Max size to set aside */ apr_time_t timeout; /* Max time to set aside */ + unsigned int newbody :1; /* whether a new body is present */ unsigned int done :1; /* Is the attempt to cache complete? */ } cache_socache_object_t; @@ -270,7 +270,8 @@ static apr_status_t store_table(apr_table_t *table, unsigned char *buffer, } static const char* regen_key(apr_pool_t *p, apr_table_t *headers, - apr_array_header_t *varray, const char *oldkey) + apr_array_header_t *varray, const char *oldkey, + apr_size_t *newkeylen) { struct iovec *iov; int i, k; @@ -322,7 +323,7 @@ static const char* regen_key(apr_pool_t *p, apr_table_t *headers, iov[k].iov_len = strlen(oldkey); k++; - return apr_pstrcatv(p, iov, k, NULL); + return apr_pstrcatv(p, iov, k, newkeylen); } static int array_alphasort(const void *fn1, const void *fn2) @@ -526,7 +527,7 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key) return DECLINED; } - nkey = regen_key(r->pool, r->headers_in, varray, key); + nkey = regen_key(r->pool, r->headers_in, varray, key, &len); /* attempt to retrieve the cached entry */ if (socache_mutex) { @@ -542,7 +543,7 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *key) buffer_len = sobj->buffer_len; rc = conf->provider->socache_provider->retrieve( conf->provider->socache_instance, r->server, - (unsigned char *) nkey, strlen(nkey), sobj->buffer, + (unsigned char *) nkey, len, sobj->buffer, &buffer_len, r->pool); if (socache_mutex) { apr_status_t status = apr_global_mutex_unlock(socache_mutex); @@ -869,7 +870,7 @@ static apr_status_t store_headers(cache_handle_t *h, request_rec *r, } obj->key = sobj->key = regen_key(r->pool, sobj->headers_in, varray, - sobj->name); + sobj->name, NULL); } } @@ -1248,7 +1249,7 @@ static const char *set_cache_socache(cmd_parms *cmd, void *in_struct_ptr, name, AP_SOCACHE_PROVIDER_VERSION); if (provider->socache_provider == NULL) { err = apr_psprintf(cmd->pool, - "Unknown socache provider '%s'. Maybe you need " + "Unknown socache provider '%s'. Maybe you need " "to load the appropriate socache module " "(mod_socache_%s?)", name, name); } @@ -1416,7 +1417,7 @@ static int socache_precfg(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptmp) APR_LOCK_DEFAULT, 0); if (rv != APR_SUCCESS) { ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(02390) - "failed to register %s mutex", cache_socache_id); + "failed to register %s mutex", cache_socache_id); return 500; /* An HTTP status would be a misnomer! */ } @@ -1450,7 +1451,7 @@ static int socache_post_config(apr_pool_t *pconf, apr_pool_t *plog, NULL, s, pconf, 0); if (rv != APR_SUCCESS) { ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(02391) - "failed to create %s mutex", cache_socache_id); + "failed to create %s mutex", cache_socache_id); return 500; /* An HTTP status would be a misnomer! */ } apr_pool_cleanup_register(pconf, NULL, remove_lock, @@ -1471,7 +1472,7 @@ static int socache_post_config(apr_pool_t *pconf, apr_pool_t *plog, &socache_hints, s, pconf); if (rv != APR_SUCCESS) { ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, plog, APLOGNO(02393) - "failed to initialise %s cache", cache_socache_id); + "failed to initialise %s cache", cache_socache_id); return 500; /* An HTTP status would be a misnomer! */ } apr_pool_cleanup_register(pconf, (void *) s, destroy_cache, -- 2.50.1