From: Tom Yu Date: Thu, 12 Apr 2007 20:12:03 +0000 (+0000) Subject: pull up r19426 from trunk X-Git-Tag: krb5-1.6.1-beta1~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9f01455ec1b44c711d8a549db8e195ae82e865fe;p=krb5.git pull up r19426 from trunk r19426@cathode-dark-space: jaltman | 2007-04-11 23:40:25 -0400 ticket: new subject: KFW 3.2 Beta 2 commits component: windows tags: pullup NetIDMgr 1.2.0.2 ================ nidmgr32.dll - When the root credential set is touched, trigger an identity refresh. This is necessary to ensure that the identity list has a complete state of the world when the identity provider attempts to initialize an initial default identity when none previously existed. (see krb5cred.dll section) - Don't set the enabled state for KHUI_ACTION_DESTROY_CRED and KHUI_ACTION_RENEW_CRED actions. They are set elsewhere. krb5common.obj - Initialize variables to prevent uninitialized use. krb4cred.dll - Re-order controls and use CheckRadioButton() for manipulating the radio buttons which select the ticket acquisition method. - Use symbolic constants instead of numbers. - If Kerberos 4 is enabled for a specific identity, then that setting takes precedence over the global setting. The global setting is merely a default if a per-identity setting is not specified. However, a per-identity setting is only read for the default identity. - If the validity of an identity is not known, assume that it is still being checked and don't display any credential text. - When handling WM_COMMAND messages for the new credentials panel, only update the data when a BN_CLICKED message is received and only update the display if the IDC_NCK4_OBTAIN checkbox is toggled. - Remove unused symbols from langres.h krb5cred.dll - When renewing an identity which was imported, first try to import it again. If that fails to obtain newer tickets, then try initializing the MSLSA cache and then importing again. - Correct spelling: k5_ident_valiate_name() -> k5_ident_validate_name(). - Refactor the code for setting an identity as the default so we can call it internally. - When setting the initial default identity, if there is no current default ccache and no known last default identity, then look through the list of ccaches with credentials and pick one with valid tickets. If all else fails, then pick any of the ccaches. netidmgr.exe - Credentials Window - Consistently use KHUI_CW_O_RELIDENT as a necessary and sufficient indicator that the identity needs to be released when freeing an outline node. - Properly initialize an outline node. - Don't group similar credentials if we aren't sorting/grouping by any specific column. - Use the KHUI_CW_O_EMPTY flag to indicate that an outline node contains no children. - Handle the case where we aren't sorting/grouping by any column. - Make sure outline nodes have valid idx_start and idx_end values. - Use consistent logic when painting and handling mouse hotspots. - Don't use WS_EX_TRANSPARENT when creating the notification window. - Use a fixed height for the notification window. - Update the outline when the default identity changes. - Hypertext Window - Correctly handle the "center" attribute in the "p" element. - Use a system brush for painting the background instead of creating one of our own. - Correct the handling of scroll_left and scroll_top when calculating the coordinates for text. - Don't check if the rectangle for the text is inside the visible area of the window before drawing. - Handle WM_ERASEBKGND and use a system color brush to erase the background. - When the size changes, force the extents to be recomputed. This will also update the scroll bars. - Use the proper return value after handling WM_PAINT. - The scrollbar messages send the operation code in the low word of wParam, not the high word. - Use GetScrollInfo() with SIF_POS when the operation is SB_ENDSCROLL or SB_THUMBPOSITION. - When the hottracked link changes for a transparent window, don't invalidate the entire parent window. Instead use MapWindowPoints() to calculate the affected rectangle and invalidate that. - Misc - Change the text of the IDS_NO_CREDS message so that it renders better on a small window. - Initialize COM when starting the GUI. - When showing and hiding the main window and the new credentials window, add a button to the task bar. This allows the user to switch focus to the window if it's obstructed. - Remove unused symbols from resource.h - New Credentials Window - Ignore the validity state of the identity when showing a password change dialog. We don't expect the identity provider to validate the identity when changing the password. ticket: 5523 version_fixed: 1.6.1 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@19436 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/identity/config/Makefile.w2k b/src/windows/identity/config/Makefile.w2k index 292706d28..efd7fbdb4 100644 --- a/src/windows/identity/config/Makefile.w2k +++ b/src/windows/identity/config/Makefile.w2k @@ -48,7 +48,7 @@ KHIMAIRA_WIN32_CONFIG=1 NETIDMGR_VERSION_MAJOR=1 NETIDMGR_VERSION_MINOR=2 NETIDMGR_VERSION_PATCH=0 -NETIDMGR_VERSION_AUX=1 +NETIDMGR_VERSION_AUX=2 NETIDMGR_RELEASEDESC= # The API version. This number must be incremented each time the API diff --git a/src/windows/identity/config/Makefile.w32 b/src/windows/identity/config/Makefile.w32 index f0196243c..5f274a49c 100644 --- a/src/windows/identity/config/Makefile.w32 +++ b/src/windows/identity/config/Makefile.w32 @@ -48,7 +48,7 @@ KHIMAIRA_WIN32_CONFIG=1 NETIDMGR_VERSION_MAJOR=1 NETIDMGR_VERSION_MINOR=2 NETIDMGR_VERSION_PATCH=0 -NETIDMGR_VERSION_AUX=1 +NETIDMGR_VERSION_AUX=2 NETIDMGR_RELEASEDESC= # The API version. This number must be incremented each time the API diff --git a/src/windows/identity/kcreddb/credset.c b/src/windows/identity/kcreddb/credset.c index 141e17cd2..2d7eeeb1f 100644 --- a/src/windows/identity/kcreddb/credset.c +++ b/src/windows/identity/kcreddb/credset.c @@ -321,6 +321,10 @@ kcdb_credset_collect(khm_handle cs_dest, if(c_sel) PFREE(c_sel); + if (cs_dest == NULL) { + kcdb_identity_refresh_all(); + } + return code; } @@ -422,6 +426,10 @@ kcdb_credset_collect_filtered(khm_handle cs_dest, if(c_sel) PFREE(c_sel); + if (cs_dest == NULL) { + kcdb_identity_refresh_all(); + } + return code; } diff --git a/src/windows/identity/plugins/common/krb5common.c b/src/windows/identity/plugins/common/krb5common.c index 759641ff7..6c3958694 100644 --- a/src/windows/identity/plugins/common/krb5common.c +++ b/src/windows/identity/plugins/common/krb5common.c @@ -90,8 +90,8 @@ khm_krb5_initialize(khm_handle ident, return(0); #else - LPCSTR functionName; - int freeContextFlag; + LPCSTR functionName = NULL; + int freeContextFlag = 0; krb5_error_code rc = 0; krb5_flags flags = 0; diff --git a/src/windows/identity/plugins/krb4/krb4newcreds.c b/src/windows/identity/plugins/krb4/krb4newcreds.c index 81c16162d..54feae5b3 100644 --- a/src/windows/identity/plugins/krb4/krb4newcreds.c +++ b/src/windows/identity/plugins/krb4/krb4newcreds.c @@ -55,33 +55,25 @@ typedef struct tag_k4_dlg_data { time_t lifetime; } k4_dlg_data; -void k4_update_display(k4_dlg_data * d) { - int i; - +void k4_update_display(k4_dlg_data * d, BOOL update_methods) { CheckDlgButton(d->hwnd, IDC_NCK4_OBTAIN, (d->k4_enabled)?BST_CHECKED: BST_UNCHECKED); if (d->k4_enabled) { EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_AUTO), TRUE); - EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), TRUE); EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_K524), TRUE); + EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), TRUE); } else { EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_AUTO), FALSE); - EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), FALSE); EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_K524), FALSE); + EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_PWD ), FALSE); } #ifdef DEBUG assert(d->method >= 0 && d->method < ARRAYLENGTH(method_to_id)); #endif - CheckDlgButton(d->hwnd, method_to_id[d->method], BST_CHECKED); - - for (i=0; i < ARRAYLENGTH(method_to_id); i++) { - if (i != d->method && method_to_id[i] != 0) - CheckDlgButton(d->hwnd, method_to_id[d->method], - BST_UNCHECKED); - } + CheckRadioButton(d->hwnd, IDC_NCK4_AUTO, IDC_NCK4_PWD, method_to_id[d->method]); khui_cw_enable_type(d->nc, credtype_id_krb4, d->k4_enabled); } @@ -103,7 +95,7 @@ void k4_update_data(k4_dlg_data * d) { khui_cw_enable_type(d->nc, credtype_id_krb4, d->k4_enabled); } - d->method = 0; + d->method = K4_METHOD_AUTO; for (i=K4_METHOD_AUTO; i<=K4_METHOD_K524; i++) { if (IsDlgButtonChecked(d->hwnd, method_to_id[i]) == BST_CHECKED) { @@ -119,19 +111,16 @@ khm_boolean k4_should_identity_get_k4(khm_handle ident) { khm_handle csp_ident = NULL; khm_handle csp_k4 = NULL; khm_boolean get_k4 = TRUE; - - if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"Krb4NewCreds", &t)) && - !t) - return FALSE; + khm_boolean id_spec = FALSE; if (KHM_FAILED(kcdb_identity_get_flags(ident, &idflags))) return FALSE; if (!(idflags & KCDB_IDENT_FLAG_DEFAULT)) { /* we only support k4 for one identity, and that is the - default identity. If we are trying to get tickets for - a non-default identity, then we start off as - disabled. */ + default identity. If we are trying to get tickets for a + non-default identity, then we start off as disabled unless + there is no default identity. */ khm_handle defident = NULL; @@ -146,16 +135,27 @@ khm_boolean k4_should_identity_get_k4(khm_handle ident) { if (KHM_SUCCEEDED(khc_open_space(csp_ident, CSNAME_KRB4CRED, 0, &csp_k4))) { khm_int32 t = 0; - if (KHM_SUCCEEDED(khc_read_int32(csp_k4, L"Krb4NewCreds", &t)) && - !t) - get_k4 = FALSE; + + if (KHM_SUCCEEDED(khc_read_int32(csp_k4, L"Krb4NewCreds", &t))) { + get_k4 = !!t; + id_spec = TRUE; + } khc_close_space(csp_k4); } khc_close_space(csp_ident); } - return get_k4; + /* if there was a value specified for the identity, then that + takes precedence. */ + if (id_spec || !get_k4) + return get_k4; + + if (KHM_SUCCEEDED(khc_read_int32(csp_params, L"Krb4NewCreds", &t)) && + !t) + return FALSE; + + return TRUE; } void k4_read_identity_data(k4_dlg_data * d) { @@ -257,8 +257,9 @@ void k4_handle_wmnc_notify(k4_dlg_data * d, kcdb_identity_get_flags(d->nc->identities[0], &flags); - if (flags & KCDB_IDENT_FLAG_INVALID) + if (!(flags & KCDB_IDENT_FLAG_VALID)) { break; + } cb = sizeof(idname); kcdb_identity_get_name(d->nc->identities[0], idname, @@ -321,7 +322,7 @@ void k4_handle_wmnc_notify(k4_dlg_data * d, case WMNC_IDENTITY_CHANGE: k4_read_identity_data(d); - k4_update_display(d); + k4_update_display(d, TRUE); break; case WMNC_CREDTEXT_LINK: @@ -343,7 +344,7 @@ void k4_handle_wmnc_notify(k4_dlg_data * d, if (!wcscmp(wids, L"Enable")) { d->k4_enabled = TRUE; - k4_update_display(d); + k4_update_display(d, TRUE); khui_cw_enable_type(d->nc, credtype_id_krb4, TRUE); } } @@ -378,17 +379,24 @@ INT_PTR CALLBACK k4_nc_dlg_proc(HWND hwnd, d->k4_enabled = TRUE; d->method = K4_METHOD_AUTO; - k4_update_display(d); + k4_update_display(d, TRUE); } break; case WM_COMMAND: { - d = (k4_dlg_data *) (LONG_PTR) - GetWindowLongPtr(hwnd, DWLP_USER); + if (HIWORD(wParam) == BN_CLICKED) { + d = (k4_dlg_data *) (LONG_PTR) + GetWindowLongPtr(hwnd, DWLP_USER); + + k4_update_data(d); - k4_update_data(d); - k4_update_display(d); + if (LOWORD(wParam) == IDC_NCK4_OBTAIN) { + k4_update_display(d, TRUE); + } + + return TRUE; + } } break; diff --git a/src/windows/identity/plugins/krb4/lang/en_us/langres.rc b/src/windows/identity/plugins/krb4/lang/en_us/langres.rc index f7a849e24..12c3903f5 100644 --- a/src/windows/identity/plugins/krb4/lang/en_us/langres.rc +++ b/src/windows/identity/plugins/krb4/lang/en_us/langres.rc @@ -60,9 +60,9 @@ BEGIN CONTROL "Kerberos v4 Ticket Options",IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP,7,7,286,11 CONTROL "Obtain Kerberos v4 credentials",IDC_NCK4_OBTAIN,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,7,26,128,10 GROUPBOX "Obtain Kerberos v4 credentials using",IDC_STATIC,7,43,286,72,WS_GROUP - CONTROL "Automatically determine method",IDC_NCK4_AUTO,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,58,152,10 - CONTROL "Kerberos v5 to v4 translation",IDC_NCK4_K524,"Button",BS_AUTORADIOBUTTON,23,76,152,10 - CONTROL "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON,23,94,152,10 + CONTROL "Automatically determine method",IDC_NCK4_AUTO,"Button",BS_AUTORADIOBUTTON,22,59,119,10 + CONTROL "Kerberos v5 to v4 translation",IDC_NCK4_K524,"Button",BS_AUTORADIOBUTTON,22,76,109,10 + CONTROL "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON,22,93,47,10 END IDD_CFG_KRB4 DIALOGEX 0, 0, 255, 182 diff --git a/src/windows/identity/plugins/krb4/langres.h b/src/windows/identity/plugins/krb4/langres.h index 2cf0de137..c78ae4167 100644 --- a/src/windows/identity/plugins/krb4/langres.h +++ b/src/windows/identity/plugins/krb4/langres.h @@ -2,76 +2,27 @@ // Microsoft Visual C++ generated include file. // Used by C:\work\pismere\athena\auth\krb5\src\windows\identity\plugins\krb4\lang\en_us\langres.rc // -#define IDS_UNK_ADDR_FMT 101 -#define IDS_KRB5_CREDTEXT_0 102 #define IDD_NC_KRB4 103 #define IDS_PLUGIN_DESC 103 -#define IDS_KEY_ENCTYPE_SHORT_DESC 104 #define IDD_CFG_KRB4 104 #define IDS_NC_K4_SHORT 104 -#define IDS_TKT_ENCTYPE_SHORT_DESC 105 #define IDS_ERR_REALM 105 #define IDD_CFG_IDS_KRB4 105 -#define IDS_KEY_ENCTYPE_LONG_DESC 106 #define IDS_ERR_PRINCIPAL 106 #define IDD_CFG_ID_KRB4 106 -#define IDS_TKT_ENCTYPE_LONG_DESC 107 #define IDS_ERR_INVINST 107 -#define IDI_ICON1 107 #define IDI_PLUGIN 107 -#define IDS_ADDR_LIST_SHORT_DESC 108 #define IDS_ERR_PWINTKT 108 -#define IDS_ADDR_LIST_LONG_DESC 109 #define IDS_CT_DISABLED 109 -#define IDS_ETYPE_NULL 110 #define IDS_CT_TGTFOR 110 -#define IDS_ETYPE_DES_CBC_CRC 111 #define IDS_METHOD_AUTO 111 -#define IDS_ETYPE_DES_CBC_MD4 112 #define IDS_METHOD_PWD 112 -#define IDS_ETYPE_DES_CBC_MD5 113 #define IDS_METHOD_K524 113 -#define IDS_ETYPE_DES_CBC_RAW 114 #define IDS_CFG_IDS_KRB4_SHORT 114 -#define IDS_ETYPE_DES3_CBC_SHA 115 -#define IDS_ETYPE_DES3_CBC_RAW 116 -#define IDS_ETYPE_DES_HMAC_SHA1 117 -#define IDS_ETYPE_DES3_CBC_SHA1 118 -#define IDS_ETYPE_AES128_CTS_HMAC_SHA1_96 119 -#define IDS_ETYPE_AES256_CTS_HMAC_SHA1_96 120 -#define IDS_ETYPE_ARCFOUR_HMAC 121 -#define IDS_ETYPE_ARCFOUR_HMAC_EXP 122 -#define IDS_ETYPE_UNKNOWN 123 -#define IDS_ETYPE_LOCAL_DES3_HMAC_SHA1 124 -#define IDS_ETYPE_LOCAL_RC4_MD4 125 -#define IDS_KRB5_SHORT_DESC 126 -#define IDS_KRB5_LONG_DESC 127 #define IDS_KRB4_SHORT_DESC 128 #define IDS_KRB4_LONG_DESC 129 -#define IDS_KRB5_FLAGS_SHORT_DESC 130 -#define IDS_RENEW_TILL_SHORT_DESC 131 -#define IDS_RENEW_TILL_LONG_DESC 132 -#define IDS_RENEW_FOR_SHORT_DESC 133 -#define IDS_RENEW_FOR_LONG_DESC 134 #define IDS_CFG_KRB4_LONG 135 #define IDS_CFG_KRB4_SHORT 136 -#define IDC_NCK5_RENEWABLE 1002 -#define IDC_NCK5_FORWARDABLE 1004 -#define IDC_NCK5_REALM 1005 -#define IDC_NCK5_ADD_REALMS 1006 -#define IDC_NCK5_LIFETIME_EDIT 1008 -#define IDC_NCK5_RENEW_EDIT 1009 -#define IDC_PPK5_CRENEW 1014 -#define IDC_PPK5_CFORWARD 1015 -#define IDC_PPK5_CPROXY 1016 -#define IDC_PPK5_NAME 1017 -#define IDC_PPK5_ISSUE 1018 -#define IDC_PPK5_VALID 1019 -#define IDC_PPK5_RENEW 1020 -#define IDC_CHECK2 1022 -#define IDC_CHECK4 1024 -#define IDC_PPK5_LIFETIME 1024 -#define IDC_CHECK5 1025 #define IDC_CFG_LBL_CACHE 1025 #define IDC_CFG_LBL_CFGFILE 1026 #define IDC_CFG_LBL_RLMPATH 1027 @@ -81,9 +32,9 @@ #define IDC_CFG_CFGBROW 1031 #define IDC_CFG_RLMBROW 1032 #define IDC_NCK4_OBTAIN 1033 -#define IDC_NCK4_PWD 1034 +#define IDC_NCK4_AUTO 1034 #define IDC_NCK4_K524 1035 -#define IDC_NCK4_AUTO 1036 +#define IDC_NCK4_PWD 1036 #define IDC_CFG_GETTIX 1037 // Next default values for new objects @@ -92,7 +43,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 108 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1039 +#define _APS_NEXT_CONTROL_VALUE 1043 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/windows/identity/plugins/krb5/krb5funcs.c b/src/windows/identity/plugins/krb5/krb5funcs.c index b924c1f4c..e66e755a7 100644 --- a/src/windows/identity/plugins/krb5/krb5funcs.c +++ b/src/windows/identity/plugins/krb5/krb5funcs.c @@ -1157,21 +1157,93 @@ khm_krb5_renew_ident(khm_handle identity) kcdb_identity_get_name(identity, idname, &cb); if (khm_krb5_get_identity_flags(identity) & K5IDFLAG_IMPORTED) { -#ifdef REIMPORT_MSLSA_CREDS +#ifndef NO_REIMPORT_MSLSA_CREDS /* we are trying to renew the identity that was imported from MSLSA: */ - BOOL imported; - char cidname[KCDB_IDENT_MAXCCH_NAME]; + BOOL imported; + BOOL retry_import = FALSE; + char cidname[KCDB_IDENT_MAXCCH_NAME]; + khm_handle imported_id = NULL; + khm_size cb; + FILETIME ft_expire; + FILETIME ft_now; + FILETIME ft_threshold; + krb5_principal princ = NULL; UnicodeStrToAnsi(cidname, sizeof(cidname), idname); - imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, NULL); + imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, &imported_id); + + if (imported == 0) + goto import_failed; + + /* if the imported identity has already expired or will soon, + we clear the cache and try again. */ + khm_krb5_list_tickets(&ctx); + + cb = sizeof(ft_expire); + if (KHM_FAILED(kcdb_identity_get_attr(imported_id, KCDB_ATTR_EXPIRE, + NULL, &ft_expire, &cb))) + goto import_failed; + + GetSystemTimeAsFileTime(&ft_now); + TimetToFileTimeInterval(5 * 60, &ft_threshold); + + ft_now = FtAdd(&ft_now, &ft_threshold); + + if (CompareFileTime(&ft_expire, &ft_now) < 0) { + /* the ticket lifetime is not long enough */ + + code = 0; + + if (ctx == NULL) + code = pkrb5_init_context(&ctx); + if (code) + goto import_failed; + + code = pkrb5_cc_resolve(ctx, "MSLSA:", &cc); + if (code) + goto import_failed; + + code = pkrb5_cc_get_principal(ctx, cc, &princ); + if (code) + goto import_failed; + + pkrb5_cc_initialize(ctx, cc, princ); + + retry_import = TRUE; + } + + import_failed: + + if (imported_id) { + kcdb_identity_release(imported_id); + imported_id = NULL; + } + + if (ctx) { + if (cc) { + pkrb5_cc_close(ctx, cc); + cc = NULL; + } + + if (princ) { + pkrb5_free_principal(ctx, princ); + princ = NULL; + } + + /* leave ctx so we can use it later */ + } + + if (retry_import) + imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, NULL); if (imported) goto cleanup; /* if the import failed, then we try to renew the identity via the usual procedure. */ + #else /* if we are suppressing further imports from MSLSA, we just skip renewing this identity. */ diff --git a/src/windows/identity/plugins/krb5/krb5identpro.c b/src/windows/identity/plugins/krb5/krb5identpro.c index bc77b26f0..834d94296 100644 --- a/src/windows/identity/plugins/krb5/krb5identpro.c +++ b/src/windows/identity/plugins/krb5/krb5identpro.c @@ -742,7 +742,7 @@ ui_cb(khui_new_creds * nc, } static khm_int32 -k5_ident_valiate_name(khm_int32 msg_type, +k5_ident_validate_name(khm_int32 msg_type, khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam) { @@ -801,6 +801,107 @@ k5_update_last_default_identity(khm_handle ident) { khc_write_string(csp_params, L"LastDefaultIdent", idname); } +static khm_int32 +k5_ident_set_default_int(khm_handle def_ident) { + wchar_t id_ccname[KRB5_MAXCCH_CCNAME]; + khm_size cb; + DWORD dw; + LONG l; + HKEY hk_ccname; + DWORD dwType; + DWORD dwSize; + wchar_t reg_ccname[KRB5_MAXCCH_CCNAME]; + +#ifdef DEBUG + assert(def_ident != NULL); +#endif + + 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') + 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); + cb += sizeof(wchar_t); + + _reportf(L"Setting default CC name in the registry"); + + l = RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\MIT\\kerberos5", 0, + KEY_READ | KEY_WRITE, &hk_ccname); + + if (l != ERROR_SUCCESS) + l = RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\MIT\\kerberos5", 0, + NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, + NULL, &hk_ccname, &dw); + + if (l != ERROR_SUCCESS) { + _reportf(L"Can't create registry key : %d", l); + _end_task(); + return KHM_ERROR_UNKNOWN; + } + + dwSize = sizeof(reg_ccname); + + l = RegQueryValueEx(hk_ccname, L"ccname", NULL, &dwType, (LPBYTE) reg_ccname, + &dwSize); + + if (l != ERROR_SUCCESS || + dwType != REG_SZ || + khm_krb5_cc_name_cmp(reg_ccname, id_ccname)) { + + /* we have to write the new value in */ + + l = RegSetValueEx(hk_ccname, L"ccname", 0, REG_SZ, (BYTE *) id_ccname, + (DWORD) cb); + } + + RegCloseKey(hk_ccname); + + if (l == ERROR_SUCCESS) { + _reportf(L"Successfully set the default ccache"); + k5_update_last_default_identity(def_ident); + return KHM_ERROR_SUCCESS; + } else { + _reportf(L"Can't set the registry value : %d", l); + return KHM_ERROR_UNKNOWN; + } +} + static khm_int32 k5_ident_set_default(khm_int32 msg_type, khm_int32 msg_subtype, @@ -815,14 +916,7 @@ k5_ident_set_default(khm_int32 msg_type, if (uparam) { /* an identity is being made default */ khm_handle def_ident = (khm_handle) vparam; - wchar_t id_ccname[KRB5_MAXCCH_CCNAME]; - khm_size cb; - DWORD dw; - LONG l; - HKEY hk_ccname; - DWORD dwType; - DWORD dwSize; - wchar_t reg_ccname[KRB5_MAXCCH_CCNAME]; + khm_int32 rv; #ifdef DEBUG assert(def_ident != NULL); @@ -840,112 +934,11 @@ k5_ident_set_default(khm_int32 msg_type, _describe(); } - 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') - 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); - cb += sizeof(wchar_t); - - _reportf(L"Setting default CC name in the registry"); - - l = RegOpenKeyEx(HKEY_CURRENT_USER, - L"Software\\MIT\\kerberos5", - 0, - KEY_READ | KEY_WRITE, - &hk_ccname); - - if (l != ERROR_SUCCESS) - l = RegCreateKeyEx(HKEY_CURRENT_USER, - L"Software\\MIT\\kerberos5", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_READ | KEY_WRITE, - NULL, - &hk_ccname, - &dw); - - if (l != ERROR_SUCCESS) { - _reportf(L"Can't create registry key : %d", l); - _end_task(); - return KHM_ERROR_UNKNOWN; - } - - dwSize = sizeof(reg_ccname); - - l = RegQueryValueEx(hk_ccname, - L"ccname", - NULL, - &dwType, - (LPBYTE) reg_ccname, - &dwSize); - - if (l != ERROR_SUCCESS || - dwType != REG_SZ || - khm_krb5_cc_name_cmp(reg_ccname, id_ccname)) { - - /* we have to write the new value in */ - - l = RegSetValueEx(hk_ccname, - L"ccname", - 0, - REG_SZ, - (BYTE *) id_ccname, - (DWORD) cb); - } + rv = k5_ident_set_default_int(def_ident); - RegCloseKey(hk_ccname); + _end_task(); - if (l == ERROR_SUCCESS) { - _reportf(L"Successfully set the default ccache"); - k5_update_last_default_identity(def_ident); - _end_task(); - return KHM_ERROR_SUCCESS; - } else { - _reportf(L"Can't set the registry value : %d", l); - _end_task(); - return KHM_ERROR_UNKNOWN; - } + return rv; } else { /* the default identity is being forgotten */ @@ -1382,7 +1375,99 @@ k5_ident_init(khm_int32 msg_type, if (ident) { kcdb_identity_set_default_int(ident); kcdb_identity_release(ident); + + found_default = TRUE; + } + } + } + + if (!found_default) { + + /* There was no default ccache and we don't have a + "LastDefaultIdent" value. Next we see if there are any + identities that have credentials which have a Krb5CCName + property (i.e. an identity that has a Kerberos 5 TGT), and + make it the default. + + Note that since the Krb5Ident plug-in has a dependency on + Krb5Cred, by the time this code runs, we already have a + listing of Kerberos 5 tickets and identities. */ + + wchar_t * idlist = NULL; + wchar_t * thisid; + khm_size cb = 0; + khm_size n_idents = 0; + khm_int32 rv; + wchar_t ccname[KRB5_MAXCCH_CCNAME]; + FILETIME ft_expire; + FILETIME ft_now; + FILETIME ft_threshold; + BOOL match_all = FALSE; + + rv = kcdb_identity_enum(0, 0, NULL, &cb, &n_idents); + + TimetToFileTimeInterval(5 * 60, &ft_threshold); + GetSystemTimeAsFileTime(&ft_now); + ft_now = FtAdd(&ft_now, &ft_threshold); + + while (rv == KHM_ERROR_TOO_LONG && n_idents > 0) { + if (idlist) { + PFREE(idlist); + idlist = NULL; + } + + idlist = PMALLOC(cb); + + if (idlist == NULL) + break; + + rv = kcdb_identity_enum(0, 0, idlist, &cb, &n_idents); + } + + if (KHM_SUCCEEDED(rv)) { + + /* first we try to find an identity that has a valid TGT. + If that fails, then we try to find an identity with + *any* TGT. */ + + try_again: + + for (thisid = idlist; + thisid && *thisid && !found_default; + thisid = multi_string_next(thisid)) { + + if (KHM_SUCCEEDED(kcdb_identity_create(thisid, 0, &ident))) { + khm_size cb_ft = sizeof(FILETIME); + cb = sizeof(ccname); + + if (KHM_SUCCEEDED(kcdb_identity_get_attr(ident, attr_id_krb5_ccname, + NULL, ccname, &cb)) && + (match_all || + (KHM_SUCCEEDED(kcdb_identity_get_attr(ident, KCDB_ATTR_EXPIRE, + NULL, &ft_expire, &cb_ft)) && + CompareFileTime(&ft_expire, &ft_now) > 0))) { + + /* found one */ + k5_ident_set_default_int(ident); + kcdb_identity_set_default_int(ident); + found_default = TRUE; + + } + + kcdb_identity_release(ident); + ident = NULL; + } } + + if (!found_default && !match_all) { + match_all = TRUE; + goto try_again; + } + } + + if (idlist) { + PFREE(idlist); + idlist = NULL; } } @@ -1450,10 +1535,10 @@ k5_msg_ident(khm_int32 msg_type, vparam); case KMSG_IDENT_VALIDATE_NAME: - return k5_ident_valiate_name(msg_type, - msg_subtype, - uparam, - vparam); + return k5_ident_validate_name(msg_type, + msg_subtype, + uparam, + vparam); case KMSG_IDENT_VALIDATE_IDENTITY: /* TODO: handle KMSG_IDENT_VALIDATE_IDENTITY */ diff --git a/src/windows/identity/ui/Makefile b/src/windows/identity/ui/Makefile index e328866a1..7091104f0 100644 --- a/src/windows/identity/ui/Makefile +++ b/src/windows/identity/ui/Makefile @@ -49,6 +49,7 @@ OBJFILES= \ $(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 \ @@ -71,7 +72,8 @@ SDKLIBFILES= \ htmlhelp.lib \ iphlpapi.lib \ shlwapi.lib \ - msimg32.lib + msimg32.lib \ + ole32.lib $(OBJ)\uiconfig.c: uiconfig.csv $(CONFDIR)\csvschema.cfg $(CCSV) $** $@ diff --git a/src/windows/identity/ui/credwnd.c b/src/windows/identity/ui/credwnd.c index a31daac5a..d72d1693e 100644 --- a/src/windows/identity/ui/credwnd.c +++ b/src/windows/identity/ui/credwnd.c @@ -1037,8 +1037,7 @@ cw_del_outline(khui_credwnd_outline *o) { o->data) PFREE(o->data); - if (((o->flags & KHUI_CW_O_STICKY) || - (o->flags & KHUI_CW_O_RELIDENT)) && + if ((o->flags & KHUI_CW_O_RELIDENT) && o->data) kcdb_identity_release((khm_handle) o->data); @@ -1048,6 +1047,7 @@ cw_del_outline(khui_credwnd_outline *o) { LPOP(&(o->children), &c); } + ZeroMemory(o, sizeof(*o)); PFREE(o); } @@ -1420,8 +1420,8 @@ cw_update_outline(khui_credwnd_tbl * tbl) continue; /* if this credential appears to be the same as another for - this view, we skip it */ - if(prevcred) { + this view, we skip it. */ + if(prevcred && n_grouping > 0) { for(j=0; j < (int) tbl->n_cols; j++) { if(kcdb_creds_comp_attr(prevcred, thiscred, tbl->cols[j].attr_id)) @@ -1576,11 +1576,13 @@ cw_update_outline(khui_credwnd_tbl * tbl) /* now ol points at the node at level j we want to be in */ ol->start = n_rows; - ol->idx_start = i; ol->length = 0; - ol->flags &= ~CW_EXPSTATE_MASK; - ol->flags &= ~KHUI_CW_O_SHOWFLAG; - ol->flags &= ~KHUI_CW_O_STICKY; + ol->idx_start = i; + ol->idx_end = i; + ol->flags &= ~(CW_EXPSTATE_MASK | + KHUI_CW_O_SHOWFLAG | + KHUI_CW_O_STICKY | + KHUI_CW_O_EMPTY); /* if the outline node is for an identity, then we have to check the expiration state for the identity. */ @@ -1594,11 +1596,10 @@ cw_update_outline(khui_credwnd_tbl * tbl) ol->flags |= flags; ol->flags |= KHUI_CW_O_SHOWFLAG; expstate |= flags; - } - - /* if we aren't showing any creds under this outline - level, we should also show any flags. */ - else if (grouping[j] == tbl->n_cols - 1) { + } else if (grouping[j] == tbl->n_cols - 1) { + /* if we aren't showing any creds under this + outline level, we should also show any + flags. */ ol->flags |= KHUI_CW_O_SHOWFLAG; } } @@ -1629,7 +1630,8 @@ cw_update_outline(khui_credwnd_tbl * tbl) if (ol) visible = visible && (ol->flags & KHUI_CW_O_EXPAND); - if(visible && grouping[n_grouping - 1] < tbl->n_cols - 1) { + if(visible && n_grouping > 0 && + grouping[n_grouping - 1] < tbl->n_cols - 1) { khm_int32 c_flags; cw_set_tbl_row_cred(tbl, n_rows, thiscred, @@ -1704,7 +1706,7 @@ cw_update_outline(khui_credwnd_tbl * tbl) if (o == NULL) { o = cw_new_outline_node(idname); LPUSH(&tbl->outline, o); - o->flags = KHUI_CW_O_VISIBLE | KHUI_CW_O_RELIDENT; + o->flags = KHUI_CW_O_VISIBLE | KHUI_CW_O_RELIDENT | KHUI_CW_O_EMPTY; o->level = 0; o->col = grouping[0]; o->data = id_def; @@ -1725,6 +1727,7 @@ cw_update_outline(khui_credwnd_tbl * tbl) o->start = n_rows; o->length = 1; o->idx_start = -1; + o->idx_end = -1; if (grouping[0] == tbl->n_cols - 1) o->flags |= KHUI_CW_O_NOOUTLINE; @@ -1782,27 +1785,32 @@ cw_update_outline(khui_credwnd_tbl * tbl) /* found it */ if (o->start != -1) /* already visible? */ continue; - o->flags &= KHUI_CW_O_STICKY | KHUI_CW_O_RELIDENT; - o->flags |= KHUI_CW_O_VISIBLE; + o->flags &= KHUI_CW_O_RELIDENT; + o->flags |= KHUI_CW_O_STICKY | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY; + + if (!kcdb_identity_is_equal(o->data, h)) { + if (o->flags & KHUI_CW_O_RELIDENT) + kcdb_identity_release(o->data); + o->data = h; + o->flags |= KHUI_CW_O_RELIDENT; + kcdb_identity_hold(h); + } } else { /* not found. create */ o = cw_new_outline_node(idarray[i]); LPUSH(&tbl->outline, o); - o->flags = KHUI_CW_O_VISIBLE; + o->flags = KHUI_CW_O_STICKY | KHUI_CW_O_VISIBLE | KHUI_CW_O_EMPTY | KHUI_CW_O_RELIDENT; o->level = 0; o->col = grouping[0]; - o->data = (void *) h; + o->data = h; + kcdb_identity_hold(h); o->attr_id = KCDB_ATTR_ID; } if (grouping[0] == tbl->n_cols - 1) o->flags |= KHUI_CW_O_NOOUTLINE; - if (o->flags & KHUI_CW_O_STICKY) - kcdb_identity_release(h); - else - /* leave identity held in this case */ - o->flags |= KHUI_CW_O_STICKY | KHUI_CW_O_RELIDENT; + kcdb_identity_release(h); o->flags &= ~KHUI_CW_O_EXPAND; o->start = n_rows; @@ -2367,6 +2375,7 @@ cw_draw_header(HDC hdc, FillRect(hdc, r, hbr); } + /* draw the background */ pl = CreatePen(PS_SOLID, 0, tbl->cr_hdr_outline); pold = SelectObject(hdc, pl); MoveToEx(hdc, r->left, r->bottom - 1, NULL); @@ -2374,13 +2383,8 @@ cw_draw_header(HDC hdc, SelectObject(hdc, pold); DeleteObject(pl); - if (o->flags & KHUI_CW_O_STICKY) { - /* khui_ilist_draw_id(tbl->ilist, IDB_TK_NEW_SM, hdc, - r->left, r->bottom - KHUI_SMICON_CY, 0); */ - if (!(o->flags & KHUI_CW_O_NOOUTLINE)) { - r->left += KHUI_SMICON_CX * 3 / 2; - } - } else if (!(o->flags & KHUI_CW_O_NOOUTLINE)) { + if (!(o->flags & KHUI_CW_O_NOOUTLINE) && + !(o->flags & KHUI_CW_O_EMPTY)) { if((tbl->mouse_state & CW_MOUSE_WOUTLINE) && tbl->mouse_row == row) { if(o->flags & KHUI_CW_O_EXPAND) { @@ -2404,6 +2408,8 @@ cw_draw_header(HDC hdc, } } + r->left += KHUI_SMICON_CX * 3 / 2; + } else if (!(o->flags & KHUI_CW_O_NOOUTLINE)) { r->left += KHUI_SMICON_CX * 3 / 2; } @@ -2437,10 +2443,10 @@ cw_draw_header(HDC hdc, } else { khui_ilist_draw_id(tbl->ilist, - ((o->flags & KHUI_CW_O_STICKY)? + ((o->flags & KHUI_CW_O_EMPTY)? IDB_ID_DIS_SM: IDB_ID_SM), - hdc, + hdc, r->left, (r->top + r->bottom - KHUI_SMICON_CY) / 2, 0); r->left += KHUI_SMICON_CX * 3 / 2 ; @@ -3277,8 +3283,9 @@ cw_wm_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) tbl->hwnd_notif = khm_create_htwnd( tbl->hwnd, buf, - r.left,r.top,r.right - r.left,(r.bottom - r.top) /2, - WS_EX_TRANSPARENT, + r.left,r.top,r.right - r.left,tbl->cell_height * 4, + 0, /* This can be WS_EX_TRANSPARENT, but + we don't fully support it yet. */ WS_VISIBLE); if(tbl->hwnd_notif) { SendMessage(tbl->hwnd_notif, WM_SETFONT, (WPARAM) tbl->hf_normal, (LPARAM) FALSE); @@ -3316,7 +3323,7 @@ cw_wm_size(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) rect.left, tbl->header_height, rect.right - rect.left, - (rect.bottom - tbl->header_height) / 2, + tbl->cell_height * 4, 0); } return DefWindowProc(hwnd, uMsg, wParam, lParam); @@ -3327,7 +3334,6 @@ cw_wm_notify(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { khui_credwnd_tbl * tbl; LPNMHDR pnmh; - tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0); pnmh = (LPNMHDR) lParam; if(pnmh->hwndFrom == tbl->hwnd_header) { @@ -3392,6 +3398,8 @@ cw_kmq_wm_dispatch(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) else if (m->subtype == KMSG_KCDB_IDENT && m->uparam == KCDB_OP_NEW_DEFAULT) { + cw_update_outline(tbl); + cw_update_extents(tbl, TRUE); InvalidateRect(hwnd, NULL, FALSE); } @@ -5475,7 +5483,7 @@ khm_create_credwnd(HWND parent) { (0, MAKEINTATOM(khui_credwnd_cls), L"", - WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_CLIPCHILDREN, + WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, r.left, r.top, r.right - r.left, diff --git a/src/windows/identity/ui/credwnd.h b/src/windows/identity/ui/credwnd.h index 7e7e63cba..adecb9f07 100644 --- a/src/windows/identity/ui/credwnd.h +++ b/src/windows/identity/ui/credwnd.h @@ -69,6 +69,8 @@ typedef struct khui_credwnd_outline_t { #define KHUI_CW_O_DATAALLOC 0x00000020 #define KHUI_CW_O_NOOUTLINE 0x00000040 #define KHUI_CW_O_RELIDENT 0x00000080 +#define KHUI_CW_O_EMPTY 0x00000100 +/* NOTE: KHUI_CW_O_* shares the same bit-space as CW_EXPSTATE_* */ typedef struct khui_credwnd_row_t { khm_int32 flags; @@ -84,6 +86,7 @@ typedef struct khui_credwnd_row_t { #define KHUI_CW_ROW_TIMERSET 0x00000008 #define KHUI_CW_ROW_SELECTED 0x00000010 #define KHUI_CW_ROW_EXPVIEW 0x00000020 +/* NOTE: KHUI_CW_ROW_* shares the same bit-space as CW_EXPSTATE_* */ /* row allocation */ /* initial number of rows to be allocated */ @@ -220,15 +223,6 @@ typedef struct khui_credwnd_tbl_t { HICON hi_lg_ident; /* large identity icon */ -#if 0 - /* icon indices */ - int idx_expand; /* index of 'expanded' icon in image list */ - int idx_expand_hi; /* index of 'expanded' icon (highlighted) in image list */ - int idx_collapse; /* index of 'collapsed' icon in image list */ - int idx_collapse_hi; /* index of 'collapsed' icon (highlighted) in image list */ - int idx_ident; /* index of 'identity' icon in image list */ -#endif - /* mouse state */ khm_int32 mouse_state; /* state of the mouse can be combo of CW_MOUSE_* values */ khm_int32 mouse_row; /* row that the mouse state applies to */ diff --git a/src/windows/identity/ui/htmlwnd.h b/src/windows/identity/ui/htmlwnd.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/windows/identity/ui/htwnd.c b/src/windows/identity/ui/htwnd.c index afb68aa02..b7c037866 100644 --- a/src/windows/identity/ui/htwnd.c +++ b/src/windows/identity/ui/htwnd.c @@ -94,7 +94,7 @@ htw_size_table[] = { htw_align_table[] = { {L"left", ALIGN_LEFT}, - {L"center", ALIGN_LEFT}, + {L"center", ALIGN_CENTER}, {L"right", ALIGN_RIGHT} }; @@ -661,9 +661,10 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) DrawEdge(hdc, &r, EDGE_SUNKEN, BF_ADJUST | BF_RECT | BF_FLAT); #endif - hbk = CreateSolidBrush(RGB(255,255,255)); + hbk = GetSysColorBrush(COLOR_WINDOW); FillRect(hdc, &r, hbk); - DeleteObject(hbk); + hbk = NULL; /* We don't need to destroy system + brushes */ /* push the default format */ format_init(&s_stack); @@ -671,7 +672,7 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) d->l_pixel_y = GetDeviceCaps(hdc, LOGPIXELSY); format_push(&s_stack,d, -MulDiv(HTW_NORMAL_SIZE, d->l_pixel_y, 72), FV_NONE, RGB(0,0,0)); - y = d->scroll_top + r.top; + y = r.top - d->scroll_top; par_start = text; @@ -732,10 +733,15 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) x = r.left - d->scroll_left; - if(align == ALIGN_CENTER) - x += (r.right - r.left)/2 - p_width / 2; - else if(align == ALIGN_RIGHT) - x += (r.right - r.left) - p_width; + if(align == ALIGN_CENTER) { + if (r.right - r.left > p_width) + x += (r.right - r.left)/2 - p_width / 2; + } + + else if(align == ALIGN_RIGHT) { + if (r.right - r.left > p_width) + x += (r.right - r.left) - p_width; + } /* begin wet run */ p = par_start; @@ -743,7 +749,7 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) p_width = 0; - while(*p) { + while(p && *p) { if(*p == L'<') { int talign = -1; int n; @@ -766,7 +772,7 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) align = talign; } else { HFONT hfold; - RECT rd,rt; + RECT rd; c = wcschr(p, L'<'); if(!c) @@ -777,15 +783,13 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SetTextColor(hdc, format_color(&s_stack)); GetTextExtentPoint32(hdc, p, (int)(c - p), &s); - rd.left = x + p_width - d->scroll_left; - rd.top = y - d->scroll_top; - rd.right = x + p_width + s.cx - d->scroll_left; - rd.bottom = y + l_height - d->scroll_top; - - if(IntersectRect(&rt, &rd, &r)) { - DrawText(hdc, p, (int)(c - p), &rd, - DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX); - } + rd.left = x + p_width; + rd.top = y; + rd.right = rd.left + s.cx; + rd.bottom = rd.top + l_height; + + DrawText(hdc, p, (int)(c - p), &rd, + DT_BOTTOM | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX); p_width += s.cx; @@ -994,18 +998,39 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd, case WM_ERASEBKGND: { + HDC hdc = (HDC) wParam; khui_htwnd_data * d; + HBRUSH hbr; + RECT r; + d = (khui_htwnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, 0); - if(d->flags & KHUI_HTWND_TRANSPARENT) - return TRUE; + GetClientRect(hwnd, &r); + hbr = GetSysColorBrush(COLOR_WINDOW); + FillRect(hdc, &r, hbr); - return FALSE; + /* no need to destroy the brush since it's a system + brush. */ + + return TRUE; + } + + case WM_SIZE: + { + khui_htwnd_data * d; + + d = (khui_htwnd_data *) (LONG_PTR) GetWindowLongPtr(hwnd, 0); + + if (d) { + d->ext_width = 0; + d->ext_height = 0; + } } + return 0; case WM_PAINT: htw_paint(hwnd, uMsg, wParam, lParam); - break; + return 0; case WM_SETCURSOR: { @@ -1088,9 +1113,17 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd, old_pos = new_pos = d->scroll_left; ext = d->ext_width; - switch(HIWORD(wParam)) { - case SB_THUMBTRACK: + switch(LOWORD(wParam)) { case SB_THUMBPOSITION: + case SB_ENDSCROLL: + ZeroMemory(&si, sizeof(si)); + si.cbSize = sizeof(si); + si.fMask = SIF_POS; + GetScrollInfo(hwnd, SB_HORZ, &si); + new_pos = si.nPos; + break; + + case SB_THUMBTRACK: ZeroMemory(&si, sizeof(si)); si.cbSize = sizeof(si); si.fMask = SIF_TRACKPOS; @@ -1122,12 +1155,8 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd, GetClientRect(hwnd, &r); -#if 0 if (new_pos > ext - (r.right - r.left)) new_pos = ext - (r.right - r.left); -#endif - if (new_pos > ext) - new_pos = ext; if (new_pos < 0) new_pos = 0; @@ -1180,13 +1209,15 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd, if(d->active_link != nl) { if(d->active_link >= 0) { - if(d->flags & KHUI_HTWND_TRANSPARENT) - { - HWND parent = GetParent(hwnd); - if(parent) { - InvalidateRect(parent, NULL, TRUE); - } + if(d->flags & KHUI_HTWND_TRANSPARENT) { + HWND parent = GetParent(hwnd); + if(parent) { + RECT rdest = d->links[d->active_link]->r; + + MapWindowPoints(hwnd, parent, (LPPOINT) &rdest, 2); + InvalidateRect(parent, &rdest, TRUE); } + } /* although we are invalidating the rect before setting active_link, WM_PAINT will not be issued until wndproc returns */ InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE); @@ -1195,13 +1226,15 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd, if(d->active_link >= 0) { /* although we are invalidating the rect before setting active_link, WM_PAINT will not be issued until wndproc returns */ - if(d->flags & KHUI_HTWND_TRANSPARENT) - { - HWND parent = GetParent(hwnd); - if(parent) { - InvalidateRect(parent, NULL, TRUE); - } + if(d->flags & KHUI_HTWND_TRANSPARENT) { + HWND parent = GetParent(hwnd); + if(parent) { + RECT rdest = d->links[d->active_link]->r; + + MapWindowPoints(hwnd, parent, (LPPOINT) &rdest, 2); + InvalidateRect(parent, &rdest, TRUE); } + } InvalidateRect(hwnd, &(d->links[d->active_link]->r), TRUE); } } diff --git a/src/windows/identity/ui/khmapp.h b/src/windows/identity/ui/khmapp.h index 6b79307a2..54beb2a12 100644 --- a/src/windows/identity/ui/khmapp.h +++ b/src/windows/identity/ui/khmapp.h @@ -60,6 +60,7 @@ #include #include #include +#include #include #include diff --git a/src/windows/identity/ui/lang/en_us/khapp.rc b/src/windows/identity/ui/lang/en_us/khapp.rc index 285db67aa..3ba3677c1 100644 --- a/src/windows/identity/ui/lang/en_us/khapp.rc +++ b/src/windows/identity/ui/lang/en_us/khapp.rc @@ -8,7 +8,6 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" - ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -34,13 +33,12 @@ END 2 TEXTINCLUDE BEGIN - "#include ""afxres.h""\r\0" + "#include ""afxres.h\0" END 3 TEXTINCLUDE BEGIN - "\r\n" - "\0" + "\r\0" END #endif // APSTUDIO_INVOKED @@ -588,7 +586,7 @@ BEGIN IDS_ACTION_HELP_ABOUT "About Network Identity Manager" IDS_CFG_GENERAL_LONG "General options" IDS_SAMPLE_STRING "Wxy" - IDS_NO_CREDS "
You currently have no credentials.Click here to obtain new credentials.
" + IDS_NO_CREDS "

