diff options
Diffstat (limited to 'blabouncer.c')
-rw-r--r-- | blabouncer.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/blabouncer.c b/blabouncer.c index 13e91c1..dcfdd1b 100644 --- a/blabouncer.c +++ b/blabouncer.c @@ -104,6 +104,8 @@ struct settings { char ircserver[HOST_NAME_MAX]; char ircserverport[MAXPORTLEN]; char conffile[PATH_MAX]; + char certfile[PATH_MAX]; + char keyfile[PATH_MAX]; }; // Return index of requested client FD within arr_clients @@ -1080,7 +1082,7 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) { // Initialise OpenSSL init_openssl(); ctx = create_context(); - configure_context(ctx); + configure_context(ctx, settings->certfile, settings->keyfile); while (1) { printf("top of loop, fdmax %d.\n", fdmax); @@ -1328,6 +1330,18 @@ int main(int argc, char *argv[]) { exit(1); } + // What is the certificate file path? + if (!getconfstr("certfile", settings.conffile, settings.certfile)) { + printf("main(): error getting 'certfile' from configuration file.\n"); + exit(1); + } + + // What is the certificate key file path? + if (!getconfstr("keyfile", settings.conffile, settings.keyfile)) { + printf("main(): error getting 'keyfile' from configuration file.\n"); + exit(1); + } + // TODO: see if any of this can be shared (i.e. 1. avoid code duplication, and 2. see if variables can be shared between client/server sockets) // TODO: track fdmax - kind of doing this now with arr_clients and num_clients but might be pointlessly tracking both in some places (?) |