[PATCH 2/2] mount.cifs: stuff pass= option with $KRB5CCNAME when sec=krb5 is specified

Jeff Layton <[email protected]>
Newsgroups gmane.linux.file-systems.cifs,gmane.network.samba.internals
Message-ID <[email protected]>
Signed-off-by: Jeff Layton <[email protected]>
---
 source3/client/mount.cifs.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index 0c551cc..d2bcd10 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -369,6 +369,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
 	char * value = NULL;
 	char * next_keyword = NULL;
 	char * out = NULL;
+	char * ccname;
 	int out_len = 0;
 	int word_len;
 	int rc = 0;
@@ -484,9 +485,13 @@ static int parse_options(char ** optionsp, int * filesys_flags)
 			}
 		} else if (strncmp(data, "sec", 3) == 0) {
 			if (value) {
-				if (!strncmp(value, "none", 4) ||
-				    !strncmp(value, "krb5", 4))
+				if (!strncmp(value, "none", 4)) {
 					got_password = 1;
+				} else if (!strncmp(value, "krb5", 4)) {
+					got_password = 1;
+					if (ccname = getenv("KRB5CCNAME"))
+						mountpassword = strdup(ccname);
+				}
 			}
 		} else if (strncmp(data, "ip", 2) == 0) {
 			if (!value || !*value) {
-- 
1.6.2.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.