1 diff -ruN mini_httpd-1.19-orig/Makefile mini_httpd-1.19-3/Makefile
2 --- mini_httpd-1.19-orig/Makefile 2002-11-02 00:02:57.000000000 +0100
3 +++ mini_httpd-1.19-3/Makefile 2005-03-09 08:52:21.000000000 +0100
5 # http://www.openssl.org/ Make sure the SSL_TREE definition points to the
6 # tree with your OpenSSL installation - depending on how you installed it,
7 # it may be in /usr/local instead of /usr/local/ssl.
10 #SSL_TREE = /usr/local/ssl
12 #SSL_INC = -I${SSL_TREE}/include
13 #SSL_LIBS = -L${SSL_TREE}/lib -lssl -lcrypto
18 +#SSL_DEFS = -DUSE_SSL -DHAVE_MATRIXSSL
20 +#SSL_LIBS = -lmatrixssl
21 +#SSL_OBJS = matrixssl_helper.o
24 -BINDIR = /usr/local/sbin
25 -MANDIR = /usr/local/man
28 +BINDIR = $(DESTDIR)/usr/sbin
29 +MANDIR = $(DESTDIR)/usr/share/man
31 CDEFS = ${SSL_DEFS} ${SSL_INC}
34 +CFLAGS = ${OFLAGS} ${CDEFS}
41 all: mini_httpd htpasswd
43 -mini_httpd: mini_httpd.o match.o tdate_parse.o
44 - ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${LDLIBS} -o mini_httpd
45 +mini_httpd: mini_httpd.o match.o tdate_parse.o ${SSL_OBJS}
46 + ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${SSL_OBJS} ${LDLIBS} -o mini_httpd
48 mini_httpd.o: mini_httpd.c version.h port.h match.h tdate_parse.h mime_encodings.h mime_types.h
49 ${CC} ${CFLAGS} -c mini_httpd.c
51 +matrixssl_helper.o: matrixssl_helper.c
52 + ${CC} ${CFLAGS} -c matrixssl_helper.c
54 match.o: match.c match.h
55 ${CC} ${CFLAGS} -c match.c
58 chmod 600 mini_httpd.pem
62 - rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd
63 +install: all uninstall
65 cp mini_httpd htpasswd ${BINDIR}
66 - rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1
67 -mkdir -p ${MANDIR}/man8
68 cp mini_httpd.8 ${MANDIR}/man8
69 -mkdir -p ${MANDIR}/man1
70 cp htpasswd.1 ${MANDIR}/man1
73 + rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd
74 + rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1
77 rm -f mini_httpd mime_encodings.h mime_types.h htpasswd mini_httpd.rnd *.o core core.* *.core
79 diff -ruN mini_httpd-1.19-orig/mini_httpd.c mini_httpd-1.19-3/mini_httpd.c
80 --- mini_httpd-1.19-orig/mini_httpd.c 2003-12-03 19:27:22.000000000 +0100
81 +++ mini_httpd-1.19-3/mini_httpd.c 2005-03-09 08:46:28.000000000 +0100
83 #endif /* HAVE_SENDFILE */
87 #include <openssl/ssl.h>
88 #include <openssl/err.h>
89 +# else /* HAVE_OPENSSL */
90 +# ifdef HAVE_MATRIXSSL
91 +# include "matrixssl_helper.h"
92 +# endif /* HAVE_MATRIXSSL */
93 +# endif /* HAVE_OPENSSL */
96 extern char* crypt( const char* key, const char* setting );
99 static char* certfile;
102 static SSL_CTX* ssl_ctx;
103 +#else /* HAVE_OPENSSL */
104 + #ifdef HAVE_MATRIXSSL
105 +static sslKeys_t* keys;
106 + #endif /* HAVE_MATRIXSSL */
107 +#endif /* HAVE_OPENSSL */
109 static char cwd[MAXPATHLEN];
115 +# ifdef HAVE_OPENSSL
116 SSL_load_error_strings();
117 SSLeay_add_ssl_algorithms();
118 ssl_ctx = SSL_CTX_new( SSLv23_server_method() );
123 +# else /* HAVE_OPENSSL */
124 +# ifdef HAVE_MATRIXSSL
126 + if ( matrixSslReadKeys( &keys, certfile, certfile, NULL, NULL ) < 0 )
128 + syslog( LOG_CRIT, "can't load certificate and/or private key\n");
129 + (void) fprintf( stderr, "%s: can't load certificate and/or private key\n", argv0 );
132 +# endif /* HAVE_MATRIXSSL */
133 +# endif /* HAVE_OPENSSL */
137 @@ -1174,6 +1198,7 @@
141 +# ifdef HAVE_OPENSSL
142 ssl = SSL_new( ssl_ctx );
143 SSL_set_fd( ssl, conn_fd );
144 if ( SSL_accept( ssl ) == 0 )
145 @@ -1181,6 +1206,16 @@
146 ERR_print_errors_fp( stderr );
149 +# else /* HAVE_OPENSSL */
150 +# ifdef HAVE_MATRIXSSL
151 + ssl = SSL_new(keys);
152 + SSL_set_fd( ssl, conn_fd );
153 + if ( SSL_accept( ssl ) <= 0 )
155 + perror( "SSL_accept" );
157 +# endif /* HAVE_MATRIXSSL */
158 +# endif /* HAVE_OPENSSL */