summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Ramsay <lack@gentoo.org>2008-11-03 22:10:18 +0000
committerJim Ramsay <lack@gentoo.org>2008-11-03 22:10:18 +0000
commit94b6e6799cff282e24f06b8b86687e9b84711a28 (patch)
tree7f0ee0979f489ebf2e07d068bb46b074337fd97b /net-misc/curl/files
parentBump to 2.24.1.1. Fixes for gnometris, gnotravex & sudoku. (diff)
downloadhistorical-94b6e6799cff282e24f06b8b86687e9b84711a28.tar.gz
historical-94b6e6799cff282e24f06b8b86687e9b84711a28.tar.bz2
historical-94b6e6799cff282e24f06b8b86687e9b84711a28.zip
Patched 7.18.2 for the NSS threadsafe issue (Bug #230413), and added 7.19.0 which is unaffected by the bug.
Package-Manager: portage-2.2_rc13/cvs/Linux 2.6.26-gentoo-r1 x86_64
Diffstat (limited to 'net-misc/curl/files')
-rw-r--r--net-misc/curl/files/curl-7.18.2-nss-threadsafe.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/net-misc/curl/files/curl-7.18.2-nss-threadsafe.patch b/net-misc/curl/files/curl-7.18.2-nss-threadsafe.patch
new file mode 100644
index 000000000000..a45120283c13
--- /dev/null
+++ b/net-misc/curl/files/curl-7.18.2-nss-threadsafe.patch
@@ -0,0 +1,77 @@
+===================================================================
+RCS file: /cvsroot/curl/curl/lib/nss.c,v
+retrieving revision 1.33
+retrieving revision 1.34
+diff -u -r1.33 -r1.34
+--- curl/lib/nss.c 2008/09/06 05:29:06 1.33
++++ curl/lib/nss.c 2008/09/23 10:27:04 1.34
+@@ -78,7 +78,9 @@
+
+ PRFileDesc *PR_ImportTCPSocket(PRInt32 osfd);
+
+-int initialized = 0;
++PRLock * nss_initlock = NULL;
++
++volatile int initialized = 0;
+
+ #define HANDSHAKE_TIMEOUT 30
+
+@@ -837,8 +839,11 @@
+ */
+ int Curl_nss_init(void)
+ {
+- if(!initialized)
++ /* curl_global_init() is not thread-safe so this test is ok */
++ if (nss_initlock == NULL) {
+ PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256);
++ nss_initlock = PR_NewLock();
++ }
+
+ /* We will actually initialize NSS later */
+
+@@ -848,7 +853,17 @@
+ /* Global cleanup */
+ void Curl_nss_cleanup(void)
+ {
+- NSS_Shutdown();
++ /* This function isn't required to be threadsafe and this is only done
++ * as a safety feature.
++ */
++ PR_Lock(nss_initlock);
++ if (initialized)
++ NSS_Shutdown();
++ PR_Unlock(nss_initlock);
++
++ PR_DestroyLock(nss_initlock);
++ nss_initlock = NULL;
++
+ initialized = 0;
+ }
+
+@@ -926,7 +941,8 @@
+ return CURLE_OK;
+
+ /* FIXME. NSS doesn't support multiple databases open at the same time. */
+- if(!initialized) {
++ PR_Lock(nss_initlock);
++ if(!initialized && !NSS_IsInitialized()) {
+ initialized = 1;
+
+ certDir = getenv("SSL_DIR"); /* Look in $SSL_DIR */
+@@ -950,6 +966,8 @@
+ if(rv != SECSuccess) {
+ infof(conn->data, "Unable to initialize NSS database\n");
+ curlerr = CURLE_SSL_CACERT_BADFILE;
++ initialized = 0;
++ PR_Unlock(nss_initlock);
+ goto error;
+ }
+
+@@ -972,6 +990,7 @@
+ }
+ #endif
+ }
++ PR_Unlock(nss_initlock);
+
+ model = PR_NewTCPSocket();
+ if(!model)