pull up r19426 from trunk
authorTom Yu <tlyu@mit.edu>
Thu, 12 Apr 2007 20:12:03 +0000 (20:12 +0000)
committerTom Yu <tlyu@mit.edu>
Thu, 12 Apr 2007 20:12:03 +0000 (20:12 +0000)
 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

23 files changed:
src/windows/identity/config/Makefile.w2k
src/windows/identity/config/Makefile.w32
src/windows/identity/kcreddb/credset.c
src/windows/identity/plugins/common/krb5common.c
src/windows/identity/plugins/krb4/krb4newcreds.c
src/windows/identity/plugins/krb4/lang/en_us/langres.rc
src/windows/identity/plugins/krb4/langres.h
src/windows/identity/plugins/krb5/krb5funcs.c
src/windows/identity/plugins/krb5/krb5identpro.c
src/windows/identity/ui/Makefile
src/windows/identity/ui/credwnd.c
src/windows/identity/ui/credwnd.h
src/windows/identity/ui/htmlwnd.h [deleted file]
src/windows/identity/ui/htwnd.c
src/windows/identity/ui/khmapp.h
src/windows/identity/ui/lang/en_us/khapp.rc
src/windows/identity/ui/main.c
src/windows/identity/ui/mainwnd.c
src/windows/identity/ui/newcredwnd.c
src/windows/identity/ui/resource.h
src/windows/identity/ui/taskbar.c [new file with mode: 0644]
src/windows/identity/ui/taskbar.h [new file with mode: 0644]
src/windows/identity/uilib/action.c

index 292706d2818656b1c918cf1a60fb37b3116b1a1c..efd7fbdb404bc16bd2b2fca5e317da0b3235627e 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=1\r
+NETIDMGR_VERSION_AUX=2\r
 NETIDMGR_RELEASEDESC=\r
 \r
 # The API version.  This number must be incremented each time the API\r
index f0196243c71589dec33150fb6bf416b652bec8e7..5f274a49cee1ac1f8e715740d29e5a20216c78af 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=1\r
+NETIDMGR_VERSION_AUX=2\r
 NETIDMGR_RELEASEDESC=\r
 \r
 # The API version.  This number must be incremented each time the API\r
