diff options
author | June McEnroe <june@causal.agency> | 2022-03-29 18:14:54 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2022-03-29 18:14:54 -0400 |
commit | 9c99b979973a0bbbee7f67ff10b696afd03ce363 (patch) | |
tree | 37a8158337594320b16050af532362b71630303f | |
parent | Replace ORIGIN #define with clientOrigin variable (diff) | |
download | pounce-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.c | 7 |
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__ |