Lennart B�ng <[EMAIL PROTECTED]>:

> Here is the openssl apps patch though to fix the problems I
> have found with the apps only capable of running once
> (when running and never exiting) due to global variables.
> 
> The patch could maybe also fix probs with running apps
> repeatedly from the openssl prompt 'OpenSSL>' since it
> is almost the same situation.

I've now too quickly looked through the apps directory and combined
our observations -- you missed "section" in ca.c, I missed one as
well, hopefully we covered everything together.

These diffs of yours

> -       if (buf != NULL) Free(buf);
> +       if (buf != NULL) { Free(buf); buf = NULL; }
>         buf=(char *)Malloc(len+1);

are of course unnecessary, so you won't find them in my patches (to
the current development version), which follow here:

Index: ca.c
===================================================================
RCS file: /usr/local/openssl/cvs/openssl/apps/ca.c,v
retrieving revision 1.41
diff -u -r1.41 ca.c
--- ca.c        1999/09/03 01:08:22     1.41
+++ ca.c        1999/09/03 22:52:29
@@ -273,9 +273,13 @@
 
        apps_startup();
 
+       key = NULL;
+       section = NULL;
+
        X509V3_add_standard_extensions();
 
        preserve=0;
+       msie_hack=0;
        if (bio_err == NULL)
                if ((bio_err=BIO_new(BIO_s_file())) != NULL)
                        BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
Index: crl.c
===================================================================
RCS file: /usr/local/openssl/cvs/openssl/apps/crl.c,v
retrieving revision 1.8
diff -u -r1.8 crl.c
--- crl.c       1999/07/21 20:56:57     1.8
+++ crl.c       1999/09/03 22:52:57
@@ -250,6 +250,7 @@
 end:
        BIO_free(out);
        BIO_free(bio_out);
+       bio_out=NULL;
        X509_CRL_free(x);
        X509V3_EXT_cleanup();
        EXIT(ret);
Index: req.c
===================================================================
RCS file: /usr/local/openssl/cvs/openssl/apps/req.c,v
retrieving revision 1.34
diff -u -r1.34 req.c
--- req.c       1999/08/27 00:08:16     1.34
+++ req.c       1999/09/03 23:09:32
@@ -152,6 +152,7 @@
        MS_STATIC char config_name[256];
 #endif
 
+       req_conf = NULL;
 #ifndef NO_DES
        cipher=EVP_des_ede3_cbc();
 #endif
Index: s_server.c
===================================================================
RCS file: /usr/local/openssl/cvs/openssl/apps/s_server.c,v
retrieving revision 1.29
diff -u -r1.29 s_server.c
--- s_server.c  1999/08/09 13:01:48     1.29
+++ s_server.c  1999/09/03 23:10:29
@@ -107,7 +107,9 @@
 static DH *load_dh_param(void );
 static DH *get_dh512(void);
 #endif
-/* static void s_server_init(void);*/
+#ifdef MONOLITH
+static void s_server_init(void);
+#endif
 
 #ifndef S_ISDIR
 # if defined(_S_IFMT) && defined(_S_IFDIR)
@@ -174,10 +176,13 @@
 static BIO *bio_s_out=NULL;
 static int s_debug=0;
 static int s_quiet=0;
+
+static int hack=0;
 
-#if 0
+#ifdef MONOLITH
 static void s_server_init(void)
        {
+       accept_socket=-1;
        cipher=NULL;
        s_server_verify=SSL_VERIFY_NONE;
        s_dcert_file=NULL;
@@ -194,6 +199,7 @@
        bio_s_out=NULL;
        s_debug=0;
        s_quiet=0;
+       hack=0;
        }
 #endif
 
@@ -240,7 +246,6 @@
 
 static int local_argc=0;
 static char **local_argv;
-static int hack=0;
 
 #ifdef CHARSET_EBCDIC
 static int ebcdic_new(BIO *bi);
@@ -419,8 +424,9 @@
        local_argv=argv;
 
        apps_startup();
-       s_quiet=0;
-       s_debug=0;
+#ifdef MONOLITH
+       s_server_init();
+#endif
 
        if (bio_err == NULL)
                bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to