source:
freewrt/package/mini_httpd/patches/500-matrixssl.patch@
6fc4520e
| Last change on this file since 6fc4520e was 475ad56, checked in by , 20 years ago | |
|---|---|
|
|
| File size: 4.3 KB | |
-
mini_httpd-1.
diff -ruN mini_httpd-1.19-orig/Makefile mini_httpd-1.19-3/Makefile
old new 14 14 # http://www.openssl.org/ Make sure the SSL_TREE definition points to the 15 15 # tree with your OpenSSL installation - depending on how you installed it, 16 16 # it may be in /usr/local instead of /usr/local/ssl. 17 18 # OpenSSL 17 19 #SSL_TREE = /usr/local/ssl 18 20 #SSL_DEFS = -DUSE_SSL 19 21 #SSL_INC = -I${SSL_TREE}/include 20 22 #SSL_LIBS = -L${SSL_TREE}/lib -lssl -lcrypto 23 #SSL_OBJS = 24 25 # MatrixSSL 26 #SSL_TREE = 27 #SSL_DEFS = -DUSE_SSL -DHAVE_MATRIXSSL 28 #SSL_INC = 29 #SSL_LIBS = -lmatrixssl 30 #SSL_OBJS = matrixssl_helper.o 21 31 22 32 23 BINDIR = /usr/local/sbin 24 MANDIR = /usr/local/man 33 DESTDIR = 34 35 BINDIR = $(DESTDIR)/usr/sbin 36 MANDIR = $(DESTDIR)/usr/share/man 25 37 CC = gcc 26 38 CDEFS = ${SSL_DEFS} ${SSL_INC} 27 CFLAGS = -O ${CDEFS} 39 OFLAGS = -O 40 CFLAGS = ${OFLAGS} ${CDEFS} 28 41 #CFLAGS = -g ${CDEFS} 29 LDFLAGS = -s42 LDFLAGS = 30 43 #LDFLAGS = -g … … 32 45 33 46 all: mini_httpd htpasswd 34 47 35 mini_httpd: mini_httpd.o match.o tdate_parse.o 36 ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${ LDLIBS} -o mini_httpd48 mini_httpd: mini_httpd.o match.o tdate_parse.o ${SSL_OBJS} 49 ${CC} ${CFLAGS} ${LDFLAGS} mini_httpd.o match.o tdate_parse.o ${SSL_OBJS} ${LDLIBS} -o mini_httpd 37 50 38 51 mini_httpd.o: mini_httpd.c version.h port.h match.h tdate_parse.h mime_encodings.h mime_types.h 39 52 ${CC} ${CFLAGS} -c mini_httpd.c 40 53 54 matrixssl_helper.o: matrixssl_helper.c 55 ${CC} ${CFLAGS} -c matrixssl_helper.c 56 41 57 match.o: match.c match.h 42 58 ${CC} ${CFLAGS} -c match.c 43 59 … … 71 87 chmod 600 mini_httpd.pem 72 88 73 89 74 install: all 75 rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd 90 install: all uninstall 76 91 -mkdir -p ${BINDIR} 77 92 cp mini_httpd htpasswd ${BINDIR} 78 rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.179 93 -mkdir -p ${MANDIR}/man8 80 94 cp mini_httpd.8 ${MANDIR}/man8 81 95 -mkdir -p ${MANDIR}/man1 82 96 cp htpasswd.1 ${MANDIR}/man1 83 97 98 uninstall: 99 rm -f ${BINDIR}/mini_httpd ${BINDIR}/htpasswd 100 rm -f ${MANDIR}/man8/mini_httpd.8 ${MANDIR}/man1/htpasswd.1 101 84 102 clean: 85 103 rm -f mini_httpd mime_encodings.h mime_types.h htpasswd mini_httpd.rnd *.o core core.* *.core 86 104 -
mini_httpd.c
diff -ruN mini_httpd-1.19-orig/mini_httpd.c mini_httpd-1.19-3/mini_httpd.c
old new 66 66 #endif /* HAVE_SENDFILE */ 67 67 68 68 #ifdef USE_SSL 69 # ifdef HAVE_OPENSSL 69 70 #include <openssl/ssl.h> 70 71 #include <openssl/err.h> 72 # else /* HAVE_OPENSSL */ 73 # ifdef HAVE_MATRIXSSL 74 # include "matrixssl_helper.h" 75 # endif /* HAVE_MATRIXSSL */ 76 # endif /* HAVE_OPENSSL */ 71 77 #endif /* USE_SSL */ 72 78 73 79 extern char* crypt( const char* key, const char* setting ); … … 193 199 static int do_ssl; 194 200 static char* certfile; 195 201 static char* cipher; 202 #ifdef HAVE_OPENSSL 196 203 static SSL_CTX* ssl_ctx; 204 #else /* HAVE_OPENSSL */ 205 #ifdef HAVE_MATRIXSSL 206 static sslKeys_t* keys; 207 #endif /* HAVE_MATRIXSSL */ 208 #endif /* HAVE_OPENSSL */ 197 209 #endif /* USE_SSL */ 198 210 static char cwd[MAXPATHLEN]; 199 211 static int got_hup; … … 540 552 #ifdef USE_SSL 541 553 if ( do_ssl ) 542 554 { 555 # ifdef HAVE_OPENSSL 543 556 SSL_load_error_strings(); 544 557 SSLeay_add_ssl_algorithms(); 545 558 ssl_ctx = SSL_CTX_new( SSLv23_server_method() ); … … 559 572 exit( 1 ); 560 573 } 561 574 } 575 # else /* HAVE_OPENSSL */ 576 # ifdef HAVE_MATRIXSSL 577 matrixSslOpen(); 578 if ( matrixSslReadKeys( &keys, certfile, certfile, NULL, NULL ) < 0 ) 579 { 580 syslog( LOG_CRIT, "can't load certificate and/or private key\n"); 581 (void) fprintf( stderr, "%s: can't load certificate and/or private key\n", argv0 ); 582 exit( 1 ); 583 } 584 # endif /* HAVE_MATRIXSSL */ 585 # endif /* HAVE_OPENSSL */ 562 586 } 563 587 #endif /* USE_SSL */ 564 588 … … 1174 1198 #ifdef USE_SSL 1175 1199 if ( do_ssl ) 1176 1200 { 1201 # ifdef HAVE_OPENSSL 1177 1202 ssl = SSL_new( ssl_ctx ); 1178 1203 SSL_set_fd( ssl, conn_fd ); 1179 1204 if ( SSL_accept( ssl ) == 0 ) … … 1181 1206 ERR_print_errors_fp( stderr ); 1182 1207 exit( 1 ); 1183 1208 } 1209 # else /* HAVE_OPENSSL */ 1210 # ifdef HAVE_MATRIXSSL 1211 ssl = SSL_new(keys); 1212 SSL_set_fd( ssl, conn_fd ); 1213 if ( SSL_accept( ssl ) <= 0 ) 1214 { 1215 perror( "SSL_accept" ); 1216 } 1217 # endif /* HAVE_MATRIXSSL */ 1218 # endif /* HAVE_OPENSSL */ 1184 1219 } 1185 1220 #endif /* USE_SSL */ 1186 1221
Note:
See TracBrowser
for help on using the repository browser.
