aboutsummaryrefslogtreecommitdiff
path: root/src/platform/windows
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-11-01 22:05:35 -0800
committerGarrett D'Amore <garrett@damore.org>2020-11-08 17:50:24 -0800
commitfc6882305f0b5e06e58a0a25740f422d133015b5 (patch)
tree714b1fa4656253c8731a8f3f0861c24715440f95 /src/platform/windows
parent4bf06d03f6ebead7f4e0603a2da3b1b891887878 (diff)
downloadnng-fc6882305f0b5e06e58a0a25740f422d133015b5.tar.gz
nng-fc6882305f0b5e06e58a0a25740f422d133015b5.tar.bz2
nng-fc6882305f0b5e06e58a0a25740f422d133015b5.zip
fixes #1041 Abstract socket address for IPC
fixes #1326 Linux IPC could use fchmod fixes #1327 getsockname on ipc may not work This introduces an abstract:// style transport, which on Linux results in using the abstract socket with the given name (not including the leading NULL byte). A new NNG_AF_ABSTRACT is provided. Auto bind abstract sockets are also supported. While here we have inlined the aios for the POSIX ipc pipe objects, eliminating at least one set of failure paths, and have also performed various other cleanups. A unix:// alias is available on POSIX systems, which acts just like ipc:// (and is fact just an alias). This is supplied so that in the future we can add support for AF_UNIX on Windows. We've also absorbed the ipcperms test into the new ipc_test suite. Finally we are now enforcing that IPC path names on Windows are not over the maximum size, rather than just silently truncating them.
Diffstat (limited to 'src/platform/windows')
-rw-r--r--src/platform/windows/win_ipcdial.c3
-rw-r--r--src/platform/windows/win_ipclisten.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/platform/windows/win_ipcdial.c b/src/platform/windows/win_ipcdial.c
index 65d1b544..c210b7be 100644
--- a/src/platform/windows/win_ipcdial.c
+++ b/src/platform/windows/win_ipcdial.c
@@ -228,7 +228,8 @@ nni_ipc_dialer_alloc(nng_stream_dialer **dp, const nng_url *url)
int rv;
if ((strcmp(url->u_scheme, "ipc") != 0) || (url->u_path == NULL) ||
- (strlen(url->u_path) == 0)) {
+ (strlen(url->u_path) == 0)||
+ (strlen(url->u_path) >= NNG_MAXADDRLEN)) {
return (NNG_EADDRINVAL);
}
if ((d = NNI_ALLOC_STRUCT(d)) == NULL) {
diff --git a/src/platform/windows/win_ipclisten.c b/src/platform/windows/win_ipclisten.c
index a3922d06..65a7a8d7 100644
--- a/src/platform/windows/win_ipclisten.c
+++ b/src/platform/windows/win_ipclisten.c
@@ -1,5 +1,5 @@
//
-// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2019 Devolutions <info@devolutions.net>
//
@@ -328,7 +328,8 @@ nni_ipc_listener_alloc(nng_stream_listener **lp, const nng_url *url)
int rv;
if ((strcmp(url->u_scheme, "ipc") != 0) || (url->u_path == NULL) ||
- (strlen(url->u_path) == 0)) {
+ (strlen(url->u_path) == 0) ||
+ (strlen(url->u_path) >= NNG_MAXADDRLEN)) {
return (NNG_EADDRINVAL);
}
if ((l = NNI_ALLOC_STRUCT(l)) == NULL) {