apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From minf...@apache.org
Subject svn commit: r1188920 - in /apr/apr/trunk/crypto: apr_crypto_nss.c apr_crypto_openssl.c
Date Tue, 25 Oct 2011 21:19:04 GMT
Author: minfrin
Date: Tue Oct 25 21:19:03 2011
New Revision: 1188920

URL: http://svn.apache.org/viewvc?rev=1188920&view=rev
Log:
apr_crypto: Support NULL values for the params field.

Modified:
    apr/apr/trunk/crypto/apr_crypto_nss.c
    apr/apr/trunk/crypto/apr_crypto_openssl.c

Modified: apr/apr/trunk/crypto/apr_crypto_nss.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_nss.c?rev=1188920&r1=1188919&r2=1188920&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_nss.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_nss.c Tue Oct 25 21:19:03 2011
@@ -150,37 +150,41 @@ static apr_status_t crypto_init(apr_pool
     int i = 0, j;
     apr_status_t status;
 
-    if (APR_SUCCESS != (status = apr_tokenize_to_argv(params, &elts, pool))) {
-        return status;
-    }
-    while ((elt = elts[i])) {
-        ptr = strchr(elt, '=');
-        if (ptr) {
-            for (klen = ptr - elt; klen && apr_isspace(elt[klen - 1]); --klen);
-            ptr++;
-        }
-        else {
-            for (klen = strlen(elt); klen && apr_isspace(elt[klen - 1]); --klen);
-        }
-        elt[klen] = 0;
+    if (params) {
+        if (APR_SUCCESS != (status = apr_tokenize_to_argv(params, &elts, pool))) {
+            return status;
+        }
+        while ((elt = elts[i])) {
+            ptr = strchr(elt, '=');
+            if (ptr) {
+                for (klen = ptr - elt; klen && apr_isspace(elt[klen - 1]); --klen)
+                    ;
+                ptr++;
+            }
+            else {
+                for (klen = strlen(elt); klen && apr_isspace(elt[klen - 1]); --klen)
+                    ;
+            }
+            elt[klen] = 0;
 
-        for (j = 0; fields[j].field != NULL; ++j) {
-            if (klen && !strcasecmp(fields[j].field, elt)) {
-                fields[j].set = 1;
-                if (ptr) {
-                    fields[j].value = ptr;
+            for (j = 0; fields[j].field != NULL; ++j) {
+                if (klen && !strcasecmp(fields[j].field, elt)) {
+                    fields[j].set = 1;
+                    if (ptr) {
+                        fields[j].value = ptr;
+                    }
+                    break;
                 }
-                break;
             }
-        }
 
-        i++;
+            i++;
+        }
+        dir = fields[0].value;
+        keyPrefix = fields[1].value;
+        certPrefix = fields[2].value;
+        secmod = fields[3].value;
+        noinit = fields[4].set;
     }
-    dir = fields[0].value;
-    keyPrefix = fields[1].value;
-    certPrefix = fields[2].value;
-    secmod = fields[3].value;
-    noinit = fields[4].set;
 
     /* if we've been asked to bypass, do so here */
     if (noinit) {

Modified: apr/apr/trunk/crypto/apr_crypto_openssl.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/crypto/apr_crypto_openssl.c?rev=1188920&r1=1188919&r2=1188920&view=diff
==============================================================================
--- apr/apr/trunk/crypto/apr_crypto_openssl.c (original)
+++ apr/apr/trunk/crypto/apr_crypto_openssl.c Tue Oct 25 21:19:03 2011
@@ -191,7 +191,7 @@ static apr_status_t crypto_make(apr_cryp
     apr_crypto_config_t *config = NULL;
     apr_crypto_t *f = apr_pcalloc(pool, sizeof(apr_crypto_t));
 
-    const char *engine;
+    const char *engine = NULL;
 
     struct {
         const char *field;
@@ -208,33 +208,37 @@ static apr_status_t crypto_make(apr_cryp
     int i = 0, j;
     apr_status_t status;
 
-    if (APR_SUCCESS != (status = apr_tokenize_to_argv(params, &elts, pool))) {
-        return status;
-    }
-    while ((elt = elts[i])) {
-        ptr = strchr(elt, '=');
-        if (ptr) {
-            for (klen = ptr - elt; klen && apr_isspace(elt[klen - 1]); --klen);
-            ptr++;
-        }
-        else {
-            for (klen = strlen(elt); klen && apr_isspace(elt[klen - 1]); --klen);
-        }
-        elt[klen] = 0;
+    if (params) {
+        if (APR_SUCCESS != (status = apr_tokenize_to_argv(params, &elts, pool))) {
+            return status;
+        }
+        while ((elt = elts[i])) {
+            ptr = strchr(elt, '=');
+            if (ptr) {
+                for (klen = ptr - elt; klen && apr_isspace(elt[klen - 1]); --klen)
+                    ;
+                ptr++;
+            }
+            else {
+                for (klen = strlen(elt); klen && apr_isspace(elt[klen - 1]); --klen)
+                    ;
+            }
+            elt[klen] = 0;
 
-        for (j = 0; fields[j].field != NULL; ++j) {
-            if (!strcasecmp(fields[j].field, elt)) {
-                fields[j].set = 1;
-                if (ptr) {
-                    fields[j].value = ptr;
+            for (j = 0; fields[j].field != NULL; ++j) {
+                if (!strcasecmp(fields[j].field, elt)) {
+                    fields[j].set = 1;
+                    if (ptr) {
+                        fields[j].value = ptr;
+                    }
+                    break;
                 }
-                break;
             }
-        }
 
-        i++;
+            i++;
+        }
+        engine = fields[0].value;
     }
-    engine = fields[0].value;
 
     if (!f) {
         return APR_ENOMEM;



Mime
View raw message