NETIDMGR_VERSION_MAJOR=1\r
NETIDMGR_VERSION_MINOR=2\r
NETIDMGR_VERSION_PATCH=0\r
-NETIDMGR_VERSION_AUX=1\r
+NETIDMGR_VERSION_AUX=2\r
NETIDMGR_RELEASEDESC=\r
\r
# The API version. This number must be incremented each time the API\r
NETIDMGR_VERSION_MAJOR=1\r
NETIDMGR_VERSION_MINOR=2\r
NETIDMGR_VERSION_PATCH=0\r
-NETIDMGR_VERSION_AUX=1\r
+NETIDMGR_VERSION_AUX=2\r
NETIDMGR_RELEASEDESC=\r
\r
# The API version. This number must be incremented each time the API\r
if(c_sel)\r
PFREE(c_sel);\r
\r
+ if (cs_dest == NULL) {\r
+ kcdb_identity_refresh_all();\r
+ }\r
+\r
return code;\r
}\r
\r
if(c_sel)\r
PFREE(c_sel);\r
\r
+ if (cs_dest == NULL) {\r
+ kcdb_identity_refresh_all();\r
+ }\r
+\r
return code;\r
}\r
\r
return(0);\r
#else\r
\r
- LPCSTR functionName;\r
- int freeContextFlag;\r
+ LPCSTR functionName = NULL;\r
+ int freeContextFlag = 0;\r
krb5_error_code rc = 0;\r
krb5_flags flags = 0;\r
\r
time_t lifetime;\r
} k4_dlg_data;\r
\r
-void k4_update_display(k4_dlg_data * d) {\r
- int i;\r
-\r
+void k4_update_display(k4_dlg_data * d, BOOL update_methods) {\r
CheckDlgButton(d->hwnd, IDC_NCK4_OBTAIN,\r
(d->k4_enabled)?BST_CHECKED: BST_UNCHECKED);\r
\r
if (d->k4_enabled) {\r
EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_AUTO), TRUE);\r
- EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), TRUE);\r
EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_K524), TRUE);\r
+ EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), TRUE);\r
} else {\r
EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_AUTO), FALSE);\r
- EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), FALSE);\r
EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_K524), FALSE);\r
+ EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), FALSE);\r
}\r
\r
#ifdef DEBUG\r
assert(d->method >= 0 && d->method < ARRAYLENGTH(method_to_id));\r
#endif\r
\r
- CheckDlgButton(d->hwnd, method_to_id[d->method], BST_CHECKED);\r
-\r
- for (i=0; i < ARRAYLENGTH(method_to_id); i++) {\r
- if (i != d->method && method_to_id[i] != 0)\r
- CheckDlgButton(d->hwnd, method_to_id[d->method],\r
- BST_UNCHECKED);\r
- }\r
+ CheckRadioButton(d->hwnd, IDC_NCK4_AUTO, IDC_NCK4_PWD, method_to_id[d->method]);\r
\r
khui_cw_enable_type(d->nc, credtype_id_krb4, d->k4_enabled);\r
}\r
khui_cw_enable_type(d->nc, credtype_id_krb4, d->k4_enabled);\r
}\r
\r
- d->method = 0;\r
+ d->method = K4_METHOD_AUTO;\r
\r
for (i=K4_METHOD_AUTO; i<=K4_METHOD_K524; i++) {\r
if (IsDlgButtonChecked(d->hwnd, method_to_id[i]) == BST_CHECKED) {\r
khm_handle csp_ident = NULL;\r
khm_handle csp_k4 = NULL;\r
khm_boolean get_k4 = TRUE;\r
-\r
- if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"Krb4NewCreds", &t)) &&\r
- !t)\r
- return FALSE;\r
+ khm_boolean id_spec = FALSE;\r
\r
if (KHM_FAILED(kcdb_identity_get_flags(ident, &idflags)))\r
return FALSE;\r
\r
if (!(idflags & KCDB_IDENT_FLAG_DEFAULT)) {\r
/* we only support k4 for one identity, and that is the\r
- default identity. If we are trying to get tickets for\r
- a non-default identity, then we start off as\r
- disabled. */\r
+ default identity. If we are trying to get tickets for a\r
+ non-default identity, then we start off as disabled unless\r
+ there is no default identity. */\r
\r
khm_handle defident = NULL;\r
\r
if (KHM_SUCCEEDED(khc_open_space(csp_ident, CSNAME_KRB4CRED, 0,\r
&csp_k4))) {\r
khm_int32 t = 0;\r
- if (KHM_SUCCEEDED(khc_read_int32(csp_k4, L"Krb4NewCreds", &t)) &&\r
- !t)\r
- get_k4 = FALSE;\r
+\r
+ if (KHM_SUCCEEDED(khc_read_int32(csp_k4, L"Krb4NewCreds", &t))) {\r
+ get_k4 = !!t;\r
+ id_spec = TRUE;\r
+ }\r
\r
khc_close_space(csp_k4);\r
}\r
khc_close_space(csp_ident);\r
}\r
\r
- return get_k4;\r
+ /* if there was a value specified for the identity, then that\r
+ takes precedence. */\r
+ if (id_spec || !get_k4)\r
+ return get_k4;\r
+\r
+ if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"Krb4NewCreds", &t)) &&\r
+ !t)\r
+ return FALSE;\r
+\r
+ return TRUE;\r
}\r
\r
void k4_read_identity_data(k4_dlg_data * d) {\r
\r
kcdb_identity_get_flags(d->nc->identities[0], &flags);\r
\r
- if (flags & KCDB_IDENT_FLAG_INVALID)\r
+ if (!(flags & KCDB_IDENT_FLAG_VALID)) {\r
break;\r
+ }\r
\r
cb = sizeof(idname);\r
kcdb_identity_get_name(d->nc->identities[0], idname,\r
\r
case WMNC_IDENTITY_CHANGE:\r
k4_read_identity_data(d);\r
- k4_update_display(d);\r
+ k4_update_display(d, TRUE);\r
break;\r
\r
case WMNC_CREDTEXT_LINK:\r
if (!wcscmp(wids, L"Enable")) {\r
d->k4_enabled = TRUE;\r
\r
- k4_update_display(d);\r
+ k4_update_display(d, TRUE);\r
khui_cw_enable_type(d->nc, credtype_id_krb4, TRUE);\r
}\r
}\r
d->k4_enabled = TRUE;\r
d->method = K4_METHOD_AUTO;\r
\r
- k4_update_display(d);\r
+ k4_update_display(d, TRUE);\r
}\r
break;\r
\r
case WM_COMMAND:\r
{\r
- d = (k4_dlg_data *) (LONG_PTR)\r
- GetWindowLongPtr(hwnd, DWLP_USER);\r
+ if (HIWORD(wParam) == BN_CLICKED) {\r
+ d = (k4_dlg_data *) (LONG_PTR)\r
+ GetWindowLongPtr(hwnd, DWLP_USER);\r
+\r
+ k4_update_data(d);\r
\r
- k4_update_data(d);\r
- k4_update_display(d);\r
+ if (LOWORD(wParam) == IDC_NCK4_OBTAIN) {\r
+ k4_update_display(d, TRUE);\r
+ }\r
+\r
+ return TRUE;\r
+ }\r
}\r
break;\r
\r
CONTROL "Kerberos v4 Ticket Options",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP,7,7,286,11\r
CONTROL "Obtain Kerberos v4 credentials",IDC_NCK4_OBTAIN,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,7,26,128,10\r
GROUPBOX "Obtain Kerberos v4 credentials using",IDC_STATIC,7,43,286,72,WS_GROUP\r
- CONTROL "Automatically determine method",IDC_NCK4_AUTO,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,58,152,10\r
- CONTROL "Kerberos v5 to v4 translation",IDC_NCK4_K524,"Button",BS_AUTORADIOBUTTON,23,76,152,10\r
- CONTROL "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON,23,94,152,10\r
+ CONTROL "Automatically determine method",IDC_NCK4_AUTO,"Button",BS_AUTORADIOBUTTON,22,59,119,10\r
+ CONTROL "Kerberos v5 to v4 translation",IDC_NCK4_K524,"Button",BS_AUTORADIOBUTTON,22,76,109,10\r
+ CONTROL "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON,22,93,47,10\r
END\r
\r
IDD_CFG_KRB4 DIALOGEX 0, 0, 255, 182\r
// Microsoft Visual C++ generated include file.\r
// Used by C:\work\pismere\athena\auth\krb5\src\windows\identity\plugins\krb4\lang\en_us\langres.rc\r
//\r
-#define IDS_UNK_ADDR_FMT 101\r
-#define IDS_KRB5_CREDTEXT_0 102\r
#define IDD_NC_KRB4 103\r
#define IDS_PLUGIN_DESC 103\r
-#define IDS_KEY_ENCTYPE_SHORT_DESC 104\r
#define IDD_CFG_KRB4 104\r
#define IDS_NC_K4_SHORT 104\r
-#define IDS_TKT_ENCTYPE_SHORT_DESC 105\r
#define IDS_ERR_REALM 105\r
#define IDD_CFG_IDS_KRB4 105\r
-#define IDS_KEY_ENCTYPE_LONG_DESC 106\r
#define IDS_ERR_PRINCIPAL 106\r
#define IDD_CFG_ID_KRB4 106\r
-#define IDS_TKT_ENCTYPE_LONG_DESC 107\r
#define IDS_ERR_INVINST 107\r
-#define IDI_ICON1 107\r
#define IDI_PLUGIN 107\r
-#define IDS_ADDR_LIST_SHORT_DESC 108\r
#define IDS_ERR_PWINTKT 108\r
-#define IDS_ADDR_LIST_LONG_DESC 109\r
#define IDS_CT_DISABLED 109\r
-#define IDS_ETYPE_NULL 110\r
#define IDS_CT_TGTFOR 110\r
-#define IDS_ETYPE_DES_CBC_CRC 111\r
#define IDS_METHOD_AUTO 111\r
-#define IDS_ETYPE_DES_CBC_MD4 112\r
#define IDS_METHOD_PWD 112\r
-#define IDS_ETYPE_DES_CBC_MD5 113\r
#define IDS_METHOD_K524 113\r
-#define IDS_ETYPE_DES_CBC_RAW 114\r
#define IDS_CFG_IDS_KRB4_SHORT 114\r
-#define IDS_ETYPE_DES3_CBC_SHA 115\r
-#define IDS_ETYPE_DES3_CBC_RAW 116\r
-#define IDS_ETYPE_DES_HMAC_SHA1 117\r
-#define IDS_ETYPE_DES3_CBC_SHA1 118\r
-#define IDS_ETYPE_AES128_CTS_HMAC_SHA1_96 119\r
-#define IDS_ETYPE_AES256_CTS_HMAC_SHA1_96 120\r
-#define IDS_ETYPE_ARCFOUR_HMAC 121\r
-#define IDS_ETYPE_ARCFOUR_HMAC_EXP 122\r
-#define IDS_ETYPE_UNKNOWN 123\r
-#define IDS_ETYPE_LOCAL_DES3_HMAC_SHA1 124\r
-#define IDS_ETYPE_LOCAL_RC4_MD4 125\r
-#define IDS_KRB5_SHORT_DESC 126\r
-#define IDS_KRB5_LONG_DESC 127\r
#define IDS_KRB4_SHORT_DESC 128\r
#define IDS_KRB4_LONG_DESC 129\r
-#define IDS_KRB5_FLAGS_SHORT_DESC 130\r
-#define IDS_RENEW_TILL_SHORT_DESC 131\r
-#define IDS_RENEW_TILL_LONG_DESC 132\r
-#define IDS_RENEW_FOR_SHORT_DESC 133\r
-#define IDS_RENEW_FOR_LONG_DESC 134\r
#define IDS_CFG_KRB4_LONG 135\r
#define IDS_CFG_KRB4_SHORT 136\r
-#define IDC_NCK5_RENEWABLE 1002\r
-#define IDC_NCK5_FORWARDABLE 1004\r
-#define IDC_NCK5_REALM 1005\r
-#define IDC_NCK5_ADD_REALMS 1006\r
-#define IDC_NCK5_LIFETIME_EDIT 1008\r
-#define IDC_NCK5_RENEW_EDIT 1009\r
-#define IDC_PPK5_CRENEW 1014\r
-#define IDC_PPK5_CFORWARD 1015\r
-#define IDC_PPK5_CPROXY 1016\r
-#define IDC_PPK5_NAME 1017\r
-#define IDC_PPK5_ISSUE 1018\r
-#define IDC_PPK5_VALID 1019\r
-#define IDC_PPK5_RENEW 1020\r
-#define IDC_CHECK2 1022\r
-#define IDC_CHECK4 1024\r
-#define IDC_PPK5_LIFETIME 1024\r
-#define IDC_CHECK5 1025\r
#define IDC_CFG_LBL_CACHE 1025\r
#define IDC_CFG_LBL_CFGFILE 1026\r
#define IDC_CFG_LBL_RLMPATH 1027\r
#define IDC_CFG_CFGBROW 1031\r
#define IDC_CFG_RLMBROW 1032\r
#define IDC_NCK4_OBTAIN 1033\r
-#define IDC_NCK4_PWD 1034\r
+#define IDC_NCK4_AUTO 1034\r
#define IDC_NCK4_K524 1035\r
-#define IDC_NCK4_AUTO 1036\r
+#define IDC_NCK4_PWD 1036\r
#define IDC_CFG_GETTIX 1037\r
\r
// Next default values for new objects\r
#ifndef APSTUDIO_READONLY_SYMBOLS\r
#define _APS_NEXT_RESOURCE_VALUE 108\r
#define _APS_NEXT_COMMAND_VALUE 40001\r
-#define _APS_NEXT_CONTROL_VALUE 1039\r
+#define _APS_NEXT_CONTROL_VALUE 1043\r
#define _APS_NEXT_SYMED_VALUE 101\r
#endif\r
#endif\r
kcdb_identity_get_name(identity, idname, &cb);\r
\r
if (khm_krb5_get_identity_flags(identity) & K5IDFLAG_IMPORTED) {\r
-#ifdef REIMPORT_MSLSA_CREDS\r
+#ifndef NO_REIMPORT_MSLSA_CREDS\r
/* we are trying to renew the identity that was imported from\r
MSLSA: */\r
- BOOL imported;\r
- char cidname[KCDB_IDENT_MAXCCH_NAME];\r
+ BOOL imported;\r
+ BOOL retry_import = FALSE;\r
+ char cidname[KCDB_IDENT_MAXCCH_NAME];\r
+ khm_handle imported_id = NULL;\r
+ khm_size cb;\r
+ FILETIME ft_expire;\r
+ FILETIME ft_now;\r
+ FILETIME ft_threshold;\r
+ krb5_principal princ = NULL;\r
\r
UnicodeStrToAnsi(cidname, sizeof(cidname), idname);\r
\r
- imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, NULL);\r
+ imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, &imported_id);\r
+\r
+ if (imported == 0)\r
+ goto import_failed;\r
+\r
+ /* if the imported identity has already expired or will soon,\r
+ we clear the cache and try again. */\r
+ khm_krb5_list_tickets(&ctx);\r
+\r
+ cb = sizeof(ft_expire);\r
+ if (KHM_FAILED(kcdb_identity_get_attr(imported_id, KCDB_ATTR_EXPIRE,\r
+ NULL, &ft_expire, &cb)))\r
+ goto import_failed;\r
+\r
+ GetSystemTimeAsFileTime(&ft_now);\r
+ TimetToFileTimeInterval(5 * 60, &ft_threshold);\r
+\r
+ ft_now = FtAdd(&ft_now, &ft_threshold);\r
+\r
+ if (CompareFileTime(&ft_expire, &ft_now) < 0) {\r
+ /* the ticket lifetime is not long enough */\r
+\r
+ code = 0;\r
+\r
+ if (ctx == NULL)\r
+ code = pkrb5_init_context(&ctx);\r
+ if (code)\r
+ goto import_failed;\r
+\r
+ code = pkrb5_cc_resolve(ctx, "MSLSA:", &cc);\r
+ if (code)\r
+ goto import_failed;\r
+\r
+ code = pkrb5_cc_get_principal(ctx, cc, &princ);\r
+ if (code)\r
+ goto import_failed;\r
+\r
+ pkrb5_cc_initialize(ctx, cc, princ);\r
+\r
+ retry_import = TRUE;\r
+ }\r
+\r
+ import_failed:\r
+\r
+ if (imported_id) {\r
+ kcdb_identity_release(imported_id);\r
+ imported_id = NULL;\r
+ }\r
+\r
+ if (ctx) {\r
+ if (cc) {\r
+ pkrb5_cc_close(ctx, cc);\r
+ cc = NULL;\r
+ }\r
+\r
+ if (princ) {\r
+ pkrb5_free_principal(ctx, princ);\r
+ princ = NULL;\r
+ }\r
+\r
+ /* leave ctx so we can use it later */\r
+ }\r
+\r
+ if (retry_import)\r
+ imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, NULL);\r
\r
if (imported)\r
goto cleanup;\r
\r
/* if the import failed, then we try to renew the identity via\r
the usual procedure. */\r
+\r
#else\r
/* if we are suppressing further imports from MSLSA, we just\r
skip renewing this identity. */\r
}\r
\r
static khm_int32\r
-k5_ident_valiate_name(khm_int32 msg_type,\r
+k5_ident_validate_name(khm_int32 msg_type,\r
khm_int32 msg_subtype,\r
khm_ui_4 uparam,\r
void * vparam) {\r
khc_write_string(csp_params, L"LastDefaultIdent", idname);\r
}\r
\r
+static khm_int32\r
+k5_ident_set_default_int(khm_handle def_ident) {\r
+ wchar_t id_ccname[KRB5_MAXCCH_CCNAME];\r
+ khm_size cb;\r
+ DWORD dw;\r
+ LONG l;\r
+ HKEY hk_ccname;\r
+ DWORD dwType;\r
+ DWORD dwSize;\r
+ wchar_t reg_ccname[KRB5_MAXCCH_CCNAME];\r
+\r
+#ifdef DEBUG\r
+ assert(def_ident != NULL);\r
+#endif\r
+\r
+ cb = sizeof(id_ccname);\r
+ if (KHM_FAILED(kcdb_identity_get_attr(def_ident, attr_id_krb5_ccname, NULL,\r
+ id_ccname, &cb))) {\r
+ khm_handle csp_ident = NULL;\r
+ khm_handle csp_k5 = NULL;\r
+\r
+ _reportf(L"The specified identity does not have the Krb5CCName property");\r
+\r
+ cb = sizeof(id_ccname);\r
+ if (KHM_SUCCEEDED(kcdb_identity_get_config(def_ident, 0, &csp_ident)) &&\r
+ KHM_SUCCEEDED(khc_open_space(csp_ident, CSNAME_KRB5CRED, 0, &csp_k5)) &&\r
+ KHM_SUCCEEDED(khc_read_string(csp_k5, L"DefaultCCName",\r
+ id_ccname, &cb))) {\r
+\r
+ _reportf(L"Found CC name in configuration [%s]", id_ccname);\r
+ } else {\r
+ /* last resort, use the name of the identity as the cc\r
+ name */\r
+ cb = sizeof(id_ccname);\r
+ if (KHM_FAILED(kcdb_identity_get_name(def_ident, id_ccname, &cb))) {\r
+ _reportf(L"Can't use name of identity as CCName");\r
+ _end_task();\r
+\r
+ id_ccname[0] = L'\0';\r
+ }\r
+ }\r
+\r
+ if (csp_k5)\r
+ khc_close_space(csp_k5);\r
+ if (csp_ident)\r
+ khc_close_space(csp_ident);\r
+\r
+ if (id_ccname[0] == L'\0')\r
+ return KHM_ERROR_INVALID_PARAM;\r
+ }\r
+\r
+ khm_krb5_canon_cc_name(id_ccname, sizeof(id_ccname));\r
+\r
+ _reportf(L"Found Krb5CCName property : %s", id_ccname);\r
+\r
+ StringCbLength(id_ccname, sizeof(id_ccname), &cb);\r
+ cb += sizeof(wchar_t);\r
+\r
+ _reportf(L"Setting default CC name in the registry");\r
+\r
+ l = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\MIT\\kerberos5", 0,\r
+ KEY_READ | KEY_WRITE, &hk_ccname);\r
+\r
+ if (l != ERROR_SUCCESS)\r
+ l = RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\MIT\\kerberos5", 0,\r
+ NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE,\r
+ NULL, &hk_ccname, &dw);\r
+\r
+ if (l != ERROR_SUCCESS) {\r
+ _reportf(L"Can't create registry key : %d", l);\r
+ _end_task();\r
+ return KHM_ERROR_UNKNOWN;\r
+ }\r
+\r
+ dwSize = sizeof(reg_ccname);\r
+\r
+ l = RegQueryValueEx(hk_ccname, L"ccname", NULL, &dwType, (LPBYTE) reg_ccname,\r
+ &dwSize);\r
+\r
+ if (l != ERROR_SUCCESS ||\r
+ dwType != REG_SZ ||\r
+ khm_krb5_cc_name_cmp(reg_ccname, id_ccname)) {\r
+\r
+ /* we have to write the new value in */\r
+ \r
+ l = RegSetValueEx(hk_ccname, L"ccname", 0, REG_SZ, (BYTE *) id_ccname,\r
+ (DWORD) cb);\r
+ }\r
+\r
+ RegCloseKey(hk_ccname);\r
+\r
+ if (l == ERROR_SUCCESS) {\r
+ _reportf(L"Successfully set the default ccache");\r
+ k5_update_last_default_identity(def_ident);\r
+ return KHM_ERROR_SUCCESS;\r
+ } else {\r
+ _reportf(L"Can't set the registry value : %d", l);\r
+ return KHM_ERROR_UNKNOWN;\r
+ }\r
+}\r
+\r
static khm_int32\r
k5_ident_set_default(khm_int32 msg_type,\r
khm_int32 msg_subtype,\r
if (uparam) {\r
/* an identity is being made default */\r
khm_handle def_ident = (khm_handle) vparam;\r
- wchar_t id_ccname[KRB5_MAXCCH_CCNAME];\r
- khm_size cb;\r
- DWORD dw;\r
- LONG l;\r
- HKEY hk_ccname;\r
- DWORD dwType;\r
- DWORD dwSize;\r
- wchar_t reg_ccname[KRB5_MAXCCH_CCNAME];\r
+ khm_int32 rv;\r
\r
#ifdef DEBUG\r
assert(def_ident != NULL);\r
_describe();\r
}\r
\r
- cb = sizeof(id_ccname);\r
- if (KHM_FAILED(kcdb_identity_get_attr(def_ident,\r
- attr_id_krb5_ccname,\r
- NULL,\r
- id_ccname,\r
- &cb))) {\r
- khm_handle csp_ident = NULL;\r
- khm_handle csp_k5 = NULL;\r
-\r
- _reportf(L"The specified identity does not have the Krb5CCName property");\r
-\r
- cb = sizeof(id_ccname);\r
- if (KHM_SUCCEEDED(kcdb_identity_get_config(def_ident, 0, &csp_ident)) &&\r
- KHM_SUCCEEDED(khc_open_space(csp_ident, CSNAME_KRB5CRED, 0, &csp_k5)) &&\r
- KHM_SUCCEEDED(khc_read_string(csp_k5, L"DefaultCCName",\r
- id_ccname, &cb))) {\r
-\r
- _reportf(L"Found CC name in configuration [%s]", id_ccname);\r
- } else {\r
- /* last resort, use the name of the identity as the cc\r
- name */\r
- cb = sizeof(id_ccname);\r
- if (KHM_FAILED(kcdb_identity_get_name(def_ident, id_ccname, &cb))) {\r
- _reportf(L"Can't use name of identity as CCName");\r
- _end_task();\r
-\r
- id_ccname[0] = L'\0';\r
- }\r
- }\r
-\r
- if (csp_k5)\r
- khc_close_space(csp_k5);\r
- if (csp_ident)\r
- khc_close_space(csp_ident);\r
-\r
- if (id_ccname[0] == L'\0')\r
- return KHM_ERROR_INVALID_PARAM;\r
- }\r
-\r
- khm_krb5_canon_cc_name(id_ccname, sizeof(id_ccname));\r
-\r
- _reportf(L"Found Krb5CCName property : %s", id_ccname);\r
-\r
- StringCbLength(id_ccname, sizeof(id_ccname), &cb);\r
- cb += sizeof(wchar_t);\r
-\r
- _reportf(L"Setting default CC name in the registry");\r
-\r
- l = RegOpenKeyEx(HKEY_CURRENT_USER,\r
- L"Software\\MIT\\kerberos5",\r
- 0,\r
- KEY_READ | KEY_WRITE,\r
- &hk_ccname);\r
-\r
- if (l != ERROR_SUCCESS)\r
- l = RegCreateKeyEx(HKEY_CURRENT_USER,\r
- L"Software\\MIT\\kerberos5",\r
- 0,\r
- NULL,\r
- REG_OPTION_NON_VOLATILE,\r
- KEY_READ | KEY_WRITE,\r
- NULL,\r
- &hk_ccname,\r
- &dw);\r
-\r
- if (l != ERROR_SUCCESS) {\r
- _reportf(L"Can't create registry key : %d", l);\r
- _end_task();\r
- return KHM_ERROR_UNKNOWN;\r
- }\r
-\r
- dwSize = sizeof(reg_ccname);\r
-\r
- l = RegQueryValueEx(hk_ccname,\r
- L"ccname",\r
- NULL,\r
- &dwType,\r
- (LPBYTE) reg_ccname,\r
- &dwSize);\r
-\r
- if (l != ERROR_SUCCESS ||\r
- dwType != REG_SZ ||\r
- khm_krb5_cc_name_cmp(reg_ccname, id_ccname)) {\r
-\r
- /* we have to write the new value in */\r
- \r
- l = RegSetValueEx(hk_ccname,\r
- L"ccname",\r
- 0,\r
- REG_SZ,\r
- (BYTE *) id_ccname,\r
- (DWORD) cb);\r
- }\r
+ rv = k5_ident_set_default_int(def_ident);\r
\r
- RegCloseKey(hk_ccname);\r
+ _end_task();\r
\r
- if (l == ERROR_SUCCESS) {\r
- _reportf(L"Successfully set the default ccache");\r
- k5_update_last_default_identity(def_ident);\r
- _end_task();\r
- return KHM_ERROR_SUCCESS;\r
- } else {\r
- _reportf(L"Can't set the registry value : %d", l);\r
- _end_task();\r
- return KHM_ERROR_UNKNOWN;\r
- }\r
+ return rv;\r
\r
} else {\r
/* the default identity is being forgotten */\r
if (ident) {\r
kcdb_identity_set_default_int(ident);\r
kcdb_identity_release(ident);\r
+\r
+ found_default = TRUE;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (!found_default) {\r
+\r
+ /* There was no default ccache and we don't have a\r
+ "LastDefaultIdent" value. Next we see if there are any\r
+ identities that have credentials which have a Krb5CCName\r
+ property (i.e. an identity that has a Kerberos 5 TGT), and\r
+ make it the default.\r
+\r
+ Note that since the Krb5Ident plug-in has a dependency on\r
+ Krb5Cred, by the time this code runs, we already have a\r
+ listing of Kerberos 5 tickets and identities. */\r
+\r
+ wchar_t * idlist = NULL;\r
+ wchar_t * thisid;\r
+ khm_size cb = 0;\r
+ khm_size n_idents = 0;\r
+ khm_int32 rv;\r
+ wchar_t ccname[KRB5_MAXCCH_CCNAME];\r
+ FILETIME ft_expire;\r
+ FILETIME ft_now;\r
+ FILETIME ft_threshold;\r
+ BOOL match_all = FALSE;\r
+\r
+ rv = kcdb_identity_enum(0, 0, NULL, &cb, &n_idents);\r
+\r
+ TimetToFileTimeInterval(5 * 60, &ft_threshold);\r
+ GetSystemTimeAsFileTime(&ft_now);\r
+ ft_now = FtAdd(&ft_now, &ft_threshold);\r
+\r
+ while (rv == KHM_ERROR_TOO_LONG && n_idents > 0) {\r
+ if (idlist) {\r
+ PFREE(idlist);\r
+ idlist = NULL;\r
+ }\r
+\r
+ idlist = PMALLOC(cb);\r
+\r
+ if (idlist == NULL)\r
+ break;\r
+\r
+ rv = kcdb_identity_enum(0, 0, idlist, &cb, &n_idents);\r
+ }\r
+\r
+ if (KHM_SUCCEEDED(rv)) {\r
+\r
+ /* first we try to find an identity that has a valid TGT.\r
+ If that fails, then we try to find an identity with\r
+ *any* TGT. */\r
+\r
+ try_again:\r
+\r
+ for (thisid = idlist;\r
+ thisid && *thisid && !found_default;\r
+ thisid = multi_string_next(thisid)) {\r
+\r
+ if (KHM_SUCCEEDED(kcdb_identity_create(thisid, 0, &ident))) {\r
+ khm_size cb_ft = sizeof(FILETIME);\r
+ cb = sizeof(ccname);\r
+\r
+ if (KHM_SUCCEEDED(kcdb_identity_get_attr(ident, attr_id_krb5_ccname,\r
+ NULL, ccname, &cb)) &&\r
+ (match_all ||\r
+ (KHM_SUCCEEDED(kcdb_identity_get_attr(ident, KCDB_ATTR_EXPIRE,\r
+ NULL, &ft_expire, &cb_ft)) &&\r
+ CompareFileTime(&ft_expire, &ft_now) > 0))) {\r
+\r
+ /* found one */\r
+ k5_ident_set_default_int(ident);\r
+ kcdb_identity_set_default_int(ident);\r
+ found_default = TRUE;\r
+\r
+ }\r
+\r
+ kcdb_identity_release(ident);\r
+ ident = NULL;\r
+ }\r
}\r
+\r
+ if (!found_default && !match_all) {\r
+ match_all = TRUE;\r
+ goto try_again;\r
+ }\r
+ }\r
+\r
+ if (idlist) {\r
+ PFREE(idlist);\r
+ idlist = NULL;\r
}\r
}\r
\r
vparam);\r
\r
case KMSG_IDENT_VALIDATE_NAME:\r
- return k5_ident_valiate_name(msg_type,\r
- msg_subtype,\r
- uparam,\r
- vparam);\r
+ return k5_ident_validate_name(msg_type,\r
+ msg_subtype,\r
+ uparam,\r
+ vparam);\r
\r
case KMSG_IDENT_VALIDATE_IDENTITY:\r
/* TODO: handle KMSG_IDENT_VALIDATE_IDENTITY */\r
$(OBJ)\reqdaemon.obj \
$(OBJ)\addrchange.obj \
$(OBJ)\debugfuncs.obj \
+ $(OBJ)\taskbar.obj \
$(OBJ)\cfg_general_wnd.obj \
$(OBJ)\cfg_identities_wnd.obj \
$(OBJ)\cfg_notif_wnd.obj \
htmlhelp.lib \
iphlpapi.lib \
shlwapi.lib \
- msimg32.lib
+ msimg32.lib \
+ ole32.lib
$(OBJ)\uiconfig.c: uiconfig.csv $(CONFDIR)\csvschema.cfg
$(CCSV) $** $@
o->data)\r
PFREE(o->data);\r
\r
- if (((o->flags & KHUI_CW_O_STICKY) ||\r
- (o->flags & KHUI_CW_O_RELIDENT)) &&\r
+ if ((o->flags & KHUI_CW_O_RELIDENT) &&\r
o->data)\r
kcdb_identity_release((khm_handle) o->data);\r
\r
LPOP(&(o->children), &c);\r
}\r
\r
+ ZeroMemory(o, sizeof(*o));\r
PFREE(o);\r
}\r
\r
continue;\r
\r
/* if this credential appears to be the same as another for\r
- this view, we skip it */\r
- if(prevcred) {\r
+ this view, we skip it. */\r
+ if(prevcred && n_grouping > 0) {\r
for(j=0; j < (int) tbl->n_cols; j++) {\r
if(kcdb_creds_comp_attr(prevcred, thiscred,\r
tbl->cols[j].attr_id))\r
/* now ol points at the node at level j we want to be\r
in */\r
ol->start = n_rows;\r
- ol->idx_start = i;\r
ol->length = 0;\r
- ol->flags &= ~CW_EXPSTATE_MASK;\r
- ol->flags &= ~KHUI_CW_O_SHOWFLAG;\r
- ol->flags &= ~KHUI_CW_O_STICKY;\r
+ ol->idx_start = i;\r
+ ol->idx_end = i;\r
+ ol->flags &= ~(CW_EXPSTATE_MASK |\r
+ KHUI_CW_O_SHOWFLAG |\r
+ KHUI_CW_O_STICKY |\r
+ KHUI_CW_O_EMPTY);\r
\r
/* if the outline node is for an identity, then we have to\r
check the expiration state for the identity. */\r
ol->flags |= flags;\r
ol->flags |= KHUI_CW_O_SHOWFLAG;\r
expstate |= flags;\r
- }\r
-\r
- /* if we aren't showing any creds under this outline\r
- level, we should also show any flags. */\r
- else if (grouping[j] == tbl->n_cols - 1) {\r
+ } else if (grouping[j] == tbl->n_cols - 1) {\r
+ /* if we aren't showing any creds under this\r
+ outline level, we should also show any\r
+ flags. */\r
ol->flags |= KHUI_CW_O_SHOWFLAG;\r
}\r
}\r
if (ol)\r
visible = visible && (ol->flags & KHUI_CW_O_EXPAND);\r
\r
- if(visible && grouping[n_grouping - 1] < tbl->n_cols - 1) {\r
+ if(visible && n_grouping > 0 &&\r
+ grouping[n_grouping - 1] < tbl->n_cols - 1) {\r
khm_int32 c_flags;\r
\r
cw_set_tbl_row_cred(tbl, n_rows, thiscred, \r
if (o == NULL) {\r
o = cw_new_outline_node(idname);\r
LPUSH(&tbl->outline, o);\r
- o->flags = KHUI_CW_O_VISIBLE | KHUI_CW_O_RELIDENT;\r
+ o->flags = KHUI_CW_O_VISIBLE | KHUI_CW_O_RELIDENT | KHUI_CW_O_EMPTY;\r
o->level = 0;\r
o->col = grouping[0];\r
o->data = id_def;\r
o->start = n_rows;\r
o->length = 1;\r
o->idx_start = -1;\r
+ o->idx_end = -1;\r
\r
if (grouping[0] == tbl->n_cols - 1)\r
o->flags |= KHUI_CW_O_NOOUTLINE;\r
/* found it */\r
if (o->start != -1) /* already visible? */\r
continue;\r
- o->flags &= KHUI_CW_O_STICKY | KHUI_CW_O_RELIDENT;\r
- o->flags |= KHUI_CW_O_VISIBLE;\r
+ o->flags &= KHUI_CW_O_RELIDENT;\r
+ o->flags |= KHUI_CW_O_STICKY | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY;\r
+\r
+ if (!kcdb_identity_is_equal(o->data, h)) {\r
+ if (o->flags & KHUI_CW_O_RELIDENT)\r
+ kcdb_identity_release(o->data);\r
+ o->data = h;\r
+ o->flags |= KHUI_CW_O_RELIDENT;\r
+ kcdb_identity_hold(h);\r
+ }\r
} else {\r
/* not found. create */\r
o = cw_new_outline_node(idarray[i]);\r
LPUSH(&tbl->outline, o);\r
- o->flags = KHUI_CW_O_VISIBLE;\r
+ o->flags = KHUI_CW_O_STICKY | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY | KHUI_CW_O_RELIDENT;\r
o->level = 0;\r
o->col = grouping[0];\r
- o->data = (void *) h;\r
+ o->data = h;\r
+ kcdb_identity_hold(h);\r
o->attr_id = KCDB_ATTR_ID;\r
}\r
\r
if (grouping[0] == tbl->n_cols - 1)\r
o->flags |= KHUI_CW_O_NOOUTLINE;\r
\r
- if (o->flags & KHUI_CW_O_STICKY)\r
- kcdb_identity_release(h);\r
- else\r
- /* leave identity held in this case */\r
- o->flags |= KHUI_CW_O_STICKY | KHUI_CW_O_RELIDENT;\r
+ kcdb_identity_release(h);\r
\r
o->flags &= ~KHUI_CW_O_EXPAND;\r
o->start = n_rows;\r
FillRect(hdc, r, hbr);\r
}\r
\r
+ /* draw the background */\r
pl = CreatePen(PS_SOLID, 0, tbl->cr_hdr_outline);\r
pold = SelectObject(hdc, pl);\r
MoveToEx(hdc, r->left, r->bottom - 1, NULL);\r
SelectObject(hdc, pold);\r
DeleteObject(pl);\r
\r
- if (o->flags & KHUI_CW_O_STICKY) {\r
- /* khui_ilist_draw_id(tbl->ilist, IDB_TK_NEW_SM, hdc, \r
- r->left, r->bottom - KHUI_SMICON_CY, 0); */\r
- if (!(o->flags & KHUI_CW_O_NOOUTLINE)) {\r
- r->left += KHUI_SMICON_CX * 3 / 2;\r
- }\r
- } else if (!(o->flags & KHUI_CW_O_NOOUTLINE)) {\r
+ if (!(o->flags & KHUI_CW_O_NOOUTLINE) &&\r
+ !(o->flags & KHUI_CW_O_EMPTY)) {\r
if((tbl->mouse_state & CW_MOUSE_WOUTLINE) && \r
tbl->mouse_row == row) {\r
if(o->flags & KHUI_CW_O_EXPAND) {\r
}\r
}\r
\r
+ r->left += KHUI_SMICON_CX * 3 / 2;\r
+ } else if (!(o->flags & KHUI_CW_O_NOOUTLINE)) {\r
r->left += KHUI_SMICON_CX * 3 / 2;\r
}\r
\r
\r
} else {\r
khui_ilist_draw_id(tbl->ilist, \r
- ((o->flags & KHUI_CW_O_STICKY)?\r
+ ((o->flags & KHUI_CW_O_EMPTY)?\r
IDB_ID_DIS_SM:\r
IDB_ID_SM), \r
- hdc, \r
+ hdc,\r
r->left,\r
(r->top + r->bottom - KHUI_SMICON_CY) / 2, 0);\r
r->left += KHUI_SMICON_CX * 3 / 2 ;\r
tbl->hwnd_notif = khm_create_htwnd(\r
tbl->hwnd,\r
buf,\r
- r.left,r.top,r.right - r.left,(r.bottom - r.top) /2,\r
- WS_EX_TRANSPARENT,\r
+ r.left,r.top,r.right - r.left,tbl->cell_height * 4,\r
+ 0, /* This can be WS_EX_TRANSPARENT, but\r
+ we don't fully support it yet. */\r
WS_VISIBLE);\r
if(tbl->hwnd_notif) {\r
SendMessage(tbl->hwnd_notif, WM_SETFONT, (WPARAM) tbl->hf_normal, (LPARAM) FALSE);\r
rect.left,\r
tbl->header_height,\r
rect.right - rect.left,\r
- (rect.bottom - tbl->header_height) / 2,\r
+ tbl->cell_height * 4,\r
0);\r
}\r
return DefWindowProc(hwnd, uMsg, wParam, lParam);\r
{\r
khui_credwnd_tbl * tbl;\r
LPNMHDR pnmh;\r
-\r
tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
pnmh = (LPNMHDR) lParam;\r
if(pnmh->hwndFrom == tbl->hwnd_header) {\r
else if (m->subtype == KMSG_KCDB_IDENT && \r
m->uparam == KCDB_OP_NEW_DEFAULT) {\r
\r
+ cw_update_outline(tbl);\r
+ cw_update_extents(tbl, TRUE);\r
InvalidateRect(hwnd, NULL, FALSE);\r
\r
}\r
(0,\r
MAKEINTATOM(khui_credwnd_cls),\r
L"",\r
- WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_CLIPCHILDREN,\r
+ WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,\r
r.left,\r
r.top,\r
r.right - r.left,\r
#define KHUI_CW_O_DATAALLOC 0x00000020\r
#define KHUI_CW_O_NOOUTLINE 0x00000040\r
#define KHUI_CW_O_RELIDENT 0x00000080\r
+#define KHUI_CW_O_EMPTY 0x00000100\r
+/* NOTE: KHUI_CW_O_* shares the same bit-space as CW_EXPSTATE_* */\r
\r
typedef struct khui_credwnd_row_t {\r
khm_int32 flags;\r
#define KHUI_CW_ROW_TIMERSET 0x00000008\r
#define KHUI_CW_ROW_SELECTED 0x00000010\r
#define KHUI_CW_ROW_EXPVIEW 0x00000020\r
+/* NOTE: KHUI_CW_ROW_* shares the same bit-space as CW_EXPSTATE_* */\r
\r
/* row allocation */\r
/* initial number of rows to be allocated */\r
\r
HICON hi_lg_ident; /* large identity icon */\r
\r
-#if 0\r
- /* icon indices */\r
- int idx_expand; /* index of 'expanded' icon in image list */\r
- int idx_expand_hi; /* index of 'expanded' icon (highlighted) in image list */\r
- int idx_collapse; /* index of 'collapsed' icon in image list */\r
- int idx_collapse_hi; /* index of 'collapsed' icon (highlighted) in image list */\r
- int idx_ident; /* index of 'identity' icon in image list */\r
-#endif\r
-\r
/* mouse state */\r
khm_int32 mouse_state; /* state of the mouse can be combo of CW_MOUSE_* values */\r
khm_int32 mouse_row; /* row that the mouse state applies to */\r
\r
htw_align_table[] = {\r
{L"left", ALIGN_LEFT},\r
- {L"center", ALIGN_LEFT},\r
+ {L"center", ALIGN_CENTER},\r
{L"right", ALIGN_RIGHT}\r
};\r
\r
DrawEdge(hdc, &r, EDGE_SUNKEN, BF_ADJUST | BF_RECT | BF_FLAT);\r
#endif\r
\r
- hbk = CreateSolidBrush(RGB(255,255,255));\r
+ hbk = GetSysColorBrush(COLOR_WINDOW);\r
FillRect(hdc, &r, hbk);\r
- DeleteObject(hbk);\r
+ hbk = NULL; /* We don't need to destroy system\r
+ brushes */\r
\r
/* push the default format */\r
format_init(&s_stack);\r
d->l_pixel_y = GetDeviceCaps(hdc, LOGPIXELSY);\r
format_push(&s_stack,d, -MulDiv(HTW_NORMAL_SIZE, d->l_pixel_y, 72), FV_NONE, RGB(0,0,0));\r
\r
- y = d->scroll_top + r.top;\r
+ y = r.top - d->scroll_top;\r
\r
par_start = text;\r
\r
\r
x = r.left - d->scroll_left;\r
\r
- if(align == ALIGN_CENTER)\r
- x += (r.right - r.left)/2 - p_width / 2;\r
- else if(align == ALIGN_RIGHT)\r
- x += (r.right - r.left) - p_width;\r
+ if(align == ALIGN_CENTER) {\r
+ if (r.right - r.left > p_width)\r
+ x += (r.right - r.left)/2 - p_width / 2;\r
+ }\r
+\r
+ else if(align == ALIGN_RIGHT) {\r
+ if (r.right - r.left > p_width)\r
+ x += (r.right - r.left) - p_width;\r
+ }\r
\r
/* begin wet run */\r
p = par_start;\r
\r
p_width = 0;\r
\r
- while(*p) {\r
+ while(p && *p) {\r
if(*p == L'<') {\r
int talign = -1;\r
int n;\r
align = talign;\r
} else {\r
HFONT hfold;\r
- RECT rd,rt;\r
+ RECT rd;\r
\r
c = wcschr(p, L'<');\r
if(!c)\r
SetTextColor(hdc, format_color(&s_stack));\r
\r
GetTextExtentPoint32(hdc, p, (int)(c - p), &s);\r
- rd.left = x + p_width - d->scroll_left;\r
- rd.top = y - d->scroll_top;\r
- rd.right = x + p_width + s.cx - d->scroll_left;\r
- rd.bottom = y + l_height - d->scroll_top;\r
-\r
- if(IntersectRect(&rt, &rd, &r)) {\r
- DrawText(hdc, p, (int)(c - p), &rd,\r
- DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);\r
- }\r
+ rd.left = x + p_width;\r
+ rd.top = y;\r
+ rd.right = rd.left + s.cx;\r
+ rd.bottom = rd.top + l_height;\r
+\r
+ DrawText(hdc, p, (int)(c - p), &rd,\r
+ DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);\r
\r
p_width += s.cx;\r
\r
\r
case WM_ERASEBKGND:\r
{\r
+ HDC hdc = (HDC) wParam;\r
khui_htwnd_data * d;\r
+ HBRUSH hbr;\r
+ RECT r;\r
+\r
d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
\r
- if(d->flags & KHUI_HTWND_TRANSPARENT)\r
- return TRUE;\r
+ GetClientRect(hwnd, &r);\r
+ hbr = GetSysColorBrush(COLOR_WINDOW);\r
+ FillRect(hdc, &r, hbr);\r
\r
- return FALSE;\r
+ /* no need to destroy the brush since it's a system\r
+ brush. */\r
+\r
+ return TRUE;\r
+ }\r
+\r
+ case WM_SIZE:\r
+ {\r
+ khui_htwnd_data * d;\r
+\r
+ d = (khui_htwnd_data *) (LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+\r
+ if (d) {\r
+ d->ext_width = 0;\r
+ d->ext_height = 0;\r
+ }\r
}\r
+ return 0;\r
\r
case WM_PAINT:\r
htw_paint(hwnd, uMsg, wParam, lParam);\r
- break;\r
+ return 0;\r
\r
case WM_SETCURSOR:\r
{\r
old_pos = new_pos = d->scroll_left;\r
ext = d->ext_width;\r
\r
- switch(HIWORD(wParam)) {\r
- case SB_THUMBTRACK:\r
+ switch(LOWORD(wParam)) {\r
case SB_THUMBPOSITION:\r
+ case SB_ENDSCROLL:\r
+ ZeroMemory(&si, sizeof(si));\r
+ si.cbSize = sizeof(si);\r
+ si.fMask = SIF_POS;\r
+ GetScrollInfo(hwnd, SB_HORZ, &si);\r
+ new_pos = si.nPos;\r
+ break;\r
+\r
+ case SB_THUMBTRACK:\r
ZeroMemory(&si, sizeof(si));\r
si.cbSize = sizeof(si);\r
si.fMask = SIF_TRACKPOS;\r
\r
GetClientRect(hwnd, &r);\r
\r
-#if 0\r
if (new_pos > ext - (r.right - r.left))\r
new_pos = ext - (r.right - r.left);\r
-#endif\r
- if (new_pos > ext)\r
- new_pos = ext;\r
\r
if (new_pos < 0)\r
new_pos = 0;\r
\r
if(d->active_link != nl) {\r
if(d->active_link >= 0) {\r
- if(d->flags & KHUI_HTWND_TRANSPARENT)\r
- {\r
- HWND parent = GetParent(hwnd);\r
- if(parent) {\r
- InvalidateRect(parent, NULL, TRUE);\r
- }\r
+ if(d->flags & KHUI_HTWND_TRANSPARENT) {\r
+ HWND parent = GetParent(hwnd);\r
+ if(parent) {\r
+ RECT rdest = d->links[d->active_link]->r;\r
+\r
+ MapWindowPoints(hwnd, parent, (LPPOINT) &rdest, 2);\r
+ InvalidateRect(parent, &rdest, TRUE);\r
}\r
+ }\r
/* although we are invalidating the rect before setting active_link,\r
WM_PAINT will not be issued until wndproc returns */\r
InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
if(d->active_link >= 0) {\r
/* although we are invalidating the rect before setting active_link,\r
WM_PAINT will not be issued until wndproc returns */\r
- if(d->flags & KHUI_HTWND_TRANSPARENT)\r
- {\r
- HWND parent = GetParent(hwnd);\r
- if(parent) {\r
- InvalidateRect(parent, NULL, TRUE);\r
- }\r
+ if(d->flags & KHUI_HTWND_TRANSPARENT) {\r
+ HWND parent = GetParent(hwnd);\r
+ if(parent) {\r
+ RECT rdest = d->links[d->active_link]->r;\r
+\r
+ MapWindowPoints(hwnd, parent, (LPPOINT) &rdest, 2);\r
+ InvalidateRect(parent, &rdest, TRUE);\r
}\r
+ }\r
InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE);\r
}\r
}\r
#include<configwnd.h>\r
#include<aboutwnd.h>\r
#include<debugfuncs.h>\r
+#include<taskbar.h>\r
\r
#include<reqdaemon.h>\r
#include<notifier.h>\r
// Generated from the TEXTINCLUDE 2 resource.\r
//\r
#include "afxres.h"\r
-\r
/////////////////////////////////////////////////////////////////////////////\r
#undef APSTUDIO_READONLY_SYMBOLS\r
\r
\r
2 TEXTINCLUDE \r
BEGIN\r
- "#include ""afxres.h""\r\0"\r
+ "#include ""afxres.h\0"\r
END\r
\r
3 TEXTINCLUDE \r
BEGIN\r
- "\r\n"\r
- "\0"\r
+ "\r\0"\r
END\r
\r
#endif // APSTUDIO_INVOKED\r
IDS_ACTION_HELP_ABOUT "About Network Identity Manager"\r
IDS_CFG_GENERAL_LONG "General options"\r
IDS_SAMPLE_STRING "Wxy"\r
- IDS_NO_CREDS "<large><center>You currently have no credentials.Click <a id=""NewCreds"">here</a> to obtain new credentials.</center></large>"\r
+ IDS_NO_CREDS "<large><p align=""center"">You currently have no credentials.</p><p align=""center"">Click <a id=""NewCreds"">here</a> to obtain new credentials.</p></large>"\r
IDS_WT_INIT_CREDS "Obtain initial credentials"\r
IDS_WT_NEW_CREDS "Obtain new credentials"\r
END\r
\r
const khm_version app_version = {KH_VERSION_LIST};\r
\r
+HRESULT hr_coinitialize = S_OK;\r
+\r
void khm_init_gui(void) {\r
+\r
+ hr_coinitialize = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);\r
+\r
khui_init_actions();\r
khui_init_rescache();\r
khui_init_menu();\r
khm_init_notifier();\r
khm_init_config();\r
khm_init_debug();\r
+ khm_init_taskbar_funcs();\r
}\r
\r
void khm_exit_gui(void) {\r
+ khm_exit_taskbar_funcs();\r
khm_exit_debug();\r
khm_exit_config();\r
khm_exit_notifier();\r
khui_exit_menu();\r
khui_exit_rescache();\r
khui_exit_actions();\r
+\r
+ if (hr_coinitialize == S_OK ||\r
+ hr_coinitialize == S_FALSE) {\r
+ CoUninitialize();\r
+ }\r
}\r
\r
void khm_parse_commandline(void) {\r
khm_int32 t;\r
khm_size s;\r
\r
+ khm_taskbar_remove_window(khm_hwnd_main);\r
+\r
/* Check if we should destroy all credentials on exit... */\r
\r
if (KHM_FAILED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw)))\r
khc_close_space(csp_cw);\r
\r
}\r
+\r
+ khm_cred_refresh();\r
}\r
\r
void \r
} else {\r
ShowWindow(khm_hwnd_main, khm_nCmdShow);\r
UpdateWindow(khm_hwnd_main);\r
+\r
+ khm_taskbar_add_window(khm_hwnd_main);\r
+\r
+ khm_cred_refresh();\r
}\r
\r
khm_nCmdShow = SW_RESTORE;\r
khc_close_space(csp_notices);\r
\r
ShowWindow(khm_hwnd_main, SW_HIDE);\r
+\r
+ khm_taskbar_remove_window(khm_hwnd_main);\r
}\r
\r
BOOL \r
\r
need_layout = TRUE;\r
\r
- } else if (flags & KCDB_IDENT_FLAG_VALID) {\r
+ } else if ((flags & KCDB_IDENT_FLAG_VALID) ||\r
+ d->nc->subtype == KMSG_CRED_PASSWORD) {\r
+ /* special case: If we are going to change the\r
+ password, we don't expect the identity provider to\r
+ validate the identity in real time. As such, we\r
+ assume that the identity is valid. */\r
\r
/* identity is valid */\r
if (d->notif_type != NC_NOTIFY_NONE) {\r
/* add this to the dialog chain */\r
khm_add_dialog(hwnd);\r
\r
+ khm_taskbar_add_window(hwnd);\r
+\r
return TRUE;\r
}\r
\r
/* remove self from dialog chain */\r
khm_del_dialog(hwnd);\r
\r
+ khm_taskbar_remove_window(hwnd);\r
+\r
d = (khui_nc_wnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, CW_PARAM);\r
\r
d->nc->ident_cb(d->nc, WMNC_IDENT_EXIT, NULL, 0, 0, 0);\r
// Used by C:\work\pismere\athena\auth\krb5\src\windows\identity\ui\lang\en_us\khapp.rc\r
//\r
#define IDI_MAIN_APP 104\r
-#define IDD_PROPPAGE_MEDIUM 106\r
#define IDD_PP_CRED 106\r
#define IDD_PP_IDENT 107\r
#define IDB_TK_REFRESH 108\r
#define IDS_MAIN_WINDOW_TITLE 108\r
#define IDS_MENU_FILE 109\r
#define IDB_ID 110\r
-#define IDS_MENU_IDENTITY 110\r
#define IDS_MENU_CRED 110\r
#define IDB_ID_DELETE 111\r
#define IDS_MENU_VIEW 111\r
#define IDB_TK_DELETE 115\r
#define IDS_ACTION_EXIT 115\r
#define IDB_TK_NEW 116\r
-#define IDS_ACTION_NEW_ID 116\r
#define IDS_CFG_ROOT_NAME 116\r
#define IDS_ACTION_SET_DEF_ID 117\r
#define IDS_ACTION_SET_SRCH_ID 118\r
#define IDB_VW_REFRESH_SM 118\r
-#define IDS_ACTION_DESTROY_ID 119\r
#define IDR_MENU_BAR 119\r
#define IDS_CFG_ROOT_TITLE 119\r
-#define IDS_ACTION_RENEW_ID 120\r
#define IDS_CFG_GENERAL_SHORT 120\r
-#define IDS_ACTION_ADD_CRED 121\r
#define IDB_TB_BLANK 121\r
#define IDS_ACTION_NEW_CRED 121\r
#define IDS_ACTION_PASSWD_ID 122\r
#define IDB_ID_NEW_DIS_SM 131\r
#define IDS_ACTION_OPT_KHIM 132\r
#define IDB_ID_NEW_SM 132\r
-#define IDS_ACTION_OPT_INIT 133\r
#define IDB_ID_REFRESH_DIS 133\r
#define IDS_ACTION_OPT_IDENTS 133\r
#define IDS_ACTION_OPT_NOTIF 134\r
#define IDS_ACTION_HELP_ABOUT 138\r
#define IDB_TK_DELETE_SM 138\r
#define IDB_TK_DIS_SM 139\r
-#define IDS_ACTIONINFO_NEW_ID 139\r
#define IDS_CFG_GENERAL_LONG 139\r
#define IDB_TK_NEW_DIS 140\r
#define IDS_SAMPLE_STRING 140\r
#define IDB_TK_REFRESH_DIS 143\r
#define IDS_WT_NEW_CREDS 143\r
#define IDB_TK_REFRESH_DIS_SM 144\r
-#define IDS_NC_PASSWORD 144\r
#define IDS_NC_IDENTITY 144\r
#define IDB_TK_REFRESH_SM 145\r
#define IDS_NC_IDENTS 145\r
#define IDS_PACTION_OK 160\r
#define IDB_FLAG_CRITICAL 161\r
#define IDS_PACTION_CANCEL 161\r
-#define IDD_NC_PASSWORD 162\r
#define IDS_PACTION_CLOSE 162\r
#define IDD_NC_NEWCRED 162\r
#define IDD_NC_BBAR 163\r
#define IDS_CFG_IDENTITY_SHORT 186\r
#define IDI_CFG_DELETED 186\r
#define IDS_CFG_IDENTITY_LONG 187\r
-#define IDI_ICON1 187\r
#define IDI_ID 187\r
#define IDS_CTX_DESTROY_CREDS 188\r
#define IDB_IMPORT_SM_DIS 188\r
#define IDS_PISTATE_FAILUNK 205\r
#define IDI_APPICON_EXP 205\r
#define IDS_PISTATE_FAILMAX 206\r
-#define IDI_ICON4 206\r
#define IDI_APPICON_OK 206\r
#define IDS_PISTATE_FAILREG 207\r
#define IDI_CFG_PLUGIN 207\r
#define IDS_NCN_IDENT_UNKNOWN 299\r
#define IDS_REMOTE_FAIL 300\r
#define IDS_REMOTE_FAIL_TITLE 301\r
-#define IDS_NOTIFICATION_ACTIONS 302\r
#define IDS_IDACTION_NEW 302\r
#define IDS_IDACTIONT_NEW 303\r
#define IDS_IDACTIONT_RENEW 304\r
#define IDS_CW_TYPEF 316\r
#define IDS_CW_EXPIREF 317\r
#define IDS_CW_EXPIRED 318\r
-#define IDC_NC_USERNAME 1007\r
-#define IDC_NC_PASSWORD 1008\r
#define IDC_NC_CREDTEXT_LABEL 1009\r
-#define IDC_NC_PASSWORD_LABEL 1010\r
-#define IDC_NC_USERNAME_LABEL 1011\r
#define IDC_NC_CREDTEXT 1012\r
#define IDC_NC_HELP 1017\r
-#define IDC_NC_OPTIONS 1019\r
#define IDC_NC_ADVANCED 1019\r
#define IDC_PP_IDNAME 1026\r
#define IDC_PP_IDDEF 1027\r
#define IDC_PP_IDSEARCH 1028\r
-#define IDC_PP_IDSTATUS 1029\r
-#define IDC_PP_IDSTATUSIMG 1030\r
-#define IDC_PP_IDVALID 1031\r
-#define IDC_PP_IDRENEW 1032\r
-#define IDC_NC_IDENTITY 1033\r
-#define IDC_NC_IDENTITY_LABEL 1034\r
#define IDC_PP_PROPLIST 1035\r
#define IDC_PP_CPROPLIST 1036\r
-#define IDC_NC_REALM 1037\r
-#define IDC_NC_REALM_LABEL 1038\r
#define IDC_NC_TPL_ROW 1039\r
#define IDC_NC_TPL_PANEL 1040\r
#define IDC_NC_TPL_LABEL 1041\r
#define IDC_NC_TPL_INPUT 1042\r
#define IDC_NC_TPL_LABEL_LG 1043\r
#define IDC_NC_TPL_INPUT_LG 1044\r
-#define IDC_NC_TPL_ROW2 1045\r
#define IDC_NC_TPL_ROW_LG 1045\r
#define IDC_CFG_NODELIST 1045\r
#define IDAPPLY 1048\r
-#define IDC_CFG_SUMMARY 1049\r
#define IDC_CFG_TITLE 1050\r
#define IDC_CFG_PANE 1051\r
#define IDC_NOTIF_MONITOR 1053\r
#define IDC_CFG_OTHER 1066\r
#define IDC_CFG_MONITOR 1069\r
#define IDC_CFG_STICKY 1070\r
-#define IDC_CFG_IDENTS 1071\r
-#define IDC_CFG_IDENTITY 1072\r
#define IDC_CFG_RENEW 1075\r
#define IDC_CFG_REMOVE 1076\r
#define IDC_CFG_TAB 1077\r
#define IDC_CFG_TARGET 1078\r
#define IDC_CFG_PLUGINS 1079\r
-#define IDC_CFG_PLUGINGRP 1080\r
-#define IDC_CFG_LBL_DESC 1083\r
#define IDC_CFG_DESC 1084\r
#define IDC_CFG_LBL_STATE 1085\r
#define IDC_CFG_STATE 1086\r
#define IDC_CFG_DEPS 1088\r
#define IDC_CFG_DISABLE 1089\r
#define IDC_CFG_ENABLE 1090\r
-#define IDC_CFG_PROVGRP 1091\r
#define IDC_CFG_LBL_MOD 1092\r
#define IDC_CFG_MODULE 1093\r
#define IDC_CFG_LBL_VEN 1094\r
#define IDC_PRODUCT 1100\r
#define IDC_COPYRIGHT 1101\r
#define IDC_BUILDINFO 1102\r
-#define IDC_LIST1 1103\r
#define IDC_MODULES 1103\r
#define IDC_PP_CONFIG 1104\r
#define IDC_CFG_UNREGISTER 1107\r
#define IDC_CFG_BOLD 1131\r
#define IDC_CFG_ITALICS 1132\r
#define IDC_CFG_ADDIDENT 1133\r
-#define IDC_CFG_IDNAME 1134\r
#define IDC_SM_CTL 1134\r
#define IDC_CFG_SHOWLOG 1135\r
#define IDC_MED_CTL 1135\r
#define IDC_LG_LBL 1139\r
#define IDC_CFG_NOTACTION 1141\r
#define IDC_CFG_NOTACT_STATIC 1142\r
-#define IDC_BUTTON1 1143\r
#define IDC_NC_BASIC 1143\r
#define IDA_ACTIVATE_MENU 40003\r
#define IDA_UP 40004\r
--- /dev/null
+/*
+ * Copyright (c) 2007 Secure Endpoints Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* $Id$ */
+
+#include<khmapp.h>
+
+#define COBJMACROS
+
+#include<shobjidl.h>
+
+#ifdef DEBUG
+#include<assert.h>
+#endif
+
+ITaskbarList *itbl = NULL;
+
+void
+khm_init_taskbar_funcs(void) {
+ HRESULT hr = NOERROR;
+
+ hr = CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER,
+ &IID_ITaskbarList, &itbl);
+
+#ifdef DEBUG
+ assert(itbl != NULL);
+#endif
+
+ if (itbl) {
+ hr = ITaskbarList_HrInit(itbl);
+#ifdef DEBUG
+ assert(hr == NOERROR);
+#endif
+ }
+}
+
+void
+khm_exit_taskbar_funcs(void) {
+ if (itbl) {
+ ITaskbarList_Release(itbl);
+ }
+}
+
+void
+khm_taskbar_add_window(HWND hwnd) {
+ HRESULT hr = NOERROR;
+
+ if (itbl) {
+ hr = ITaskbarList_AddTab(itbl, hwnd);
+#ifdef DEBUG
+ assert(hr == NOERROR);
+#endif
+ }
+}
+
+void
+khm_taskbar_remove_window(HWND hwnd) {
+ HRESULT hr = NOERROR;
+
+ if (itbl) {
+ hr = ITaskbarList_DeleteTab(itbl, hwnd);
+#ifdef DEBUG
+ assert(hr == NOERROR);
+#endif
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2007 Secure Endpoints Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/* $Id$ */
+
+#ifndef NETIDMGR_TASKBAR_H
+#define NETIDMGR_TASKBAR_H
+
+void khm_init_taskbar_funcs(void);
+
+void khm_exit_taskbar_funcs(void);
+
+void khm_taskbar_add_window(HWND hwnd);
+
+void khm_taskbar_remove_window(HWND hwnd);
+
+#endif
\r
if (khui_ctx.scope != KHUI_SCOPE_NONE) {\r
khui_enable_action(KHUI_ACTION_PROPERTIES, TRUE);\r
- khui_enable_action(KHUI_ACTION_DESTROY_CRED, TRUE);\r
- khui_enable_action(KHUI_ACTION_RENEW_CRED, TRUE);\r
} else {\r
khui_enable_action(KHUI_ACTION_PROPERTIES, FALSE);\r
- khui_enable_action(KHUI_ACTION_DESTROY_CRED, FALSE);\r
- khui_enable_action(KHUI_ACTION_RENEW_CRED, FALSE);\r
}\r
\r
LeaveCriticalSection(&cs_actions);\r