summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2022-03-29 18:14:54 -0400
committerJune McEnroe <june@causal.agency>2022-03-29 18:14:54 -0400
commit9c99b979973a0bbbee7f67ff10b696afd03ce363 (patch)
tree37a8158337594320b16050af532362b71630303f
parentReplace ORIGIN #define with clientOrigin variable (diff)
downloadpounce-9c99b979973a0bbbee7f67ff10b696afd03ce363.tar.gz
pounce-9c99b979973a0bbbee7f67ff10b696afd03ce363.zip
Set clientOrigin from bindHost, add dot if necessary
Since effectively the difference between a nick origin and a server
origin is the presence of a dot.
-rw-r--r--bounce.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bounce.c b/bounce.c
index de455d4..69783f8 100644
--- a/bounce.c
+++ b/bounce.c
@@ -285,6 +285,13 @@ int main(int argc, char *argv[]) {
 	if (clientPass && clientPass[0] != '$') {
 		errx(EX_USAGE, "password must be hashed with -x");
 	}
+	if (strchr(bindHost, '.')) {
+		clientOrigin = strdup(bindHost);
+		if (!clientOrigin) err(EX_OSERR, "strdup");
+	} else {
+		int n = asprintf(&clientOrigin, "%s.", bindHost);
+		if (n < 0) err(EX_OSERR, "asprintf");
+	}
 
 	if (printCert) {
 #ifdef __OpenBSD__