aboutsummaryrefslogtreecommitdiff
path: root/sslutils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-01-07 22:37:50 -0800
committerGuy Harris <guy@alum.mit.edu>2019-01-07 22:37:50 -0800
commit9225ae2eca86dc75ee9d4c8a626e0c9c1d5a7831 (patch)
treeed3bfe10ebd9f5bfe5e708a53251a6d9b97566c7 /sslutils.c
parent941280a5cd6aefafa79ff4dd032c4467a42c1fd1 (diff)
Make the key file and certificate file names local to sslutils.c.
Have routines that set them, given a pointer to the name. Use that in rpcapd, rather than copying to a buffer (you don't need to copy strings from argv - unless you're going to overwrite them, which you probably shouldn't do). This removes a requirement for the platform to define PATH_MAX.
Diffstat (limited to 'sslutils.c')
-rw-r--r--sslutils.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sslutils.c b/sslutils.c
index 605000bc..d09ed6c9 100644
--- a/sslutils.c
+++ b/sslutils.c
@@ -41,14 +41,24 @@
#include "sslutils.h"
#include "pcap/pcap.h"
-char ssl_keyfile[PATH_MAX]; //!< file containing the private key in PEM format
-char ssl_certfile[PATH_MAX]; //!< file containing the server's certificate in PEM format
-char ssl_rootfile[PATH_MAX]; //!< file containing the list of CAs trusted by the client
+static const char *ssl_keyfile = ""; //!< file containing the private key in PEM format
+static const char *ssl_certfile = ""; //!< file containing the server's certificate in PEM format
+static const char *ssl_rootfile = ""; //!< file containing the list of CAs trusted by the client
// TODO: a way to set ssl_rootfile from the command line, or an envvar?
// TODO: lock?
static SSL_CTX *ctx;
+void ssl_set_certfile(const char *certfile)
+{
+ ssl_certfile = certfile;
+}
+
+void ssl_set_keyfile(const char *keyfile)
+{
+ ssl_keyfile = keyfile;
+}
+
int ssl_init_once(int is_server, int enable_compression, char *errbuf, size_t errbuflen)
{
static int inited = 0;