summaryrefslogtreecommitdiff
path: root/src/third_party/asio-master
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2018-04-17 13:55:47 -0400
committerJonathan Reams <jbreams@mongodb.com>2018-05-08 15:56:42 -0400
commit930c5cdb85858be4a11d68249d34101c3117baec (patch)
tree9cc5ee99740c4ec2fc8f99454b2532a66ab01a25 /src/third_party/asio-master
parente6c9fa2388b3ee6f789b14c5f767ea4c01834090 (diff)
downloadmongo-930c5cdb85858be4a11d68249d34101c3117baec.tar.gz
SERVER-33874 Unifiy hostname resolution in TransportLayerASIO
Diffstat (limited to 'src/third_party/asio-master')
-rw-r--r--src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp13
-rw-r--r--src/third_party/asio-master/patches/0004-Fix-UNIX-endpoint-length.patch25
2 files changed, 33 insertions, 5 deletions
diff --git a/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp b/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp
index af02feada17..e7e2f2e9611 100644
--- a/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp
+++ b/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp
@@ -110,12 +110,15 @@ void endpoint::init(const char* path_name, std::size_t path_length)
data_.local.sun_family = AF_UNIX;
if (path_length > 0)
memcpy(data_.local.sun_path, path_name, path_length);
- path_length_ = path_length;
- // NUL-terminate normal path names. Names that start with a NUL are in the
- // UNIX domain protocol's "abstract namespace" and are not NUL-terminated.
- if (path_length > 0 && data_.local.sun_path[0] == 0)
- data_.local.sun_path[path_length] = 0;
+ // For anonymous (zero-length path) or abstract namespace sockets, the path_length_ is just
+ // the length of the buffer passed in.
+ path_length_ = path_length;
+ // Otherwise it's a normal UNIX path, and the size must include the null terminator.
+ if (path_length > 0 && data_.local.sun_path[0] != 0)
+ {
+ path_length_ += 1;
+ }
}
} // namespace detail
diff --git a/src/third_party/asio-master/patches/0004-Fix-UNIX-endpoint-length.patch b/src/third_party/asio-master/patches/0004-Fix-UNIX-endpoint-length.patch
new file mode 100644
index 00000000000..6c217f7180f
--- /dev/null
+++ b/src/third_party/asio-master/patches/0004-Fix-UNIX-endpoint-length.patch
@@ -0,0 +1,25 @@
+diff --git a/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp b/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp
+index af02feada1..e7e2f2e961 100644
+--- a/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp
++++ b/src/third_party/asio-master/asio/include/asio/local/detail/impl/endpoint.ipp
+@@ -110,12 +110,15 @@ void endpoint::init(const char* path_name, std::size_t path_length)
+ data_.local.sun_family = AF_UNIX;
+ if (path_length > 0)
+ memcpy(data_.local.sun_path, path_name, path_length);
+- path_length_ = path_length;
+
+- // NUL-terminate normal path names. Names that start with a NUL are in the
+- // UNIX domain protocol's "abstract namespace" and are not NUL-terminated.
+- if (path_length > 0 && data_.local.sun_path[0] == 0)
+- data_.local.sun_path[path_length] = 0;
++ // For anonymous (zero-length path) or abstract namespace sockets, the path_length_ is just
++ // the length of the buffer passed in.
++ path_length_ = path_length;
++ // Otherwise it's a normal UNIX path, and the size must include the null terminator.
++ if (path_length > 0 && data_.local.sun_path[0] != 0)
++ {
++ path_length_ += 1;
++ }
+ }
+
+ } // namespace detail