Can you try the following diff to acme-client that adds support for
parsing a port number after the hostname?
If we decide to go this route we may wish to support a service name
in addition to a port number and IP addresses bracked with '[' and
']' but first things first.
- todd
Index: netproc.c
===================================================================
RCS file: /cvs/src/usr.sbin/acme-client/netproc.c,v
retrieving revision 1.33
diff -u -p -u -r1.33 netproc.c
--- netproc.c 14 Dec 2022 18:32:26 -0000 1.33
+++ netproc.c 4 Jun 2023 14:27:25 -0000
@@ -19,6 +19,7 @@
#include <ctype.h>
#include <err.h>
#include <errno.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -124,6 +125,15 @@ url2host(const char *host, short *port,
warn("strdup");
free(url);
return NULL;
+ }
+
+ /* Check for optional port. */
+ if ((ep = strrchr(url, ':')) != NULL) {
+ short urlport = strtonum(ep + 1, 1, SHRT_MAX, NULL);
+ if (urlport != 0) {
+ *ep = '\0';
+ *port = urlport;
+ }
}
return url;