HDFS-10193. fuse_dfs segfaults if uid cannot be resolved to a username (John 
Thiltges via cmccabe)


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

Branch: refs/heads/HDFS-7240
Commit: 0d19a0ce98053572447bdadf88687ec55f2f1f46
Parents: af1d125
Author: Colin Patrick Mccabe <cmcc...@cloudera.com>
Authored: Wed Mar 23 11:19:18 2016 -0700
Committer: Colin Patrick Mccabe <cmcc...@cloudera.com>
Committed: Wed Mar 23 11:19:18 2016 -0700

----------------------------------------------------------------------
 .../src/main/native/fuse-dfs/fuse_connect.c                     | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0d19a0ce/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c
 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c
index e696072..6ee4ad5 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c
@@ -570,6 +570,11 @@ int fuseConnectAsThreadUid(struct hdfsConn **conn)
   
   ctx = fuse_get_context();
   usrname = getUsername(ctx->uid);
+  if (!usrname) {
+    ERROR("fuseConnectAsThreadUid(): failed to get username for uid %"PRId64
+          "\n", (uint64_t)ctx->uid);
+    return EIO;
+  }
   ret = fuseConnect(usrname, ctx, conn);
   free(usrname);
   return ret;

Reply via email to