commit c75383b43523395c0bf9fca87daec3a3bed6d30b19d400680abbc2b48a424cf8 from: Stefan Sperling date: Mon Sep 29 09:49:53 2025 UTC fix gotsysd.conf "listen on" statement failing on non-existent sockets Reported by Mischa Peters commit - a3176e35e3da51757d6cc9ff8ab9c6eaa5a64aa25797c38a5c0af96bb51365a5 commit + c75383b43523395c0bf9fca87daec3a3bed6d30b19d400680abbc2b48a424cf8 blob - 37b54dadf03649cf5d25ec36d430b712f03faffc31c0ff9965230b23bbd8e7af blob + 349d50d4f4bdafbde7d2bafd4e45b4499f4b3c6ec9de8f8f17692bff54dfde69 --- gotsysd/parse.y +++ gotsysd/parse.y @@ -158,9 +158,21 @@ main : LISTEN ON STRING { "must be an absolute path", $3); if (realpath($3, gotsysd->unix_socket_path) == NULL) { - yyerror("realpath %s: %s", $3, strerror(errno)); - free($3); - YYERROR; + if (errno != ENOENT && errno != EACCES) { + yyerror("realpath %s: %s", $3, + strerror(errno)); + free($3); + YYERROR; + } + + if (strlcpy(gotsysd->unix_socket_path, $3, + sizeof(gotsysd->unix_socket_path)) >= + sizeof(gotsysd->unix_socket_path)) { + yyerror("unix socket path too long: %s", + $3); + free($3); + YYERROR; + } } free($3); } blob - e4f052bdd7ed80449316fcfbd2dc1770bbcc2b0b27fa079246c25c8613990d3d blob + ae1495129a39c474c3948c9530423f67096c121d2662165ca9b80bd3bb849422 --- regress/gotsysd/Makefile +++ regress/gotsysd/Makefile @@ -29,6 +29,7 @@ GOTD_CONF=gotd.conf GOTD_UID=501 # /usr/ports/infrastructure/db/user.list GOTD_USER=_gotd GOTSYSD_CONF=gotsysd.conf +GOTSYSD_UNIX_SOCKET=/var/run/gotsysd.sock GOTSYSD_UID=600 # /usr/ports/infrastructure/db/user.list GOTSYS_CONF=gotsys.conf GOT_CONF=got.conf @@ -195,6 +196,7 @@ ${GOTD_CONF}: ${GOTSYSD_CONF}: @${UNPRIV} "echo permit root > $@" @${UNPRIV} "echo permit _gotd >> $@" + @${UNPRIV} "echo listen on \\'${GOTSYSD_UNIX_SOCKET}\\' >> $@" ${GOTSYS_CONF}: ${GOTSYSD_SSH_PUBKEY} @${UNPRIV} "echo user ${GOTSYSD_TEST_USER} { >> $@"