Skip to content

Commit 6b09e66

Browse files
fapiftabilaharith
authored andcommitted
HDFS-14668 Support Fuse with Users from multiple Security Realms (apache#1739)
1 parent f827502 commit 6b09e66

File tree

1 file changed

+11
-1
lines changed
  • hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs

1 file changed

+11
-1
lines changed

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/fuse-dfs/fuse_connect.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ static int fuseNewConnect(const char *usrname, struct fuse_context *ctx,
476476
if (gPort) {
477477
hdfsBuilderSetNameNodePort(bld, gPort);
478478
}
479-
hdfsBuilderSetUserName(bld, usrname);
480479
if (gHdfsAuthConf == AUTH_CONF_KERBEROS) {
481480
findKerbTicketCachePath(ctx, kpath, sizeof(kpath));
482481
if (stat(kpath, &st) < 0) {
@@ -495,6 +494,17 @@ static int fuseNewConnect(const char *usrname, struct fuse_context *ctx,
495494
ret = -ENOMEM;
496495
goto error;
497496
}
497+
} else {
498+
// earlier the username was set to the builder always, but due to
499+
// HADOOP-9747 if we specify the username in case of kerberos authentication
500+
// the username will be used as the principal name, and that will conflict
501+
// with ticket cache based authentication as we have the OS user name here
502+
// not the real kerberos principal name. So with SIMPLE auth we pass on the
503+
// OS username still, and the UGI will use that as the username, but with
504+
// kerberos authentication we do not pass in the OS username and let the
505+
// authentication happen with the principal who's ticket is in the ticket
506+
// cache. (HDFS-15034 is still a possible improvement for SIMPLE AUTH.)
507+
hdfsBuilderSetUserName(bld, usrname);
498508
}
499509
conn->usrname = strdup(usrname);
500510
if (!conn->usrname) {

0 commit comments

Comments
 (0)