소스 검색

HDFS-4485. DN should chmod socket path a+w. Contributed by Colin Patrick McCabe.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-347@1444304 13f79535-47bb-0310-9956-ffa450edef68
Aaron Myers 12 년 전
부모
커밋
1132f51a9c

+ 15 - 0
hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/net/unix/DomainSocket.c

@@ -196,6 +196,21 @@ static jthrowable setup(JNIEnv *env, int *ofd, jobject jpath, int doConnect)
               terror(ret), addr.sun_path);
       goto done;
     }
+    /* We need to make the socket readable and writable for all users in the
+     * system.
+     *
+     * If the system administrator doesn't want the socket to be accessible to
+     * all users, he can simply adjust the +x permissions on one of the socket's
+     * parent directories.
+     *
+     * See HDFS-4485 for more discussion.
+     */
+    if (chmod(addr.sun_path, 0666)) {
+      ret = errno;
+      jthr = newException(env, "java/net/BindException",
+              "chmod(%s, 0666) failed: %s", addr.sun_path, terror(ret));
+      goto done;
+    }
     if (listen(fd, LISTEN_BACKLOG) < 0) {
       ret = errno;
       jthr = newException(env, "java/net/BindException",

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.HDFS-347.txt

@@ -41,3 +41,5 @@ HDFS-4438. TestDomainSocket fails when system umask is set to 0002. (Colin Patri
 HDFS-4440. Avoid annoying log message when dfs.domain.socket.path is not set. (Colin Patrick McCabe via atm)
 
 HDFS-4473. Don't create domain socket unless we need it. (Colin Patrick McCabe via atm)
+
+HDFS-4485. DN should chmod socket path a+w. (Colin Patrick McCabe via atm)