From common-commits-return-86335-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Wed Aug 1 19:06:26 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id EA52B180662 for ; Wed, 1 Aug 2018 19:06:25 +0200 (CEST) Received: (qmail 89444 invoked by uid 500); 1 Aug 2018 17:06:19 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 88749 invoked by uid 99); 1 Aug 2018 17:06:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Aug 2018 17:06:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AFB08E11A0; Wed, 1 Aug 2018 17:06:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: xkrogen@apache.org To: common-commits@hadoop.apache.org Date: Wed, 01 Aug 2018 17:06:58 -0000 Message-Id: <33f78e81bbab472981f5c1f6c9beda43@git.apache.org> In-Reply-To: <13329d44b72e41458376fff314fa2504@git.apache.org> References: <13329d44b72e41458376fff314fa2504@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [42/50] hadoop git commit: HDFS-13322 fuse dfs - uid persists when switching between ticket caches. Contributed by Istvan Fajth. HDFS-13322 fuse dfs - uid persists when switching between ticket caches. Contributed by Istvan Fajth. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/40f9b0c5 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/40f9b0c5 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/40f9b0c5 Branch: refs/heads/HDFS-12943 Commit: 40f9b0c5c13f40921b6976589543a04efa489f93 Parents: c835fc0 Author: Aaron Fabbri Authored: Tue Jul 31 15:21:38 2018 -0700 Committer: Aaron Fabbri Committed: Tue Jul 31 18:44:49 2018 -0700 ---------------------------------------------------------------------- .../src/main/native/fuse-dfs/fuse_connect.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/40f9b0c5/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 6ee4ad5..f08917a 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 @@ -192,7 +192,7 @@ int fuseConnectInit(const char *nnUri, int port) } /** - * Compare two libhdfs connections by username + * Compare two libhdfs connections by username and Kerberos ticket cache path * * @param a The first libhdfs connection * @param b The second libhdfs connection @@ -201,22 +201,26 @@ int fuseConnectInit(const char *nnUri, int port) */ static int hdfsConnCompare(const struct hdfsConn *a, const struct hdfsConn *b) { - return strcmp(a->usrname, b->usrname); + int rc = strcmp(a->usrname, b->usrname); + if (rc) return rc; + return gHdfsAuthConf == AUTH_CONF_KERBEROS && strcmp(a->kpath, b->kpath); } /** * Find a libhdfs connection by username * * @param usrname The username to look up + * @param kpath The Kerberos ticket cache file path * * @return The connection, or NULL if none could be found */ -static struct hdfsConn* hdfsConnFind(const char *usrname) +static struct hdfsConn* hdfsConnFind(const char *usrname, const char *kpath) { struct hdfsConn exemplar; memset(&exemplar, 0, sizeof(exemplar)); exemplar.usrname = (char*)usrname; + exemplar.kpath = (char*)kpath; return RB_FIND(hdfsConnTree, &gConnTree, &exemplar); } @@ -542,8 +546,13 @@ static int fuseConnect(const char *usrname, struct fuse_context *ctx, int ret; struct hdfsConn* conn; + char kpath[PATH_MAX] = { 0 }; + if (gHdfsAuthConf == AUTH_CONF_KERBEROS) { + findKerbTicketCachePath(ctx, kpath, sizeof(kpath)); + } + pthread_mutex_lock(&gConnMutex); - conn = hdfsConnFind(usrname); + conn = hdfsConnFind(usrname, kpath); if (!conn) { ret = fuseNewConnect(usrname, ctx, &conn); if (ret) { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org