From 53af2e64832e8521bc5760dd23b68ce26725e624 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Tue, 13 Sep 2011 15:14:27 +1000 Subject: [PATCH] merge static credentials file locator from windows branch --- mech_eap/util_cred.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mech_eap/util_cred.c b/mech_eap/util_cred.c index 4c8c8c7..0cb8a76 100644 --- a/mech_eap/util_cred.c +++ b/mech_eap/util_cred.c @@ -36,7 +36,9 @@ #include "gssapiP_eap.h" +#ifndef WIN32 #include +#endif OM_uint32 gssEapAllocCred(OM_uint32 *minor, gss_cred_id_t *pCred) @@ -142,6 +144,21 @@ readStaticIdentityFile(OM_uint32 *minor, ccacheName = getenv("GSSEAP_IDENTITY"); if (ccacheName == NULL) { +#ifdef WIN32 + TCHAR szPath[MAX_PATH]; + + if (!SUCCEEDED(SHGetFolderPath(NULL, + CSIDL_APPDATA, /* |CSIDL_FLAG_CREATE */ + NULL, /* User access token */ + 0, + szPath))) { + major = GSS_S_CRED_UNAVAIL; + *minor = GetLastError(); + goto cleanup; + } + + snprintf(buf, sizeof(buf), "%s/.gss_eap_id", szPath); +#else if (getpwuid_r(getuid(), &pwd, pwbuf, sizeof(pwbuf), &pw) != 0 || pw == NULL || pw->pw_dir == NULL) { major = GSS_S_CRED_UNAVAIL; @@ -150,6 +167,7 @@ readStaticIdentityFile(OM_uint32 *minor, } snprintf(buf, sizeof(buf), "%s/.gss_eap_id", pw->pw_dir); +#endif /* WIN32 */ ccacheName = buf; } -- 2.1.4