Browse Source

Added server_domain parameter to init_ssl callback

Drew Wells 5 years ago
parent
commit
a347f725b5
2 changed files with 5 additions and 2 deletions
  1. 3 1
      include/civetweb.h
  2. 2 1
      src/civetweb.c

+ 3 - 1
include/civetweb.h

@@ -247,12 +247,14 @@ struct mg_callbacks {
 
 	/* Called when civetweb initializes SSL library.
 	   Parameters:
+	     server_domain: authentication_domain from the domain config.
+	     ssl_ctx: SSL_CTX pointer.
 	     user_data: parameter user_data passed when starting the server.
 	   Return value:
 	     0: civetweb will set up the SSL certificate.
 	     1: civetweb assumes the callback already set up the certificate.
 	    -1: initializing ssl fails. */
-	int (*init_ssl)(void *ssl_context, void *user_data);
+	int (*init_ssl)(const char *server_domain, void *ssl_ctx, void *user_data);
 
 	/* Called when civetweb is about to create or free a SSL_CTX.
 	Parameters:

+ 2 - 1
src/civetweb.c

@@ -15923,7 +15923,8 @@ init_ssl_ctx_impl(struct mg_context *phys_ctx,
 	/* If a callback has been specified, call it. */
 	callback_ret = (phys_ctx->callbacks.init_ssl == NULL)
 	                   ? 0
-	                   : (phys_ctx->callbacks.init_ssl(dom_ctx->ssl_ctx,
+	                   : (phys_ctx->callbacks.init_ssl(dom_ctx->config[AUTHENTICATION_DOMAIN],
+	                                                   dom_ctx->ssl_ctx,
 	                                                   phys_ctx->user_data));
 
 	/* If callback returns 0, civetweb sets up the SSL certificate.