Skip to content

Commit

Permalink
Define NO_SSLSYM to disable runtime SSL dynamic loader.
Browse files Browse the repository at this point in the history
Increase squeezelite revision to 1154.
  • Loading branch information
ralph-irving committed May 20, 2019
1 parent f5f4d54 commit f6afd56
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
9 changes: 6 additions & 3 deletions main.c
Expand Up @@ -205,6 +205,9 @@ static void usage(const char *argv0) {
#if USE_SSL
" SSL"
#endif
#if NO_SSLSYM
" NO_SSLSYM"
#endif
#if LINKALL
" LINKALL"
#endif
Expand Down Expand Up @@ -689,9 +692,9 @@ int main(int argc, char **argv) {
signal(SIGHUP, sighandler);
#endif

#if USE_SSL && !LINKALL
#if USE_SSL && !LINKALL && !NO_SSLSYM
ssl_loaded = load_ssl_symbols();
#endif
#endif

// set the output buffer size if not specified on the command line, take account of resampling
if (!output_buf_size) {
Expand Down Expand Up @@ -816,7 +819,7 @@ int main(int argc, char **argv) {
}
#endif

#if USE_SSL && !LINKALL
#if USE_SSL && !LINKALL && !NO_SSLSYM
free_ssl_symbols();
#endif

Expand Down
2 changes: 1 addition & 1 deletion slimproto.c
Expand Up @@ -120,7 +120,7 @@ static void sendHELO(bool reconnect, const char *fixed_cap, const char *var_cap,
struct HELO_packet pkt;

#if USE_SSL
#if !LINKALL
#if !LINKALL && !NO_SSLSYM
if (ssl_loaded) base_cap = SSL_CAP "," BASE_CAP;
else base_cap = BASE_CAP;
#endif
Expand Down
10 changes: 8 additions & 2 deletions squeezelite.h
Expand Up @@ -26,7 +26,7 @@

#define MAJOR_VERSION "1.9"
#define MINOR_VERSION "2"
#define MICRO_VERSION "1153"
#define MICRO_VERSION "1154"

#if defined(CUSTOM_VERSION)
#define VERSION "v" MAJOR_VERSION "." MINOR_VERSION "-" MICRO_VERSION STR(CUSTOM_VERSION)
Expand Down Expand Up @@ -163,6 +163,12 @@
#define USE_SSL 0
#endif

#if defined (NO_SSLSYM)
#undef NO_SSLSYM
#define NO_SSLSYM 1
#else
#define NO_SSLSYM 0
#endif

#if !LINKALL

Expand Down Expand Up @@ -735,7 +741,7 @@ void ir_close(void);
#endif

// sslsym.c
#if USE_SSL && !LINKALL
#if USE_SSL && !LINKALL && !NO_SSLSYM
bool load_ssl_symbols(void);
void free_ssl_symbols(void);
bool ssl_loaded;
Expand Down
9 changes: 4 additions & 5 deletions sslsym.c
@@ -1,5 +1,5 @@
/*
* SSL symboles dynamic loader
* SSL symbols dynamic loader
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -18,7 +18,7 @@

#include "squeezelite.h"

#if USE_SSL && !LINKALL
#if USE_SSL && !LINKALL && !NO_SSLSYM

#if WIN
#define dlclose FreeLibrary
Expand Down Expand Up @@ -73,9 +73,8 @@ static char *LIBCRYPTO[] = { "libcrypto.so",
#define V5(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5) p1, p2, p3, p4, p5
#define V6(t1, p1, t2, p2, t3, p3, t4, p4, t5, p5, t6, p6) p1, p2, p3, p4, p5, p6

#define EXPAND(x) x
#define P(n, ...) EXPAND(P##n(__VA_ARGS__))
#define V(n, ...) EXPAND(V##n(__VA_ARGS__))
#define P(n, ...) P##n(__VA_ARGS__)
#define V(n, ...) V##n(__VA_ARGS__)

#define SYM(fn) dlsym_##fn
#define SYMDECL(fn, ret, n, ...) \
Expand Down
4 changes: 2 additions & 2 deletions stream.c
Expand Up @@ -377,7 +377,7 @@ void stream_init(log_level level, unsigned stream_buf_size) {
}

#if USE_SSL
#if !LINKALL
#if !LINKALL && !NO_SSLSYM
if (ssl_loaded) {
#endif
SSL_library_init();
Expand All @@ -387,7 +387,7 @@ void stream_init(log_level level, unsigned stream_buf_size) {
exit(0);
}
SSL_CTX_set_options(SSLctx, SSL_OP_NO_SSLv2);
#if !LINKALL
#if !LINKALL && !NO_SSLSYM
}
#endif
ssl = NULL;
Expand Down

0 comments on commit f6afd56

Please sign in to comment.