From: Jeffrey Altman Date: Sat, 7 Apr 2007 01:02:00 +0000 (+0000) Subject: NIM 1.2.0.1 corrections X-Git-Tag: krb5-1.7-alpha1~1174 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5ace55fd0e100506f4803ffebc9b1aeb8f252185;p=krb5.git NIM 1.2.0.1 corrections NetIdMgr Version 1.2.0.1 netidmgr.exe: - add functionality to implement previously defined "DefaultSticky" registry based configuration parameter. This value is can be added to an installer by a transform or pushed by Group Policy. When set, it controls the default setting of the "sticky" flag for new identities. nidmgr32.dll: - fix the version resources: FileVersion, ProductName, and ProductVersion krb5cred.dll: - when importing an identity from the MSLSA, if there has never been a default identity, configure the MSLSA identity to be the default. ticket: new component: windows tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19407 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/identity/config/Makefile.w2k b/src/windows/identity/config/Makefile.w2k index e8da2fc17..292706d28 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=0 +NETIDMGR_VERSION_AUX=1 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 d65d45d73..f0196243c 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=0 +NETIDMGR_VERSION_AUX=1 NETIDMGR_RELEASEDESC= # The API version. This number must be incremented each time the API diff --git a/src/windows/identity/nidmgrdll/nidmgrdll.rc b/src/windows/identity/nidmgrdll/nidmgrdll.rc index b091bdbfa..1f600b6b3 100644 --- a/src/windows/identity/nidmgrdll/nidmgrdll.rc +++ b/src/windows/identity/nidmgrdll/nidmgrdll.rc @@ -47,12 +47,12 @@ BEGIN BEGIN VALUE "CompanyName", KH_VERSTR_COMPANY_1033 VALUE "FileDescription", "Network Identity Manager API" - VALUE "FileVersion", KH_VERSION_STRING + VALUE "FileVersion", KH_VERSTR_VERSION_1033 VALUE "InternalName", "nidmgr32" VALUE "LegalCopyright", KH_VERSTR_COPYRIGHT_1033 VALUE "OriginalFilename", "nidmgr32.dll" - VALUE "ProductName", KH_VERSTR_PRODUCT_1033 - VALUE "ProductVersion", KH_VERSTR_VERSION_1033 + VALUE "ProductName", "Network Identity Manager" + VALUE "ProductVersion", KH_VERSTR_PRODUCT_1033 #ifdef KH_VERSTR_COMMENT_1033 VALUE "Comments", KH_VERSTR_COMMENT_1033 #endif diff --git a/src/windows/identity/plugins/krb5/krb5funcs.c b/src/windows/identity/plugins/krb5/krb5funcs.c index bc0170d8f..b924c1f4c 100644 --- a/src/windows/identity/plugins/krb5/krb5funcs.c +++ b/src/windows/identity/plugins/krb5/krb5funcs.c @@ -1165,7 +1165,7 @@ khm_krb5_renew_ident(khm_handle identity) UnicodeStrToAnsi(cidname, sizeof(cidname), idname); - imported = khm_krb5_ms2mit(cidname, FALSE, TRUE); + imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, NULL); if (imported) goto cleanup; @@ -2096,7 +2096,8 @@ IsKerberosLogon(VOID) BOOL -khm_krb5_ms2mit(char * match_princ, BOOL match_realm, BOOL save_creds) +khm_krb5_ms2mit(char * match_princ, BOOL match_realm, BOOL save_creds, + khm_handle * ret_ident) { #ifdef NO_KRB5 return(FALSE); @@ -2238,9 +2239,15 @@ khm_krb5_ms2mit(char * match_princ, BOOL match_realm, BOOL save_creds) /* and mark the identity as having been imported */ if (ident) { khm_krb5_set_identity_flags(ident, K5IDFLAG_IMPORTED, K5IDFLAG_IMPORTED); + + if (ret_ident) { + *ret_ident = ident; + kcdb_identity_hold(*ret_ident); + } } rc = TRUE; + } else { /* Enumerate tickets from cache looking for an initial ticket */ if ((code = pkrb5_cc_start_seq_get(kcontext, mslsa_ccache, &cursor))) @@ -2271,6 +2278,9 @@ cleanup: pkrb5_cc_close(kcontext, mslsa_ccache); if (kcontext) pkrb5_free_context(kcontext); + if (ident) + kcdb_identity_release(ident); + return(rc); #endif /* NO_KRB5 */ } @@ -2568,6 +2578,10 @@ khm_krb5_get_default_realm(void) char * def = 0; pkrb5_init_context(&ctx); + + if (ctx == 0) + return NULL; + pkrb5_get_default_realm(ctx,&def); if (def) { diff --git a/src/windows/identity/plugins/krb5/krb5funcs.h b/src/windows/identity/plugins/krb5/krb5funcs.h index ce3989682..b4ab452b3 100644 --- a/src/windows/identity/plugins/krb5/krb5funcs.h +++ b/src/windows/identity/plugins/krb5/krb5funcs.h @@ -108,7 +108,8 @@ typedef struct tag_k5params { BOOL khm_krb5_ms2mit(char * match_princ, BOOL match_realm, - BOOL save_creds); + BOOL save_creds, + khm_handle * ret_ident); int khm_krb5_kinit(krb5_context alt_ctx, diff --git a/src/windows/identity/plugins/krb5/krb5newcreds.c b/src/windows/identity/plugins/krb5/krb5newcreds.c index b9f0c075e..edd64725d 100644 --- a/src/windows/identity/plugins/krb5/krb5newcreds.c +++ b/src/windows/identity/plugins/krb5/krb5newcreds.c @@ -2710,14 +2710,34 @@ k5_msg_cred_dialog(khm_int32 msg_type, if (t != K5_LSAIMPORT_NEVER) { krb5_context ctx = NULL; + khm_handle id_default = NULL; + khm_handle id_imported = NULL; BOOL imported; - imported = khm_krb5_ms2mit(NULL, (t == K5_LSAIMPORT_MATCH), TRUE); + imported = khm_krb5_ms2mit(NULL, (t == K5_LSAIMPORT_MATCH), TRUE, + &id_imported); if (imported) { khm_krb5_list_tickets(&ctx); + if (ctx) pkrb5_free_context(ctx); + + kcdb_identity_refresh(id_imported); + + if (KHM_SUCCEEDED(kcdb_identity_get_default(&id_default))) { + kcdb_identity_release(id_default); + id_default = NULL; + } else { + _reportf(L"There was no default identity. Setting default"); + kcdb_identity_set_default(id_imported); + } + + /* and update the LRU */ + k5_update_LRU(id_imported); } + + if (id_imported) + kcdb_identity_release(id_imported); } } break; diff --git a/src/windows/identity/ui/cfg_identities_wnd.c b/src/windows/identity/ui/cfg_identities_wnd.c index 3ba843f75..a8813d116 100644 --- a/src/windows/identity/ui/cfg_identities_wnd.c +++ b/src/windows/identity/ui/cfg_identities_wnd.c @@ -500,7 +500,7 @@ write_params_idents(void) { cfg_idents.applied = TRUE; } if (cfg_idents.work.sticky != cfg_idents.saved.sticky) { - khc_write_int32(csp_cw, L"DefaultMonitor", + khc_write_int32(csp_cw, L"DefaultSticky", !!cfg_idents.work.sticky); cfg_idents.work.sticky = cfg_idents.saved.sticky; cfg_idents.applied = TRUE; diff --git a/src/windows/identity/ui/mainmenu.c b/src/windows/identity/ui/mainmenu.c index e27d0399b..6634549b4 100644 --- a/src/windows/identity/ui/mainmenu.c +++ b/src/windows/identity/ui/mainmenu.c @@ -820,6 +820,16 @@ khm_refresh_identity_menus(void) { khm_size n_idents = 0; khm_size t; khm_int32 rv = KHM_ERROR_SUCCESS; + khm_handle csp_cw = NULL; + khm_int32 idflags; + khm_int32 def_sticky = 0; + khm_boolean sticky_done = FALSE; + + if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw))) { + khc_read_int32(csp_cw, L"DefaultSticky", &def_sticky); + khc_close_space(csp_cw); + csp_cw = NULL; + } kcdb_identity_refresh_all(); @@ -921,6 +931,16 @@ khm_refresh_identity_menus(void) { khui_menu_insert_action(dest_def, 1000, khm_get_identity_destroy_action(identity), 0); + + idflags = 0; + kcdb_identity_get_flags(identity, &idflags); + + if (!(idflags & KCDB_IDENT_FLAG_STICKY) && def_sticky) { + kcdb_identity_set_flags(identity, + KCDB_IDENT_FLAG_STICKY, + KCDB_IDENT_FLAG_STICKY); + sticky_done = TRUE; + } } if (idlist) @@ -931,6 +951,10 @@ khm_refresh_identity_menus(void) { khui_action_unlock(); khui_refresh_actions(); + + if (sticky_done) { + InvalidateRect(khm_hwnd_main_cred, NULL, TRUE); + } } khm_boolean diff --git a/src/windows/identity/ui/mainwnd.c b/src/windows/identity/ui/mainwnd.c index 76a3fdefe..38402a275 100644 --- a/src/windows/identity/ui/mainwnd.c +++ b/src/windows/identity/ui/mainwnd.c @@ -221,6 +221,10 @@ khm_main_wnd_proc(HWND hwnd, kmq_subscribe_hwnd(KMSG_KMM, hwnd); mw_restart_refresh_timer(hwnd); + /* if the plug-ins finished loading before the window was + created, we would have missed the KMSG_KMM_I_DONE message. + So we check if the module load is complete and if so, fire + off KMSG_ACT_BEGIN_CMDLINE. */ if (!kmm_load_pending()) kmq_post_message(KMSG_ACT, KMSG_ACT_BEGIN_CMDLINE, 0, 0); break; diff --git a/src/windows/identity/ui/mainwnd.h b/src/windows/identity/ui/mainwnd.h index 263ffeba4..7b14d35a2 100644 --- a/src/windows/identity/ui/mainwnd.h +++ b/src/windows/identity/ui/mainwnd.h @@ -33,6 +33,7 @@ extern ATOM khm_main_window_class; extern HWND khm_hwnd_main; extern HWND khm_hwnd_rebar; +extern HWND khm_hwnd_main_cred; #define KHM_MAIN_WND_NORMAL 0 #define KHM_MAIN_WND_MINI 1