You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.4 KiB
128 lines
4.4 KiB
2 years ago
|
diff -up openwsman-2.6.8/src/server/shttpd/compat_unix.h.orig openwsman-2.6.8/src/server/shttpd/compat_unix.h
|
||
|
--- openwsman-2.6.8/src/server/shttpd/compat_unix.h.orig 2018-10-12 12:06:26.000000000 +0200
|
||
|
+++ openwsman-2.6.8/src/server/shttpd/compat_unix.h 2018-11-22 13:30:10.756423510 +0100
|
||
|
@@ -27,10 +27,6 @@
|
||
|
pthread_create(&tid, NULL, (void *(*)(void *))a, c); } while (0)
|
||
|
#endif /* !NO_THREADS */
|
||
|
|
||
|
-#ifndef SSL_LIB
|
||
|
-#define SSL_LIB "libssl.so"
|
||
|
-#endif
|
||
|
-
|
||
|
#define DIRSEP '/'
|
||
|
#define IS_DIRSEP_CHAR(c) ((c) == '/')
|
||
|
#define O_BINARY 0
|
||
|
diff -up openwsman-2.6.8/src/server/shttpd/io_ssl.c.orig openwsman-2.6.8/src/server/shttpd/io_ssl.c
|
||
|
--- openwsman-2.6.8/src/server/shttpd/io_ssl.c.orig 2018-10-12 12:06:26.000000000 +0200
|
||
|
+++ openwsman-2.6.8/src/server/shttpd/io_ssl.c 2018-11-22 13:30:10.757423510 +0100
|
||
|
@@ -11,23 +11,6 @@
|
||
|
#include "defs.h"
|
||
|
|
||
|
#if !defined(NO_SSL)
|
||
|
-struct ssl_func ssl_sw[] = {
|
||
|
- {"SSL_free", {0}},
|
||
|
- {"SSL_accept", {0}},
|
||
|
- {"SSL_connect", {0}},
|
||
|
- {"SSL_read", {0}},
|
||
|
- {"SSL_write", {0}},
|
||
|
- {"SSL_get_error", {0}},
|
||
|
- {"SSL_set_fd", {0}},
|
||
|
- {"SSL_new", {0}},
|
||
|
- {"SSL_CTX_new", {0}},
|
||
|
- {"SSLv23_server_method", {0}},
|
||
|
- {"SSL_library_init", {0}},
|
||
|
- {"SSL_CTX_use_PrivateKey_file", {0}},
|
||
|
- {"SSL_CTX_use_certificate_file",{0}},
|
||
|
- {NULL, {0}}
|
||
|
-};
|
||
|
-
|
||
|
void
|
||
|
_shttpd_ssl_handshake(struct stream *stream)
|
||
|
{
|
||
|
diff -up openwsman-2.6.8/src/server/shttpd/shttpd.c.orig openwsman-2.6.8/src/server/shttpd/shttpd.c
|
||
|
--- openwsman-2.6.8/src/server/shttpd/shttpd.c.orig 2018-10-12 12:06:26.000000000 +0200
|
||
|
+++ openwsman-2.6.8/src/server/shttpd/shttpd.c 2018-11-22 13:30:41.314416695 +0100
|
||
|
@@ -1476,20 +1476,14 @@ set_ssl(struct shttpd_ctx *ctx, const ch
|
||
|
int retval = FALSE;
|
||
|
EC_KEY* key;
|
||
|
|
||
|
- /* Load SSL library dynamically */
|
||
|
- if ((lib = dlopen(SSL_LIB, RTLD_LAZY)) == NULL) {
|
||
|
- _shttpd_elog(E_LOG, NULL, "set_ssl: cannot load %s", SSL_LIB);
|
||
|
- return (FALSE);
|
||
|
- }
|
||
|
-
|
||
|
- for (fp = ssl_sw; fp->name != NULL; fp++)
|
||
|
- if ((fp->ptr.v_void = dlsym(lib, fp->name)) == NULL) {
|
||
|
- _shttpd_elog(E_LOG, NULL,"set_ssl: cannot find %s", fp->name);
|
||
|
- return (FALSE);
|
||
|
- }
|
||
|
-
|
||
|
/* Initialize SSL crap */
|
||
|
+ debug("Initialize SSL");
|
||
|
+ SSL_load_error_strings();
|
||
|
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||
|
+ OPENSSL_init_ssl(0, NULL);
|
||
|
+#else
|
||
|
SSL_library_init();
|
||
|
+#endif
|
||
|
|
||
|
if ((CTX = SSL_CTX_new(SSLv23_server_method())) == NULL)
|
||
|
_shttpd_elog(E_LOG, NULL, "SSL_CTX_new error");
|
||
|
diff -up openwsman-2.6.8/src/server/shttpd/ssl.h.orig openwsman-2.6.8/src/server/shttpd/ssl.h
|
||
|
--- openwsman-2.6.8/src/server/shttpd/ssl.h.orig 2018-10-12 12:06:26.000000000 +0200
|
||
|
+++ openwsman-2.6.8/src/server/shttpd/ssl.h 2018-11-22 13:30:10.757423510 +0100
|
||
|
@@ -12,52 +12,4 @@
|
||
|
|
||
|
#include <openssl/ssl.h>
|
||
|
|
||
|
-#else
|
||
|
-
|
||
|
-/*
|
||
|
- * Snatched from OpenSSL includes. I put the prototypes here to be independent
|
||
|
- * from the OpenSSL source installation. Having this, shttpd + SSL can be
|
||
|
- * built on any system with binary SSL libraries installed.
|
||
|
- */
|
||
|
-
|
||
|
-typedef struct ssl_st SSL;
|
||
|
-typedef struct ssl_method_st SSL_METHOD;
|
||
|
-typedef struct ssl_ctx_st SSL_CTX;
|
||
|
-
|
||
|
-#define SSL_ERROR_WANT_READ 2
|
||
|
-#define SSL_ERROR_WANT_WRITE 3
|
||
|
-#define SSL_ERROR_SYSCALL 5
|
||
|
-#define SSL_FILETYPE_PEM 1
|
||
|
-
|
||
|
-#endif
|
||
|
-
|
||
|
-/*
|
||
|
- * Dynamically loaded SSL functionality
|
||
|
- */
|
||
|
-struct ssl_func {
|
||
|
- const char *name; /* SSL function name */
|
||
|
- union variant ptr; /* Function pointer */
|
||
|
-};
|
||
|
-
|
||
|
-extern struct ssl_func ssl_sw[];
|
||
|
-
|
||
|
-#define FUNC(x) ssl_sw[x].ptr.v_func
|
||
|
-
|
||
|
-#define SSL_free(x) (* (void (*)(SSL *)) FUNC(0))(x)
|
||
|
-#define SSL_accept(x) (* (int (*)(SSL *)) FUNC(1))(x)
|
||
|
-#define SSL_connect(x) (* (int (*)(SSL *)) FUNC(2))(x)
|
||
|
-#define SSL_read(x,y,z) (* (int (*)(SSL *, void *, int)) FUNC(3))((x),(y),(z))
|
||
|
-#define SSL_write(x,y,z) \
|
||
|
- (* (int (*)(SSL *, const void *,int)) FUNC(4))((x), (y), (z))
|
||
|
-#define SSL_get_error(x,y)(* (int (*)(SSL *, int)) FUNC(5))((x), (y))
|
||
|
-#define SSL_set_fd(x,y) (* (int (*)(SSL *, int)) FUNC(6))((x), (y))
|
||
|
-#define SSL_new(x) (* (SSL * (*)(SSL_CTX *)) FUNC(7))(x)
|
||
|
-#define SSL_CTX_new(x) (* (SSL_CTX * (*)(const SSL_METHOD *)) FUNC(8))(x)
|
||
|
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||
|
-#define SSLv23_server_method() (* (SSL_METHOD * (*)(void)) FUNC(9))()
|
||
|
-#define SSL_library_init() (* (int (*)(void)) FUNC(10))()
|
||
|
#endif
|
||
|
-#define SSL_CTX_use_PrivateKey_file(x,y,z) (* (int (*)(SSL_CTX *, \
|
||
|
- const char *, int)) FUNC(11))((x), (y), (z))
|
||
|
-#define SSL_CTX_use_certificate_file(x,y,z) (* (int (*)(SSL_CTX *, \
|
||
|
- const char *, int)) FUNC(12))((x), (y), (z))
|