]> git.ipfire.org Git - thirdparty/samba.git/commit
lib/tsocket: new function to parse host port strs.
authorMatthew Grant <matt@mattgrant.net.nz>
Sun, 19 Sep 2021 05:41:42 +0000 (17:41 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 28 Sep 2021 09:44:35 +0000 (09:44 +0000)
commitf39a06de3bea9ec03a3e82c8892d9e572abd1163
treef472f94d46c1c02f1b1c947968629c049323de4d
parent775939823a5a956acc236c808d5aee78cbd9e132
lib/tsocket: new function to parse host port strs.

tsocket_address_inet_from_hostport_strings() on top of
tsocket_address_inet_from_strings(), implementing the ability to parse a
port number appended to an IPv6 or IPv4 address. IPv6 addresses can also
optionally have square brackets around them, but these are needed to
specify the port number as colon is used to delimit port from the IP
address in the string.

Note that this code just recognises and parses the strings with port
given, or just IPv6 with square brackets.  The rest of the parsing is
passed on to tsocket_address_inet_from strings(), and errors from there
passed back up the stack.

Signed-off-by: Matthew Grant <grantma@mattgrant.net.nz>
Reviewed-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/tsocket/tsocket.h
lib/tsocket/tsocket_bsd.c