123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- $Id$
- --- mini_httpd-1.19.orig/mini_httpd.c 2005-06-29 19:31:17.000000000 +0200
- +++ mini_httpd-1.19/mini_httpd.c 2007-01-20 19:48:49.000000000 +0100
- @@ -66,8 +66,14 @@
- #endif /* HAVE_SENDFILE */
-
- #ifdef USE_SSL
- +# ifdef HAVE_OPENSSL
- #include <openssl/ssl.h>
- #include <openssl/err.h>
- +# else /* HAVE_OPENSSL */
- +# ifdef HAVE_MATRIXSSL
- +# include "matrixssl_helper.h"
- +# endif /* HAVE_MATRIXSSL */
- +# endif /* HAVE_OPENSSL */
- #endif /* USE_SSL */
-
- extern char* crypt( const char* key, const char* setting );
- @@ -132,10 +138,10 @@ typedef long long int64_t;
- #define CGI_NICE 10
- #endif /* CGI_NICE */
- #ifndef CGI_PATH
- -#define CGI_PATH "/usr/local/bin:/usr/ucb:/bin:/usr/bin"
- +#define CGI_PATH "/usr/bin:/bin:/usr/sbin:/sbin"
- #endif /* CGI_PATH */
- #ifndef CGI_LD_LIBRARY_PATH
- -#define CGI_LD_LIBRARY_PATH "/usr/local/lib:/usr/lib"
- +#define CGI_LD_LIBRARY_PATH "/usr/lib:/lib"
- #endif /* CGI_LD_LIBRARY_PATH */
- #ifndef AUTH_FILE
- #define AUTH_FILE ".htpasswd"
- @@ -193,7 +199,13 @@ static int listen4_fd, listen6_fd;
- static int do_ssl;
- static char* certfile;
- static char* cipher;
- +#ifdef HAVE_OPENSSL
- static SSL_CTX* ssl_ctx;
- +#else /* HAVE_OPENSSL */
- + #ifdef HAVE_MATRIXSSL
- +static sslKeys_t* keys;
- + #endif /* HAVE_MATRIXSSL */
- +#endif /* HAVE_OPENSSL */
- #endif /* USE_SSL */
- static char cwd[MAXPATHLEN];
- static int got_hup;
- @@ -540,6 +552,7 @@ main( int argc, char** argv )
- #ifdef USE_SSL
- if ( do_ssl )
- {
- +# ifdef HAVE_OPENSSL
- SSL_load_error_strings();
- SSLeay_add_ssl_algorithms();
- ssl_ctx = SSL_CTX_new( SSLv23_server_method() );
- @@ -559,6 +572,17 @@ main( int argc, char** argv )
- exit( 1 );
- }
- }
- +# else /* HAVE_OPENSSL */
- +# ifdef HAVE_MATRIXSSL
- + matrixSslOpen();
- + if ( matrixSslReadKeys( &keys, certfile, certfile, NULL, NULL ) < 0 )
- + {
- + syslog( LOG_CRIT, "can't load certificate and/or private key\n");
- + (void) fprintf( stderr, "%s: can't load certificate and/or private key\n", argv0 );
- + exit( 1 );
- + }
- +# endif /* HAVE_MATRIXSSL */
- +# endif /* HAVE_OPENSSL */
- }
- #endif /* USE_SSL */
-
- @@ -1174,6 +1198,7 @@ handle_request( void )
- #ifdef USE_SSL
- if ( do_ssl )
- {
- +# ifdef HAVE_OPENSSL
- ssl = SSL_new( ssl_ctx );
- SSL_set_fd( ssl, conn_fd );
- if ( SSL_accept( ssl ) == 0 )
- @@ -1181,6 +1206,16 @@ handle_request( void )
- ERR_print_errors_fp( stderr );
- exit( 1 );
- }
- +# else /* HAVE_OPENSSL */
- +# ifdef HAVE_MATRIXSSL
- + ssl = SSL_new(keys);
- + SSL_set_fd( ssl, conn_fd );
- + if ( SSL_accept( ssl ) <= 0 )
- + {
- + perror( "SSL_accept" );
- + }
- +# endif /* HAVE_MATRIXSSL */
- +# endif /* HAVE_OPENSSL */
- }
- #endif /* USE_SSL */
-
|