Blame SOURCES/mod_revocator-segfault-fix.patch

3515f1
diff -rupN mod_revocator-1.0.3.patched/Makefile.am mod_revocator-1.0.3.segfault/Makefile.am
3515f1
--- mod_revocator-1.0.3.patched/Makefile.am	2010-04-13 07:11:09.000000000 -0700
3515f1
+++ mod_revocator-1.0.3.segfault/Makefile.am	2011-10-11 09:41:23.000000000 -0700
3515f1
@@ -10,7 +10,7 @@ libmodrev_la_SOURCES = mod_rev.c
3515f1
 libmodrev_la_LDFLAGS = -module -avoid-version
3515f1
 
3515f1
 INCLUDES = -I@apache_inc@ @nspr_inc@ @nss_inc@ @apr_inc@ -Imozilla/security/nss/lib/base @ldapsdk_inc@ -Imozilla/security/nss/lib/ckfw
3515f1
-LIBS = @ldapsdk_lib@ @nspr_lib@ @nss_lib@ @ldapsdk_libs_ssl@ -lssl3 -lsmime3 -lnss3 -lnssb @ldapsdk_libs@ -lplc4 -lplds4 -lnspr4 -lpthread -ldl
3515f1
+LIBS = @ldapsdk_lib@ @nspr_lib@ @nss_lib@ @ldapsdk_libs_ssl@ -lssl3 -lsmime3 -lnss3 -lnssutil3 -lnssb @ldapsdk_libs@ -lplc4 -lplds4 -lnspr4 -lpthread -ldl
3515f1
 DEFS = -D__REVOCATION_IMPLEMENTATION__=1 @extra_cppflags@
3515f1
 
3515f1
 # Remove nsprstub.o from libnssckfw.a so we can use our own stub, then
3515f1
diff -rupN mod_revocator-1.0.3.patched/crlhelper.cpp mod_revocator-1.0.3.segfault/crlhelper.cpp
3515f1
--- mod_revocator-1.0.3.patched/crlhelper.cpp	2011-10-11 09:18:33.000000000 -0700
3515f1
+++ mod_revocator-1.0.3.segfault/crlhelper.cpp	2011-10-11 09:35:53.000000000 -0700
3515f1
@@ -229,7 +229,7 @@ int main(int argc, char ** argv)
3515f1
             }
3515f1
             if (NULL == data) {
3515f1
                 data = fetch_url(url, 30, lastfetchtime, &len, &errnum);
3515f1
-                if (expired)
3515f1
+                if (expired) {
3515f1
                     if (errnum == CL_NOUPDATE_AVAILABLE) {
3515f1
                         node->fetchtime = PR_Now();
3515f1
                         data = node->data;
3515f1
@@ -243,6 +243,7 @@ int main(int argc, char ** argv)
3515f1
                             urlcache = node->next;
3515f1
                         }
3515f1
                         freeNode(node);
3515f1
+                    }
3515f1
                 }
3515f1
                 if (data) {
3515f1
                     node = (Node *)malloc(sizeof(Node));
3515f1
@@ -262,10 +263,11 @@ int main(int argc, char ** argv)
3515f1
                     data = node->data;
3515f1
                     node->fetchtime = PR_Now();
3515f1
                     node->errnum = errnum;
3515f1
-                    if (urlcache)
3515f1
+                    if (urlcache) {
3515f1
                         node->next = urlcache;
3515f1
-                    else
3515f1
+                    } else {
3515f1
                         node->next = NULL;
3515f1
+                    }
3515f1
                     urlcache = node;
3515f1
                 }
3515f1
             }
3515f1
diff -rupN mod_revocator-1.0.3.patched/mod_rev.c mod_revocator-1.0.3.segfault/mod_rev.c
3515f1
--- mod_revocator-1.0.3.patched/mod_rev.c	2011-10-11 09:18:33.000000000 -0700
3515f1
+++ mod_revocator-1.0.3.segfault/mod_rev.c	2011-10-11 11:15:37.000000000 -0700
3515f1
@@ -501,6 +501,23 @@ InitRevocation(apr_pool_t *p, server_rec
3515f1
         apr_os_file_get(&infd, sc->proc.out);
3515f1
         PR_snprintf(configstring, CONFIGLEN, "library=%s name=revocation parameters=\"%s %ld %d %d\"", revocation_library, sc->crlfile ? sc->crlfile : "", sc->semid, infd, outfd);
3515f1
 
3515f1
+        /* Since NSS now separates some functionality into 'libnssutil3.so',
3515f1
+         * to prevent a segmentation violation from occurring, it is now
3515f1
+         * necessary to insure that all executables and libraries are
3515f1
+         * linked against this library, and that the SECOID_Init() function
3515f1
+         * is called prior to calling the SECMOD_LoadUserModule() function.
3515f1
+         */
3515f1
+        if (SECOID_Init() != SECSuccess) {
3515f1
+            free(configstring);
3515f1
+            apr_dso_unload(dlh);
3515f1
+            ap_log_error(APLOG_MARK, APLOG_ERR, 0, base_server,
3515f1
+                 "Unable to initialize SECOID, NSS error %d. %s", PR_GetError(), critical ? "" : "CRL retrieval will be disabled.");
3515f1
+            if (critical) {
3515f1
+                kill_apache();
3515f1
+            }
3515f1
+            return APR_EGENERAL;
3515f1
+        }
3515f1
+
3515f1
         mod = SECMOD_LoadUserModule(configstring, NULL, PR_FALSE);
3515f1
         if (!mod || !mod->loaded)
3515f1
         {