From b6ad43c7e76da131f284a6af5a210a77ba08c610 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sat, 2 Nov 2019 04:06:41 -0400 Subject: Implement UNIX-domain binding --- bounce.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bounce.c') diff --git a/bounce.c b/bounce.c index 06340fd..a3a9693 100644 --- a/bounce.c +++ b/bounce.c @@ -172,6 +172,7 @@ static void signalHandler(int signal) { int main(int argc, char *argv[]) { const char *bindHost = "localhost"; const char *bindPort = "6697"; + const char *bindUnix = NULL; char certPath[PATH_MAX] = ""; char privPath[PATH_MAX] = ""; const char *save = NULL; @@ -189,7 +190,7 @@ int main(int argc, char *argv[]) { const char *away = "pounced :3"; const char *quit = "connection reset by purr"; - const char *Opts = "!A:C:H:K:NP:Q:W:a:f:h:j:n:p:r:s:u:vw:"; + const char *Opts = "!A:C:H:K:NP:Q:U:W:a:f:h:j:n:p:r:s:u:vw:"; const struct option LongOpts[] = { { "insecure", no_argument, NULL, '!' }, { "away", required_argument, NULL, 'A' }, @@ -199,6 +200,7 @@ int main(int argc, char *argv[]) { { "names", no_argument, NULL, 'N' }, { "bind-port", required_argument, NULL, 'P' }, { "quit", required_argument, NULL, 'Q' }, + { "bind-unix", required_argument, NULL, 'U' }, { "client-pass", required_argument, NULL, 'W' }, { "sasl", required_argument, NULL, 'a' }, { "save", required_argument, NULL, 'f' }, @@ -225,6 +227,7 @@ int main(int argc, char *argv[]) { break; case 'N': stateJoinNames = true; break; case 'P': bindPort = optarg; break; case 'Q': quit = optarg; + break; case 'U': bindUnix = optarg; break; case 'W': clientPass = optarg; break; case 'a': auth = optarg; break; case 'f': save = optarg; @@ -271,7 +274,9 @@ int main(int argc, char *argv[]) { fclose(priv); int bind[8]; - size_t binds = listenBind(bind, 8, bindHost, bindPort); + size_t binds = bindUnix + ? listenUnix(bind, ARRAY_LEN(bind), bindUnix) + : listenBind(bind, ARRAY_LEN(bind), bindHost, bindPort); int server = serverConnect(insecure, host, port); #ifdef __FreeBSD__ -- cgit 1.4.1 og/home?id=1c95b5a33b82fdc2fde2715d6b56db1d530c3fad&showmsg=1&follow=1'>home/.local (unfollow)
Commit message (Collapse)Author
2019-12-20Source .editrc before applying -v or -eJune McEnroe
Otherwise a bind -v in .editrc will take precedence and overwrite the ^I binding for sh-complete.
2019-12-20Disable signing commitsJune McEnroe
Why did I ever turn this on? This gets me nothing but inconvenience. RIP to all the wasted bytes in my git repos.
2019-12-19Ignore about-filterJune McEnroe
2019-12-19Fix matching make tags with no sourcesJune McEnroe
2019-12-19Avoid matching := assignments as tagsJune McEnroe
2019-12-18Hide line numbers when rendering mdocJune McEnroe
Hack: output an extra <td> after rendering mdoc so that line numbers can be hidden based on there being three. This required splitting source-filter and about-filter since on about pages there is no table.
2019-12-18Customize cgit CSSJune McEnroe
2019-12-18Use :target rather than :focus pseudo-classJune McEnroe
:target persists after you click on something else.
2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe
2019-12-18Add git.causal.agency cgit configJune McEnroe
2019-12-18Bail from hi if input is binaryJune McEnroe
NULs in the input cause an infinite loop in htmlEscape, not to mention regexes obviously not working, etc.
2019-12-16Post "cgit setup"June McEnroe