summaryrefslogtreecommitdiff
path: root/tests/tcp.c
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2013-09-04 08:39:35 +0200
committerMartin Sustrik <sustrik@250bpm.com>2013-09-04 08:39:35 +0200
commit661e506259f47a26bc2beac443443466f119a1e1 (patch)
tree2d0e82f2cdf594e1652f69ef4603c91c73153302 /tests/tcp.c
parentf40f4ffb4a8595c56f7ee6a0ab3ee0e8a11d7ff0 (diff)
downloadnanomsg-661e506259f47a26bc2beac443443466f119a1e1.tar.gz
Hostname syntax is validated before resolving it
Fix for issue #120 Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'tests/tcp.c')
-rw-r--r--tests/tcp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/tcp.c b/tests/tcp.c
index 5b48292..abba9a1 100644
--- a/tests/tcp.c
+++ b/tests/tcp.c
@@ -105,6 +105,18 @@ int main ()
rc = nn_bind (sc, "tcp://eth10000:5555");
nn_assert (rc < 0);
errno_assert (nn_errno () == ENODEV);
+ rc = nn_connect (sc, "tcp://:5555");
+ nn_assert (rc < 0);
+ errno_assert (nn_errno () == EINVAL);
+ rc = nn_connect (sc, "tcp://-hostname:5555");
+ nn_assert (rc < 0);
+ errno_assert (nn_errno () == EINVAL);
+ rc = nn_connect (sc, "tcp://abc.123.---.#:5555");
+ nn_assert (rc < 0);
+ errno_assert (nn_errno () == EINVAL);
+ rc = nn_connect (sc, "tcp://[::1]:5555");
+ nn_assert (rc < 0);
+ errno_assert (nn_errno () == EINVAL);
/* Connect correctly. Do so before binding the peer socket. */
rc = nn_connect (sc, SOCKET_ADDRESS);