More consolidation of the computation of the default ccache name
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Sep 2007 03:16:18 +0000 (03:16 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Sep 2007 03:16:18 +0000 (03:16 +0000)
ticket: 5691

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19974 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/identity/plugins/krb5/krb5identpro.c

index 6f7ee308223409b6fcb99922838835156e5f8af5..996918351f1ed3465060620475e11e78e8d9e74f 100644 (file)
@@ -830,41 +830,14 @@ k5_ident_set_default_int(khm_handle def_ident) {
     cb = sizeof(id_ccname);
     if (KHM_FAILED(kcdb_identity_get_attr(def_ident, attr_id_krb5_ccname, NULL,
                                           id_ccname, &cb))) {
-        khm_handle csp_ident = NULL;
-        khm_handle csp_k5 = NULL;
-
         _reportf(L"The specified identity does not have the Krb5CCName property");
 
         cb = sizeof(id_ccname);
-        if (KHM_SUCCEEDED(kcdb_identity_get_config(def_ident, 0, &csp_ident)) &&
-            KHM_SUCCEEDED(khc_open_space(csp_ident, CSNAME_KRB5CRED, 0, &csp_k5)) &&
-            KHM_SUCCEEDED(khc_read_string(csp_k5, L"DefaultCCName",
-                                          id_ccname, &cb))) {
-
-            _reportf(L"Found CC name in configuration [%s]", id_ccname);
-        } else {
-            /* last resort, use the name of the identity as the cc
-               name */
-            cb = sizeof(id_ccname);
-            if (KHM_FAILED(kcdb_identity_get_name(def_ident, id_ccname, &cb))) {
-                _reportf(L"Can't use name of identity as CCName");
-                _end_task();
-
-                id_ccname[0] = L'\0';
-            }
-        }
-
-        if (csp_k5)
-            khc_close_space(csp_k5);
-        if (csp_ident)
-            khc_close_space(csp_ident);
-
-        if (id_ccname[0] == L'\0')
+        if (KHM_FAILED(khm_krb5_get_identity_default_ccache(def_ident, id_ccname, &cb))) {
             return KHM_ERROR_INVALID_PARAM;
+        }
     }
 
-    khm_krb5_canon_cc_name(id_ccname, sizeof(id_ccname));
-
     _reportf(L"Found Krb5CCName property : %s", id_ccname);
 
     StringCbLength(id_ccname, sizeof(id_ccname), &cb);