"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
gotd: unix_socket -> listen on
To:
gameoftrees@openbsd.org
Date:
Thu, 5 Jan 2023 18:19:40 +0100

Download raw body.

Thread
This syntax reads nicer and is consistent with gotwebd.

ok?

 switch gotd.conf syntax from 'unix_socket' to 'listen on'
 
diff c7224e4126f5079e0dcb5b29b8ddb14c242a6c0b 393e4b5fb9a73c507424240612346c511f19b0f6
commit - c7224e4126f5079e0dcb5b29b8ddb14c242a6c0b
commit + 393e4b5fb9a73c507424240612346c511f19b0f6
blob - ccde19f88e7b40b792b110a9d7de24f505e67cae
blob + 42253ba60317aec22ed6f18dd8917d823ce845ed
--- gotd/gotd.conf.5
+++ gotd/gotd.conf.5
@@ -85,7 +85,7 @@ anonymous user identity.
 is granted read access and many concurrent connections will share this
 anonymous user identity.
 .El
-.It Ic unix_socket Ar path
+.It Ic listen on Ar path
 Set the path to the unix socket which
 .Xr gotd 8
 should listen on.
@@ -185,6 +185,9 @@ user _gotd
 # Run as the default user:
 user _gotd
 
+# Listen on the default socket:
+listen on "/var/run/gotd.sock"
+
 # This repository can be accessed via ssh://user@example.com/src
 repository "src" {
 	path "/var/git/src.git"
blob - 2103f5caa2ef025a6e22f6667363ba2268844af0
blob + a29a7a44f821516812229082c0eb453b05172017
--- gotd/parse.y
+++ gotd/parse.y
@@ -104,7 +104,7 @@ typedef struct {
 
 %}
 
-%token	PATH ERROR ON UNIX_SOCKET USER REPOSITORY PERMIT DENY
+%token	PATH ERROR LISTEN ON USER REPOSITORY PERMIT DENY
 %token	RO RW CONNECTION LIMIT REQUEST TIMEOUT
 
 %token	<v.string>	STRING
@@ -194,18 +194,18 @@ main		: UNIX_SOCKET STRING {
 		}
 		;
 
-main		: UNIX_SOCKET STRING {
+main		: LISTEN ON STRING {
 			if (gotd_proc_id == PROC_LISTEN) {
-				if (strlcpy(gotd->unix_socket_path, $2,
+				if (strlcpy(gotd->unix_socket_path, $3,
 				    sizeof(gotd->unix_socket_path)) >=
 				    sizeof(gotd->unix_socket_path)) {
 					yyerror("%s: unix socket path too long",
 					    __func__);
-					free($2);
+					free($3);
 					YYERROR;
 				}
 			}
-			free($2);
+			free($3);
 		}
 		| USER STRING {
 			if (strlcpy(gotd->user_name, $2,
@@ -353,6 +353,7 @@ lookup(char *s)
 		{ "connection",			CONNECTION },
 		{ "deny",			DENY },
 		{ "limit",			LIMIT },
+		{ "listen",			LISTEN },
 		{ "on",				ON },
 		{ "path",			PATH },
 		{ "permit",			PERMIT },
@@ -361,7 +362,6 @@ lookup(char *s)
 		{ "ro",				RO },
 		{ "rw",				RW },
 		{ "timeout",			TIMEOUT },
-		{ "unix_socket",		UNIX_SOCKET },
 		{ "user",			USER },
 	};
 	const struct keywords *p;
blob - c43ea128c1006bf4ed809106ce3ea7d8811bbf90
blob + af62270eac97585fd2c25fe84f7394ea0f036e99
--- regress/gotd/Makefile
+++ regress/gotd/Makefile
@@ -58,7 +58,7 @@ start_gotd_ro: ensure_root
 	fi
 
 start_gotd_ro: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
@@ -68,7 +68,7 @@ start_gotd_ro_group: ensure_root
 	@$(GOTD_TRAP); sleep .5
 
 start_gotd_ro_group: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
@@ -79,7 +79,7 @@ start_gotd_ro_denied_user: ensure_root
 
 # try a permit rule followed by a deny rule; last matched rule wins
 start_gotd_ro_denied_user: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
@@ -91,7 +91,7 @@ start_gotd_ro_denied_group: ensure_root
 
 # try a permit rule followed by a deny rule; last matched rule wins
 start_gotd_ro_denied_group: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
@@ -103,7 +103,7 @@ start_gotd_ro_bad_user: ensure_root
 
 # $GOTD_DEVUSER should not equal $GOTD_USER
 start_gotd_ro_bad_user: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
@@ -114,7 +114,7 @@ start_gotd_ro_bad_group: ensure_root
 
 # $GOTD_DEVUSER should not be in group wheel
 start_gotd_ro_bad_group: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf
@@ -124,7 +124,7 @@ start_gotd_rw: ensure_root
 	@$(GOTD_TRAP); sleep .5
 
 start_gotd_rw: ensure_root
-	@echo 'unix_socket "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
+	@echo 'listen on "$(GOTD_SOCK)"' > $(PWD)/gotd.conf
 	@echo "user $(GOTD_USER)" >> $(PWD)/gotd.conf
 	@echo 'repository "test-repo" {' >> $(PWD)/gotd.conf
 	@echo '    path "$(GOTD_TEST_REPO)"' >> $(PWD)/gotd.conf