From edd6aa54cba63f0af68a4a82627d4450ca0e6e96 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Eagles Date: Thu, 27 Mar 2014 20:08:47 +0000 Subject: [PATCH] HADOOP-10442. Group look-up can cause segmentation fault when certain JNI-based mapping module is used. (Kihwal Lee via jeagles) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1582452 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../native/src/org/apache/hadoop/security/hadoop_user_info.c | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 6cca91b0de6..7acb08ca6af 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -199,6 +199,9 @@ Release 2.4.0 - UNRELEASED HADOOP-10399. FileContext API for ACLs. (Vinayakumar B via cnauroth) + HADOOP-10442. Group look-up can cause segmentation fault when certain + JNI-based mapping module is used. (Kihwal Lee via jeagles) + Release 2.3.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/hadoop_user_info.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/hadoop_user_info.c index 5c58b96c39e..1bd7bdc6c1e 100644 --- a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/hadoop_user_info.c +++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/security/hadoop_user_info.c @@ -178,6 +178,11 @@ int hadoop_user_info_getgroups(struct hadoop_user_info *uinfo) return ret; } return 0; + } else if (ret != -1) { + // Any return code that is not -1 is considered as error. + // Since the user lookup was successful, there should be at least one + // group for this user. + return EIO; } ngids = realloc(uinfo->gids, sizeof(uinfo->gids[0]) * ngroups); if (!ngids) {