summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8efdf07)
raw | patch | inline | side by side (parent: 8efdf07)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 30 Jan 2015 11:35:20 +0000 (12:35 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 30 Jan 2015 11:35:20 +0000 (12:35 +0100) |
src/include/utils/ssl.h | patch | blob | history | |
src/utils/ssl.c | patch | blob | history |
index 801c574ba0b7df7d663935156b25ae75dbcd0e61..5379bc9ebf7f15af9b93844b9c78e6fc3c045a38 100644 (file)
--- a/src/include/utils/ssl.h
+++ b/src/include/utils/ssl.h
* options are specified, default values will be used instead.
*/
sdb_ssl_client_t *
-sdb_ssl_client_create(sdb_ssl_options_t *opts);
+sdb_ssl_client_create(const sdb_ssl_options_t *opts);
/*
* sdb_ssl_client_destroy:
* options are specified, default values will be used instead.
*/
sdb_ssl_server_t *
-sdb_ssl_server_create(sdb_ssl_options_t *opts);
+sdb_ssl_server_create(const sdb_ssl_options_t *opts);
/*
* sdb_ssl_server_destroy:
diff --git a/src/utils/ssl.c b/src/utils/ssl.c
index d9ad060bb2270a86157135cb57e442b1a15af76e..723df2115600d404c3bf127c4d985e0fcc537203 100644 (file)
--- a/src/utils/ssl.c
+++ b/src/utils/ssl.c
} /* ssl_log_err */
static int
-copy_options(sdb_ssl_options_t *dst, sdb_ssl_options_t *src)
+copy_options(sdb_ssl_options_t *dst, const sdb_ssl_options_t *src)
{
+ sdb_ssl_options_t tmp;
sdb_ssl_options_t def = SDB_SSL_DEFAULT_OPTIONS;
- if (! src)
- src = &def;
-
- if (! src->ca_file)
- src->ca_file = def.ca_file;
- if (! src->key_file)
- src->key_file = def.key_file;
- if (! src->cert_file)
- src->cert_file = def.cert_file;
-
- dst->ca_file = strdup(src->ca_file);
- dst->key_file = strdup(src->key_file);
- dst->cert_file = strdup(src->cert_file);
+ if (src)
+ tmp = *src;
+ else
+ tmp = def;
+
+ if (! tmp.ca_file)
+ tmp.ca_file = def.ca_file;
+ if (! tmp.key_file)
+ tmp.key_file = def.key_file;
+ if (! tmp.cert_file)
+ tmp.cert_file = def.cert_file;
+
+ dst->ca_file = strdup(tmp.ca_file);
+ dst->key_file = strdup(tmp.key_file);
+ dst->cert_file = strdup(tmp.cert_file);
if ((! dst->ca_file) || (! dst->key_file) || (! dst->cert_file))
return -1;
- if (src->crl_file) {
- dst->crl_file = strdup(src->crl_file);
+ if (tmp.crl_file) {
+ dst->crl_file = strdup(tmp.crl_file);
if (! dst->crl_file)
return -1;
}
*/
sdb_ssl_client_t *
-sdb_ssl_client_create(sdb_ssl_options_t *opts)
+sdb_ssl_client_create(const sdb_ssl_options_t *opts)
{
sdb_ssl_client_t *client;
} /* sdb_ssl_client_connect */
sdb_ssl_server_t *
-sdb_ssl_server_create(sdb_ssl_options_t *opts)
+sdb_ssl_server_create(const sdb_ssl_options_t *opts)
{
sdb_ssl_server_t *server;