commit 83577462cc61708af1c98d70939bb1d6c54a1506 from: Stefan Sperling date: Thu Jan 05 18:01:06 2023 UTC switch gotd.conf syntax from 'unix_socket' to 'listen on' ok op@ commit - 1dec34dfda7ccb3caadab65aca907251ab8fd72e commit + 83577462cc61708af1c98d70939bb1d6c54a1506 blob - ccde19f88e7b40b792b110a9d7de24f505e67cae blob + 42253ba60317aec22ed6f18dd8917d823ce845ed --- gotd/gotd.conf.5 +++ gotd/gotd.conf.5 @@ -85,7 +85,7 @@ expected to exceed the default limit, for example if a 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 @@ configuration file. # 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 STRING @@ -194,18 +194,18 @@ timeout : NUMBER { } ; -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 @@ 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: 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_group: 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_user: 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_denied_group: 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_user: 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_ro_bad_group: 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