NIM 1.2.0.1 corrections
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 7 Apr 2007 01:02:00 +0000 (01:02 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 7 Apr 2007 01:02:00 +0000 (01:02 +0000)
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

src/windows/identity/config/Makefile.w2k
src/windows/identity/config/Makefile.w32
src/windows/identity/nidmgrdll/nidmgrdll.rc
src/windows/identity/plugins/krb5/krb5funcs.c
src/windows/identity/plugins/krb5/krb5funcs.h
src/windows/identity/plugins/krb5/krb5newcreds.c
src/windows/identity/ui/cfg_identities_wnd.c
src/windows/identity/ui/mainmenu.c
src/windows/identity/ui/mainwnd.c
src/windows/identity/ui/mainwnd.h

index e8da2fc175850fe2d23ca604f84a1ccf94d00448..292706d2818656b1c918cf1a60fb37b3116b1a1c 100644 (file)
@@ -48,7 +48,7 @@ KHIMAIRA_WIN32_CONFIG=1
 NETIDMGR_VERSION_MAJOR=1\r
 NETIDMGR_VERSION_MINOR=2\r
 NETIDMGR_VERSION_PATCH=0\r
-NETIDMGR_VERSION_AUX=0\r
+NETIDMGR_VERSION_AUX=1\r
 NETIDMGR_RELEASEDESC=\r
 \r
 # The API version.  This number must be incremented each time the API\r
index d65d45d73635f53dccd211d9eac7625b9aed1349..f0196243c71589dec33150fb6bf416b652bec8e7 100644 (file)
@@ -48,7 +48,7 @@ KHIMAIRA_WIN32_CONFIG=1
 NETIDMGR_VERSION_MAJOR=1\r
 NETIDMGR_VERSION_MINOR=2\r
 NETIDMGR_VERSION_PATCH=0\r
-NETIDMGR_VERSION_AUX=0\r
+NETIDMGR_VERSION_AUX=1\r
 NETIDMGR_RELEASEDESC=\r
 \r
 # The API version.  This number must be incremented each time the API\r
index b091bdbfa6bf12cbcb3a59adf9b03e1731db9cc2..1f600b6b3b1256c08e3ee7a6286d0981b016b099 100644 (file)
@@ -47,12 +47,12 @@ BEGIN
         BEGIN\r
             VALUE "CompanyName", KH_VERSTR_COMPANY_1033\r
             VALUE "FileDescription", "Network Identity Manager API"\r
-            VALUE "FileVersion", KH_VERSION_STRING\r
+            VALUE "FileVersion", KH_VERSTR_VERSION_1033\r
             VALUE "InternalName", "nidmgr32"\r
             VALUE "LegalCopyright", KH_VERSTR_COPYRIGHT_1033\r
             VALUE "OriginalFilename", "nidmgr32.dll"\r
-            VALUE "ProductName", KH_VERSTR_PRODUCT_1033\r
-            VALUE "ProductVersion", KH_VERSTR_VERSION_1033\r
+            VALUE "ProductName", "Network Identity Manager"\r
+            VALUE "ProductVersion", KH_VERSTR_PRODUCT_1033\r
 #ifdef KH_VERSTR_COMMENT_1033\r
             VALUE "Comments",     KH_VERSTR_COMMENT_1033\r
 #endif\r
index bc0170d8fab944ea95581231b5144fb848498c65..b924c1f4c5dc43a7e7a4e04ffe800e42bc529bad 100644 (file)
@@ -1165,7 +1165,7 @@ khm_krb5_renew_ident(khm_handle identity)
 \r
         UnicodeStrToAnsi(cidname, sizeof(cidname), idname);\r
 \r
-        imported = khm_krb5_ms2mit(cidname, FALSE, TRUE);\r
+        imported = khm_krb5_ms2mit(cidname, FALSE, TRUE, NULL);\r
 \r
         if (imported)\r
             goto cleanup;\r
@@ -2096,7 +2096,8 @@ IsKerberosLogon(VOID)
 \r
 \r
 BOOL\r
-khm_krb5_ms2mit(char * match_princ, BOOL match_realm, BOOL save_creds)\r
+khm_krb5_ms2mit(char * match_princ, BOOL match_realm, BOOL save_creds,\r
+                khm_handle * ret_ident)\r
 {\r
 #ifdef NO_KRB5\r
     return(FALSE);\r
@@ -2238,9 +2239,15 @@ khm_krb5_ms2mit(char * match_princ, BOOL match_realm, BOOL save_creds)
         /* and mark the identity as having been imported */\r
         if (ident) {\r
             khm_krb5_set_identity_flags(ident, K5IDFLAG_IMPORTED, K5IDFLAG_IMPORTED);\r
+\r
+            if (ret_ident) {\r
+                *ret_ident = ident;\r
+                kcdb_identity_hold(*ret_ident);\r
+            }\r
         }\r
 \r
         rc = TRUE;\r
+\r
     } else {\r
         /* Enumerate tickets from cache looking for an initial ticket */\r
         if ((code = pkrb5_cc_start_seq_get(kcontext, mslsa_ccache, &cursor))) \r
@@ -2271,6 +2278,9 @@ cleanup:
         pkrb5_cc_close(kcontext, mslsa_ccache);\r
     if (kcontext)\r
         pkrb5_free_context(kcontext);\r
+    if (ident)\r
+        kcdb_identity_release(ident);\r
+\r
     return(rc);\r
 #endif /* NO_KRB5 */\r
 }\r
@@ -2568,6 +2578,10 @@ khm_krb5_get_default_realm(void)
     char * def = 0;\r
 \r
     pkrb5_init_context(&ctx);\r
+\r
+    if (ctx == 0)\r
+        return NULL;\r
+\r
     pkrb5_get_default_realm(ctx,&def);\r
     \r
     if (def) {\r
index ce3989682806fd603f9224e1581dbd74d635ca06..b4ab452b315dbc7e6e6548011afd608cdd777fea 100644 (file)
@@ -108,7 +108,8 @@ typedef struct tag_k5params {
 BOOL \r
 khm_krb5_ms2mit(char * match_princ,\r
                 BOOL   match_realm,\r
-                BOOL   save_creds);\r
+                BOOL   save_creds,\r
+                khm_handle * ret_ident);\r
 \r
 int\r
 khm_krb5_kinit(krb5_context       alt_ctx,\r
index b9f0c075e31dce2b223791783e375994c295a271..edd64725da98dafab19fe01c540b35df65fe1f7e 100644 (file)
@@ -2710,14 +2710,34 @@ k5_msg_cred_dialog(khm_int32 msg_type,
 \r
             if (t != K5_LSAIMPORT_NEVER) {\r
                 krb5_context ctx = NULL;\r
+                khm_handle id_default = NULL;\r
+                khm_handle id_imported = NULL;\r
                 BOOL imported;\r
 \r
-                imported = khm_krb5_ms2mit(NULL, (t == K5_LSAIMPORT_MATCH), TRUE);\r
+                imported = khm_krb5_ms2mit(NULL, (t == K5_LSAIMPORT_MATCH), TRUE,\r
+                                           &id_imported);\r
                 if (imported) {\r
                     khm_krb5_list_tickets(&ctx);\r
+\r
                     if (ctx)\r
                         pkrb5_free_context(ctx);\r
+\r
+                    kcdb_identity_refresh(id_imported);\r
+\r
+                    if (KHM_SUCCEEDED(kcdb_identity_get_default(&id_default))) {\r
+                        kcdb_identity_release(id_default);\r
+                        id_default = NULL;\r
+                    } else {\r
+                        _reportf(L"There was no default identity.  Setting default");\r
+                        kcdb_identity_set_default(id_imported);\r
+                    }\r
+\r
+                    /* and update the LRU */\r
+                    k5_update_LRU(id_imported);\r
                 }\r
+\r
+                if (id_imported)\r
+                    kcdb_identity_release(id_imported);\r
             }\r
         }\r
         break;\r
index 3ba843f75e629fa1585ebd02e3eb138cdfa7da5f..a8813d1164726735e055d6b8af56d04aa8904b52 100644 (file)
@@ -500,7 +500,7 @@ write_params_idents(void) {
             cfg_idents.applied = TRUE;\r
         }\r
         if (cfg_idents.work.sticky != cfg_idents.saved.sticky) {\r
-            khc_write_int32(csp_cw, L"DefaultMonitor",\r
+            khc_write_int32(csp_cw, L"DefaultSticky",\r
                             !!cfg_idents.work.sticky);\r
             cfg_idents.work.sticky = cfg_idents.saved.sticky;\r
             cfg_idents.applied = TRUE;\r
index e27d0399b3e7709402b6ca33c37adc9c18b24981..6634549b4ce80fa428380b9c8a5255d533bd17dd 100644 (file)
@@ -820,6 +820,16 @@ khm_refresh_identity_menus(void) {
     khm_size n_idents = 0;\r
     khm_size t;\r
     khm_int32 rv = KHM_ERROR_SUCCESS;\r
+    khm_handle csp_cw = NULL;\r
+    khm_int32 idflags;\r
+    khm_int32 def_sticky = 0;\r
+    khm_boolean sticky_done = FALSE;\r
+\r
+    if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw))) {\r
+        khc_read_int32(csp_cw, L"DefaultSticky", &def_sticky);\r
+        khc_close_space(csp_cw);\r
+        csp_cw = NULL;\r
+    }\r
 \r
     kcdb_identity_refresh_all();\r
 \r
@@ -921,6 +931,16 @@ khm_refresh_identity_menus(void) {
         khui_menu_insert_action(dest_def, 1000,\r
                                 khm_get_identity_destroy_action(identity),\r
                                 0);\r
+\r
+        idflags = 0;\r
+        kcdb_identity_get_flags(identity, &idflags);\r
+\r
+        if (!(idflags & KCDB_IDENT_FLAG_STICKY) && def_sticky) {\r
+            kcdb_identity_set_flags(identity,\r
+                                    KCDB_IDENT_FLAG_STICKY,\r
+                                    KCDB_IDENT_FLAG_STICKY);\r
+            sticky_done = TRUE;\r
+        }\r
     }\r
 \r
     if (idlist)\r
@@ -931,6 +951,10 @@ khm_refresh_identity_menus(void) {
     khui_action_unlock();\r
 \r
     khui_refresh_actions();\r
+\r
+    if (sticky_done) {\r
+        InvalidateRect(khm_hwnd_main_cred, NULL, TRUE);\r
+    }\r
 }\r
 \r
 khm_boolean\r
index 76a3fdefebfc9affd943f2f30f9d1aed30238f54..38402a2750bc26470172611e3dd849e6cf77d0f0 100644 (file)
@@ -221,6 +221,10 @@ khm_main_wnd_proc(HWND hwnd,
         kmq_subscribe_hwnd(KMSG_KMM, hwnd);\r
         mw_restart_refresh_timer(hwnd);\r
 \r
+        /* if the plug-ins finished loading before the window was\r
+           created, we would have missed the KMSG_KMM_I_DONE message.\r
+           So we check if the module load is complete and if so, fire\r
+           off KMSG_ACT_BEGIN_CMDLINE. */\r
         if (!kmm_load_pending())\r
             kmq_post_message(KMSG_ACT, KMSG_ACT_BEGIN_CMDLINE, 0, 0);\r
         break;\r
index 263ffeba4bed6bc439158094b623b8726bbfc96e..7b14d35a28338072ba77b6a6c8f8207b5113c4d0 100644 (file)
@@ -33,6 +33,7 @@
 extern ATOM khm_main_window_class;\r
 extern HWND khm_hwnd_main;\r
 extern HWND khm_hwnd_rebar;\r
+extern HWND khm_hwnd_main_cred;\r
 \r
 #define KHM_MAIN_WND_NORMAL 0\r
 #define KHM_MAIN_WND_MINI   1\r