summaryrefslogtreecommitdiff
path: root/src/swanctl/commands/load_creds.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2019-01-02 10:45:36 +0100
committerYves-Alexis Perez <corsac@debian.org>2019-01-02 11:07:05 +0100
commit918094fde55fa0dbfd59a5f88d576efb513a88db (patch)
tree61e31656c60a6cc928c50cd633568043673e2cbd /src/swanctl/commands/load_creds.c
parent69bc96f6b0b388d35e983f8d27224fa49d92918c (diff)
downloadvyos-strongswan-918094fde55fa0dbfd59a5f88d576efb513a88db.tar.gz
vyos-strongswan-918094fde55fa0dbfd59a5f88d576efb513a88db.zip
New upstream version 5.7.2
Diffstat (limited to 'src/swanctl/commands/load_creds.c')
-rw-r--r--src/swanctl/commands/load_creds.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/swanctl/commands/load_creds.c b/src/swanctl/commands/load_creds.c
index a9e352f7e..9a38b5d1e 100644
--- a/src/swanctl/commands/load_creds.c
+++ b/src/swanctl/commands/load_creds.c
@@ -106,10 +106,13 @@ static void load_certs(load_ctx_t *ctx, char *type_str, char *dir)
x509_flag_t flag;
struct stat st;
chunk_t *map;
- char *path;
+ char *path, buf[PATH_MAX];
vici_cert_info_from_str(type_str, &type, &flag);
+ snprintf(buf, sizeof(buf), "%s%s%s", swanctl_dir, DIRECTORY_SEPARATOR, dir);
+ dir = buf;
+
enumerator = enumerator_create_directory(dir);
if (enumerator)
{
@@ -428,7 +431,10 @@ static void load_keys(load_ctx_t *ctx, char *type, char *dir)
enumerator_t *enumerator;
struct stat st;
chunk_t *map;
- char *path, *rel;
+ char *path, *rel, buf[PATH_MAX];
+
+ snprintf(buf, sizeof(buf), "%s%s%s", swanctl_dir, DIRECTORY_SEPARATOR, dir);
+ dir = buf;
enumerator = enumerator_create_directory(dir);
if (enumerator)
@@ -535,7 +541,10 @@ static void load_containers(load_ctx_t *ctx, char *type, char *dir)
enumerator_t *enumerator;
struct stat st;
chunk_t *map;
- char *path, *rel;
+ char *path, *rel, buf[PATH_MAX];
+
+ snprintf(buf, sizeof(buf), "%s%s%s", swanctl_dir, DIRECTORY_SEPARATOR, dir);
+ dir = buf;
enumerator = enumerator_create_directory(dir);
if (enumerator)
@@ -946,7 +955,7 @@ static int load_creds(vici_conn_t *conn)
bool clear = FALSE, noprompt = FALSE;
command_format_options_t format = COMMAND_FORMAT_NONE;
settings_t *cfg;
- char *arg, *file = SWANCTL_CONF;
+ char *arg, *file = NULL;
int ret;
while (TRUE)
@@ -978,10 +987,9 @@ static int load_creds(vici_conn_t *conn)
break;
}
- cfg = settings_create(file);
+ cfg = load_swanctl_conf(file);
if (!cfg)
{
- fprintf(stderr, "parsing '%s' failed\n", file);
return EINVAL;
}