mturk       2005/06/01 04:44:37

  Modified:    jni/java/org/apache/tomcat/jni SSLContext.java
               jni/native/src sslcontext.c
  Log:
  Use sslBIO with index instead two sepatate functions doing the same
  thing for different struct members.
  
  Revision  Changes    Path
  1.5       +4 -10     
jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLContext.java
  
  Index: SSLContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jni/java/org/apache/tomcat/jni/SSLContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SSLContext.java   1 Jun 2005 08:19:39 -0000       1.4
  +++ SSLContext.java   1 Jun 2005 11:44:36 -0000       1.5
  @@ -70,7 +70,7 @@
        public static native void setVhostId(long ctx, String id);
    
       /**
  -     * Asssociate BIOCallback for error reporting.
  +     * Asssociate BIOCallback for input or output data capture.
        * <br />
        * First word in the output string will contain error
        * level in the form:
  @@ -86,14 +86,8 @@
        * Default is to use the stderr output stream.
        * @param ctx Server or Client context to use.
        * @param bio BIO handle to use, created with SSL.newBIO
  +     * @param dir BIO direction (1 for input 0 for output).
        */
  -     public static native void setErrBIO(long ctx, long bio);
  -
  -    /**
  -     * Asssociate BIOCallback for Password prompting.
  -     * @param ctx Server or Client context to use.
  -     * @param bio BIO handle to use, created with SSL.newBIO
  -     */
  -     public static native void setPPromptBIO(long ctx, long bio);
  +     public static native void setBIO(long ctx, long bio, int dir);
   
   }
  
  
  
  1.9       +17 -23    jakarta-tomcat-connectors/jni/native/src/sslcontext.c
  
  Index: sslcontext.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jni/native/src/sslcontext.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- sslcontext.c      1 Jun 2005 11:22:16 -0000       1.8
  +++ sslcontext.c      1 Jun 2005 11:44:37 -0000       1.9
  @@ -236,35 +236,29 @@
       TCN_FREE_CSTRING(id);
   }
   
  -TCN_IMPLEMENT_CALL(void, SSLContext, setErrBIO)(TCN_STDARGS, jlong ctx,
  -                                                jlong bio)
  +TCN_IMPLEMENT_CALL(void, SSLContext, setBIO)(TCN_STDARGS, jlong ctx,
  +                                             jlong bio, jint dir)
   {
       tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
  -    BIO *bio_os       = J2P(bio, BIO *);
  +    BIO *bio_handle   = J2P(bio, BIO *);
   
       UNREFERENCED_STDARGS;
       TCN_ASSERT(ctx != 0);
  -    if (c->bio_os && c->bio_os != bio_os)
  -        SSL_BIO_close(c->bio_os);
  -    SSL_BIO_doref(bio_os);
  -    c->bio_os = bio_os;
  +    if (dir == 0) {
  +        if (c->bio_os && c->bio_os != bio_handle)
  +            SSL_BIO_close(c->bio_os);
  +        c->bio_os = bio_handle;
  +    }
  +    else if (dir == 1) {
  +        if (c->bio_os && c->bio_is != bio_handle)
  +            SSL_BIO_close(c->bio_is);
  +        c->bio_os = bio_handle;
  +    }
  +    else
  +        return;
  +    SSL_BIO_doref(bio_handle);
   }
   
  -TCN_IMPLEMENT_CALL(void, SSLContext, setPPromptBIO)(TCN_STDARGS, jlong ctx,
  -                                                    jlong bio)
  -{
  -    tcn_ssl_ctxt_t *c = J2P(ctx, tcn_ssl_ctxt_t *);
  -    BIO *bio_is       = J2P(bio, BIO *);
  -
  -    UNREFERENCED_STDARGS;
  -    TCN_ASSERT(ctx != 0);
  -    if (c->bio_is && c->bio_is != bio_is)
  -        SSL_BIO_close(c->bio_is);
  -    SSL_BIO_doref(bio_is);
  -    c->bio_is = bio_is;
  -}
  -
  -
   #else
   /* OpenSSL is not supported
    * If someday we make OpenSSL optional
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to