hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: HADOOP-12296. when setnetgrent returns 0 in linux, exception should be thrown. Contributed by Chang Li (cherry picked from commit b9d25c3ee2d20166d6a786c5a16cc001e249f61c)
Date Wed, 04 Nov 2015 16:35:29 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 8334d8647 -> b9389ac5b


HADOOP-12296. when setnetgrent returns 0 in linux, exception should be thrown. Contributed
by Chang Li
(cherry picked from commit b9d25c3ee2d20166d6a786c5a16cc001e249f61c)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/b9389ac5
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b9389ac5
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b9389ac5

Branch: refs/heads/branch-2
Commit: b9389ac5b5c9804c509794994dac80078ae49e2a
Parents: 8334d86
Author: Jason Lowe <jlowe@apache.org>
Authored: Wed Nov 4 16:34:01 2015 +0000
Committer: Jason Lowe <jlowe@apache.org>
Committed: Wed Nov 4 16:35:12 2015 +0000

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt   |  3 +++
 .../security/JniBasedUnixGroupsNetgroupMapping.c  | 18 +++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9389ac5/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index b9260e3..beb3b9e 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -803,6 +803,9 @@ Release 2.7.3 - UNRELEASED
 
   BUG FIXES
 
+    HADOOP-12296. when setnetgrent returns 0 in linux, exception should be
+    thrown (Chang Li via jlowe)
+
 Release 2.7.2 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/b9389ac5/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
index de73a8a..4ae1051 100644
--- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c
@@ -57,6 +57,7 @@ Java_org_apache_hadoop_security_JniBasedUnixGroupsNetgroupMapping_getUsersForNet
   int setnetgrentCalledFlag = 0;
 
   // if not NULL then THROW exception
+  char *errorType = NULL;
   char *errorMessage = NULL;
 
   cgroup = (*env)->GetStringUTFChars(env, jgroup, NULL);
@@ -94,7 +95,14 @@ Java_org_apache_hadoop_security_JniBasedUnixGroupsNetgroupMapping_getUsersForNet
       }
     }
   }
-
+#if defined(__linux__)
+  else {
+    errorType = "java/io/IOException";
+    errorMessage =
+        "no netgroup of this name is known or some other error occurred";
+    goto END;
+  }
+#endif
   //--------------------------------------------------
   // build return data (java array)
 
@@ -103,7 +111,7 @@ Java_org_apache_hadoop_security_JniBasedUnixGroupsNetgroupMapping_getUsersForNet
     (*env)->FindClass(env, "java/lang/String"),
     NULL);
   if (jusers == NULL) {
-    errorMessage = "java/lang/OutOfMemoryError";
+    errorType = "java/lang/OutOfMemoryError";
     goto END;
   }
 
@@ -114,7 +122,7 @@ Java_org_apache_hadoop_security_JniBasedUnixGroupsNetgroupMapping_getUsersForNet
   for(current = userListHead; current != NULL; current = current->next) {
     jstring juser = (*env)->NewStringUTF(env, current->string);
     if (juser == NULL) {
-      errorMessage = "java/lang/OutOfMemoryError";
+      errorType = "java/lang/OutOfMemoryError";
       goto END;
     }
     (*env)->SetObjectArrayElement(env, jusers, i++, juser);
@@ -134,8 +142,8 @@ END:
   }
 
   // return results or THROW
-  if(errorMessage) {
-    THROW(env, errorMessage, NULL);
+  if(errorType) {
+    THROW(env, errorType, errorMessage);
     return NULL;
   } else {
     return jusers;


Mime
View raw message