summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Basch <probe@mit.edu>1997-02-28 23:11:37 +0000
committerRichard Basch <probe@mit.edu>1997-02-28 23:11:37 +0000
commit2beab8b8fe46a5b6fb0dc8c2983e27fa63b366e1 (patch)
tree3bae7a6e0f695c900b1248b45f6744359b6d9710
parent90c5bc6c987c81d66fef70a1713ac1bb81e9dde1 (diff)
If RegKRB5CCNAME is set in kerberos.ini, use that value to determine the
registry key that contains the credential cache name to use. This indirection provides a means of interoperating with Gradent's PC-DCE product. [deengert@anl.gov] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9990 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/lib/krb5/os/ccdefname.c55
1 files changed, 49 insertions, 6 deletions
diff --git a/src/lib/krb5/os/ccdefname.c b/src/lib/krb5/os/ccdefname.c
index 639fc666b6..b1a0f4f11c 100644
--- a/src/lib/krb5/os/ccdefname.c
+++ b/src/lib/krb5/os/ccdefname.c
@@ -111,12 +111,55 @@ char pathbuf[255];
{
char defname[160]; /* Default value */
- GetWindowsDirectory (defname, sizeof(defname)-7);
- strcat (defname, "\\krb5cc");
- strcpy (name_buf, "FILE:");
- GetPrivateProfileString(INI_FILES, INI_KRB_CCACHE, defname,
- name_buf+5, sizeof(name_buf)-5, KERBEROS_INI);
- }
+#if defined(_WIN32)
+ /* If the RegKRB5CCNAME variable is set, it will point to
+ * the registry key that has the name of the cache to use.
+ * The Gradient PC-DCE sets the registry key
+ * [HKEY_CURRENT_USER\Software\Gradient\DCE\Default\KRB5CCNAME]
+ * to point at the cache file name (including the FILE: prefix).
+ * By indirecting with the RegKRB5CCNAME entry in kerberos.ini,
+ * we can accomodate other versions that might set a registry
+ * variable.
+ */
+ char newkey[256];
+
+ LONG name_buf_size;
+ HKEY hkey;
+ DWORD ipType;
+ int found = 0;
+ char *cp;
+
+
+ GetPrivateProfileString(INI_FILES, "RegKRB5CCNAME", "",
+ newkey, sizeof(newkey), KERBEROS_INI);
+ if (strlen(newkey)) {
+ cp = strrchr(newkey,'\\');
+ if (cp) {
+ *cp = '\0'; /* split the string */
+ cp++;
+ } else
+ cp = "";
+ if (RegOpenKeyEx(HKEY_CURRENT_USER, newkey, 0,
+ KEY_QUERY_VALUE, &hkey) == ERROR_SUCCESS) {
+ name_buf_size = sizeof(name_buf);
+ if (RegQueryValueEx(hkey, cp, 0, &ipType,
+ name_buf, &name_buf_size)
+ == ERROR_SUCCESS)
+ found = 1;
+ }
+ }
+ if(!(found)) {
+#endif
+
+ GetWindowsDirectory (defname, sizeof(defname)-7);
+ strcat (defname, "\\krb5cc");
+ strcpy (name_buf, "FILE:");
+ GetPrivateProfileString(INI_FILES, INI_KRB_CCACHE, defname,
+ name_buf+5, sizeof(name_buf)-5, KERBEROS_INI);
+#if defined(_WIN32)
+ }
+#endif
+ }
#else
sprintf(name_buf, "FILE:/tmp/krb5cc_%d", getuid());
#endif