Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 50B36200B41 for ; Thu, 7 Jul 2016 17:06:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4F3B6160A68; Thu, 7 Jul 2016 15:06:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 73E5B160A4F for ; Thu, 7 Jul 2016 17:06:29 +0200 (CEST) Received: (qmail 15007 invoked by uid 500); 7 Jul 2016 15:06:28 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 14998 invoked by uid 99); 7 Jul 2016 15:06:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2016 15:06:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 44EC0C63AC for ; Thu, 7 Jul 2016 15:06:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.513 X-Spam-Level: X-Spam-Status: No, score=0.513 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.287] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 9xfKj8YTeaog for ; Thu, 7 Jul 2016 15:06:27 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTP id 4999C5F47B for ; Thu, 7 Jul 2016 15:06:27 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 6C16FE0099 for ; Thu, 7 Jul 2016 15:06:26 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 1789F3A0051 for ; Thu, 7 Jul 2016 15:06:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1751808 - in /apr/apr-util/branches/1.5.x: ./ CHANGES crypto/apr_crypto.c crypto/apr_crypto_nss.c Date: Thu, 07 Jul 2016 15:06:25 -0000 To: commits@apr.apache.org From: minfrin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160707150626.1789F3A0051@svn01-us-west.apache.org> archived-at: Thu, 07 Jul 2016 15:06:30 -0000 Author: minfrin Date: Thu Jul 7 15:06:25 2016 New Revision: 1751808 URL: http://svn.apache.org/viewvc?rev=1751808&view=rev Log: Backport r1751806 apr_crypto: Don't cache the driver if initialisation fails. This stops the second and subsequent attempt to use the API from failing claiming the library is not initialised. Modified: apr/apr-util/branches/1.5.x/ (props changed) apr/apr-util/branches/1.5.x/CHANGES apr/apr-util/branches/1.5.x/crypto/apr_crypto.c apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c Propchange: apr/apr-util/branches/1.5.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Jul 7 15:06:25 2016 @@ -1,4 +1,4 @@ -/apr/apr/trunk:781403,781409,784519,784592,789965,794508,917837-917838,982408-982409,998533,1086937,1127053,1127648,1128838,1129433,1133587,1207704,1210524,1211987,1214516,1308087,1308131,1308318,1327636,1340286,1346865,1357761,1357772,1357780,1357966,1357968,1357979,1358295,1358480,1361811,1362241,1362248,1362252,1362255,1363076,1369681,1370626,1371811,1371817,1371919,1371923,1382174,1389154,1389169,1390461,1390477,1402870,1402897,1402903,1402907,1406088,1422413,1425356,1426442,1426448,1438960,1449308,1449314,1460185,1460243-1460244,1462219,1462224,1484271,1493715,1495887,1495889,1496407,1516261,1523479,1529554,1531009,1541054,1543399,1544846,1618843,1619438,1625247,1626561,1648830,1711657,1722547,1728958,1728963 +/apr/apr/trunk:781403,781409,784519,784592,789965,794508,917837-917838,982408-982409,998533,1086937,1127053,1127648,1128838,1129433,1133587,1207704,1210524,1211987,1214516,1308087,1308131,1308318,1327636,1340286,1346865,1357761,1357772,1357780,1357966,1357968,1357979,1358295,1358480,1361811,1362241,1362248,1362252,1362255,1363076,1369681,1370626,1371811,1371817,1371919,1371923,1382174,1389154,1389169,1390461,1390477,1402870,1402897,1402903,1402907,1406088,1422413,1425356,1426442,1426448,1438960,1449308,1449314,1460185,1460243-1460244,1462219,1462224,1484271,1493715,1495887,1495889,1496407,1516261,1523479,1529554,1531009,1541054,1543399,1544846,1618843,1619438,1625247,1626561,1648830,1711657,1722547,1728958,1728963,1751806 /apr/apr-util/branches/1.3.x:896410,1154885 /apr/apr-util/branches/1.4.x:1126217,1211211,1211219,1211223,1211330 /apr/apr-util/trunk:731033-731034,731225,731236,731291,731293,731379,743986,744009,745771,747612,747623,747630,1626561 Modified: apr/apr-util/branches/1.5.x/CHANGES URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/CHANGES?rev=1751808&r1=1751807&r2=1751808&view=diff ============================================================================== --- apr/apr-util/branches/1.5.x/CHANGES [utf-8] (original) +++ apr/apr-util/branches/1.5.x/CHANGES [utf-8] Thu Jul 7 15:06:25 2016 @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with APR-util 1.5.5 + *) apr_crypto: Don't cache the driver if initialisation fails. This + stops the second and subsequent attempt to use the API from failing + claiming the library is not initialised. [Graham Leggett] + *) apr_memcache: Abort connections and error out on unexpected value, length or type returned by the memcache server for multigetp. [Jeffrey Crowell , Yann Ylavic] Modified: apr/apr-util/branches/1.5.x/crypto/apr_crypto.c URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/crypto/apr_crypto.c?rev=1751808&r1=1751807&r2=1751808&view=diff ============================================================================== --- apr/apr-util/branches/1.5.x/crypto/apr_crypto.c (original) +++ apr/apr-util/branches/1.5.x/crypto/apr_crypto.c Thu Jul 7 15:06:25 2016 @@ -188,12 +188,15 @@ APU_DECLARE(apr_status_t) apr_crypto_get apr_snprintf(symname, sizeof(symname), "apr_crypto_%s_driver", name); rv = apu_dso_load(&dso, &symbol, modname, symname, pool); if (rv == APR_SUCCESS || rv == APR_EINIT) { /* previously loaded?!? */ - *driver = symbol; - name = apr_pstrdup(pool, name); - apr_hash_set(drivers, name, APR_HASH_KEY_STRING, *driver); + apr_crypto_driver_t *d = symbol; rv = APR_SUCCESS; - if ((*driver)->init) { - rv = (*driver)->init(pool, params, result); + if (d->init) { + rv = d->init(pool, params, result); + } + if (APR_SUCCESS == rv) { + *driver = symbol; + name = apr_pstrdup(pool, name); + apr_hash_set(drivers, name, APR_HASH_KEY_STRING, *driver); } } apu_dso_mutex_unlock(); Modified: apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c?rev=1751808&r1=1751807&r2=1751808&view=diff ============================================================================== --- apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c (original) +++ apr/apr-util/branches/1.5.x/crypto/apr_crypto_nss.c Thu Jul 7 15:06:25 2016 @@ -198,9 +198,6 @@ static apr_status_t crypto_init(apr_pool return APR_EREINIT; } - apr_pool_cleanup_register(pool, pool, crypto_shutdown_helper, - apr_pool_cleanup_null); - if (keyPrefix || certPrefix || secmod) { s = NSS_Initialize(dir, certPrefix, keyPrefix, secmod, flags); } @@ -212,15 +209,19 @@ static apr_status_t crypto_init(apr_pool } if (s != SECSuccess) { if (result) { + /* Note: all memory must be owned by the caller, in case we're unloaded */ apu_err_t *err = apr_pcalloc(pool, sizeof(apu_err_t)); err->rc = PR_GetError(); - err->msg = PR_ErrorToName(s); - err->reason = "Error during 'nss' initialisation"; + err->msg = apr_pstrdup(pool, PR_ErrorToName(s)); + err->reason = apr_pstrdup(pool, "Error during 'nss' initialisation"); *result = err; } return APR_ECRYPT; } + apr_pool_cleanup_register(pool, pool, crypto_shutdown_helper, + apr_pool_cleanup_null); + return APR_SUCCESS; }