tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r439948 - in /tomcat/connectors/trunk/jni: java/org/apache/tomcat/jni/SSL.java native/src/ssl.c
Date Mon, 04 Sep 2006 06:29:34 GMT
Author: mturk
Date: Sun Sep  3 23:29:33 2006
New Revision: 439948

URL: http://svn.apache.org/viewvc?view=rev&rev=439948
Log:
Added setting for global random file name.
It allows to set the filename that will be
used during SSL.initialize instead to depend
on default OpenSSL for deducting .rdnfile

Modified:
    tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSL.java
    tomcat/connectors/trunk/jni/native/src/ssl.c

Modified: tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSL.java
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSL.java?view=diff&rev=439948&r1=439947&r2=439948
==============================================================================
--- tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSL.java (original)
+++ tomcat/connectors/trunk/jni/java/org/apache/tomcat/jni/SSL.java Sun Sep  3 23:29:33 2006
@@ -254,6 +254,14 @@
                                           boolean base64);
 
     /**
+     * Sets global random filename.
+     * @param filename Filename to use.
+     *        If set it will be used for SSL initialization
+     *        and all contexts where explicitly not set.
+     */
+    public static native void randSet(String filename);
+
+    /**
      * Initialize new BIO
      * @param pool The pool to use.
      * @param callback BIOCallback to use

Modified: tomcat/connectors/trunk/jni/native/src/ssl.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jni/native/src/ssl.c?view=diff&rev=439948&r1=439947&r2=439948
==============================================================================
--- tomcat/connectors/trunk/jni/native/src/ssl.c (original)
+++ tomcat/connectors/trunk/jni/native/src/ssl.c Sun Sep  3 23:29:33 2006
@@ -29,6 +29,7 @@
 #include "ssl_private.h"
 
 static int ssl_initialized = 0;
+static char *ssl_global_rand_file = NULL;
 extern apr_pool_t *tcn_global_pool;
 
 ENGINE *tcn_ssl_engine = NULL;
@@ -252,6 +253,9 @@
     int n;
 
     if (file == NULL)
+        file = ssl_global_rand_file;
+
+    if (file == NULL)
         file = RAND_file_name(buffer, sizeof(buffer));
     else if ((n = RAND_egd(file)) > 0) {
         return n;
@@ -473,6 +477,16 @@
     r = ssl_rand_make(J2S(file), length, base64);
     TCN_FREE_CSTRING(file);
     return r ? JNI_TRUE : JNI_FALSE;
+}
+
+TCN_IMPLEMENT_CALL(void, SSL, randSet)(TCN_STDARGS, jstring file)
+{
+    TCN_ALLOC_CSTRING(file);
+    UNREFERENCED(o);
+    if (J2S(file)) {
+        ssl_global_rand_file = apr_pstrdup(tcn_global_pool, J2S(file));        
+    }
+    TCN_FREE_CSTRING(file);
 }
 
 /* OpenSSL Java Stream BIO */



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message