index 141e17cd22a8719b3c9002a1e6984efcb84d7ba7..2d7eeeb1fc72a436069099013fb2d29228938f6b 100644 (file)
@@ -321,6 +321,10 @@ kcdb_credset_collect(khm_handle cs_dest,
     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
@@ -422,6 +426,10 @@ kcdb_credset_collect_filtered(khm_handle cs_dest,
     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
index 759641ff7154029353c8d69a83c370a3614c26a2..6c39586945f3dc6490096d8a8f44e5d477fbb8d9 100644 (file)
@@ -90,8 +90,8 @@ khm_krb5_initialize(khm_handle ident,
     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
index 81c16162d2bedc0130160f6303f31099f631852a..54feae5b3690c6eee9fe7d039abc19f1ef588fb8 100644 (file)
@@ -55,33 +55,25 @@ typedef struct tag_k4_dlg_data {
     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
@@ -103,7 +95,7 @@ void k4_update_data(k4_dlg_data * d) {
         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
@@ -119,19 +111,16 @@ khm_boolean k4_should_identity_get_k4(khm_handle ident) {
     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
@@ -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,\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
@@ -257,8 +257,9 @@ void k4_handle_wmnc_notify(k4_dlg_data * d,
 \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
@@ -321,7 +322,7 @@ void k4_handle_wmnc_notify(k4_dlg_data * d,
 \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
@@ -343,7 +344,7 @@ void k4_handle_wmnc_notify(k4_dlg_data * d,
             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
@@ -378,17 +379,24 @@ INT_PTR CALLBACK k4_nc_dlg_proc(HWND hwnd,
             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
index f7a849e24b4e7f911d336c30e52fb7b09ba62a26..12c3903f5ef978342f509e7a34e3d857e3320d2a 100644 (file)
@@ -60,9 +60,9 @@ BEGIN
     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
index 2cf0de137c78f83bbcea818d8c59b839712ffdff..c78ae41674aeff87080015048b5954eb57c4eb78 100644 (file)
@@ -2,76 +2,27 @@
 // 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
@@ -81,9 +32,9 @@
 #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
@@ -92,7 +43,7 @@
 #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
index b924c1f4c5dc43a7e7a4e04ffe800e42bc529bad..e66e755a74b0bbabf6e30458c568868d8da407b2 100644 (file)
@@ -1157,21 +1157,93 @@ khm_krb5_renew_ident(khm_handle identity)
     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
index bc77b26f05eaea6517be2e2357dd938d7fca9945..834d94296c9aa4b3a23d4e890d4e40557c4f3aab 100644 (file)
@@ -742,7 +742,7 @@ ui_cb(khui_new_creds * nc,
 }\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
@@ -801,6 +801,107 @@ k5_update_last_default_identity(khm_handle ident) {
     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
@@ -815,14 +916,7 @@ k5_ident_set_default(khm_int32 msg_type,
     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
@@ -840,112 +934,11 @@ k5_ident_set_default(khm_int32 msg_type,
             _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
@@ -1382,7 +1375,99 @@ k5_ident_init(khm_int32 msg_type,
             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
@@ -1450,10 +1535,10 @@ k5_msg_ident(khm_int32 msg_type,
                              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
index e328866a1c956fb2622b19a6d0192bb74560e0d7..7091104f0f36d277b8c5b487f78eae1421cb9b57 100644 (file)
@@ -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) $** $@
index a31daac5aba299860792134efdbb9376e8d04b4f..d72d1693e5d91a72b918578f629f848f7a32ed30 100644 (file)
@@ -1037,8 +1037,7 @@ cw_del_outline(khui_credwnd_outline *o) {
         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
@@ -1048,6 +1047,7 @@ cw_del_outline(khui_credwnd_outline *o) {
         LPOP(&(o->children), &c);\r
     }\r
 \r
+    ZeroMemory(o, sizeof(*o));\r
     PFREE(o);\r
 }\r
 \r
@@ -1420,8 +1420,8 @@ cw_update_outline(khui_credwnd_tbl * tbl)
             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
@@ -1576,11 +1576,13 @@ cw_update_outline(khui_credwnd_tbl * tbl)
             /* 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
@@ -1594,11 +1596,10 @@ cw_update_outline(khui_credwnd_tbl * tbl)
                     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
@@ -1629,7 +1630,8 @@ cw_update_outline(khui_credwnd_tbl * tbl)
         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
@@ -1704,7 +1706,7 @@ cw_update_outline(khui_credwnd_tbl * tbl)
             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
@@ -1725,6 +1727,7 @@ cw_update_outline(khui_credwnd_tbl * tbl)
             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
@@ -1782,27 +1785,32 @@ cw_update_outline(khui_credwnd_tbl * tbl)
                 /* 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
@@ -2367,6 +2375,7 @@ cw_draw_header(HDC hdc,
         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
@@ -2374,13 +2383,8 @@ cw_draw_header(HDC hdc,
     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
@@ -2404,6 +2408,8 @@ cw_draw_header(HDC hdc,
             }\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
@@ -2437,10 +2443,10 @@ cw_draw_header(HDC hdc,
 \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
@@ -3277,8 +3283,9 @@ cw_wm_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
             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
@@ -3316,7 +3323,7 @@ cw_wm_size(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
             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
@@ -3327,7 +3334,6 @@ cw_wm_notify(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {\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
@@ -3392,6 +3398,8 @@ cw_kmq_wm_dispatch(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         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
@@ -5475,7 +5483,7 @@ khm_create_credwnd(HWND parent) {
         (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
index 7e7e63cba79c9d15d5df2022e0040a5a8b4c8420..adecb9f072b9b23cf66bbbc292aba277f756dcba 100644 (file)
@@ -69,6 +69,8 @@ typedef struct khui_credwnd_outline_t {
 #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
@@ -84,6 +86,7 @@ typedef struct khui_credwnd_row_t {
 #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
@@ -220,15 +223,6 @@ typedef struct khui_credwnd_tbl_t {
 \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
diff --git a/src/windows/identity/ui/htmlwnd.h b/src/windows/identity/ui/htmlwnd.h
deleted file mode 100644 (file)
index e69de29..0000000
index afb68aa0296689fcb0468254e89732b5d9256f61..b7c0378668f44d815b877042d0c80c6af056047e 100644 (file)
@@ -94,7 +94,7 @@ htw_size_table[] = {
 \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
@@ -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);\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
@@ -671,7 +672,7 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     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
@@ -732,10 +733,15 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 \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
@@ -743,7 +749,7 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 \r
         p_width = 0;\r
 \r
-        while(*p) {\r
+        while(p && *p) {\r
             if(*p == L'<') {\r
                 int talign = -1;\r
                 int n;\r
@@ -766,7 +772,7 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                     align = talign;\r
             } else {\r
                 HFONT hfold;\r
-                RECT rd,rt;\r
+                RECT rd;\r
 \r
                 c = wcschr(p, L'<');\r
                 if(!c)\r
@@ -777,15 +783,13 @@ static LRESULT htw_paint(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
                 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
@@ -994,18 +998,39 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
 \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
@@ -1088,9 +1113,17 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
             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
@@ -1122,12 +1155,8 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
 \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
@@ -1180,13 +1209,15 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
 \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
@@ -1195,13 +1226,15 @@ LRESULT CALLBACK khui_htwnd_proc(HWND hwnd,
                 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
index 6b79307a29de798b1b93c32329c302a8ca273649..54beb2a12d702e5064967292aa2ee45b1d7eb9de 100644 (file)
@@ -60,6 +60,7 @@
 #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
index 285db67aa986b8be2ed0d8f0bc2073a87366f7c3..3ba3677c13b09d19b39347062501c0bd336b321c 100644 (file)
@@ -8,7 +8,6 @@
 // Generated from the TEXTINCLUDE 2 resource.\r
 //\r
 #include "afxres.h"\r
-\r
 /////////////////////////////////////////////////////////////////////////////\r
 #undef APSTUDIO_READONLY_SYMBOLS\r
 \r
@@ -34,13 +33,12 @@ END
 \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
@@ -588,7 +586,7 @@ BEGIN
     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
index e7d59eddb9471540e3bc07186904db44405cbe1a..3e3a94f673654b11feb521f3ae9f4aeb9fe5be11 100644 (file)
@@ -47,7 +47,12 @@ khm_startup_options khm_startup;
 \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
@@ -55,9 +60,11 @@ void khm_init_gui(void) {
     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
@@ -65,6 +72,11 @@ void khm_exit_gui(void) {
     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
index 38402a2750bc26470172611e3dd849e6cf77d0f0..159255f1cad594278399d1671c789621c203f7db 100644 (file)
@@ -93,6 +93,8 @@ khm_pre_shutdown(void) {
     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
@@ -1133,6 +1135,8 @@ khm_set_main_window_mode(int mode) {
         khc_close_space(csp_cw);\r
 \r
     }\r
+\r
+    khm_cred_refresh();\r
 }\r
 \r
 void \r
@@ -1207,6 +1211,10 @@ khm_show_main_window(void) {
     } 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
@@ -1296,6 +1304,8 @@ khm_hide_main_window(void) {
         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
index 4e4e5e116e957c56e68b9f824f426f8809cc79b6..d4d9a785c66f8f066333db4ab3e0b2c666be4236 100644 (file)
@@ -883,7 +883,12 @@ nc_update_credtext(khui_nc_wnd_data * d)
 \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
@@ -1581,6 +1586,8 @@ nc_handle_wm_create(HWND hwnd,
     /* 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
@@ -1678,6 +1685,8 @@ nc_handle_wm_destroy(HWND hwnd,
     /* 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
index 31df1fe7e48614f5e5cd140b047fd6b03bd2179b..7be9a84bef985363adadee4a44a57f2511ad6ab1 100644 (file)
@@ -3,14 +3,12 @@
 // 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
@@ -57,7 +51,6 @@
 #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
@@ -71,7 +64,6 @@
 #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
@@ -82,7 +74,6 @@
 #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
diff --git a/src/windows/identity/ui/taskbar.c b/src/windows/identity/ui/taskbar.c
new file mode 100644 (file)
index 0000000..48a575f
--- /dev/null
@@ -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<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
+    }
+}
diff --git a/src/windows/identity/ui/taskbar.h b/src/windows/identity/ui/taskbar.h
new file mode 100644 (file)
index 0000000..32adf5c
--- /dev/null
@@ -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
index a0295d39eec4cdc8b8b052dd31e885a472116118..ae017e1d0a220b3ad59685208cd854527f1f84bd 100644 (file)
@@ -1490,12 +1490,8 @@ khui_context_refresh(void) {
 \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