swanctl: Concatenate relative certificate paths correctly on Windows
authorMartin Willi <martin@revosec.ch>
Thu, 15 May 2014 13:12:35 +0000 (15:12 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:09 +0000 (15:53 +0200)
src/swanctl/commands/load_conns.c

index d418cd3..c551601 100644 (file)
@@ -102,16 +102,18 @@ static void add_file_list_key(vici_req_t *req, char *key, char *value)
        enumerator = enumerator_create_token(value, ",", " ");
        while (enumerator->enumerate(enumerator, &token))
        {
-               if (*token != '/')
+               if (!path_absolute(token))
                {
                        if (streq(key, "certs"))
                        {
-                               snprintf(buf, sizeof(buf), "%s/%s", SWANCTL_X509DIR, token);
+                               snprintf(buf, sizeof(buf), "%s%s%s",
+                                                SWANCTL_X509DIR, DIRECTORY_SEPARATOR, token);
                                token = buf;
                        }
                        if (streq(key, "cacerts"))
                        {
-                               snprintf(buf, sizeof(buf), "%s/%s", SWANCTL_X509CADIR, token);
+                               snprintf(buf, sizeof(buf), "%s%s%s",
+                                                SWANCTL_X509CADIR, DIRECTORY_SEPARATOR, token);
                                token = buf;
                        }
                }