Skip to content

Commit

Permalink
Make sure global state is initialized prior to init_openssl in -t con…
Browse files Browse the repository at this point in the history
…figuration testing mode.
  • Loading branch information
daghf committed May 26, 2015
1 parent e3c2be7 commit 7f549a3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ static char tmp_buf[150];

// for testing configuration only
#include <openssl/ssl.h>
SSL_CTX * init_openssl();
SSL_CTX * init_openssl(void);
void init_globals(void);

static void config_error_set (char *fmt, ...) {
memset(error_buf, '\0', sizeof(error_buf));
Expand Down Expand Up @@ -1428,6 +1429,7 @@ void config_parse_cli(int argc, char **argv, hitch_config *cfg) {
// was this only a test?
if (test_only) {
fprintf(stderr, "Trying to initialize SSL contexts with your certificates");
init_globals();
if (!init_openssl()) {
config_die("Error initializing OpenSSL.");
}
Expand Down
4 changes: 2 additions & 2 deletions src/hitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ find_ctx(const char *file) {
/* Init library and load specified certificate.
* Establishes a SSL_ctx, to act as a template for
* each connection */
void init_openssl() {
void init_openssl(void) {
struct cert_files *cf;
struct listen_sock *ls;
SSL_CTX *ctx;
Expand Down Expand Up @@ -2028,7 +2028,7 @@ void drop_privileges() {
}


void init_globals() {
void init_globals(void) {
/* backaddr */
struct addrinfo hints;

Expand Down

0 comments on commit 7f549a3

Please sign in to comment.