You currently have no credentials.

Click here to obtain new credentials.

" IDS_WT_INIT_CREDS "Obtain initial credentials" IDS_WT_NEW_CREDS "Obtain new credentials" END diff --git a/src/windows/identity/ui/main.c b/src/windows/identity/ui/main.c index e7d59eddb..3e3a94f67 100644 --- a/src/windows/identity/ui/main.c +++ b/src/windows/identity/ui/main.c @@ -47,7 +47,12 @@ khm_startup_options khm_startup; const khm_version app_version = {KH_VERSION_LIST}; +HRESULT hr_coinitialize = S_OK; + void khm_init_gui(void) { + + hr_coinitialize = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + khui_init_actions(); khui_init_rescache(); khui_init_menu(); @@ -55,9 +60,11 @@ void khm_init_gui(void) { khm_init_notifier(); khm_init_config(); khm_init_debug(); + khm_init_taskbar_funcs(); } void khm_exit_gui(void) { + khm_exit_taskbar_funcs(); khm_exit_debug(); khm_exit_config(); khm_exit_notifier(); @@ -65,6 +72,11 @@ void khm_exit_gui(void) { khui_exit_menu(); khui_exit_rescache(); khui_exit_actions(); + + if (hr_coinitialize == S_OK || + hr_coinitialize == S_FALSE) { + CoUninitialize(); + } } void khm_parse_commandline(void) { diff --git a/src/windows/identity/ui/mainwnd.c b/src/windows/identity/ui/mainwnd.c index 38402a275..159255f1c 100644 --- a/src/windows/identity/ui/mainwnd.c +++ b/src/windows/identity/ui/mainwnd.c @@ -93,6 +93,8 @@ khm_pre_shutdown(void) { khm_int32 t; khm_size s; + khm_taskbar_remove_window(khm_hwnd_main); + /* Check if we should destroy all credentials on exit... */ if (KHM_FAILED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw))) @@ -1133,6 +1135,8 @@ khm_set_main_window_mode(int mode) { khc_close_space(csp_cw); } + + khm_cred_refresh(); } void @@ -1207,6 +1211,10 @@ khm_show_main_window(void) { } else { ShowWindow(khm_hwnd_main, khm_nCmdShow); UpdateWindow(khm_hwnd_main); + + khm_taskbar_add_window(khm_hwnd_main); + + khm_cred_refresh(); } khm_nCmdShow = SW_RESTORE; @@ -1296,6 +1304,8 @@ khm_hide_main_window(void) { khc_close_space(csp_notices); ShowWindow(khm_hwnd_main, SW_HIDE); + + khm_taskbar_remove_window(khm_hwnd_main); } BOOL diff --git a/src/windows/identity/ui/newcredwnd.c b/src/windows/identity/ui/newcredwnd.c index 4e4e5e116..d4d9a785c 100644 --- a/src/windows/identity/ui/newcredwnd.c +++ b/src/windows/identity/ui/newcredwnd.c @@ -883,7 +883,12 @@ nc_update_credtext(khui_nc_wnd_data * d) need_layout = TRUE; - } else if (flags & KCDB_IDENT_FLAG_VALID) { + } else if ((flags & KCDB_IDENT_FLAG_VALID) || + d->nc->subtype == KMSG_CRED_PASSWORD) { + /* special case: If we are going to change the + password, we don't expect the identity provider to + validate the identity in real time. As such, we + assume that the identity is valid. */ /* identity is valid */ if (d->notif_type != NC_NOTIFY_NONE) { @@ -1581,6 +1586,8 @@ nc_handle_wm_create(HWND hwnd, /* add this to the dialog chain */ khm_add_dialog(hwnd); + khm_taskbar_add_window(hwnd); + return TRUE; } @@ -1678,6 +1685,8 @@ nc_handle_wm_destroy(HWND hwnd, /* remove self from dialog chain */ khm_del_dialog(hwnd); + khm_taskbar_remove_window(hwnd); + d = (khui_nc_wnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, CW_PARAM); d->nc->ident_cb(d->nc, WMNC_IDENT_EXIT, NULL, 0, 0, 0); diff --git a/src/windows/identity/ui/resource.h b/src/windows/identity/ui/resource.h index 31df1fe7e..7be9a84be 100644 --- a/src/windows/identity/ui/resource.h +++ b/src/windows/identity/ui/resource.h @@ -3,14 +3,12 @@ // Used by C:\work\pismere\athena\auth\krb5\src\windows\identity\ui\lang\en_us\khapp.rc // #define IDI_MAIN_APP 104 -#define IDD_PROPPAGE_MEDIUM 106 #define IDD_PP_CRED 106 #define IDD_PP_IDENT 107 #define IDB_TK_REFRESH 108 #define IDS_MAIN_WINDOW_TITLE 108 #define IDS_MENU_FILE 109 #define IDB_ID 110 -#define IDS_MENU_IDENTITY 110 #define IDS_MENU_CRED 110 #define IDB_ID_DELETE 111 #define IDS_MENU_VIEW 111 @@ -23,17 +21,13 @@ #define IDB_TK_DELETE 115 #define IDS_ACTION_EXIT 115 #define IDB_TK_NEW 116 -#define IDS_ACTION_NEW_ID 116 #define IDS_CFG_ROOT_NAME 116 #define IDS_ACTION_SET_DEF_ID 117 #define IDS_ACTION_SET_SRCH_ID 118 #define IDB_VW_REFRESH_SM 118 -#define IDS_ACTION_DESTROY_ID 119 #define IDR_MENU_BAR 119 #define IDS_CFG_ROOT_TITLE 119 -#define IDS_ACTION_RENEW_ID 120 #define IDS_CFG_GENERAL_SHORT 120 -#define IDS_ACTION_ADD_CRED 121 #define IDB_TB_BLANK 121 #define IDS_ACTION_NEW_CRED 121 #define IDS_ACTION_PASSWD_ID 122 @@ -57,7 +51,6 @@ #define IDB_ID_NEW_DIS_SM 131 #define IDS_ACTION_OPT_KHIM 132 #define IDB_ID_NEW_SM 132 -#define IDS_ACTION_OPT_INIT 133 #define IDB_ID_REFRESH_DIS 133 #define IDS_ACTION_OPT_IDENTS 133 #define IDS_ACTION_OPT_NOTIF 134 @@ -71,7 +64,6 @@ #define IDS_ACTION_HELP_ABOUT 138 #define IDB_TK_DELETE_SM 138 #define IDB_TK_DIS_SM 139 -#define IDS_ACTIONINFO_NEW_ID 139 #define IDS_CFG_GENERAL_LONG 139 #define IDB_TK_NEW_DIS 140 #define IDS_SAMPLE_STRING 140 @@ -82,7 +74,6 @@ #define IDB_TK_REFRESH_DIS 143 #define IDS_WT_NEW_CREDS 143 #define IDB_TK_REFRESH_DIS_SM 144 -#define IDS_NC_PASSWORD 144 #define IDS_NC_IDENTITY 144 #define IDB_TK_REFRESH_SM 145 #define IDS_NC_IDENTS 145 @@ -116,7 +107,6 @@ #define IDS_PACTION_OK 160 #define IDB_FLAG_CRITICAL 161 #define IDS_PACTION_CANCEL 161 -#define IDD_NC_PASSWORD 162 #define IDS_PACTION_CLOSE 162 #define IDD_NC_NEWCRED 162 #define IDD_NC_BBAR 163 @@ -165,7 +155,6 @@ #define IDS_CFG_IDENTITY_SHORT 186 #define IDI_CFG_DELETED 186 #define IDS_CFG_IDENTITY_LONG 187 -#define IDI_ICON1 187 #define IDI_ID 187 #define IDS_CTX_DESTROY_CREDS 188 #define IDB_IMPORT_SM_DIS 188 @@ -203,7 +192,6 @@ #define IDS_PISTATE_FAILUNK 205 #define IDI_APPICON_EXP 205 #define IDS_PISTATE_FAILMAX 206 -#define IDI_ICON4 206 #define IDI_APPICON_OK 206 #define IDS_PISTATE_FAILREG 207 #define IDI_CFG_PLUGIN 207 @@ -305,7 +293,6 @@ #define IDS_NCN_IDENT_UNKNOWN 299 #define IDS_REMOTE_FAIL 300 #define IDS_REMOTE_FAIL_TITLE 301 -#define IDS_NOTIFICATION_ACTIONS 302 #define IDS_IDACTION_NEW 302 #define IDS_IDACTIONT_NEW 303 #define IDS_IDACTIONT_RENEW 304 @@ -323,39 +310,24 @@ #define IDS_CW_TYPEF 316 #define IDS_CW_EXPIREF 317 #define IDS_CW_EXPIRED 318 -#define IDC_NC_USERNAME 1007 -#define IDC_NC_PASSWORD 1008 #define IDC_NC_CREDTEXT_LABEL 1009 -#define IDC_NC_PASSWORD_LABEL 1010 -#define IDC_NC_USERNAME_LABEL 1011 #define IDC_NC_CREDTEXT 1012 #define IDC_NC_HELP 1017 -#define IDC_NC_OPTIONS 1019 #define IDC_NC_ADVANCED 1019 #define IDC_PP_IDNAME 1026 #define IDC_PP_IDDEF 1027 #define IDC_PP_IDSEARCH 1028 -#define IDC_PP_IDSTATUS 1029 -#define IDC_PP_IDSTATUSIMG 1030 -#define IDC_PP_IDVALID 1031 -#define IDC_PP_IDRENEW 1032 -#define IDC_NC_IDENTITY 1033 -#define IDC_NC_IDENTITY_LABEL 1034 #define IDC_PP_PROPLIST 1035 #define IDC_PP_CPROPLIST 1036 -#define IDC_NC_REALM 1037 -#define IDC_NC_REALM_LABEL 1038 #define IDC_NC_TPL_ROW 1039 #define IDC_NC_TPL_PANEL 1040 #define IDC_NC_TPL_LABEL 1041 #define IDC_NC_TPL_INPUT 1042 #define IDC_NC_TPL_LABEL_LG 1043 #define IDC_NC_TPL_INPUT_LG 1044 -#define IDC_NC_TPL_ROW2 1045 #define IDC_NC_TPL_ROW_LG 1045 #define IDC_CFG_NODELIST 1045 #define IDAPPLY 1048 -#define IDC_CFG_SUMMARY 1049 #define IDC_CFG_TITLE 1050 #define IDC_CFG_PANE 1051 #define IDC_NOTIF_MONITOR 1053 @@ -374,15 +346,11 @@ #define IDC_CFG_OTHER 1066 #define IDC_CFG_MONITOR 1069 #define IDC_CFG_STICKY 1070 -#define IDC_CFG_IDENTS 1071 -#define IDC_CFG_IDENTITY 1072 #define IDC_CFG_RENEW 1075 #define IDC_CFG_REMOVE 1076 #define IDC_CFG_TAB 1077 #define IDC_CFG_TARGET 1078 #define IDC_CFG_PLUGINS 1079 -#define IDC_CFG_PLUGINGRP 1080 -#define IDC_CFG_LBL_DESC 1083 #define IDC_CFG_DESC 1084 #define IDC_CFG_LBL_STATE 1085 #define IDC_CFG_STATE 1086 @@ -390,7 +358,6 @@ #define IDC_CFG_DEPS 1088 #define IDC_CFG_DISABLE 1089 #define IDC_CFG_ENABLE 1090 -#define IDC_CFG_PROVGRP 1091 #define IDC_CFG_LBL_MOD 1092 #define IDC_CFG_MODULE 1093 #define IDC_CFG_LBL_VEN 1094 @@ -401,7 +368,6 @@ #define IDC_PRODUCT 1100 #define IDC_COPYRIGHT 1101 #define IDC_BUILDINFO 1102 -#define IDC_LIST1 1103 #define IDC_MODULES 1103 #define IDC_PP_CONFIG 1104 #define IDC_CFG_UNREGISTER 1107 @@ -419,7 +385,6 @@ #define IDC_CFG_BOLD 1131 #define IDC_CFG_ITALICS 1132 #define IDC_CFG_ADDIDENT 1133 -#define IDC_CFG_IDNAME 1134 #define IDC_SM_CTL 1134 #define IDC_CFG_SHOWLOG 1135 #define IDC_MED_CTL 1135 @@ -429,7 +394,6 @@ #define IDC_LG_LBL 1139 #define IDC_CFG_NOTACTION 1141 #define IDC_CFG_NOTACT_STATIC 1142 -#define IDC_BUTTON1 1143 #define IDC_NC_BASIC 1143 #define IDA_ACTIVATE_MENU 40003 #define IDA_UP 40004 diff --git a/src/windows/identity/ui/taskbar.c b/src/windows/identity/ui/taskbar.c new file mode 100644 index 000000000..48a575f64 --- /dev/null +++ b/src/windows/identity/ui/taskbar.c @@ -0,0 +1,87 @@ +/* + * 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 + +#define COBJMACROS + +#include + +#ifdef DEBUG +#include +#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 + } +} diff --git a/src/windows/identity/ui/taskbar.h b/src/windows/identity/ui/taskbar.h new file mode 100644 index 000000000..32adf5c29 --- /dev/null +++ b/src/windows/identity/ui/taskbar.h @@ -0,0 +1,38 @@ +/* + * 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 diff --git a/src/windows/identity/uilib/action.c b/src/windows/identity/uilib/action.c index a0295d39e..ae017e1d0 100644 --- a/src/windows/identity/uilib/action.c +++ b/src/windows/identity/uilib/action.c @@ -1490,12 +1490,8 @@ khui_context_refresh(void) { if (khui_ctx.scope != KHUI_SCOPE_NONE) { khui_enable_action(KHUI_ACTION_PROPERTIES, TRUE); - khui_enable_action(KHUI_ACTION_DESTROY_CRED, TRUE); - khui_enable_action(KHUI_ACTION_RENEW_CRED, TRUE); } else { khui_enable_action(KHUI_ACTION_PROPERTIES, FALSE); - khui_enable_action(KHUI_ACTION_DESTROY_CRED, FALSE); - khui_enable_action(KHUI_ACTION_RENEW_CRED, FALSE); } LeaveCriticalSection(&cs_actions);