From: Graham Leggett Date: Fri, 16 Feb 2018 12:37:30 +0000 (+0000) Subject: mod_authnz_ldap: Fix language long names detection as short name. X-Git-Tag: 2.4.30~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed789bf5c1874f60ee639d85e89e1f59e3d9f16e;p=apache mod_authnz_ldap: Fix language long names detection as short name. trunk patch: http://svn.apache.org/r1824336 +1: ylavic, elukey, rpluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1824456 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index d20a3472b2..0fad546769 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.30 + *) mod_authnz_ldap: Fix language long names detection as short name. + [Yann Ylavic] + *) mod_proxy: Worker schemes and hostnames which are too large are no longer fatal errors; it is logged and the truncated values are stored. [Jim Jagielski] diff --git a/STATUS b/STATUS index fdd0def06e..d60f484909 100644 --- a/STATUS +++ b/STATUS @@ -118,11 +118,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mod_authnz_ldap: Fix language long names detection as short name. - trunk patch: http://svn.apache.org/r1824336 - 2.4.x patch: trunk works (modulo CHANGES) - +1: ylavic, elukey, rpluem - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/aaa/mod_authnz_ldap.c b/modules/aaa/mod_authnz_ldap.c index 8cee7d47b1..98c48a8609 100644 --- a/modules/aaa/mod_authnz_ldap.c +++ b/modules/aaa/mod_authnz_ldap.c @@ -126,9 +126,13 @@ static char* derive_codepage_from_lang (apr_pool_t *p, char *language) charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING); - if (!charset) { - language[2] = '\0'; - charset = (char*) apr_hash_get(charset_conversions, language, APR_HASH_KEY_STRING); + /* + * Test if language values like 'en-US' return a match from the charset + * conversion map when shortened to 'en'. + */ + if (!charset && strlen(language) > 3 && language[2] == '-') { + char *language_short = apr_pstrndup(p, language, 2); + charset = (char*) apr_hash_get(charset_conversions, language_short, APR_HASH_KEY_STRING); } if (charset) {