summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2013-12-24 17:58:21 +0530
committerVijay Bellur <vbellur@redhat.com>2013-12-26 03:36:30 -0800
commitd4b8825436daad701995e120f38da706e5fe97c1 (patch)
tree0c358fcdd8118b054f1d6c5cddbedadd0a6bdc05
parent0d7279d32d5f55c0210bdcfda2d3f83e35f524b6 (diff)
socket: unix socket connect path can't be greater than UNIX_PATH_MAX characters
Change-Id: I74788b63dd1c14507aa6d65182ea4b87a2e1f389 BUG: 1046308 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/6589 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--rpc/rpc-transport/socket/src/name.c4
-rw-r--r--tests/bugs/bug-1046308.t19
2 files changed, 21 insertions, 2 deletions
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index 1647d5b..c6eae97 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -285,7 +285,7 @@ af_unix_client_get_remote_sockaddr (rpc_transport_t *this,
goto err;
}
- if (strlen (connect_path) > UNIX_PATH_MAX) {
+ if ((strlen (connect_path) + 1) > UNIX_PATH_MAX) {
gf_log (this->name, GF_LOG_ERROR,
"connect-path value length %"GF_PRI_SIZET" > %d octets",
strlen (connect_path), UNIX_PATH_MAX);
@@ -329,7 +329,7 @@ af_unix_server_get_local_sockaddr (rpc_transport_t *this,
#define UNIX_PATH_MAX 108
#endif
- if (strlen (listen_path) > UNIX_PATH_MAX) {
+ if ((strlen (listen_path) + 1) > UNIX_PATH_MAX) {
gf_log (this->name, GF_LOG_ERROR,
"option transport.unix.listen-path has value length "
"%"GF_PRI_SIZET" > %d",
diff --git a/tests/bugs/bug-1046308.t b/tests/bugs/bug-1046308.t
new file mode 100644
index 0000000..cfec3a3
--- /dev/null
+++ b/tests/bugs/bug-1046308.t
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+
+cleanup;
+
+volname="StartMigrationDuringRebalanceTest"
+TEST glusterd
+TEST pidof glusterd;
+
+TEST $CLI volume info;
+TEST $CLI volume create $volname $H0:$B0/${volname}{1,2};
+TEST $CLI volume start $volname;
+TEST $CLI volume rebalance $volname start;
+
+cleanup;
+
+
+