[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 17/254: nss: adapt to the new Curl_llist API
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 17/254: nss: adapt to the new Curl_llist API |
Date: |
Sat, 17 Jun 2017 16:50:49 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit c8ac0b6a7f9d308fcfe404d445a013b9a2c58845
Author: Kamil Dudka <address@hidden>
AuthorDate: Mon Apr 24 17:25:00 2017 +0200
nss: adapt to the new Curl_llist API
This commit fixes compilation failure caused by
cbae73e1dd95946597ea74ccb580c30f78e3fa73.
---
lib/vtls/nss.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index 89a16d3fe..e1a122947 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -85,6 +85,12 @@ static struct curl_llist nss_crl_list;
static NSSInitContext *nss_context = NULL;
static volatile int initialized = 0;
+/* type used to wrap pointers as list nodes */
+struct ptr_list_wrap {
+ void *ptr;
+ struct curl_llist_element node;
+};
+
typedef struct {
const char *name;
int num;
@@ -371,6 +377,18 @@ static PK11SlotInfo* nss_find_slot_by_name(const char
*slot_name)
return slot;
}
+/* wrap 'ptr' as list node and tail-insert into 'list' */
+static CURLcode insert_wrapped_ptr(struct curl_llist *list, void *ptr)
+{
+ struct ptr_list_wrap *wrap = malloc(sizeof *wrap);
+ if(!wrap)
+ return CURLE_OUT_OF_MEMORY;
+
+ wrap->ptr = ptr;
+ Curl_llist_insert_next(list, list->tail, wrap, &wrap->node);
+ return CURLE_OK;
+}
+
/* Call PK11_CreateGenericObject() with the given obj_class and filename. If
* the call succeeds, append the object handle to the list of objects so that
* the object can be destroyed in Curl_nss_close(). */
@@ -413,7 +431,7 @@ static CURLcode nss_create_object(struct ssl_connect_data
*ssl,
if(!obj)
return result;
- if(!Curl_llist_insert_next(&ssl->obj_list, ssl->obj_list.tail, obj)) {
+ if(insert_wrapped_ptr(&ssl->obj_list, obj) != CURLE_OK) {
PK11_DestroyGenericObject(obj);
return CURLE_OUT_OF_MEMORY;
}
@@ -430,17 +448,21 @@ static CURLcode nss_create_object(struct ssl_connect_data
*ssl,
* NSS objects in Curl_nss_close() */
static void nss_destroy_object(void *user, void *ptr)
{
- PK11GenericObject *obj = (PK11GenericObject *)ptr;
+ struct ptr_list_wrap *wrap = (struct ptr_list_wrap *) ptr;
+ PK11GenericObject *obj = (PK11GenericObject *) wrap->ptr;
(void) user;
PK11_DestroyGenericObject(obj);
+ free(wrap);
}
/* same as nss_destroy_object() but for CRL items */
static void nss_destroy_crl_item(void *user, void *ptr)
{
- SECItem *crl_der = (SECItem *)ptr;
+ struct ptr_list_wrap *wrap = (struct ptr_list_wrap *) ptr;
+ SECItem *crl_der = (SECItem *) wrap->ptr;
(void) user;
SECITEM_FreeItem(crl_der, PR_TRUE);
+ free(wrap);
}
static CURLcode nss_load_cert(struct ssl_connect_data *ssl,
@@ -496,7 +518,7 @@ static CURLcode nss_cache_crl(SECItem *crl_der)
PR_Lock(nss_crllock);
/* store the CRL item so that we can free it in Curl_nss_cleanup() */
- if(!Curl_llist_insert_next(&nss_crl_list, nss_crl_list.tail, crl_der)) {
+ if(insert_wrapped_ptr(&nss_crl_list, crl_der) != CURLE_OK) {
SECITEM_FreeItem(crl_der, PR_TRUE);
PR_Unlock(nss_crllock);
return CURLE_OUT_OF_MEMORY;
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 13/254: llist: fix a comment after cbae73e1dd9, (continued)
- [GNUnet-SVN] [gnurl] 13/254: llist: fix a comment after cbae73e1dd9, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 11/254: multi: clarify condition in curl_multi_wait, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 08/254: llist: no longer uses malloc, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 66/254: krb5: use private buffer for temp string, not receive buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 22/254: curl: set a 100K buffer size by default, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 34/254: http-proxy: removed unused argument in CURL_DISABLE_PROXY case, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 06/254: mbedtls: enable NTLM (& SMB) even if MD4 support is unavailable, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 20/254: configure: stop prepending to LDFLAGS, CPPFLAGS, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 10/254: lib: fix maybe-uninitialized warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 14/254: configure: fix the -ldl check for openssl, add -lpthread check, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 17/254: nss: adapt to the new Curl_llist API,
gnunet <=
- [GNUnet-SVN] [gnurl] 35/254: test1443: test --remote-time, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 12/254: schannel: Don't treat encrypted partial record as pending data, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 58/254: http: don't clobber the receive buffer for timecond, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 15/254: RELEASE-NOTES: synced with c68fed875, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 16/254: curl-compilers.m4: accept -Og and -Ofast GCC flags, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 19/254: if2ip: fix -Wcast-align warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 53/254: http: use private user:password output buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 07/254: typecheck-gcc: handle function pointers properly, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 23/254: typecheck-gcc: fix _curl_is_slist_info, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 24/254: nss: do not leak PKCS #11 slot while loading a key, gnunet, 2017/06/17