~sircmpwn/gmni-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH gmni] gmnlm: create cert dir on 6x response

Details
Message ID
<20210309102159.20469-1-ecs@d2evs.net>
DKIM signature
pass
Download raw message
Patch: +9 -1
So that the OpenSSL command doesn't fail when the cert dir hasn't
already been created.
---
Once this is merged, I'll send a follow-up patch updating the other
dirname calls to use posix_dirname.
 include/util.h | 1 +
 src/gmnlm.c    | 7 +++++++
 src/util.c     | 2 +-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/util.h b/include/util.h
index 8ec9ac5..6c241f4 100644
--- a/include/util.h
+++ b/include/util.h
@@ -9,6 +9,7 @@ struct pathspec {
};

char *getpath(const struct pathspec *paths, size_t npaths);
void posix_dirname(char *path, char *dname);
int mkdirs(char *path, mode_t mode);
int download_resp(FILE *out, struct gemini_response resp, const char *path,
		char *url);
diff --git a/src/gmnlm.c b/src/gmnlm.c
index 87d6f35..1379959 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -510,6 +510,13 @@ do_requests(struct browser *browser, struct gemini_response *resp)
			n = snprintf(certpath, sizeof(certpath), path_fmt, host, "crt");
			assert(n < sizeof(certpath));
			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));
			fprintf(stderr, "The server requested a client certificate.\n"
				"Presently, this process is not automated.\n"
diff --git a/src/util.c b/src/util.c
index 1cb0bf4..8441b58 100644
--- a/src/util.c
+++ b/src/util.c
@@ -11,7 +11,7 @@
#include <sys/stat.h>
#include "util.h"

static void
void
posix_dirname(char *path, char *dname)
{
	char p[PATH_MAX+1];
-- 
2.30.1
Details
Message ID
<C9SUELDBQ4OK.3972F837RIENO@taiga>
In-Reply-To
<20210309102159.20469-1-ecs@d2evs.net> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks!

To git@git.sr.ht:~sircmpwn/gmni
   93f3052..42d8022  master -> master
Reply to thread Export thread (mbox)