mirror of
https://git.sr.ht/~sircmpwn/gmni
synced 2024-05-05 19:56:03 +02:00
gmnlm: create cert dir on 6x response
So that the OpenSSL command doesn't fail when the cert dir hasn't already been created.
This commit is contained in:
parent
42d80229d4
commit
93f30522f0
|
@ -9,6 +9,7 @@ struct pathspec {
|
||||||
};
|
};
|
||||||
|
|
||||||
char *getpath(const struct pathspec *paths, size_t npaths);
|
char *getpath(const struct pathspec *paths, size_t npaths);
|
||||||
|
void posix_dirname(char *path, char *dname);
|
||||||
int mkdirs(char *path, mode_t mode);
|
int mkdirs(char *path, mode_t mode);
|
||||||
int download_resp(FILE *out, struct gemini_response resp, const char *path,
|
int download_resp(FILE *out, struct gemini_response resp, const char *path,
|
||||||
char *url);
|
char *url);
|
||||||
|
|
|
@ -510,6 +510,13 @@ do_requests(struct browser *browser, struct gemini_response *resp)
|
||||||
n = snprintf(certpath, sizeof(certpath), path_fmt, host, "crt");
|
n = snprintf(certpath, sizeof(certpath), path_fmt, host, "crt");
|
||||||
assert(n < sizeof(certpath));
|
assert(n < sizeof(certpath));
|
||||||
n = snprintf(keypath, sizeof(keypath), path_fmt, host, "key");
|
n = snprintf(keypath, sizeof(keypath), path_fmt, host, "key");
|
||||||
|
char dname[PATH_MAX + 1];
|
||||||
|
posix_dirname(certpath, dname);
|
||||||
|
if (mkdirs(dname, 0755) != 0) {
|
||||||
|
fprintf(stderr, "Error creating directory %s: %s\n",
|
||||||
|
dname, strerror(errno));
|
||||||
|
break;
|
||||||
|
}
|
||||||
assert(n < sizeof(keypath));
|
assert(n < sizeof(keypath));
|
||||||
fprintf(stderr, "The server requested a client certificate.\n"
|
fprintf(stderr, "The server requested a client certificate.\n"
|
||||||
"Presently, this process is not automated.\n"
|
"Presently, this process is not automated.\n"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static void
|
void
|
||||||
posix_dirname(char *path, char *dname)
|
posix_dirname(char *path, char *dname)
|
||||||
{
|
{
|
||||||
char p[PATH_MAX+1];
|
char p[PATH_MAX+1];
|
||||||
|
|
Loading…
Reference in New Issue