HDFS-7771. fuse_dfs should permit FILE: on the front of KRB5CCNAME (cmccabe)

This commit is contained in:
Colin Patrick Mccabe 2015-02-11 12:14:23 -08:00
parent 026dfddfa3
commit 50625e660a
2 changed files with 19 additions and 0 deletions

View File

@ -918,6 +918,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7736. Fix typos in dfsadmin/fsck/snapshotDiff usage messages. HDFS-7736. Fix typos in dfsadmin/fsck/snapshotDiff usage messages.
(Brahma Reddy Battula via wheat9) (Brahma Reddy Battula via wheat9)
HDFS-7771. fuse_dfs should permit FILE: on the front of KRB5CCNAME
(cmccabe)
Release 2.6.1 - UNRELEASED Release 2.6.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -28,6 +28,7 @@
#include <search.h> #include <search.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <utime.h> #include <utime.h>
@ -358,6 +359,15 @@ static void hdfsConnExpiry(void)
pthread_mutex_unlock(&gConnMutex); pthread_mutex_unlock(&gConnMutex);
} }
// The Kerberos FILE: prefix. This indicates that the kerberos ticket cache
// specifier is a file. (Note that we also assume that the specifier is a file
// if no prefix is present.)
#define KRB_FILE_PREFIX "FILE:"
// Length of the Kerberos file prefix, which is equal to the string size in
// bytes minus 1 (because we don't count the null terminator in the length.)
#define KRB_FILE_PREFIX_LEN (sizeof(KRB_FILE_PREFIX) - 1)
/** /**
* Find the Kerberos ticket cache path. * Find the Kerberos ticket cache path.
* *
@ -414,6 +424,12 @@ done:
} else { } else {
path[pathIdx] = '\0'; path[pathIdx] = '\0';
} }
if (strncmp(path, KRB_FILE_PREFIX, KRB_FILE_PREFIX_LEN) == 0) {
fprintf(stderr, "stripping " KRB_FILE_PREFIX " from the front of "
"KRB5CCNAME.\n");
memmove(path, path + KRB_FILE_PREFIX_LEN,
strlen(path + KRB_FILE_PREFIX_LEN) + 1);
}
} }
/** /**