Version=2\r
AppVersion=0.1.1.0\r
Date=Nov 01, 2005\r
-# Beta 1 release of NetIDMgr\r
+# Alpha 1 release of NetIDMgr, along with KFW 3.0.0 beta\r
\r
#----------------------------------------------------------------\r
Version=3\r
AppVersion=0.1.2.0\r
Date=Nov 30, 2005\r
-# Beta 2 release\r
+# Alpha 2 release of NetIDMgr, along with KFW 3.0.0 beta 2\r
\r
+Version=4\r
+AppVersion=1.0.0.0\r
+Date=Dec 05, 2005\r
# This file will be included by all the makefiles\r
# in the build tree.\r
#\r
-# Copyright (c) 2004 Massachusetts Institute of Technology\r
+# Copyright (c) 2004,2005 Massachusetts Institute of Technology\r
#\r
# Permission is hereby granted, free of charge, to any person\r
# obtaining a copy of this software and associated documentation files\r
# SPECIAL : Special build. Typically one with non-mainline patches.\r
\r
# Version info\r
-NETIDMGR_VERSION_MAJOR=0\r
-NETIDMGR_VERSION_MINOR=1\r
-NETIDMGR_VERSION_PATCH=3\r
+NETIDMGR_VERSION_MAJOR=1\r
+NETIDMGR_VERSION_MINOR=0\r
+NETIDMGR_VERSION_PATCH=0\r
NETIDMGR_VERSION_AUX=0\r
-NETIDMGR_RELEASEDESC=Beta 3\r
+NETIDMGR_RELEASEDESC=\r
\r
# The API version. This number must be incremented each time the API\r
# changes. Plugins specify the version of the API that they were\r
#\r
# Changes to the API version numbers should be documented in\r
# apiversion.txt at the root of the source tree.\r
-NETIDMGR_VERSION_API=3\r
+NETIDMGR_VERSION_API=4\r
\r
NETIDMGR_VERSION=$(NETIDMGR_VERSION_MAJOR).$(NETIDMGR_VERSION_MINOR).$(NETIDMGR_VERSION_PATCH).$(NETIDMGR_VERSION_AUX)\r
NETIDMGR_VERSIONC=$(NETIDMGR_VERSION_MAJOR),$(NETIDMGR_VERSION_MINOR),$(NETIDMGR_VERSION_PATCH),$(NETIDMGR_VERSION_AUX)\r
\r
# The default release type is PRIVATE is no other type is specified\r
!if ("$(KH_RELEASE)" != "OFFICIAL") && ("$(KH_RELEASE)" != "PRERELEASE") && ("$(KH_RELEASE)" != "PRIVATE") && ("$(KH_RELEASE)" != "SPECIAL")\r
-KH_RELEASE=PRERELEASE\r
+KH_RELEASE=PRIVATE\r
!endif\r
\r
# Actual build environment settings\r
<p>\r
Network Identity Manager was conceived as an identity management\r
solution to make up for the shortcomings of Leash32 (distributed with\r
-MIT Kerberos for Windows) and AFSCREDS (distributed with OpenAFS).\r
+MIT Kerberos for Windows) and AFSCreds (distributed with OpenAFS).\r
</p>\r
\r
<p>\r
</p>\r
\r
<p>\r
-A presentation given about Khimaira at the <a\r
+Khimaira was presented at the <a\r
href="http://www.pmw.org/afsbpw05/">AFS and Kerberos Best Practices\r
-Workshop 2005</a> can be found on the workshop website and <a\r
+Workshop 2005</a>. The slides can be found on the workshop website and <a\r
href="http://web.mit.edu/asanka/www/misc.shtml">here</a>.\r
</p>\r
\r
<p>\r
-The work on Khimaira was funded by <a\r
+The work on Network Identity Manager was supported by <a\r
href="http://web.mit.edu">MIT</a> <a\r
href="http://web.mit.edu/ist/">Information Services and\r
-Technology</a>.\r
+Technology</a>, <a href="http://www.jpl.nasa.gov">NASA Jet Propulsion Laboratory</a>,\r
+and <a href="http://www.secure-endpoints.com">Secure Endpoints Inc.</a>.\r
</p>\r
\r
<h3>Design</h3>\r
<html>\r
<head>\r
- <title>title</title>\r
- <meta name="description" content="">\r
- <meta name="keywords" content="">\r
+ <title>Change Password</title>\r
+ <meta name="description" content="change password">\r
+ <meta name="keywords" content="change password dialog">\r
<link rel="stylesheet" type="text/css" href="nidmgr.css">\r
</head>\r
<body>\r
\r
+<h1>Change Password</h1>\r
+\r
+<p>The change password dialog can be invoked from the <a\r
+href="menu_credential.htm">Credentials</a> menu. This is used to\r
+change the password for the primary credentials provider (currently\r
+Kerberos 5).\r
+</p>\r
+\r
+<p>For the default identity provider (Kerberos 5), there are two input\r
+boxes to specify the identity for which the password is to be changed.\r
+The identity uniquely maps to the Kerberos principal of the same name.\r
+Then the current password must be entered along with the new password\r
+twice.\r
+</p>\r
+\r
+<p>Note that currently, when the password for an identity is being\r
+changed, only the associated Kerberos 5 password is changed.\r
+</p>\r
+\r
</body>\r
</html>
\ No newline at end of file
<html>\r
<head>\r
- <title>title</title>\r
- <meta name="description" content="">\r
- <meta name="keywords" content="">\r
+ <title>Destroy Credentials</title>\r
+ <meta name="description" content="Destroy Credentials">\r
+ <meta name="keywords" content="destroy credentials">\r
<link rel="stylesheet" type="text/css" href="nidmgr.css">\r
</head>\r
<body>\r
\r
+<h1>Destroy Credentials</h1>\r
+\r
+<p>This action will attempt to destroy the credentials that are\r
+currently selected in the credentials window. How the credentials are\r
+destroyed is up to each credentials provider.\r
+</p>\r
+\r
+<p>In some cases, you may need to select all the credentials of a\r
+specific type for the delete operation to succeed. This happens when\r
+the credentials provider does not support deleting individual\r
+credentials, but supports deleting all the credentials stored in one\r
+specific location.\r
+</p>\r
+\r
+<p>The action can be invoked by selecting the credentials and then\r
+pressing the <span class="pre">Delete</span> key or by pressing <span\r
+class="pre">Ctrl + D</span>. You can also select the <span\r
+class="pre">Delete credentials</span> action from the context menu\r
+(available via right-clicking inside the credentials window) or the\r
+credentials menu.\r
+</p>\r
+\r
</body>\r
</html>
\ No newline at end of file
<html>\r
<head>\r
- <title>title</title>\r
- <meta name="description" content="">\r
- <meta name="keywords" content="">\r
+ <title>Import Credentials</title>\r
+ <meta name="description" content="Import Credentials">\r
+ <meta name="keywords" content="Import Credentials">\r
<link rel="stylesheet" type="text/css" href="nidmgr.css">\r
</head>\r
<body>\r
\r
+<h1>Import Credentials</h1>\r
+\r
+<p>Allows you to import credentials from the Windows LSA credentials\r
+cache into any of the caches under the control of any credentials\r
+provider. Currently, the only credentials provider that supports\r
+importing is Kerberos 5.\r
+</p>\r
+\r
+<p>This action can be invoked via the <a\r
+href="menu_credential.htm">Credentials</a> menu or by pressing <span\r
+class="pre">Ctrl + I</span>. In addition, the Kerberos 5\r
+configuration pane accessible via the <a\r
+href="menu_options.htm">Options</a> menu provides an options that\r
+control how the importing of credentials happen.\r
+</p>\r
+\r
</body>\r
</html>
\ No newline at end of file
<html>\r
<head>\r
- <title>title</title>\r
- <meta name="description" content="">\r
- <meta name="keywords" content="">\r
+ <title>New Credentials</title>\r
+ <meta name="description" content="obtain new credentials">\r
+ <meta name="keywords" content="new creds">\r
<link rel="stylesheet" type="text/css" href="nidmgr.css">\r
</head>\r
<body>\r
\r
+<h1>New Credentials</h1>\r
+\r
+<p>The new credentials dialog can be invoked from the <a\r
+href="menu_credential.htm">Credentials</a> menu, by typing <span\r
+class="pre">Ctrl + N</span>, using the context menu in the credentials\r
+window or using the context menu in the NetIDMgr icon in the system\r
+notification area.\r
+</p>\r
+\r
+<p>Once invoked, you will be presented with a dialog similar to the\r
+following:\r
+</p>\r
+\r
+<p>\r
+<img src="images/screen_new_creds.bmp" alt="New credentials dialog"/>\r
+<p class="caption">New credentials dialog with a valid identity\r
+selected.</p> <p class="caption"><i>Note that the above screenshot is\r
+from an instance of NetIDMgr with Kerberos 5, Kerberos 4 and OpenAFS\r
+plugins with a Kerberos 5 identity manager. Actual display may be\r
+different depending on the plugins that are active.</i></p>\r
+</p>\r
+\r
+<p>If the Kerberos 5 identity provider is used, the dialog will ask\r
+for a username and a realm to determine the identity for which new\r
+credentials will be obtained for. Depending on the selected identity,\r
+you may be required to provide a password or other form of\r
+authentication for new credentials to be obtained.\r
+</p>\r
+\r
+<p>Below the prompts is the credentials summary window. This window\r
+provides an overview of the credentals that will be obtained when the\r
+dialog is completed.\r
+</p>\r
+\r
+<h3>Expanded view</h3>\r
+\r
+<p>If you click any of the hyperlinks in the credentials summary\r
+window or select the <span class="pre">Options >></span> button,\r
+the dialog will switch to the exanded view. An example of this is\r
+shown below:\r
+</p>\r
+\r
+<p>\r
+<img src="images/screen_new_creds_exp.bmp"\r
+alt="Expanded new credentials window" />\r
+\r
+<p class="caption">Expanded view of the new credetials dialog</p>\r
+</p>\r
+\r
+<p>\r
+The expanded view provides access to additional options available for\r
+each credential provider. For example, the Kerberos 5 credentials\r
+provider allows you to set the lifetime of the obtained Kerberos\r
+ticket as well as ticket flags such as <i>renewable</i> or\r
+<i>forwardable</i>.\r
+</p>\r
+\r
+<h3>Credentials summary window</h3>\r
+\r
+<p>\r
+The credentials summary window provides an overview of the credentials\r
+that will be obtained after the successful completion of the new\r
+credentials dialog. The window contains hyperlinks that will take you\r
+to the corresponding credentials option panels where you will be able\r
+to set additional options for each type.\r
+</p>\r
+\r
+<p>\r
+If there is a problem with the selected identity, the credentials\r
+window will display a message describing the problem. For example:\r
+</p>\r
+\r
+<p>\r
+<img src="images/screen_new_creds_err01.bmp" alt="Credentials summary window showing an invalid identity" />\r
+</p>\r
+\r
+<p>\r
+The above is an example of what you would see if the provided identity\r
+is invalid. Once the identity provider (in this case, Kerberos 5)\r
+indicates that the identity is invalid, it will be displayed as above\r
+along with a brief description of why the identity was found to be\r
+invalid. Here, the Kerberos 5 identity provider is reporting that the\r
+specified principal does not exist in the Kerberos database.\r
+</p>\r
+\r
+<h3>Additional notes</h3>\r
+\r
+<p>\r
+The new credentials dialog can be invoked from the command line using\r
+the <span class="pre"> -i </span> or <span class="pre"> --kinit\r
+</span> command line option. Additionally, if you specify the <span\r
+class="pre"> -a </span> or <span class="pre"> --autoinit </span>\r
+command line option, the new credentials dialog will be displayed if\r
+there are no credentials available.\r
+</p>\r
+\r
+<p>\r
+Setting the <span class="pre">Prompt for new credentials if there\r
+aren't any at startup</span> option is set in the <span\r
+class="pre">General</span> configuration panel, then the behavior is\r
+similar to the <span class="pre">--autoinit</span> option.\r
+</p>\r
+\r
</body>\r
</html>
\ No newline at end of file
<p><a href="mailto:kerberos@MIT.EDU" class="mail">kerberos@MIT.EDU</a>\r
is a mailing list set up for discussing Kerberos issues. It is\r
gatewayed to the Usenet newsgroup 'comp.protocols.kerberos'. If you\r
-prefer to read it via mail, send a request to kerberos-request@MIT.EDU\r
-to get added or subscribe via the web page:</p>\r
+prefer to read it via mail, send a subscription request to \r
+<a href="mailto:kerberos-request@MIT.EDU" class="mail">kerberos-request@MIT.EDU</a>\r
+or subscribe via the web page:</p>\r
\r
<p> <a href="http://mailman.mit.edu/mailman/listinfo/kerberos"\r
class="external">\r
completeness. It is bad enough that it is the last menu on the menu\r
bar. We didn't want to pile on any more disrespect by not documenting\r
it. We encourage you to not read this and just go ahead and click any\r
-item on this menu. It is guaranteed that nothing bad will happen.\r
-This is not a generalization that would extend to, say, the <a\r
-href="menu_credential.htm">Credentials</a> menu. If anything bad\r
-happens, please file a bug report at <a\r
-href="mailto:kfw-bugs@mit.edu">kfw-bugs@mit.edu</a>.\r
+item on this menu. If anything unexpected happens, please file a bug \r
+report at <a href="mailto:kfw-bugs@mit.edu">kfw-bugs@mit.edu</a>.\r
</p>\r
\r
<p>\r
<li><a name="notifs" /><span class="title">Notifications ...</span>:\r
Opens the Notifications control panel.</li>\r
\r
+<li><a name="plugins" /><span class="title">Plugins ...</span>:\r
+Opens the Plug-ins and Modules control panel.</li>\r
+\r
</ul>\r
\r
</body>\r
\r
<ul>\r
\r
-<li><a name="choosecol" /> <span class="title">Choolse Columns\r
-...</span>: Invokes a dialog where you can choose which columns are\r
+<li><a name="choosecol" /> <span class="title">Choose Columns\r
+...</span>: <b>Not implemented in this release.</b>\r
+Invokes a dialog where you can choose which columns are\r
displayed in the view window. If you change the columns, or their\r
order, a new custom layout will be created for you which you can later\r
use using the <span class="pre">Layout</span> submenu later.</li>\r
where the credentials will be grouped by identity and by\r
credentials type, in that order.</li>\r
\r
- <li><span class="title">By Type</span>: A predefined layout\r
+ <li><span class="title">By Type</span>: <b>Not implemented in\r
+ this release.</b> A predefined layout\r
where the credentials are grouped by credentials type</li>\r
\r
<li><span class="title">By Location</span>: A predefined layout\r
href="concept_cred_pro.htm">credential providers</a> choose the\r
interpretation of the <span class="pre">location</span> property\r
as the concept of location changes from type to type.</li>\r
-\r
- <li><span class="title">Custom</span>: The custom layout. If\r
- you customize the layout by adding, removing or reordering the\r
- columns, then NetIDMgr will create a new custom layout using the\r
- customizations. You can choose this option to revisit that layout</li>\r
-\r
</ul>\r
</li>\r
\r
\r
SPAN.title {\r
font-weight: bold;\r
-}
\ No newline at end of file
+}\r
+\r
<p>\r
Once you open the NetIDMgr window, you will be presented with a view\r
of your existing credentials, or a message notifying you that you\r
-don't have any. The credentials view should be fairly self\r
-explanatory, but if there's any doubt, more information <a\r
+don't have any. Details of the credentials view objects <a\r
href="wnd_main.htm">can be found here.</a>\r
</p>\r
\r
\r
<p>\r
The Network Identity Manager (or NetIDMgr for short) allows you to\r
-manage your credentials (Kerberos tickets, AFS tokens, etc.) on a per\r
-identity basis.\r
+manage your network identities and the associated credentials \r
+(Kerberos tickets, AFS tokens, etc.).\r
</p>\r
\r
<p>\r
<p>\r
This version is distributed as a part of the MIT Kerberos for Windows\r
product along with the Kerberos 5 and Kerberos 4 plugins. The OpenAFS\r
-plugin, which is required for supporting OpenAFS tokens, is\r
+plugin, which is required for supporting AFS tokens, is\r
distributed separately.\r
</p>\r
\r
#define IDH_ACTION_OPT_KHIM 2012\r
#define IDH_ACTION_OPT_INIT 2013\r
#define IDH_ACTION_OPT_NOTIF 2014\r
+\r
+#define IDH_NC_CREDWND 3000\r
+#define IDH_NC_OK 3001\r
+#define IDH_NC_CANCEL 3002\r
+#define IDH_NC_HELP 3003\r
+#define IDH_NC_TABBUTTON 3004\r
+#define IDH_NC_OPTIONS 3005\r
+#define IDH_NC_TABMAIN 3006\r
+#define IDH_NC_SETDEF 3007\r
\r
\r
[ALIAS]\r
+IDH_ACTION_NEW_ID=html\act_new_creds.htm\r
+IDH_ACTION_PASSWD_ID=html\act_chpw.htm\r
IDH_WELCOME=html\welcome.htm\r
\r
[MAP]\r
[TEXT POPUPS]\r
khhelp.h\r
popups_newcreds.txt\r
+popups_password.txt\r
\r
[INFOTYPES]\r
Category:Concepts\r
-foo \r
+.topic IDH_NC_TABMAIN\r
+Opens the identity selection panel.\r
+\r
+.topic IDH_NC_TABBUTTON\r
+Opens the option panel for this credentials type.\r
+\r
+.topic IDH_NC_OK\r
+Obtains new credentials using the information that you provided.\r
+\r
+.topic IDH_NC_CANCEL\r
+Cancels the new credentials operation.\r
+\r
+.topic IDH_NC_HELP\r
+Provides help for this dialog box.\r
+\r
+.topic IDH_NC_OPTIONS\r
+Expands the dialog and allows you to set additional\r
+options for the credentials that will be obtained\r
+by this dialog.\r
+\r
+.topic IDH_NC_CREDWND\r
+Provides an overview of the credentials that will be obtained\r
+after the successful completion of the new credentials dialog.\r
+Clicking on the hyperlinks will take you to the corresponding\r
+credentials option panels where you will be able to set\r
+additional options for each type.\r
+\r
+.topic IDH_NC_SETDEF\r
+If checked, once the credentials acquisition operation completes, the\r
+identity will be set as the default.\r
\r
#define KMSG_ACT_BEGIN_CMDLINE 128\r
\r
+#define KMSG_ACT_CONTINUE_CMDLINE 129\r
+\r
/*@}*/\r
\r
/*! \defgroup kmq_msg_cred KMSG_CRED subtypes\r
RegCloseKey(s->regkey_user);\r
s->regkey_machine = NULL;\r
s->regkey_user = NULL;\r
+\r
+ if (s->flags &\r
+ (KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U)) {\r
+ khcint_remove_space(s, s->flags);\r
+ }\r
}\r
\r
LeaveCriticalSection(&cs_conf_global);\r
wchar_t sk_name[KCONF_MAXCCH_NAME];\r
FILETIME ft;\r
size_t cch;\r
- HKEY hkp;\r
+ HKEY hkp = NULL;\r
const wchar_t * t;\r
LONG rv = ERROR_SUCCESS;\r
\r
LONG hr;\r
size_t cbsize;\r
wchar_t * value = NULL;\r
- int free_space;\r
+ int free_space = 0;\r
khm_handle conf = NULL;\r
\r
\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
LONG hr;\r
wchar_t * value = NULL;\r
- int free_space;\r
+ int free_space = 0;\r
khm_handle conf = NULL;\r
\r
\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
LONG hr;\r
wchar_t * value = NULL;\r
- int free_space;\r
+ int free_space = 0;\r
khm_handle conf = NULL;\r
\r
\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
LONG hr;\r
wchar_t * value = NULL;\r
- int free_space;\r
+ int free_space = 0;\r
khm_handle conf = NULL;\r
\r
\r
return rv;\r
}\r
\r
+khm_int32\r
+khcint_remove_space(kconf_conf_space * c, khm_int32 flags) {\r
+ kconf_conf_space * cc;\r
+ kconf_conf_space * cn;\r
+\r
+ /* TODO: if this is the last child space and the parent is marked\r
+ for deletion, delete the parent as well. */\r
+\r
+ cc = TFIRSTCHILD(c);\r
+ while (cc) {\r
+ cn = LNEXT(cc);\r
+\r
+ khcint_remove_space(cc, flags);\r
+\r
+ cc = cn;\r
+ }\r
+\r
+ cc = TFIRSTCHILD(c);\r
+ if (!cc) {\r
+ kconf_conf_space * p;\r
+\r
+ if (c->refcount) {\r
+ c->flags |= (flags &\r
+ (KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U));\r
+ } else {\r
+ p = TPARENT(c);\r
+ \r
+ TDELCHILD(p, c);\r
+\r
+ if (c->regpath) {\r
+ if (flags & KCONF_SPACE_FLAG_DELETE_U)\r
+ RegDeleteKey(HKEY_CURRENT_USER,\r
+ c->regpath);\r
+ if (flags & KCONF_SPACE_FLAG_DELETE_M)\r
+ RegDeleteKey(HKEY_LOCAL_MACHINE,\r
+ c->regpath);\r
+ }\r
+\r
+ khcint_free_space(c);\r
+ }\r
+ } else {\r
+ c->flags |= (flags &\r
+ (KCONF_SPACE_FLAG_DELETE_M |\r
+ KCONF_SPACE_FLAG_DELETE_U));\r
+ }\r
+\r
+ return KHM_ERROR_SUCCESS;\r
+}\r
+\r
KHMEXP khm_int32 KHMAPI\r
khc_remove_space(khm_handle conf) {\r
- /* TODO: implement this */\r
-\r
/*\r
- mark this space as well as all child spaces as\r
'delete-on-close' using flags. Mark should indicate which\r
space has any children left. If there are none, check if the\r
parent space is also marked for deletion.\r
*/\r
- assert(FALSE);\r
+ HKEY hku = NULL;\r
+ HKEY hkm = NULL;\r
+ kconf_conf_space * c;\r
+ khm_int32 rv = KHM_ERROR_SUCCESS;\r
+ khm_int32 flags = 0;\r
+\r
+ if(!khc_is_config_running())\r
+ return KHM_ERROR_NOT_READY;\r
+\r
+ if(!khc_is_handle(conf))\r
+ return KHM_ERROR_INVALID_PARAM;\r
+\r
+ c = khc_space_from_handle(conf);\r
+\r
+ EnterCriticalSection(&cs_conf_global);\r
\r
- return 0;\r
+ if (khc_is_machine_handle(conf))\r
+ flags |= KCONF_SPACE_FLAG_DELETE_M;\r
+ if (khc_is_user_handle(conf))\r
+ flags |= KCONF_SPACE_FLAG_DELETE_U;\r
+\r
+ rv = khcint_remove_space(c, flags);\r
+\r
+ LeaveCriticalSection(&cs_conf_global);\r
+\r
+ return rv;\r
}\r
\r
khm_boolean \r
khm_handle prev,\r
khm_handle * next);\r
\r
+/*! \brief Remove a configuration space\r
+\r
+ The configuration space will be marked for removal. Once all the\r
+ handles for the space have been released, it will be deleted. The\r
+ configuration stores that will be affected are the write enabled\r
+ configuration stores for the handle.\r
+ */\r
+KHMEXP khm_int32 KHMAPI\r
+khc_remove_space(khm_handle conf);\r
/*@}*/\r
\r
#endif\r
} kconf_conf_space;\r
\r
//#define KCONF_SPACE_FLAG_SCHEMA 0x00000020\r
-#define KCONF_SPACE_FLAG_DELETED 0x00000040\r
+#define KCONF_SPACE_FLAG_DELETE_U 0x00000040\r
+#define KCONF_SPACE_FLAG_DELETE_M 0x00000080\r
\r
typedef struct kconf_conf_handle_t {\r
khm_int32 magic;\r
\r
#define khc_is_config_running() (conf_init && conf_status)\r
\r
-#define CONFIG_REGPATHW L"SOFTWARE\\MIT\\NetIDMgr"\r
+#define CONFIG_REGPATHW L"Software\\MIT\\NetIDMgr"\r
\r
void init_kconf(void);\r
void exit_kconf(void);\r
HKEY\r
khcint_space_open_key(kconf_conf_space * s, khm_int32 flags);\r
\r
+khm_int32\r
+khcint_remove_space(kconf_conf_space * c, khm_int32 flags);\r
+\r
#endif\r
\r
case KCDB_ATTR_TIMELEFT:\r
{\r
- /* we are going to make liberal use of __int64 here. It\r
- is equivalent to FILETIME and also the MSDN docs say we\r
- should use it if the compiler supports it */\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
- unsigned __int64 ftc;\r
- SYSTEMTIME st;\r
\r
- if(!buf || *pcb_buf < sizeof(__int64)) {\r
- *pcb_buf = sizeof(__int64);\r
+ if(!buf || *pcb_buf < sizeof(FILETIME)) {\r
+ *pcb_buf = sizeof(FILETIME);\r
rv = KHM_ERROR_TOO_LONG;\r
} else if(!kcdb_cred_buf_exist(c,KCDB_ATTR_EXPIRE)) {\r
- *pcb_buf = sizeof(__int64);\r
+ *pcb_buf = sizeof(FILETIME);\r
/* setting the timeleft to _I64_MAX has the\r
interpretation that this credential does not\r
expire, which is the default behavior if the\r
expiration time is not known */\r
- *((__int64 *) buf) = _I64_MAX;\r
+ *((FILETIME *) buf) = IntToFt(_I64_MAX);\r
} else {\r
- GetSystemTime(&st);\r
- SystemTimeToFileTime(&st, (LPFILETIME) &ftc);\r
- *((__int64 *) buf) =\r
- *((__int64 *) kcdb_cred_buf_get(c,KCDB_ATTR_EXPIRE)) - ftc;\r
+ FILETIME ftc;\r
+ khm_int64 iftc;\r
+\r
+ GetSystemTimeAsFileTime(&ftc);\r
+ iftc = FtToInt(&ftc);\r
+\r
+ *((FILETIME *) buf) =\r
+ IntToFt(FtToInt((FILETIME *) \r
+ kcdb_cred_buf_get(c,KCDB_ATTR_EXPIRE))\r
+ - iftc);\r
+ *pcb_buf = sizeof(FILETIME);\r
}\r
\r
return rv;\r
\r
case KCDB_ATTR_RENEW_TIMELEFT:\r
{\r
- /* we are going to make liberal use of __int64 here. It\r
- is equivalent to FILETIME and also the MSDN docs say we\r
- should use it if the compiler supports it */\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
- unsigned __int64 ftc;\r
- SYSTEMTIME st;\r
\r
- if(!buf || *pcb_buf < sizeof(__int64)) {\r
- *pcb_buf = sizeof(__int64);\r
+ if(!buf || *pcb_buf < sizeof(FILETIME)) {\r
+ *pcb_buf = sizeof(FILETIME);\r
rv = KHM_ERROR_TOO_LONG;\r
} else if(!kcdb_cred_buf_exist(c,KCDB_ATTR_RENEW_EXPIRE)) {\r
- *pcb_buf = sizeof(__int64);\r
+ *pcb_buf = sizeof(FILETIME);\r
/* setting the timeleft to _I64_MAX has the\r
interpretation that this credential does not\r
expire, which is the default behavior if the\r
expiration time is not known */\r
- *((__int64 *) buf) = _I64_MAX;\r
+ *((FILETIME *) buf) = IntToFt(_I64_MAX);\r
} else {\r
- GetSystemTime(&st);\r
- SystemTimeToFileTime(&st, (LPFILETIME) &ftc);\r
- *((__int64 *) buf) =\r
- *((__int64 *) kcdb_cred_buf_get(c,KCDB_ATTR_RENEW_EXPIRE)) - ftc;\r
+ FILETIME ftc;\r
+\r
+ GetSystemTimeAsFileTime(&ftc);\r
+\r
+ *((FILETIME *) buf) =\r
+ IntToFt(FtToInt(((FILETIME *)\r
+ kcdb_cred_buf_get(c,KCDB_ATTR_RENEW_EXPIRE))\r
+ - FtToInt(&ftc)));\r
+ *pcb_buf = sizeof(FILETIME);\r
}\r
\r
return rv;\r
{\r
kcdb_attrib_i * ai;\r
size_t cb_size = 0;\r
- khm_boolean prop;\r
+ khm_boolean prop = FALSE;\r
\r
if(!cbsize)\r
return KHM_ERROR_INVALID_PARAM;\r
prop = FALSE;\r
else if(id >= KCDB_ATTR_MIN_PROP_ID && id <= KCDB_ATTR_MAX_PROP_ID)\r
prop = TRUE;\r
+ else \r
+ return KHM_ERROR_INVALID_PARAM;\r
\r
if(prop)\r
ai = kcdb_property_tbl[id - KCDB_ATTR_MIN_PROP_ID];\r
code = KHM_ERROR_NOT_FOUND;\r
}\r
\r
-_exit:\r
+ _exit:\r
kcdb_cred_unlock_read();\r
-_exit_nolock:\r
+ _exit_nolock:\r
if(type)\r
kcdb_type_release_info(type);\r
if(attrib)\r
if (!(f & KCDB_CRED_FLAG_EXPIRED) && \r
kcdb_cred_buf_exist(cred, KCDB_ATTR_EXPIRE)) {\r
\r
- khm_int64 ftc;\r
+ FILETIME ftc;\r
\r
- GetSystemTimeAsFileTime((LPFILETIME) &ftc);\r
- if (ftc > *((khm_int64 *) \r
- kcdb_cred_buf_get(cred, KCDB_ATTR_EXPIRE)))\r
+ GetSystemTimeAsFileTime(&ftc);\r
+ if (CompareFileTime(&ftc, ((FILETIME *) \r
+ kcdb_cred_buf_get(cred, KCDB_ATTR_EXPIRE)))\r
+ >= 0)\r
f |= KCDB_CRED_FLAG_EXPIRED;\r
}\r
\r
if (!(f & KCDB_CRED_FLAG_INVALID)) {\r
if (f & KCDB_CRED_FLAG_RENEWABLE) {\r
if (kcdb_cred_buf_exist(cred, KCDB_ATTR_RENEW_EXPIRE)) {\r
- khm_int64 ftc;\r
+ FILETIME ftc;\r
\r
- GetSystemTimeAsFileTime((LPFILETIME) &ftc);\r
- if (ftc > *((khm_int64 *) kcdb_cred_buf_get(cred, KCDB_ATTR_RENEW_EXPIRE)))\r
+ GetSystemTimeAsFileTime(&ftc);\r
+ if (CompareFileTime(&ftc, ((FILETIME *)\r
+ kcdb_cred_buf_get(cred, KCDB_ATTR_RENEW_EXPIRE))) >= 0)\r
f |= KCDB_CRED_FLAG_INVALID;\r
}\r
} else {\r
(((nclist - (KCDB_CREDSET_INITIAL_SIZE + 1)) / KCDB_CREDSET_GROWTH_FACTOR) + 1) *\r
KCDB_CREDSET_GROWTH_FACTOR;\r
\r
- new_clist = calloc(nclist, sizeof(kcdb_credset_credref));\r
+ new_clist = PCALLOC(nclist, sizeof(kcdb_credset_credref));\r
\r
memcpy(new_clist, cs->clist, cs->nclist * sizeof(kcdb_credset_credref));\r
\r
khm_int32 rv = KHM_ERROR_SUCCESS;\r
int i;\r
\r
- if((credset && !kcdb_credset_is_credset(credset)) ||\r
- (!f || !cred))\r
+ if((credset && !kcdb_credset_is_credset(credset)) || !f)\r
return KHM_ERROR_INVALID_PARAM;\r
\r
if(credset)\r
cs->flags &= ~KCDB_CREDSET_FLAG_ENUM;\r
\r
if(i < cs->nclist) {\r
- *cred = (khm_handle) cs->clist[i].cred;\r
- kcdb_cred_hold(*cred);\r
- if(idx)\r
+ if (cred) {\r
+ *cred = (khm_handle) cs->clist[i].cred;\r
+ kcdb_cred_hold(*cred);\r
+ }\r
+\r
+ if(idx) {\r
*idx = i;\r
+ }\r
} else {\r
rv = KHM_ERROR_NOT_FOUND;\r
}\r
kcdb_identity_create(const wchar_t *name, \r
khm_int32 flags, \r
khm_handle * result) {\r
- kcdb_identity * id;\r
- kcdb_identity * id_tmp;\r
+ kcdb_identity * id = NULL;\r
+ kcdb_identity * id_tmp = NULL;\r
size_t namesize;\r
\r
if(!result || !name)\r
void * buffer,\r
khm_size cbbuf)\r
{\r
- kcdb_identity * id;\r
- kcdb_attrib * attrib;\r
- kcdb_type * type;\r
+ kcdb_identity * id = NULL;\r
+ kcdb_attrib * attrib = NULL;\r
+ kcdb_type * type = NULL;\r
khm_size slot;\r
khm_size cbdest;\r
khm_int32 code = KHM_ERROR_SUCCESS;\r
KHMEXP long KHMAPI \r
FtCompare(LPFILETIME pft1, LPFILETIME pft2);\r
\r
+/*! \brief Convert a FILETIME to a 64 bit int\r
+*/\r
+KHMEXP khm_int64 KHMAPI FtToInt(LPFILETIME pft);\r
+\r
+/*! \brief Convert a 64 bit int to a FILETIME\r
+*/\r
+KHMEXP FILETIME KHMAPI IntToFt(khm_int64 i);\r
+\r
+/*! \brief Calculate the difference between two FILETIMEs\r
+\r
+ Returns the value of ft1 - ft2\r
+ */\r
+KHMEXP FILETIME KHMAPI FtSub(LPFILETIME ft1, LPFILETIME ft2);\r
+\r
+/*! \brief Calculate the sum of two FILETIMEs\r
+\r
+ Return the value of ft1 + ft2\r
+ */\r
+KHMEXP FILETIME KHMAPI FtAdd(LPFILETIME ft1, LPFILETIME ft2);\r
+\r
/*! \brief Convert a FILETIME inverval to a string\r
*/\r
KHMEXP khm_int32 KHMAPI \r
STRINGTABLE \r
BEGIN\r
IDS_CREDDB "Khimaira Credentials Database"\r
- IDS_NAME "Name"\r
+ IDS_NAME "Service Name"\r
IDS_IDENTITY "Identity"\r
IDS_ISSUED "Issued on"\r
IDS_EXPIRES "Expires on"\r
- IDS_TIMELEFT "Time left"\r
+ IDS_TIMELEFT "Time Remaining"\r
IDS_LOCATION "Location"\r
IDS_PARENT "Parent"\r
IDS_TYPE "Type"\r
\r
STRINGTABLE \r
BEGIN\r
- IDS_IVl_W_SPEC "w,wk,wks,weeks"\r
+ 128 "w,wk,wks,weeks"\r
IDS_FLAGS "Flags"\r
IDS_RENEW_TIMELEFT "Renewable Time left"\r
IDS_RENEW_EXPIRES "Renewable time expires"\r
//{{NO_DEPENDENCIES}}\r
// Microsoft Visual C++ generated include file.\r
-// Used by D:\work\khimaira\src\kcreddb\lang\en_us\kcredres.rc\r
+// Used by D:\work\pismere\athena\auth\krb5\src\windows\identity\kcreddb\lang\en_us\kcredres.rc\r
//\r
#define IDS_CREDDB 101\r
#define IDS_NAME 102\r
#define IDS_IVL_D_SPEC 127\r
#define IDS_IVl_W_SPEC 128\r
#define IDS_IVL_W_SPEC 128\r
-#define IDS_IVl_W_SPEC 128\r
#define IDS_FLAGS 129\r
#define IDS_RENEW_TIMELEFT 130\r
#define IDS_RENEW_EXPIRES 131\r
/* returns the number of milliseconds that must elapse away from the\r
interval specified in pft for the representation of pft to change\r
from whatever it is right now */\r
-KHMEXP long KHMAPI FtIntervalMsToRepChange(LPFILETIME pft)\r
+KHMEXP long KHMAPI \r
+FtIntervalMsToRepChange(LPFILETIME pft)\r
{\r
__int64 ms,s,m,h,d;\r
+ __int64 ift;\r
long l;\r
\r
- ms = *((__int64 *) pft) / 10000i64;\r
+ ift = FtToInt(pft);\r
+ ms = ift / 10000i64;\r
\r
- if(ms < 0 || *((__int64 *) pft) == _I64_MAX)\r
+ if(ms < 0 || ift == _I64_MAX)\r
return -1;\r
\r
s = ms / 1000i64;\r
h = s / 3600;\r
d = s / (3600*24);\r
\r
- if(d > 0) {\r
+ if (d > 0) {\r
/* rep change at next hour change */\r
l = (long) (ms % (3600*1000i64));\r
- } else if(h > 0) {\r
+ } else if (h > 0) {\r
+ /* rep change at next minute change */\r
+ l = (long) (ms % (60*1000i64));\r
+ } else if (m > 5) {\r
/* rep change at next minute change */\r
l = (long) (ms % (60*1000i64));\r
} else {\r
+ /* rep change at next second change */\r
l = (long) (ms % 1000);\r
}\r
\r
return l;\r
}\r
\r
-KHMEXP khm_int32 KHMAPI FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)\r
+KHMEXP khm_int32 KHMAPI \r
+FtIntervalToString(LPFILETIME data, wchar_t * buffer, khm_size * cb_buf)\r
{\r
size_t cbsize;\r
__int64 s,m,h,d;\r
+ __int64 ift;\r
wchar_t ibuf[256];\r
wchar_t fbuf[256];\r
wchar_t * t;\r
\r
if(!cb_buf)\r
return KHM_ERROR_INVALID_PARAM;\r
- s = *((__int64 *) data) / 10000000i64;\r
+\r
+ ift = FtToInt(data);\r
+ s = ift / 10000000i64;\r
\r
m = s / 60;\r
h = s / 3600;\r
d = s / (3600*24);\r
\r
- if(*((__int64 *) data) == _I64_MAX) {\r
+ if(ift == _I64_MAX) {\r
LoadString(hinst_kcreddb, IDS_IVL_UNKNOWN, ibuf, sizeof(ibuf)/sizeof(wchar_t));\r
} else if(s < 0) {\r
LoadString(hinst_kcreddb, IDS_IVL_EXPIRED, ibuf, sizeof(ibuf)/sizeof(wchar_t));\r
StringCbPrintf(t, sizeof(ibuf) - wcslen(ibuf)*sizeof(wchar_t), fbuf, h);\r
}\r
}\r
- } else if(h > 0) {\r
+ } else if(h > 0 || m > 5) {\r
m = (s - (h * 3600)) / 60;\r
if(h == 1) {\r
LoadString(hinst_kcreddb, IDS_IVL_1H, ibuf, ARRAYLENGTH(ibuf));\r
- } else {\r
+ } else if (h > 1) {\r
LoadString(hinst_kcreddb, IDS_IVL_H, fbuf, ARRAYLENGTH(fbuf));\r
StringCbPrintf(ibuf, sizeof(ibuf), fbuf, h);\r
+ } else {\r
+ *ibuf = L'\0';\r
}\r
- if(m > 0) {\r
- StringCbCat(ibuf, sizeof(ibuf), L" ");\r
+\r
+ if(m > 0 || h == 0) {\r
+ if (h >= 1)\r
+ StringCbCat(ibuf, sizeof(ibuf), L" ");\r
+\r
t = ibuf + wcslen(ibuf);\r
if(m == 1)\r
{\r
return KHM_ERROR_SUCCESS;\r
}\r
\r
-khm_int32 KHMAPI kcdb_type_interval_toString(\r
- const void * data, \r
- khm_size cbd, \r
- wchar_t * buffer, \r
- khm_size * cb_buf, \r
- khm_int32 flags)\r
+khm_int32 KHMAPI \r
+kcdb_type_interval_toString(const void * data, \r
+ khm_size cbd, \r
+ wchar_t * buffer, \r
+ khm_size * cb_buf, \r
+ khm_int32 flags)\r
{\r
return FtIntervalToString((LPFILETIME) data, buffer, cb_buf);\r
}\r
{\r
__int64 i1, i2;\r
\r
- i1 = *((__int64 *) d1);\r
- i2 = *((__int64 *) d2);\r
+ i1 = FtToInt((FILETIME *) d1);\r
+ i2 = FtToInt((FILETIME *) d2);\r
\r
if(i1 < i2)\r
return -1;\r
void * d_dst,\r
khm_size * cbd_dst)\r
{\r
- if(d_dst && *cbd_dst >= sizeof(__int64)) {\r
- *cbd_dst = sizeof(__int64);\r
- *((__int64 *) d_dst) = *((__int64 *) d_src);\r
+ if(d_dst && *cbd_dst >= sizeof(FILETIME)) {\r
+ *cbd_dst = sizeof(FILETIME);\r
+ *((FILETIME *) d_dst) = *((FILETIME *) d_src);\r
return KHM_ERROR_SUCCESS;\r
} else {\r
- *cbd_dst = sizeof(__int64);\r
+ *cbd_dst = sizeof(FILETIME);\r
return KHM_ERROR_TOO_LONG;\r
}\r
}\r
type.toString = kcdb_type_interval_toString;\r
type.name = KCDB_TYPENAME_INTERVAL;\r
type.id = KCDB_TYPE_INTERVAL;\r
- type.cb_max = sizeof(__int64);\r
- type.cb_min = sizeof(__int64);\r
+ type.cb_max = sizeof(FILETIME);\r
+ type.cb_min = sizeof(FILETIME);\r
type.flags = KCDB_TYPE_FLAG_CB_FIXED;\r
\r
kcdb_type_register(&type, NULL);\r
\r
KHMEXP void KHMAPI TimetToFileTime( time_t t, LPFILETIME pft )\r
{\r
- LONGLONG ll = Int32x32To64(t, 10000000) + 116444736000000000i64;\r
+ LONGLONG ll;\r
+\r
+ if ( sizeof(time_t) == 4 )\r
+ ll = Int32x32To64(t, 10000000) + 116444736000000000i64;\r
+ else {\r
+ ll = t * 10000000i64 + 116444736000000000i64;\r
+ }\r
pft->dwLowDateTime = (DWORD) ll;\r
pft->dwHighDateTime = (DWORD) (ll >> 32);\r
}\r
\r
KHMEXP void KHMAPI TimetToFileTimeInterval(time_t t, LPFILETIME pft)\r
{\r
- LONGLONG ll = Int32x32To64(t, 10000000);\r
+ LONGLONG ll;\r
+ \r
+ if ( sizeof(time_t) == 4 )\r
+ ll = Int32x32To64(t, 10000000);\r
+ else {\r
+ ll = t * 10000000i64;\r
+ }\r
pft->dwLowDateTime = (DWORD) ll;\r
pft->dwHighDateTime = (DWORD) (ll >> 32);\r
}\r
\r
KHMEXP long KHMAPI FtIntervalToSeconds(LPFILETIME pft)\r
{\r
- __int64 i = *((__int64 *) pft);\r
+ __int64 i = FtToInt(pft);\r
return (long) (i / 10000000i64);\r
}\r
\r
KHMEXP long KHMAPI FtIntervalToMilliseconds(LPFILETIME pft)\r
{\r
- __int64 i = *((__int64 *) pft);\r
+ __int64 i = FtToInt(pft);\r
return (long) (i / 10000i64);\r
}\r
\r
-KHMEXP long KHMAPI FtCompare(LPFILETIME pft1, LPFILETIME pft2) {\r
- __int64 i1 = *((__int64 *) pft1);\r
- __int64 i2 = *((__int64 *) pft2);\r
+KHMEXP khm_int64 KHMAPI FtToInt(LPFILETIME pft) {\r
+ LARGE_INTEGER ll;\r
+ ll.LowPart = pft->dwLowDateTime;\r
+ ll.HighPart = pft->dwHighDateTime;\r
+ return ll.QuadPart;\r
+}\r
\r
- if (i1 < i2)\r
- return -1;\r
- if (i1 == i2)\r
- return 0;\r
- return 1;\r
+KHMEXP FILETIME KHMAPI IntToFt(khm_int64 i) {\r
+ LARGE_INTEGER ll;\r
+ FILETIME ft;\r
+\r
+ ll.QuadPart = i;\r
+ ft.dwLowDateTime = ll.LowPart;\r
+ ft.dwHighDateTime = ll.HighPart;\r
+\r
+ return ft;\r
+}\r
+\r
+KHMEXP FILETIME KHMAPI FtSub(LPFILETIME ft1, LPFILETIME ft2) {\r
+ FILETIME d;\r
+ LARGE_INTEGER l1, l2;\r
+\r
+ l1.LowPart = ft1->dwLowDateTime;\r
+ l1.HighPart = ft1->dwHighDateTime;\r
+ l2.LowPart = ft2->dwLowDateTime;\r
+ l2.HighPart = ft2->dwHighDateTime;\r
+\r
+ l1.QuadPart -= l2.QuadPart;\r
+\r
+ d.dwLowDateTime = l1.LowPart;\r
+ d.dwHighDateTime = l1.HighPart;\r
+\r
+ return d;\r
+}\r
+\r
+KHMEXP FILETIME KHMAPI FtAdd(LPFILETIME ft1, LPFILETIME ft2) {\r
+ FILETIME d;\r
+ LARGE_INTEGER l1, l2;\r
+\r
+ l1.LowPart = ft1->dwLowDateTime;\r
+ l1.HighPart = ft1->dwHighDateTime;\r
+ l2.LowPart = ft2->dwLowDateTime;\r
+ l2.HighPart = ft2->dwHighDateTime;\r
+\r
+ l1.QuadPart += l2.QuadPart;\r
+\r
+ d.dwLowDateTime = l1.LowPart;\r
+ d.dwHighDateTime = l1.HighPart;\r
+\r
+ return d;\r
}\r
\r
KHMEXP int KHMAPI AnsiStrToUnicode( wchar_t * wstr, size_t cbwstr, const char * astr)\r
{\r
size_t cb;\r
wchar_t * b;\r
- __int64 *pr, t;\r
+ __int64 t;\r
\r
- pr = (__int64 *) pft;\r
- *pr = 0;\r
+ *pft = IntToFt(0);\r
\r
/* ideally we should synchronize this, but it doesn't hurt if two\r
threads do this at the same time, because we only set the ivspecs_loaded\r
b = e;\r
}\r
\r
- *pr = t;\r
+ *pft = IntToFt(t);\r
\r
return KHM_ERROR_SUCCESS;\r
}\r
\r
#include<kherrinternal.h>\r
#include<assert.h>\r
-#ifdef Debug\r
#include<stdarg.h>\r
-#endif\r
\r
CRITICAL_SECTION cs_error;\r
DWORD tls_error = 0;\r
LeaveCriticalSection(&cs_error);\r
}\r
\r
+KHMEXP kherr_event * __cdecl\r
+kherr_reportf(const wchar_t * long_desc_fmt, ...) {\r
+ va_list vl;\r
+ wchar_t buf[1024];\r
+ kherr_event * e;\r
+\r
+ va_start(vl, long_desc_fmt);\r
+ StringCbVPrintf(buf, sizeof(buf), long_desc_fmt, vl);\r
+#ifdef DEBUG\r
+ OutputDebugString(buf);\r
+#endif\r
+ va_end(vl);\r
+\r
+ e = kherr_report(KHERR_DEBUG_1,\r
+ NULL, NULL, NULL, buf, NULL, 0,\r
+ KHERR_SUGGEST_NONE, 0, 0, 0, 0, KHERR_RF_CSTR_LONG_DESC\r
+#ifdef _WIN32\r
+ ,NULL\r
+#endif\r
+ );\r
+ if (e) {\r
+ kherr_evaluate_event(e);\r
+ }\r
+\r
+ return e;\r
+}\r
+\r
+KHMEXP kherr_event * __cdecl\r
+kherr_reportf_ex(enum kherr_severity severity,\r
+ const wchar_t * facility,\r
+ khm_int32 facility_id,\r
+#ifdef _WIN32\r
+ HMODULE hModule,\r
+#endif\r
+ const wchar_t * long_desc_fmt, ...) {\r
+ va_list vl;\r
+ wchar_t buf[1024];\r
+ kherr_event * e;\r
+\r
+ va_start(vl, long_desc_fmt);\r
+ StringCbVPrintf(buf, sizeof(buf), long_desc_fmt, vl);\r
+#ifdef DEBUG\r
+ OutputDebugString(buf);\r
+#endif\r
+ va_end(vl);\r
+\r
+ e = kherr_report(severity, NULL, facility, NULL, buf, NULL, facility_id,\r
+ KHERR_SUGGEST_NONE, 0, 0, 0, 0, KHERR_RF_CSTR_LONG_DESC\r
+#ifdef _WIN32\r
+ ,hModule\r
+#endif\r
+ );\r
+ if (e) {\r
+ kherr_evaluate_event(e);\r
+ }\r
+\r
+ return e;\r
+}\r
+\r
KHMEXP kherr_event * KHMAPI \r
kherr_report(enum kherr_severity severity,\r
const wchar_t * short_desc,\r
#endif\r
);\r
\r
+/*! \brief Report a formatted message\r
+\r
+ The format string \a long_desc_fmt should be a string constant and\r
+ the format specifiers follow that of \a sprintf. This creates an\r
+ event with the long description set to the expansion of the format\r
+ string against the arguments.\r
+ */\r
+KHMEXP kherr_event * __cdecl\r
+kherr_reportf_ex(enum kherr_severity severity,\r
+ const wchar_t * facility,\r
+ khm_int32 facility_id,\r
+#ifdef _WIN32\r
+ HMODULE hModule,\r
+#endif\r
+ const wchar_t * long_desc_fmt,\r
+ ...);\r
+\r
+/*! \brief Report a formatted message\r
+\r
+ The format string \a long_desc_fmt should be a string constant and\r
+ the format specifiers follow that of \a sprintf. This creates an\r
+ event with the long description set to the expansion of the format\r
+ string against the arguments.\r
+ */\r
+KHMEXP kherr_event * __cdecl\r
+kherr_reportf(const wchar_t * long_desc_fmt,\r
+ ...);\r
+\r
/*! \brief Create a parameter out of a transient string\r
\r
A parameter is created by duplicating the string that is passed\r
}\r
\r
void\r
-kmmint_add_to_plugin_queue(void) {\r
- InterlockedIncrement(&pending_plugins);\r
+kmmint_add_to_plugin_queue(kmm_plugin_i * plugin) {\r
+ EnterCriticalSection(&cs_kmm);\r
+ if (!(plugin->flags & KMM_PLUGIN_FLAG_IN_QUEUE)) {\r
+ InterlockedIncrement(&pending_plugins);\r
+ plugin->flags |= KMM_PLUGIN_FLAG_IN_QUEUE;\r
+ }\r
+ LeaveCriticalSection(&cs_kmm);\r
}\r
\r
void\r
-kmmint_remove_from_plugin_queue(void) {\r
- InterlockedDecrement(&pending_plugins);\r
+kmmint_remove_from_plugin_queue(kmm_plugin_i * plugin) {\r
+ EnterCriticalSection(&cs_kmm);\r
\r
+ if (plugin->flags & KMM_PLUGIN_FLAG_IN_QUEUE) {\r
+ InterlockedDecrement(&pending_plugins);\r
+ plugin->flags &= ~KMM_PLUGIN_FLAG_IN_QUEUE;\r
+ }\r
+\r
+ LeaveCriticalSection(&cs_kmm);\r
kmmint_check_completion();\r
}\r
\r
\r
/* if it fails to initialize, we exit the plugin */\r
if(KHM_FAILED(rv)) {\r
- kmmint_remove_from_plugin_queue();\r
+ kmmint_remove_from_plugin_queue(p);\r
rv = 1;\r
goto _exit;\r
}\r
pd->n_unresolved--;\r
\r
if(pd->n_unresolved == 0) {\r
+ kmmint_add_to_plugin_queue(pd);\r
kmm_hold_plugin(kmm_handle_from_plugin(pd));\r
kmq_post_message(KMSG_KMM, KMSG_KMM_I_REG, KMM_REG_INIT_PLUGIN, (void *) pd);\r
}\r
} while(FALSE);\r
LeaveCriticalSection(&cs_kmm);\r
\r
- kmmint_remove_from_plugin_queue();\r
+ kmmint_remove_from_plugin_queue(p);\r
\r
/* main message loop */\r
while(KHM_SUCCEEDED(kmq_dispatch(INFINITE)));\r
goto _exit_post;\r
}\r
\r
- kmmint_add_to_plugin_queue();\r
+ kmmint_add_to_plugin_queue(p);\r
\r
p->ht_thread = CreateThread(NULL,\r
0,\r
if(KHM_SUCCEEDED(khc_read_int32(csp_mod, L"FailureCount", &i))) {\r
khm_int64 tm;\r
khm_int64 ct;\r
+ FILETIME fct;\r
khm_int32 last_reason = 0;\r
\r
/* reset the failure count if the failure count reset time\r
period has elapsed */\r
tm = 0;\r
khc_read_int64(csp_mod, L"FailureTime", &tm);\r
- GetSystemTimeAsFileTime((LPFILETIME) &ct);\r
- ct -= tm;\r
+ GetSystemTimeAsFileTime(&fct);\r
+\r
+ ct = (FtToInt(&fct) - tm) / 10000000i64;\r
\r
if(tm > 0 && \r
- FtIntervalToSeconds((LPFILETIME) &ct) > fail_reset_time) {\r
+ ct > fail_reset_time) {\r
i = 0;\r
khc_write_int32(csp_mod, L"FailureCount", 0);\r
khc_write_int64(csp_mod, L"FailureTime", 0);\r
_exit:\r
if(csp_mod) {\r
if(record_failure) {\r
- khm_int64 ct;\r
+ FILETIME fct;\r
\r
i = 0;\r
khc_read_int32(csp_mod, L"FailureCount", &i);\r
khc_write_int32(csp_mod, L"FailureCount", i);\r
\r
if(i==1) { /* first fault */\r
- GetSystemTimeAsFileTime((LPFILETIME) &ct);\r
- khc_write_int64(csp_mod, L"FailureTime", ct);\r
+ GetSystemTimeAsFileTime(&fct);\r
+ khc_write_int64(csp_mod, L"FailureTime", FtToInt(&fct));\r
}\r
\r
khc_write_int32(csp_mod, L"FailureReason", m->state);\r
/* the plugin is in the module's plugin list */\r
#define KMM_PLUGIN_FLAG_IN_MODLIST 4\r
\r
+#define KMM_PLUGIN_FLAG_IN_QUEUE 0x10\r
+\r
enum kmm_registrar_uparam_t {\r
KMM_REG_INIT_MODULE,\r
KMM_REG_EXIT_MODULE,\r
\r
clean::\r
$(RM) $(INCFILES)\r
+ $(RM) $(OBJFILES)\r
\r
{}.c{$(LIBDIR)}.obj:\r
$(C2OBJ)\r
EnableWindow(GetDlgItem(d->hwnd, IDC_NCK4_K524), FALSE);\r
}\r
\r
- CheckRadioButton(d->hwnd, IDC_NCK4_AUTO, IDC_NCK4_K524,\r
+ CheckRadioButton(d->hwnd, IDC_NCK4_AUTO, IDC_NCK4_PWD,\r
method_to_id[d->method]);\r
+\r
+ khui_cw_enable_type(d->nc, credtype_id_krb4, d->k4_enabled);\r
}\r
\r
void k4_update_data(k4_dlg_data * d) {\r
}\r
}\r
\r
+khm_boolean k4_should_identity_get_k4(khm_handle ident) {\r
+ khm_int32 idflags = 0;\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
+\r
+ khm_handle defident = NULL;\r
+\r
+ if (KHM_SUCCEEDED(kcdb_identity_get_default(&defident))) {\r
+ kcdb_identity_release(defident);\r
+\r
+ return FALSE;\r
+ }\r
+ }\r
+\r
+ return TRUE;\r
+}\r
+\r
void k4_read_identity_data(k4_dlg_data * d) {\r
khm_handle csp_ident = NULL;\r
khm_handle csp_k4 = NULL;\r
}\r
\r
khc_close_space(csp_ident);\r
-\r
- kcdb_identity_get_flags(d->nc->identities[0], &idflags);\r
}\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
-\r
- khm_handle defident = NULL;\r
-\r
- if (KHM_SUCCEEDED(kcdb_identity_get_default(&defident))) {\r
- kcdb_identity_release(defident);\r
-\r
- d->k4_enabled = FALSE;\r
- }\r
+ if (d->k4_enabled) {\r
+ d->k4_enabled = k4_should_identity_get_k4(d->nc->identities[0]);\r
}\r
} else {\r
d->k4_enabled = FALSE;\r
\r
nc = (khui_new_creds *) vparam;\r
\r
+ if (!nc->ctx.identity)\r
+ break;\r
+\r
+ if (!k4_should_identity_get_k4(nc->ctx.identity))\r
+ break;\r
+\r
nct = PMALLOC(sizeof(*nct));\r
#ifdef DEBUG\r
assert(nct);\r
BS_AUTOCHECKBOX | WS_TABSTOP,7,26,97,10\r
CONTROL "Automatically determine method",IDC_NCK4_AUTO,"Button",\r
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,58,119,10\r
- CONTROL "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON | \r
- WS_TABSTOP,23,75,47,10\r
CONTROL "Kerberos 5 to 4 translation",IDC_NCK4_K524,"Button",\r
- BS_AUTORADIOBUTTON | WS_TABSTOP,23,92,101,10\r
+ BS_AUTORADIOBUTTON | WS_TABSTOP,23,76,101,10\r
+ CONTROL "Password",IDC_NCK4_PWD,"Button",BS_AUTORADIOBUTTON | \r
+ WS_TABSTOP,23,94,47,10\r
GROUPBOX "Obtain Kerberos 4 tickets using",IDC_STATIC,7,43,286,72,\r
WS_GROUP\r
END\r
case kadm_err_base:\r
break;\r
default:\r
+ if (code == KRB5KRB_AP_ERR_BAD_INTEGRITY) {\r
+ *suggestion = MSG_ERR_S_INTEGRITY;\r
+ }\r
*suggest_code = KHERR_SUGGEST_RETRY;\r
AnsiStrToUnicode(buf, cbbuf, com_err_msg);\r
return;\r
\r
wchar_t config_file[MAX_PATH]; /* path to configuration file */\r
khm_boolean create_config_file; /* create config_file if missing? */\r
+ khm_boolean inc_realms; /* include full realm list in new\r
+ credentials dialog? */\r
\r
/* [libdefaults] */\r
khm_boolean dns_lookup_kdc;\r
khm_int32 flags;\r
} k5_config_data;\r
\r
-#define K5_CDFLAG_MOD_DEF_REALM 1\r
-#define K5_CDFLAG_MOD_CONF_FILE 2\r
-#define K5_CDFLAG_MOD_DNS_LOOKUP_KDC 4\r
-#define K5_CDFLAG_MOD_DNS_LOOKUP_RLM 8\r
-#define K5_CDFLAG_MOD_DNS_FALLBACK 0x10\r
-#define K5_CDFLAG_MOD_NOADDRESSES 0x20\r
-#define K5_CDFLAG_MOD_LSA_IMPORT 0x40\r
-#define K5_CDFLAG_MOD_CREATE_CONF 0x80\r
-#define K5_CDFLAG_MOD_REALMS 0x1000\r
+#define K5_CDFLAG_MOD_DEF_REALM 0x00000001\r
+#define K5_CDFLAG_MOD_CONF_FILE 0x00000002\r
+#define K5_CDFLAG_MOD_DNS_LOOKUP_KDC 0x00000004\r
+#define K5_CDFLAG_MOD_DNS_LOOKUP_RLM 0x00000008\r
+#define K5_CDFLAG_MOD_DNS_FALLBACK 0x00000010\r
+#define K5_CDFLAG_MOD_NOADDRESSES 0x00000020\r
+#define K5_CDFLAG_MOD_LSA_IMPORT 0x00000040\r
+#define K5_CDFLAG_MOD_CREATE_CONF 0x00000080\r
+#define K5_CDFLAG_MOD_INC_REALMS 0x00000100\r
+#define K5_CDFLAG_MOD_REALMS 0x00001000\r
\r
static const char *const conf_yes[] = {\r
"y", "yes", "true", "t", "1", "on",\r
pprofile_release(profile);\r
}\r
\r
- /* last, read the MSLSA import setting */\r
{\r
khm_int32 t;\r
\r
+ /* last, read the MSLSA import setting */\r
if (KHM_SUCCEEDED(khc_read_int32(csp_params,\r
L"MsLsaImport", &t))) {\r
d->lsa_import = t;\r
} else {\r
d->lsa_import = K5_LSAIMPORT_ALWAYS;\r
}\r
+\r
+ if (KHM_SUCCEEDED(khc_read_int32(csp_params,\r
+ L"UseFullRealmList", &t))) {\r
+ d->inc_realms = !!t;\r
+ } else {\r
+ d->inc_realms = TRUE;\r
+ }\r
}\r
\r
d->flags = 0;\r
\r
/* write the MSLSA import setting */\r
if (d->flags & K5_CDFLAG_MOD_LSA_IMPORT) {\r
-\r
khc_write_int32(csp_params, L"MsLsaImport", d->lsa_import);\r
+ }\r
\r
+ if (d->flags & K5_CDFLAG_MOD_INC_REALMS) {\r
+ khc_write_int32(csp_params, L"UseFullRealmList", d->inc_realms);\r
}\r
\r
if (!(d->flags & \r
\r
d->node_main = (khui_config_node) lParam;\r
\r
+ CheckDlgButton(hwnd, IDC_CFG_INCREALMS,\r
+ (d->inc_realms)? BST_CHECKED: BST_UNCHECKED);\r
+\r
hw = GetDlgItem(hwnd, IDC_CFG_DEFREALM);\r
#ifdef DEBUG\r
assert(hw);\r
KHUI_CNFLAG_MODIFIED);\r
return TRUE;\r
}\r
+\r
+ if (wParam == MAKEWPARAM(IDC_CFG_INCREALMS, BN_CLICKED)) {\r
+ if (IsDlgButtonChecked(hwnd, IDC_CFG_INCREALMS) ==\r
+ BST_CHECKED) {\r
+ d->inc_realms = TRUE;\r
+ } else {\r
+ d->inc_realms = FALSE;\r
+ }\r
+ d->flags |= K5_CDFLAG_MOD_INC_REALMS;\r
+\r
+ khui_cfg_set_flags(d->node_main,\r
+ KHUI_CNFLAG_MODIFIED,\r
+ KHUI_CNFLAG_MODIFIED);\r
+ return TRUE;\r
+ }\r
}\r
break;\r
\r
khm_handle csp_idroot = NULL;\r
\r
cb = sizeof(idname);\r
- khui_cfg_get_name(d->cfg.ctx_node, idname, &cb);\r
+ rv = khui_cfg_get_name(d->cfg.ctx_node, idname, &cb);\r
+#ifdef DEBUG\r
+ assert(KHM_SUCCEEDED(rv));\r
+#endif\r
\r
rv = kcdb_identity_create(idname, 0, &d->ident);\r
#ifdef DEBUG\r
\r
cb = sizeof(d->ccache);\r
rv = khc_read_string(csp_ident, L"DefaultCCName", d->ccache, &cb);\r
- if (KHM_FAILED(rv))\r
- ZeroMemory(d->ccache, sizeof(d->ccache));\r
+ if (KHM_FAILED(rv) || cb <= sizeof(wchar_t)) {\r
+ cb = sizeof(d->ccache);\r
+ if (KHM_FAILED(kcdb_identity_get_attr(d->ident, attr_id_krb5_ccname,\r
+ NULL, d->ccache, &cb)))\r
+ ZeroMemory(d->ccache, sizeof(d->ccache));\r
+ }\r
\r
khui_tracker_initialize(&d->tc_life);\r
d->tc_life.current = d->life;\r
khm_handle ident = NULL;\r
khm_handle cred = NULL;\r
time_t tt;\r
- khm_int64 ft, eft;\r
+ FILETIME ft, eft;\r
khm_int32 ti;\r
\r
\r
KRBv5Credentials.times.starttime = KRBv5Credentials.times.authtime;\r
\r
tt = KRBv5Credentials.times.starttime;\r
- TimetToFileTime(tt, (LPFILETIME) &ft);\r
+ TimetToFileTime(tt, &ft);\r
kcdb_cred_set_attr(cred, KCDB_ATTR_ISSUE, &ft, sizeof(ft));\r
\r
tt = KRBv5Credentials.times.endtime;\r
- TimetToFileTime(tt, (LPFILETIME) &eft);\r
+ TimetToFileTime(tt, &eft);\r
kcdb_cred_set_attr(cred, KCDB_ATTR_EXPIRE, &eft, sizeof(eft));\r
\r
- eft -= ft;\r
- kcdb_cred_set_attr(cred, KCDB_ATTR_LIFETIME, &eft, sizeof(eft));\r
+ {\r
+ FILETIME ftl;\r
+\r
+ ftl = FtSub(&eft, &ft);\r
+ kcdb_cred_set_attr(cred, KCDB_ATTR_LIFETIME, &ftl, sizeof(ftl));\r
+ }\r
\r
if (KRBv5Credentials.times.renew_till > 0) {\r
+ FILETIME ftl;\r
+\r
tt = KRBv5Credentials.times.renew_till;\r
- TimetToFileTime(tt, (LPFILETIME) &eft);\r
+ TimetToFileTime(tt, &eft);\r
kcdb_cred_set_attr(cred, KCDB_ATTR_RENEW_EXPIRE, &eft, \r
sizeof(eft));\r
\r
- eft -= ft;\r
- kcdb_cred_set_attr(cred, KCDB_ATTR_RENEW_LIFETIME, &eft, \r
- sizeof(eft));\r
+\r
+ ftl = FtSub(&eft, &ft);\r
+ kcdb_cred_set_attr(cred, KCDB_ATTR_RENEW_LIFETIME, &ftl, \r
+ sizeof(ftl));\r
}\r
\r
ti = KRBv5Credentials.ticket_flags;\r
int n = 0;\r
while ( KRBv5Credentials.addresses[n] )\r
n++;\r
- list->addrList = calloc(1, n * sizeof(char *));\r
+ list->addrList = PCALLOC(1, n * sizeof(char *));\r
if (!list->addrList) {\r
MessageBox(NULL, "Memory Error", "Error", MB_OK);\r
return ENOMEM; \r
list->addrCount = n;\r
for ( n=0; n<list->addrCount; n++ ) {\r
wsprintf(Buffer, "Address: %s", one_addr(KRBv5Credentials.addresses[n]));\r
- list->addrList[n] = (char*) calloc(1, strlen(Buffer)+1);\r
+ list->addrList[n] = (char*) PCALLOC(1, strlen(Buffer)+1);\r
if (!list->addrList[n])\r
{\r
MessageBox(NULL, "Memory Error", "Error", MB_OK);\r
#endif\r
\r
if(cred_flags & KCDB_CRED_FLAG_INITIAL) {\r
- __int64 t_issue_new;\r
- __int64 t_expire_old;\r
- __int64 t_expire_new;\r
+ FILETIME ft_issue_new;\r
+ FILETIME ft_expire_old;\r
+ FILETIME ft_expire_new;\r
khm_size cb;\r
\r
/* an initial ticket! If we find one, we generally set\r
the current primary credential. */\r
\r
tt = KRBv5Credentials.times.endtime;\r
- TimetToFileTime(tt, (LPFILETIME) &t_expire_new);\r
+ TimetToFileTime(tt, &ft_expire_new);\r
\r
tt = KRBv5Credentials.times.starttime;\r
- TimetToFileTime(tt, (LPFILETIME) &t_issue_new);\r
+ TimetToFileTime(tt, &ft_issue_new);\r
\r
- cb = sizeof(t_expire_old);\r
+ cb = sizeof(ft_expire_old);\r
if(KHM_FAILED(kcdb_identity_get_attr(tident, \r
KCDB_ATTR_EXPIRE, \r
- NULL, &t_expire_old, \r
+ NULL, &ft_expire_old, \r
&cb))\r
- || t_expire_new > t_expire_old)\r
- {\r
+ || CompareFileTime(&ft_expire_new, &ft_expire_old) > 0) {\r
+\r
kcdb_identity_set_attr(tident, attr_id_krb5_ccname, \r
wcc_name, KCDB_CBSIZE_AUTO);\r
kcdb_identity_set_attr(tident, KCDB_ATTR_EXPIRE, \r
- &t_expire_new, \r
- sizeof(t_expire_new));\r
+ &ft_expire_new, \r
+ sizeof(ft_expire_new));\r
kcdb_identity_set_attr(tident, KCDB_ATTR_ISSUE,\r
- &t_issue_new,\r
- sizeof(t_issue_new));\r
+ &ft_issue_new,\r
+ sizeof(ft_issue_new));\r
\r
if (KRBv5Credentials.times.renew_till > 0) {\r
tt = KRBv5Credentials.times.renew_till;\r
- TimetToFileTime(tt, (LPFILETIME) &ft);\r
+ TimetToFileTime(tt, &ft);\r
kcdb_identity_set_attr(tident, \r
KCDB_ATTR_RENEW_EXPIRE, \r
&ft, sizeof(ft));\r
char *princ_name = NULL;\r
BOOL rc = FALSE;\r
\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Begin : khm_krb5_ms2mit. save_cred=%d\n", (int) save_creds);\r
-#endif\r
+ kherr_reportf(L"Begin : khm_krb5_ms2mit. save_cred=%d\n", (int) save_creds);\r
+\r
if ( !pkrb5_init_context )\r
goto cleanup;\r
\r
if (code = pkrb5_init_context(&kcontext))\r
goto cleanup;\r
\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Resolving MSLSA\n");\r
-#endif\r
+ kherr_reportf(L"Resolving MSLSA\n");\r
+\r
if (code = pkrb5_cc_resolve(kcontext, "MSLSA:", &mslsa_ccache))\r
goto cleanup;\r
\r
if ( save_creds ) {\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Getting principal\n");\r
-#endif\r
- if (code = pkrb5_cc_get_principal(kcontext, mslsa_ccache, &princ))\r
+ kherr_reportf(L"Getting principal\n");\r
+ if (code = pkrb5_cc_get_principal(kcontext, mslsa_ccache, &princ))\r
goto cleanup;\r
\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Unparsing name\n");\r
-#endif\r
- if (code = pkrb5_unparse_name(kcontext, princ, &princ_name))\r
+ kherr_reportf(L"Unparsing name\n");\r
+ if (code = pkrb5_unparse_name(kcontext, princ, &princ_name))\r
goto cleanup;\r
\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Unparsed [%S]. Resolving target cache\n", princ_name);\r
-#endif\r
+ kherr_reportf(L"Unparsed [%S]. Resolving target cache\n", princ_name);\r
/* TODO: actually look up the preferred ccache name */\r
if (code = pkrb5_cc_resolve(kcontext, princ_name, &ccache)) {\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Cannot resolve cache [%S] with code=%d. Trying default.\n", princ_name, code);\r
-#endif\r
+ kherr_reportf(L"Cannot resolve cache [%S] with code=%d. Trying default.\n", princ_name, code);\r
\r
if (code = pkrb5_cc_default(kcontext, &ccache)) {\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Failed to resolve default ccache. Code=%d", code);\r
-#endif\r
+ kherr_reportf(L"Failed to resolve default ccache. Code=%d", code);\r
goto cleanup;\r
}\r
}\r
\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Initializing ccache\n");\r
-#endif\r
+ kherr_reportf(L"Initializing ccache\n");\r
if (code = pkrb5_cc_initialize(kcontext, ccache, princ))\r
goto cleanup;\r
\r
-#ifdef DEBUG\r
- kherr_debug_printf(L"Copying credentials\n");\r
-#endif\r
+ kherr_reportf(L"Copying credentials\n");\r
if (code = pkrb5_cc_copy_creds(kcontext, mslsa_ccache, ccache))\r
goto cleanup;\r
\r
}\r
\r
cleanup:\r
-#ifdef DEBUG\r
- kherr_debug_printf(L" Received code=%d", code);\r
-#endif\r
+ kherr_reportf(L" Received code=%d", code);\r
\r
if (princ_name)\r
pkrb5_free_unparsed_name(kcontext, princ_name);\r
0,\r
(LPARAM) t);\r
}\r
+ _done_adding_lru:\r
+\r
+ {\r
+ khm_int32 inc_realms = 0;\r
+\r
+ if (KHM_FAILED(khc_read_int32(csp_params,\r
+ L"UseFullRealmList",\r
+ &inc_realms)) ||\r
+ !inc_realms)\r
+ goto _done_adding_all_realms;\r
+ }\r
+\r
+ if(ms)\r
+ PFREE(ms);\r
+\r
+ ms = khm_krb5_get_realm_list();\r
+ if(ms) {\r
+ for (t = ms; t && *t; t = multi_string_next(t)) {\r
+ lr = SendMessage(d->hw_realm,\r
+ CB_FINDSTRINGEXACT,\r
+ (WPARAM) -1,\r
+ (LPARAM) t);\r
+ if (lr != CB_ERR)\r
+ continue;\r
+\r
+ SendMessage(d->hw_realm,\r
+ CB_ADDSTRING,\r
+ 0,\r
+ (LPARAM) t);\r
+ }\r
+ }\r
+ _done_adding_all_realms:\r
\r
- _done_adding_lru:\r
/* set the current selection of the realms list */\r
if (defrealm) {\r
SendMessage(d->hw_realm,\r
return KHM_ERROR_SUCCESS;\r
}\r
\r
-\r
-static khm_int32\r
-k5_ident_init(khm_int32 msg_type,\r
- khm_int32 msg_subtype,\r
- khm_ui_4 uparam,\r
- void * vparam) {\r
+static khm_boolean\r
+k5_refresh_default_identity(krb5_context ctx) {\r
/* just like notify_create, except now we set the default identity\r
based on what we find in the configuration */\r
krb5_ccache cc = NULL;\r
khm_handle ident = NULL;\r
khm_boolean found_default = FALSE;\r
\r
- assert(k5_identpro_ctx != NULL);\r
+ assert(ctx != NULL);\r
\r
- code = pkrb5_cc_default(k5_identpro_ctx, &cc);\r
+ code = pkrb5_cc_default(ctx, &cc);\r
if (code)\r
goto _nc_cleanup;\r
-\r
- code = pkrb5_cc_get_principal(k5_identpro_ctx,\r
- cc,\r
- &princ);\r
+ \r
+ code = pkrb5_cc_get_principal(ctx, cc, &princ);\r
if (code)\r
goto _nc_cleanup;\r
\r
- code = pkrb5_unparse_name(k5_identpro_ctx,\r
- princ,\r
- &princ_nameA);\r
+ code = pkrb5_unparse_name(ctx, princ, &princ_nameA);\r
if (code)\r
goto _nc_cleanup;\r
\r
- AnsiStrToUnicode(princ_nameW,\r
- sizeof(princ_nameW),\r
- princ_nameA);\r
+ AnsiStrToUnicode(princ_nameW, sizeof(princ_nameW), princ_nameA);\r
\r
- if (KHM_FAILED(kcdb_identity_create(princ_nameW,\r
- 0,\r
- &ident)))\r
+ if (KHM_FAILED(kcdb_identity_create(princ_nameW, 0, &ident)))\r
goto _nc_cleanup;\r
\r
kcdb_identity_set_default_int(ident);\r
\r
_nc_cleanup:\r
if (princ_nameA)\r
- pkrb5_free_unparsed_name(k5_identpro_ctx,\r
- princ_nameA);\r
+ pkrb5_free_unparsed_name(ctx, princ_nameA);\r
+\r
if (princ)\r
- pkrb5_free_principal(k5_identpro_ctx,\r
- princ);\r
+ pkrb5_free_principal(ctx, princ);\r
+\r
if (cc)\r
- pkrb5_cc_close(k5_identpro_ctx, cc);\r
+ pkrb5_cc_close(ctx, cc);\r
\r
if (ident)\r
kcdb_identity_release(ident);\r
\r
+ return found_default;\r
+}\r
+\r
+static khm_int32\r
+k5_ident_init(khm_int32 msg_type,\r
+ khm_int32 msg_subtype,\r
+ khm_ui_4 uparam,\r
+ void * vparam) {\r
+\r
+ khm_boolean found_default;\r
+ khm_handle ident;\r
+\r
+ found_default = k5_refresh_default_identity(k5_identpro_ctx);\r
+\r
if (!found_default) {\r
wchar_t widname[KCDB_IDENT_MAXCCH_NAME];\r
khm_size cb;\r
return r;\r
}\r
\r
+\r
+/* Identity change notification thread */\r
+\r
+HANDLE h_ccname_exit_event;\r
+HANDLE h_ccname_thread;\r
+\r
+DWORD WINAPI k5_ccname_monitor_thread(LPVOID lpParameter) {\r
+ krb5_context ctx = 0;\r
+\r
+ HKEY hk_ccname;\r
+ HANDLE h_notify;\r
+ HANDLE h_waits[2];\r
+\r
+ khm_int32 rv = KHM_ERROR_SUCCESS;\r
+ DWORD dwType;\r
+ DWORD dwSize;\r
+ DWORD dwDisp;\r
+ wchar_t reg_ccname[KRB5_MAXCCH_CCNAME];\r
+ LONG l;\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
+ &dwDisp);\r
+\r
+ if (l != ERROR_SUCCESS) {\r
+ rv = KHM_ERROR_UNKNOWN;\r
+ goto _exit;\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
+\r
+ reg_ccname[0] = L'\0';\r
+ }\r
+\r
+ l = pkrb5_init_context(&ctx);\r
+\r
+ if (l)\r
+ goto _exit_0;\r
+\r
+ h_notify = CreateEvent(NULL, FALSE, FALSE, L"Local\\Krb5CCNameChangeNotifier");\r
+\r
+ if (h_notify == NULL)\r
+ goto _exit_0;\r
+\r
+ /* begin wait loop */\r
+\r
+ h_waits[0] = h_ccname_exit_event;\r
+ h_waits[1] = h_notify;\r
+\r
+ do {\r
+ DWORD dwrv;\r
+\r
+ l = RegNotifyChangeKeyValue(hk_ccname, FALSE,\r
+ REG_NOTIFY_CHANGE_LAST_SET,\r
+ h_notify, TRUE);\r
+\r
+ if (l != ERROR_SUCCESS) {\r
+ rv = KHM_ERROR_UNKNOWN;\r
+ break;\r
+ }\r
+\r
+ dwrv = WaitForMultipleObjects(2, h_waits, FALSE, INFINITE);\r
+\r
+ if (dwrv == WAIT_OBJECT_0) {\r
+ /* exit! */\r
+ break;\r
+\r
+ } else if (dwrv == WAIT_OBJECT_0 + 1) {\r
+ /* change notify! */\r
+ wchar_t new_ccname[KRB5_MAXCCH_CCNAME];\r
+\r
+ dwSize = sizeof(new_ccname);\r
+ \r
+ l = RegQueryValueEx(hk_ccname,\r
+ L"ccname",\r
+ NULL,\r
+ &dwType,\r
+ (LPBYTE) new_ccname,\r
+ &dwSize);\r
+\r
+ if (l != ERROR_SUCCESS ||\r
+ dwType != REG_SZ) {\r
+ new_ccname[0] = L'\0';\r
+ }\r
+\r
+ if (wcsicmp(new_ccname, reg_ccname)) {\r
+ k5_refresh_default_identity(ctx);\r
+ StringCbCopy(reg_ccname, sizeof(reg_ccname), new_ccname);\r
+ }\r
+\r
+ } else {\r
+ /* something went wrong */\r
+ rv = KHM_ERROR_UNKNOWN;\r
+ break;\r
+ }\r
+\r
+ } while (TRUE);\r
+\r
+ CloseHandle(h_notify);\r
+\r
+ _exit_0:\r
+\r
+ RegCloseKey(hk_ccname);\r
+\r
+ if (ctx)\r
+ pkrb5_free_context(ctx);\r
+\r
+ _exit:\r
+ ExitThread(rv);\r
+\r
+ /* not reached */\r
+ return rv;\r
+}\r
+\r
khm_int32\r
k5_msg_system_idpro(khm_int32 msg_type, khm_int32 msg_subtype,\r
khm_ui_4 uparam, void * vparam) {\r
\r
kcdb_attrib_release_info(attr);\r
}\r
+\r
+ h_ccname_exit_event = CreateEvent(NULL, FALSE, FALSE, NULL);\r
+ if (h_ccname_exit_event) {\r
+ h_ccname_thread = CreateThread(NULL,\r
+ 200 * 1024,\r
+ k5_ccname_monitor_thread,\r
+ NULL,\r
+ 0,\r
+ NULL);\r
+ } else {\r
+ h_ccname_thread = NULL;\r
+ }\r
}\r
break;\r
\r
case KMSG_SYSTEM_EXIT:\r
{\r
+\r
+ if (h_ccname_thread) {\r
+ SetEvent(h_ccname_exit_event);\r
+ WaitForSingleObject(h_ccname_thread, INFINITE);\r
+ CloseHandle(h_ccname_thread);\r
+ CloseHandle(h_ccname_exit_event);\r
+\r
+ h_ccname_exit_event = NULL;\r
+ h_ccname_thread = NULL;\r
+ }\r
+\r
if (k5_identpro_ctx) {\r
pkrb5_free_context(k5_identpro_ctx);\r
k5_identpro_ctx = NULL;\r
goto _switch_to_main;\r
\r
if (!k5_cp_check_continue()) {\r
+ g_fjob.code = KRB5KRB_AP_ERR_BAD_INTEGRITY;\r
goto _switch_to_main;\r
}\r
}\r
nct->type = credtype_id_krb5;\r
nct->ordinal = 1;\r
\r
- LoadString(hResModule, IDS_KRB5_SHORT_DESC, \r
+ LoadString(hResModule, IDS_KRB5_NC_NAME, \r
wbuf, ARRAYLENGTH(wbuf));\r
StringCbLength(wbuf, sizeof(wbuf), &cbsize);\r
cbsize += sizeof(wchar_t);\r
\r
realms = khm_krb5_get_realm_list();\r
if(realms) {\r
- t = realms;\r
- while(t && *t) {\r
+ for (t = realms; t && *t; t = multi_string_next(t)) {\r
SendDlgItemMessage(hwnd, IDC_NCK5_REALM, \r
CB_ADDSTRING,\r
0, (LPARAM) t);\r
- t = multi_string_next(t);\r
}\r
PFREE(realms);\r
}\r
NULL))))\r
g_fjob.code = 0;\r
\r
-\r
if(g_fjob.code != 0) {\r
wchar_t tbuf[1024];\r
DWORD suggestion;\r
\r
khm_krb5_list_tickets(&ctx);\r
\r
+ if (nc->set_default) {\r
+ kcdb_identity_set_default(nc->identities[0]);\r
+ }\r
+\r
/* If there is no default identity, then make this the default */\r
kcdb_identity_refresh(nc->identities[0]);\r
{\r
wbuf);\r
\r
atsign = wcschr(idname, L'@');\r
- if (atsign != NULL)\r
+ if (atsign == NULL)\r
goto _done_with_LRU;\r
\r
atsign++;\r
\r
if (wbuf)\r
PFREE(wbuf);\r
+\r
} else if (g_fjob.state == FIBER_STATE_NONE) {\r
/* the user cancelled the operation */\r
r = KHUI_NC_RESPONSE_EXIT | \r
_end_task();\r
} else if (nc->subtype == KMSG_CRED_RENEW_CREDS) {\r
\r
- __int64 ftidexp = 0;\r
- __int64 ftcurrent;\r
+ FILETIME ftidexp = {0,0};\r
+ FILETIME ftcurrent;\r
khm_size cb;\r
\r
- GetSystemTimeAsFileTime((LPFILETIME) &ftcurrent);\r
+ GetSystemTimeAsFileTime(&ftcurrent);\r
\r
_begin_task(0);\r
_report_mr0(KHERR_NONE, MSG_CTX_RENEW_CREDS);\r
khui_cw_set_response(nc, credtype_id_krb5, \r
KHUI_NC_RESPONSE_EXIT | \r
KHUI_NC_RESPONSE_FAILED);\r
- } else if (ftcurrent < ftidexp) {\r
+ } else if (CompareFileTime(&ftcurrent, &ftidexp) < 0) {\r
wchar_t tbuf[1024];\r
DWORD suggestion;\r
kherr_suggestion sug_id;\r
DefaultRenewLifetime,KC_INT32,604800,Default renewable lifetime\r
MaxRenewLifetime,KC_INT32,2592000,Maximum renewable lifetime\r
MinRenewLifetime,KC_INT32,60,Maximum renewable lifetime\r
+ UseFullRealmList,KC_INT32,0,Use the full list of realms in the New Creds dialog\r
LRURealms,KC_STRING,,\r
LRUPrincipals,KC_STRING,,\r
LastDefaultIdent,KC_STRING,,Last known default identity\r
COMBOBOX IDC_NCK5_REALM,60,25,233,17,CBS_DROPDOWN | \r
CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP\r
PUSHBUTTON "Specify &additional realms ...",IDC_NCK5_ADD_REALMS,181,\r
- 43,112,16,BS_NOTIFY | WS_DISABLED\r
+ 43,112,16,BS_NOTIFY | NOT WS_VISIBLE | WS_DISABLED\r
LTEXT "&Lifetime",IDC_STATIC,7,67,61,12\r
EDITTEXT IDC_NCK5_LIFETIME_EDIT,85,67,107,12,ES_AUTOHSCROLL\r
CONTROL "&Renewable for",IDC_NCK5_RENEWABLE,"Button",\r
WS_VSCROLL | WS_TABSTOP\r
PUSHBUTTON "Configure Realms ...",IDC_CFG_CFGREALMS,76,25,84,14,\r
WS_DISABLED\r
- GROUPBOX "Keberos Configuration File",IDC_CFG_CFGFILEGRP,7,57,241,\r
- 48\r
- LTEXT "Location",IDC_CFG_LBL_CFGFILE,13,71,28,8\r
- EDITTEXT IDC_CFG_CFGFILE,76,68,119,14,ES_AUTOHSCROLL\r
- PUSHBUTTON "Browse...",IDC_CFG_BROWSE,198,68,44,14\r
+ GROUPBOX "Keberos Configuration File",IDC_CFG_CFGFILEGRP,7,45,241,\r
+ 61\r
+ LTEXT "Location",IDC_CFG_LBL_CFGFILE,13,61,28,8\r
+ EDITTEXT IDC_CFG_CFGFILE,76,58,119,14,ES_AUTOHSCROLL\r
+ PUSHBUTTON "Browse...",IDC_CFG_BROWSE,198,58,44,14\r
CONTROL "Create file if missing",IDC_CFG_CREATECONFIG,"Button",\r
- BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,76,89,80,10\r
+ BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,76,76,80,10\r
+ CONTROL "Include realms in New Credentials realm list",\r
+ IDC_CFG_INCREALMS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,\r
+ 76,91,153,10\r
GROUPBOX "Windows® Options",IDC_CFG_WINGRP,7,110,241,65\r
LTEXT "Hostname",IDC_CFG_LBL_HOSTNAME,13,123,33,8\r
EDITTEXT IDC_CFG_HOSTNAME,76,120,166,14,ES_AUTOHSCROLL | \r
IDS_ETYPE_UNKNOWN "(Unknown)"\r
IDS_ETYPE_LOCAL_DES3_HMAC_SHA1 "LOCAL-DES3-HMAC-SHA1"\r
IDS_ETYPE_LOCAL_RC4_MD4 "LOCAL-RC4-MD4"\r
- IDS_KRB5_SHORT_DESC "Kerberos 5"\r
+ IDS_KRB5_SHORT_DESC "Kerberos 5 tickets"\r
IDS_KRB5_LONG_DESC "Kerberos 5 tickets"\r
END\r
\r
IDS_NO "No"\r
IDS_CFG_RE_NEWSERVER "<New server...>"\r
IDS_CFG_RE_NEWDMAP "<New domain mapping...>"\r
+ IDS_KRB5_NC_NAME "Kerberos 5"\r
END\r
\r
#endif // English (U.S.) resources\r
Please select an identity to change the password.\r
.\r
\r
+MessageId=\r
+SymbolicName=MSG_ERR_S_INTEGRITY\r
+Language=English\r
+This is commonly caused by an incorrect password. Please verify that the password is correct and note that passwords are case sensitive.\r
+.\r
+\r
+\r
MessageId=\r
SymbolicName=MSG_\r
Language=English\r
#define IDS_NO 196\r
#define IDS_CFG_RE_NEWSERVER 197\r
#define IDS_CFG_RE_NEWDMAP 198\r
+#define IDS_KRB5_NC_NAME 199\r
#define IDC_NCK5_RENEWABLE 1002\r
#define IDC_NCK5_FORWARDABLE 1004\r
#define IDC_NCK5_REALM 1005\r
#define IDC_CFG_INCAPI 1066\r
#define IDC_CFG_INCMSLSA 1067\r
#define IDC_PPK5_FLAGS 1072\r
+#define IDC_CHECK1 1073\r
+#define IDC_CFG_INCREALMS 1073\r
\r
// Next default values for new objects\r
// \r
#ifndef APSTUDIO_READONLY_SYMBOLS\r
#define _APS_NEXT_RESOURCE_VALUE 117\r
#define _APS_NEXT_COMMAND_VALUE 40001\r
-#define _APS_NEXT_CONTROL_VALUE 1073\r
+#define _APS_NEXT_CONTROL_VALUE 1074\r
#define _APS_NEXT_SYMED_VALUE 101\r
#endif\r
#endif\r
void khm_parse_commandline();\r
void khm_register_window_classes(void);\r
\r
-HWND khm_html_help(HWND hwnd, UINT command, DWORD_PTR data);\r
+HWND khm_html_help(HWND hwnd, wchar_t * suffix, UINT command, DWORD_PTR data);\r
\r
#define MAX_RES_STRING 1024\r
\r
HWND hwnd;\r
} ident_data;\r
\r
+typedef struct tag_global_props {\r
+ BOOL monitor;\r
+ BOOL auto_renew;\r
+ BOOL sticky;\r
+} global_props;\r
+\r
typedef struct tag_idents_data {\r
BOOL valid;\r
\r
khm_size n_idents;\r
khm_size nc_idents;\r
\r
+ /* global options */\r
+ global_props saved;\r
+ global_props work;\r
+ BOOL applied;\r
+\r
int refcount;\r
\r
HIMAGELIST hi_status;\r
khui_config_init_data cfg;\r
} idents_data;\r
\r
-static idents_data cfg_idents = {FALSE, NULL, 0, 0, 0, NULL };\r
+static idents_data cfg_idents = {FALSE, NULL, 0, 0,\r
+ {0, 0, 0},\r
+ {0, 0, 0},\r
+ FALSE,\r
+\r
+ 0, NULL };\r
\r
static void\r
read_params_ident(ident_data * d) {\r
return;\r
}\r
\r
- if (d->saved.monitor != d->work.monitor)\r
- khc_write_int32(csp_ident, L"Monitor", !!d->work.monitor);\r
+ if (d->removed) {\r
\r
- if (d->saved.auto_renew != d->work.auto_renew)\r
- khc_write_int32(csp_ident, L"AllowAutoRenew", !!d->work.auto_renew);\r
+ khc_remove_space(csp_ident);\r
\r
- if (d->saved.sticky != d->work.sticky) {\r
- kcdb_identity_set_flags(d->ident,\r
- (d->work.sticky)?KCDB_IDENT_FLAG_STICKY:0,\r
- KCDB_IDENT_FLAG_STICKY);\r
+ } else {\r
+\r
+ if (d->saved.monitor != d->work.monitor)\r
+ khc_write_int32(csp_ident, L"Monitor", !!d->work.monitor);\r
+\r
+ if (d->saved.auto_renew != d->work.auto_renew)\r
+ khc_write_int32(csp_ident, L"AllowAutoRenew",\r
+ !!d->work.auto_renew);\r
+\r
+ if (d->saved.sticky != d->work.sticky) {\r
+ kcdb_identity_set_flags(d->ident,\r
+ (d->work.sticky)?KCDB_IDENT_FLAG_STICKY:0,\r
+ KCDB_IDENT_FLAG_STICKY);\r
+ }\r
}\r
\r
khc_close_space(csp_ident);\r
static void\r
write_params_idents(void) {\r
int i;\r
+ khm_handle csp_cw;\r
+\r
+ if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow",\r
+ KHM_FLAG_CREATE, &csp_cw))) {\r
+ if (cfg_idents.work.monitor != cfg_idents.saved.monitor) {\r
+ khc_write_int32(csp_cw, L"DefaultMonitor",\r
+ !!cfg_idents.work.monitor);\r
+ cfg_idents.work.monitor = cfg_idents.saved.monitor;\r
+ cfg_idents.applied = TRUE;\r
+ }\r
+ if (cfg_idents.work.auto_renew != cfg_idents.saved.auto_renew) {\r
+ khc_write_int32(csp_cw, L"DefaultAllowAutoRenew",\r
+ !!cfg_idents.work.auto_renew);\r
+ cfg_idents.work.auto_renew = cfg_idents.saved.auto_renew;\r
+ cfg_idents.applied = TRUE;\r
+ }\r
+ if (cfg_idents.work.sticky != cfg_idents.saved.sticky) {\r
+ khc_write_int32(csp_cw, L"DefaultMonitor",\r
+ !!cfg_idents.work.sticky);\r
+ cfg_idents.work.sticky = cfg_idents.saved.sticky;\r
+ cfg_idents.applied = TRUE;\r
+ }\r
+ khc_close_space(csp_cw);\r
+ }\r
\r
for (i=0; i < (int)cfg_idents.n_idents; i++) {\r
write_params_ident(&cfg_idents.idents[i]);\r
khm_size cb;\r
int n_tries = 0;\r
int i;\r
+ khm_handle csp_cw;\r
\r
if (cfg_idents.valid)\r
return;\r
assert(cfg_idents.nc_idents == 0);\r
#endif\r
\r
+ if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw))) {\r
+ khm_int32 t;\r
+\r
+ if (KHM_SUCCEEDED(khc_read_int32(csp_cw, L"DefaultMonitor", &t)))\r
+ cfg_idents.saved.monitor = !!t;\r
+ else\r
+ cfg_idents.saved.monitor = TRUE;\r
+\r
+ if (KHM_SUCCEEDED(khc_read_int32(csp_cw, L"DefaultAllowAutoRenew", &t)))\r
+ cfg_idents.saved.auto_renew = !!t;\r
+ else\r
+ cfg_idents.saved.auto_renew = TRUE;\r
+\r
+ if (KHM_SUCCEEDED(khc_read_int32(csp_cw, L"DefaultSticky", &t)))\r
+ cfg_idents.saved.sticky = !!t;\r
+ else\r
+ cfg_idents.saved.sticky = FALSE;\r
+\r
+ } else {\r
+\r
+ cfg_idents.saved.monitor = TRUE;\r
+ cfg_idents.saved.auto_renew = TRUE;\r
+ cfg_idents.saved.sticky = FALSE;\r
+\r
+ }\r
+\r
+ cfg_idents.work = cfg_idents.saved;\r
+ cfg_idents.applied = FALSE;\r
+\r
do {\r
rv = kcdb_identity_enum(KCDB_IDENT_FLAG_CONFIG,\r
KCDB_IDENT_FLAG_CONFIG,\r
free_idents_data();\r
}\r
\r
-#define BS_TRUE 1\r
-#define BS_FALSE 2\r
-\r
-static void\r
-refresh_view_idents_sel(HWND hwnd) {\r
- HWND hw;\r
- int sel_count;\r
- int i;\r
- int idx;\r
- ident_data * d;\r
- LVITEM lvi;\r
-\r
- int monitor = 0;\r
- int auto_renew = 0;\r
- int sticky = 0;\r
-\r
- hw = GetDlgItem(hwnd, IDC_CFG_IDENTS);\r
-\r
- sel_count = ListView_GetSelectedCount(hw);\r
-\r
- idx = -1;\r
- for (i=0; i < sel_count; i++) {\r
- idx = ListView_GetNextItem(hw, idx, LVNI_SELECTED);\r
-#ifdef DEBUG\r
- assert(idx != -1);\r
-#endif\r
- ZeroMemory(&lvi, sizeof(lvi));\r
-\r
- lvi.iItem = idx;\r
- lvi.iSubItem = 0;\r
- lvi.mask = LVIF_PARAM;\r
-\r
- ListView_GetItem(hw, &lvi);\r
-\r
- d = (ident_data *) lvi.lParam;\r
-#ifdef DEBUG\r
- assert(d != NULL);\r
-#endif\r
-\r
- if (d->work.monitor)\r
- monitor |= BS_TRUE;\r
- else\r
- monitor |= BS_FALSE;\r
-\r
- if (d->work.auto_renew)\r
- auto_renew |= BS_TRUE;\r
- else\r
- auto_renew |= BS_FALSE;\r
-\r
- if (d->work.sticky)\r
- sticky |= BS_TRUE;\r
- else\r
- sticky |= BS_FALSE;\r
- }\r
-\r
- CheckDlgButton(hwnd, IDC_CFG_MONITOR,\r
- (monitor == BS_TRUE)? BST_CHECKED:\r
- ((monitor == BS_FALSE)? BST_UNCHECKED:\r
- BST_INDETERMINATE));\r
-\r
- CheckDlgButton(hwnd, IDC_CFG_RENEW,\r
- (auto_renew == BS_TRUE)? BST_CHECKED:\r
- ((auto_renew == BS_FALSE)? BST_UNCHECKED:\r
- BST_INDETERMINATE));\r
-\r
- CheckDlgButton(hwnd, IDC_CFG_STICKY,\r
- (sticky == BS_TRUE)? BST_CHECKED:\r
- ((sticky == BS_FALSE)? BST_UNCHECKED:\r
- BST_INDETERMINATE));\r
-\r
- if (sel_count > 0) {\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_MONITOR), TRUE);\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_RENEW), TRUE);\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_STICKY), TRUE);\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_REMOVE), TRUE);\r
- } else {\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_MONITOR), FALSE);\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_RENEW), FALSE);\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_STICKY), FALSE);\r
- EnableWindow(GetDlgItem(hwnd, IDC_CFG_REMOVE), FALSE);\r
- }\r
-}\r
-\r
-#undef BS_TRUE\r
-#undef BS_FALSE\r
\r
static void\r
refresh_data_idents(HWND hwnd) {\r
- HWND hw;\r
- int sel_count;\r
- int i;\r
- int idx;\r
- ident_data * d;\r
- LVITEM lvi;\r
-\r
- UINT monitor = IsDlgButtonChecked(hwnd, IDC_CFG_MONITOR);\r
- UINT auto_renew = IsDlgButtonChecked(hwnd, IDC_CFG_RENEW);\r
- UINT sticky = IsDlgButtonChecked(hwnd, IDC_CFG_STICKY);\r
-\r
- hw = GetDlgItem(hwnd, IDC_CFG_IDENTS);\r
-\r
- sel_count = ListView_GetSelectedCount(hw);\r
-\r
- idx = -1;\r
- for (i=0; i < sel_count; i++) {\r
- idx = ListView_GetNextItem(hw, idx, LVNI_SELECTED);\r
-#ifdef DEBUG\r
- assert(idx != -1);\r
-#endif\r
- ZeroMemory(&lvi, sizeof(lvi));\r
-\r
- lvi.iItem = idx;\r
- lvi.iSubItem = 0;\r
- lvi.mask = LVIF_PARAM;\r
-\r
- ListView_GetItem(hw, &lvi);\r
-\r
- d = (ident_data *) lvi.lParam;\r
-#ifdef DEBUG\r
- assert(d != NULL);\r
-#endif\r
-\r
- if (monitor == BST_CHECKED)\r
- d->work.monitor = TRUE;\r
- else if (monitor == BST_UNCHECKED)\r
- d->work.monitor = FALSE;\r
-\r
- if (auto_renew == BST_CHECKED)\r
- d->work.auto_renew = TRUE;\r
- else if (auto_renew == BST_UNCHECKED)\r
- d->work.auto_renew = FALSE;\r
-\r
- if (sticky == BST_CHECKED)\r
- d->work.sticky = TRUE;\r
- else if (sticky == BST_UNCHECKED)\r
- d->work.sticky = FALSE;\r
-\r
- if (d->hwnd)\r
- PostMessage(d->hwnd, KHUI_WM_CFG_NOTIFY,\r
- MAKEWPARAM(0, WMCFG_UPDATE_STATE), 0);\r
- }\r
+ cfg_idents.work.monitor =\r
+ (IsDlgButtonChecked(hwnd, IDC_CFG_MONITOR) == BST_CHECKED);\r
+ cfg_idents.work.auto_renew =\r
+ (IsDlgButtonChecked(hwnd, IDC_CFG_RENEW) == BST_CHECKED);\r
+ cfg_idents.work.sticky =\r
+ (IsDlgButtonChecked(hwnd, IDC_CFG_STICKY) == BST_CHECKED);\r
}\r
\r
static void\r
refresh_view_idents_state(HWND hwnd) {\r
- HWND hw;\r
- int i;\r
- LVITEM lvi;\r
- ident_data * d;\r
-\r
- BOOL modified = FALSE;\r
- BOOL applied = FALSE;\r
-\r
- hw = GetDlgItem(hwnd, IDC_CFG_IDENTS);\r
-\r
- for (i = -1;;) {\r
-\r
- i = ListView_GetNextItem(hw, i, LVNI_ALL);\r
- if (i == -1)\r
- break;\r
-\r
- ZeroMemory(&lvi, sizeof(lvi));\r
- lvi.iItem = i;\r
- lvi.iSubItem = 0;\r
- lvi.mask = LVIF_PARAM;\r
-\r
- ListView_GetItem(hw, &lvi);\r
-\r
- d = (ident_data *) lvi.lParam;\r
-#ifdef DEBUG\r
- assert(d != NULL);\r
-#endif\r
-\r
- ZeroMemory(&lvi, sizeof(lvi));\r
-\r
- lvi.mask = LVIF_STATE;\r
- lvi.stateMask = LVIS_STATEIMAGEMASK;\r
- lvi.iItem = i;\r
- lvi.iSubItem = 0;\r
-\r
- if (d->removed) {\r
- lvi.state = INDEXTOSTATEIMAGEMASK(cfg_idents.idx_deleted);\r
- modified = TRUE;\r
- } else if (d->saved.monitor != d->work.monitor ||\r
- d->saved.auto_renew != d->work.auto_renew ||\r
- d->saved.sticky != d->work.sticky) {\r
- lvi.state = INDEXTOSTATEIMAGEMASK(cfg_idents.idx_modified);\r
- modified = TRUE;\r
- } else if (d->applied) {\r
- lvi.state = INDEXTOSTATEIMAGEMASK(cfg_idents.idx_applied);\r
- applied = TRUE;\r
- } else {\r
- lvi.state = INDEXTOSTATEIMAGEMASK(cfg_idents.idx_default);\r
- }\r
-\r
- ListView_SetItem(hw, &lvi);\r
- }\r
-\r
- {\r
- khm_int32 flags = 0;\r
-\r
- if (modified)\r
- flags |= KHUI_CNFLAG_MODIFIED;\r
- if (applied)\r
- flags |= KHUI_CNFLAG_APPLIED;\r
-\r
- khui_cfg_set_flags_inst(&cfg_idents.cfg, flags,\r
- KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);\r
- }\r
-}\r
-\r
-static void\r
-remove_idents(HWND hwnd) {\r
- HWND hw;\r
- int sel_count;\r
- int i;\r
- int idx;\r
- ident_data * d;\r
- LVITEM lvi;\r
-\r
- hw = GetDlgItem(hwnd, IDC_CFG_IDENTS);\r
-\r
- sel_count = ListView_GetSelectedCount(hw);\r
-\r
- idx = -1;\r
- for (i=0; i < sel_count; i++) {\r
- idx = ListView_GetNextItem(hw, idx, LVNI_SELECTED);\r
-#ifdef DEBUG\r
- assert(idx != -1);\r
-#endif\r
- ZeroMemory(&lvi, sizeof(lvi));\r
-\r
- lvi.iItem = idx;\r
- lvi.iSubItem = 0;\r
- lvi.mask = LVIF_PARAM;\r
+ BOOL modified;\r
+ BOOL applied;\r
+ khm_int32 flags = 0;\r
\r
- ListView_GetItem(hw, &lvi);\r
+ applied = cfg_idents.applied;\r
+ modified = (cfg_idents.work.monitor != cfg_idents.saved.monitor ||\r
+ cfg_idents.work.auto_renew != cfg_idents.saved.auto_renew ||\r
+ cfg_idents.work.sticky != cfg_idents.saved.sticky);\r
\r
- d = (ident_data *) lvi.lParam;\r
-#ifdef DEBUG\r
- assert(d != NULL);\r
-#endif\r
+ if (modified)\r
+ flags |= KHUI_CNFLAG_MODIFIED;\r
+ if (applied)\r
+ flags |= KHUI_CNFLAG_APPLIED;\r
\r
- d->removed = TRUE;\r
- }\r
+ khui_cfg_set_flags_inst(&cfg_idents.cfg, flags,\r
+ KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);\r
}\r
\r
INT_PTR CALLBACK\r
switch(umsg) {\r
case WM_INITDIALOG:\r
{\r
- HWND hw;\r
HICON hicon;\r
- LVCOLUMN lvcol;\r
- LVITEM lvi;\r
- wchar_t coltext[256];\r
- RECT r;\r
- int i;\r
\r
hold_idents_data();\r
\r
cfg_idents.hwnd = hwnd;\r
cfg_idents.cfg = *((khui_config_init_data *) lParam);\r
\r
- /* first add the column */\r
- hw = GetDlgItem(hwnd, IDC_CFG_IDENTS);\r
-\r
- ZeroMemory(&lvcol, sizeof(lvcol));\r
- lvcol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_FMT;\r
-\r
- lvcol.fmt = LVCFMT_IMAGE | LVCFMT_LEFT;\r
-\r
- GetWindowRect(hw, &r);\r
- lvcol.cx = ((r.right - r.left) * 95) / 100;\r
-\r
- LoadString(khm_hInstance, IDS_CFG_IDS_IDENTITY,\r
- coltext, ARRAYLENGTH(coltext));\r
- lvcol.pszText = coltext;\r
-\r
- ListView_InsertColumn(hw, 0, &lvcol);\r
-\r
- /* and the status icons */\r
+ /* add the status icons */\r
if (cfg_idents.hi_status)\r
goto _done_with_icons;\r
\r
\r
DestroyIcon(hicon);\r
\r
- ListView_SetImageList(hw, cfg_idents.hi_status, LVSIL_SMALL);\r
- ListView_SetImageList(hw, cfg_idents.hi_status, LVSIL_STATE);\r
-\r
_done_with_icons:\r
\r
- /* now add each identity */\r
- for(i=0; i < (int)cfg_idents.n_idents; i++) {\r
- ZeroMemory(&lvi, sizeof(lvi));\r
-\r
- lvi.mask = LVIF_PARAM | LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;\r
- lvi.iImage = cfg_idents.idx_id;\r
- lvi.lParam = (LPARAM) &cfg_idents.idents[i];\r
- lvi.pszText = cfg_idents.idents[i].idname;\r
- lvi.state = INDEXTOSTATEIMAGEMASK(cfg_idents.idx_default);\r
- lvi.stateMask = LVIS_STATEIMAGEMASK;\r
-\r
- cfg_idents.idents[i].lv_idx = ListView_InsertItem(hw, &lvi);\r
- }\r
+ CheckDlgButton(hwnd, IDC_CFG_MONITOR,\r
+ (cfg_idents.work.monitor)?BST_CHECKED:BST_UNCHECKED);\r
+ CheckDlgButton(hwnd, IDC_CFG_RENEW,\r
+ (cfg_idents.work.auto_renew)?BST_CHECKED:BST_UNCHECKED);\r
+ CheckDlgButton(hwnd, IDC_CFG_STICKY,\r
+ (cfg_idents.work.sticky)?BST_CHECKED:BST_UNCHECKED);\r
\r
}\r
return FALSE;\r
\r
- case WM_NOTIFY:\r
- {\r
- LPNMHDR lpnm = (LPNMHDR) lParam;\r
-\r
- if (lpnm->code == LVN_ITEMCHANGED) {\r
- refresh_view_idents_sel(hwnd);\r
- }\r
- }\r
- return TRUE;\r
-\r
case WM_COMMAND:\r
\r
if (HIWORD(wParam) == BN_CLICKED) {\r
UINT ctrl = LOWORD(wParam);\r
+\r
switch(ctrl) {\r
case IDC_CFG_MONITOR:\r
case IDC_CFG_RENEW:\r
case IDC_CFG_STICKY:\r
- if (IsDlgButtonChecked(hwnd, ctrl) == BST_CHECKED)\r
- CheckDlgButton(hwnd, ctrl, BST_UNCHECKED);\r
- else\r
- CheckDlgButton(hwnd, ctrl, BST_CHECKED);\r
refresh_data_idents(hwnd);\r
break;\r
-\r
- case IDC_CFG_REMOVE:\r
- remove_idents(hwnd);\r
- break;\r
}\r
\r
refresh_view_idents_state(hwnd);\r
\r
case WMCFG_UPDATE_STATE:\r
refresh_view_idents_state(hwnd);\r
- refresh_view_idents_sel(hwnd);\r
break;\r
}\r
}\r
(d->work.sticky? BST_CHECKED: BST_UNCHECKED));\r
}\r
\r
+static void\r
+mark_remove_ident(HWND hwnd, khui_config_init_data * idata) {\r
+ ident_data * d;\r
+\r
+ d = find_ident_by_node(idata->ctx_node);\r
+#ifdef DEBUG\r
+ assert(d);\r
+#endif\r
+\r
+ if (d->removed)\r
+ return;\r
+\r
+ d->removed = TRUE;\r
+\r
+ khui_cfg_set_flags_inst(idata, KHUI_CNFLAG_MODIFIED,\r
+ KHUI_CNFLAG_MODIFIED);\r
+\r
+ EnableWindow(GetDlgItem(hwnd, IDC_CFG_REMOVE), FALSE);\r
+}\r
+\r
static void\r
refresh_data_ident(HWND hwnd, khui_config_init_data * idata) {\r
ident_data * d;\r
PostMessage(cfg_idents.hwnd, KHUI_WM_CFG_NOTIFY,\r
MAKEWPARAM(1, WMCFG_UPDATE_STATE), 0);\r
break;\r
+\r
+ case IDC_CFG_REMOVE:\r
+ mark_remove_ident(hwnd, idata);\r
+ if (cfg_idents.hwnd)\r
+ PostMessage(cfg_idents.hwnd, KHUI_WM_CFG_NOTIFY,\r
+ MAKEWPARAM(1, WMCFG_UPDATE_STATE), 0);\r
+ break;\r
}\r
}\r
+\r
khm_set_dialog_result(hwnd, 0);\r
return TRUE;\r
\r
khui_cfg_set_flags(d->node,\r
KHUI_CNFLAG_APPLIED,\r
KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED);\r
+\r
+ khm_timer_refresh(hwnd_notifier);\r
}\r
\r
static void\r
\r
khui_cfg_clear_params();\r
\r
+ khui_cfg_set_configui_handle(hwnd);\r
+\r
d = PMALLOC(sizeof(*d));\r
ZeroMemory(d, sizeof(*d));\r
\r
khm_add_dialog(hwnd);\r
khm_enter_modal(hwnd);\r
\r
- khui_cfg_set_configui_handle(hwnd);\r
-\r
return TRUE;\r
\r
case WM_DESTROY:\r
static HANDLE in_dialog_evt = NULL;\r
static LONG init_dialog = 0;\r
static khm_int32 dialog_result = 0;\r
+static wchar_t dialog_identity[KCDB_IDENT_MAXCCH_NAME];\r
\r
static void\r
dialog_sync_init(void) {\r
}\r
\r
void \r
-khm_cred_end_dialog(khm_int32 result) {\r
+khm_cred_end_dialog(khui_new_creds * nc) {\r
dialog_sync_init();\r
\r
EnterCriticalSection(&cs_dialog);\r
in_dialog = FALSE;\r
SetEvent(in_dialog_evt);\r
}\r
- dialog_result = result;\r
+ dialog_result = nc->result;\r
+ if (nc->subtype == KMSG_CRED_NEW_CREDS &&\r
+ nc->n_identities > 0 &&\r
+ nc->identities[0]) {\r
+ khm_size cb;\r
+\r
+ cb = sizeof(dialog_identity);\r
+ if (KHM_FAILED(kcdb_identity_get_name(nc->identities[0],\r
+ dialog_identity,\r
+ &cb)))\r
+ dialog_identity[0] = 0;\r
+ } else {\r
+ dialog_identity[0] = 0;\r
+ }\r
LeaveCriticalSection(&cs_dialog);\r
}\r
\r
}\r
\r
khm_int32\r
-khm_cred_wait_for_dialog(DWORD timeout, khm_int32 * result) {\r
+khm_cred_wait_for_dialog(DWORD timeout, khm_int32 * result,\r
+ wchar_t * ident, khm_size cb_ident) {\r
khm_int32 rv;\r
\r
dialog_sync_init();\r
\r
if (!in_dialog) {\r
rv = KHM_ERROR_SUCCESS;\r
- if (result)\r
+ if (result) {\r
*result = dialog_result;\r
+ }\r
+ if (ident) {\r
+ StringCbCopy(ident, cb_ident, dialog_identity);\r
+ }\r
break;\r
} else if(dw == WAIT_TIMEOUT) {\r
rv = KHM_ERROR_TIMEOUT;\r
khui_context_reset();\r
*/\r
\r
- khm_cred_end_dialog(nc->result);\r
+ khm_cred_end_dialog(nc);\r
}\r
\r
khui_cw_destroy_cred_blob(nc);\r
\r
kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, 0);\r
\r
- khm_cred_process_commandline();\r
+ kmq_post_message(KMSG_ACT, KMSG_ACT_CONTINUE_CMDLINE, 0, 0);\r
}\r
break;\r
\r
\r
kmq_post_message(KMSG_CRED, KMSG_CRED_REFRESH, 0, 0);\r
\r
- khm_cred_process_commandline();\r
+ kmq_post_message(KMSG_ACT, KMSG_ACT_CONTINUE_CMDLINE, 0, 0);\r
break;\r
\r
case KMSG_CRED_IMPORT:\r
- khm_cred_process_commandline();\r
+ kmq_post_message(KMSG_ACT, KMSG_ACT_CONTINUE_CMDLINE, 0, 0);\r
break;\r
\r
case KMSG_CRED_REFRESH:\r
khui_alert_release(a);\r
\r
khui_context_release(&nc->ctx);\r
+ nc->result = KHUI_NC_RESULT_CANCEL;\r
+ khm_cred_end_dialog(nc);\r
khui_cw_destroy_cred_blob(nc);\r
- khm_cred_end_dialog(KHUI_NC_RESULT_CANCEL);\r
return;\r
}\r
\r
_end_task();\r
} else {\r
khui_context_release(&nc->ctx);\r
+ nc->result = KHUI_NC_RESULT_CANCEL;\r
+ khm_cred_end_dialog(nc);\r
khui_cw_destroy_cred_blob(nc);\r
- khm_cred_end_dialog(KHUI_NC_RESULT_CANCEL);\r
}\r
}\r
\r
\r
if (khm_startup.init ||\r
khm_startup.renew ||\r
- khm_startup.destroy) {\r
+ khm_startup.destroy ||\r
+ khm_startup.autoinit) {\r
kcdb_identity_get_default(&defident);\r
}\r
\r
kcdb_credset_get_size(NULL, &count);\r
\r
if (count == 0) {\r
+ if (defident)\r
+ khui_context_set(KHUI_SCOPE_IDENT,\r
+ defident,\r
+ KCDB_CREDTYPE_INVALID,\r
+ NULL, NULL, 0,\r
+ NULL);\r
+ else\r
+ khui_context_reset();\r
+\r
khm_cred_obtain_new_creds(NULL);\r
}\r
khm_startup.autoinit = FALSE;\r
\r
void\r
khm_cred_begin_commandline(void) {\r
+ khm_handle csp_cw;\r
+\r
if (khm_startup.seen)\r
return;\r
\r
+ if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow", 0, &csp_cw))) {\r
+ khm_int32 t = 0;\r
+\r
+ khc_read_int32(csp_cw, L"Autoinit", &t);\r
+ if (t)\r
+ khm_startup.autoinit = TRUE;\r
+\r
+ t = 0;\r
+ khc_read_int32(csp_cw, L"AutoImport", &t);\r
+ if (t)\r
+ khm_startup.import = TRUE;\r
+\r
+ khc_close_space(csp_cw);\r
+\r
+ }\r
+\r
khm_startup.seen = TRUE;\r
khm_startup.processing = TRUE;\r
\r
khm_size cb;\r
khm_size n_idents;\r
\r
- __int64 ft_now;\r
- __int64 ft_exp;\r
- __int64 ft_issue;\r
+ FILETIME ft_now;\r
+ FILETIME ft_exp;\r
+ FILETIME ft_issue;\r
\r
if (KHM_SUCCEEDED(khc_open_space(NULL, L"CredWindow",\r
0, &csp_cw))) {\r
if (!ids)\r
return;\r
\r
- GetSystemTimeAsFileTime((LPFILETIME) &ft_now);\r
+ GetSystemTimeAsFileTime(&ft_now);\r
\r
for (t=ids; t && *t; t = multi_string_next(t)) {\r
khm_handle ident;\r
(kcdb_identity_get_attr(ident, KCDB_ATTR_EXPIRE, NULL,\r
&ft_exp, &cb)) &&\r
\r
- ft_now > (ft_issue + ft_exp)/2 &&\r
- ft_now < ft_exp) {\r
+ CompareFileTime(&ft_now, &ft_exp) < 0) {\r
\r
- khm_cred_renew_identity(ident);\r
+ khm_int64 i_issue;\r
+ khm_int64 i_exp;\r
+ khm_int64 i_now;\r
\r
+ i_issue = FtToInt(&ft_issue);\r
+ i_exp = FtToInt(&ft_exp);\r
+ i_now = FtToInt(&ft_now);\r
+\r
+ if (i_now > (i_issue + i_exp) / 2) {\r
+\r
+ khm_cred_renew_identity(ident);\r
+\r
+ }\r
}\r
\r
kcdb_identity_release(ident);\r
khm_cred_is_in_dialog(void);\r
\r
khm_int32\r
-khm_cred_wait_for_dialog(DWORD timeout, khm_int32 * result);\r
+khm_cred_wait_for_dialog(DWORD timeout, khm_int32 * result,\r
+ wchar_t * ident, khm_size cb_ident);\r
\r
void\r
khm_cred_begin_commandline(void);\r
void\r
khm_cred_addr_change(void);\r
\r
+void\r
+khm_cred_import(void);\r
+\r
#endif\r
ADD_BITMAP(IDB_FLAG_WARN);\r
ADD_BITMAP(IDB_FLAG_EXPIRED);\r
ADD_BITMAP(IDB_FLAG_CRITICAL);\r
+ ADD_BITMAP(IDB_FLAG_RENEW);\r
ADD_BITMAP(IDB_WDG_STUCK);\r
ADD_BITMAP(IDB_WDG_STUCK_HI);\r
ADD_BITMAP(IDB_WDG_STICK);\r
if(KHM_FAILED(kcdb_cred_get_attr(cred, KCDB_ATTR_TIMELEFT, NULL, &ft, &cbsize)))\r
return 0;\r
\r
- s = FtIntervalToMilliseconds(&ft) / 1000;\r
+ s = FtIntervalToSeconds(&ft);\r
\r
flags = 0;\r
if(s < 0)\r
khm_size cbbuf;\r
khm_int32 flags;\r
int selected;\r
+ khm_int32 expstate = 0;\r
\r
/* this is called after calling cw_update_creds, so we assume\r
that the credentials are all loaded and sorted according to\r
visible = visible && (ol->flags & KHUI_CW_O_EXPAND);\r
\r
flags = cw_get_cred_exp_flags(tbl, thiscred);\r
+ expstate |= flags;\r
\r
if(visible) {\r
khm_int32 c_flags;\r
_exit:\r
if(grouping)\r
PFREE(grouping);\r
+\r
+ if (tbl->n_rows == 0)\r
+ khm_notify_icon_expstate(KHM_NOTIF_EMPTY);\r
+ else if (expstate & CW_EXPSTATE_EXPIRED)\r
+ khm_notify_icon_expstate(KHM_NOTIF_EXP);\r
+ else if ((expstate & CW_EXPSTATE_WARN) ||\r
+ (expstate & CW_EXPSTATE_CRITICAL))\r
+ khm_notify_icon_expstate(KHM_NOTIF_WARN);\r
+ else\r
+ khm_notify_icon_expstate(KHM_NOTIF_OK);\r
}\r
\r
void \r
}\r
phi->lParam = col->attr_id;\r
#if (_WIN32_WINNT >= 0x501)\r
- if(col->flags & KHUI_CW_COL_SORT_INC) {\r
- phi->fmt |= HDF_SORTUP;\r
- } else if(col->flags & KHUI_CW_COL_SORT_DEC) {\r
- phi->fmt |= HDF_SORTDOWN;\r
+ if (IS_COMMCTL6()) {\r
+ if(col->flags & KHUI_CW_COL_SORT_INC) {\r
+ phi->fmt |= HDF_SORTUP;\r
+ } else if(col->flags & KHUI_CW_COL_SORT_DEC) {\r
+ phi->fmt |= HDF_SORTDOWN;\r
+ }\r
}\r
#endif\r
if(col->width < 0) {\r
int selected = 0;\r
khm_int32 idf = 0;\r
\r
- /* each header consists of a 'expose' widget and some text */\r
+ /* each header consists of a couple of widgets and some text */\r
/* we need to figure out the background color first */\r
\r
cr = &(tbl->rows[row]);\r
hdc, \r
r->left, r->bottom - KHUI_SMICON_CY, \r
0);\r
- r->left += KHUI_SMICON_CX ;\r
+ r->left += KHUI_SMICON_CX * 3 / 2 ;\r
}\r
\r
/* ok, now o->header contains the string representation of the\r
WS_CHILD | HDS_BUTTONS |\r
HDS_FULLDRAG | HDS_HORZ | HDS_HOTTRACK\r
#if (_WIN32_WINNT >= 0x501)\r
- | HDS_FLAT\r
+ | ((IS_COMMCTL6())?HDS_FLAT:0)\r
#endif\r
,\r
0,0,0,0,hwnd, (HMENU) 0, khm_hInstance, NULL);\r
\r
if(j > tbl->rows[i].col) {\r
cbbuf = sizeof(buf);\r
- if(KHM_FAILED(kcdb_cred_get_attr_string((khm_handle) tbl->rows[i].data, tbl->cols[j].attr_id, buf, &cbbuf, KCDB_TS_SHORT)))\r
+ if(KHM_FAILED(kcdb_cred_get_attr_string((khm_handle) tbl->rows[i].data,\r
+ tbl->cols[j].attr_id, buf,\r
+ &cbbuf, KCDB_TS_SHORT)))\r
continue;\r
\r
rh.left += tbl->hpad;\r
rh.right -= tbl->hpad;\r
\r
SetTextAlign(hdc, 0);\r
- DrawText(hdc, buf, (int)((cbbuf / sizeof(wchar_t)) - 1), &rh, DT_LEFT | DT_VCENTER | DT_NOCLIP | DT_SINGLELINE | DT_END_ELLIPSIS);\r
+ DrawText(hdc, buf, (int)((cbbuf / sizeof(wchar_t)) - 1), &rh,\r
+ DT_LEFT | DT_VCENTER | DT_NOCLIP | DT_SINGLELINE | DT_END_ELLIPSIS);\r
//TextOut(hdc, x, y + tbl->vpad, buf, (cbbuf / sizeof(wchar_t)) - 1);\r
}\r
}\r
flag = o->flags;\r
else\r
flag = 0;\r
- }\r
- else\r
+ } else {\r
flag = tbl->rows[i].flags;\r
+ }\r
\r
flag &= CW_EXPSTATE_MASK;\r
\r
if (KHM_SUCCEEDED(kcdb_cred_get_flags((khm_handle) tbl->rows[i].data, &flags)) &&\r
(flags & KCDB_CRED_FLAG_RENEWABLE)) {\r
khui_ilist_draw_id(tbl->ilist,\r
- IDB_TK_REFRESH_SM,\r
+ IDB_FLAG_RENEW,\r
hdc,\r
x, y, 0);\r
}\r
x >= KHUI_SMICON_CX * 3 / 2 &&\r
x < KHUI_SMICON_CX * 5 / 2){\r
nm_state |= CW_MOUSE_WSTICKY | CW_MOUSE_WIDGET;\r
+ } else if (tbl->cols[tbl->rows[row].col].attr_id ==\r
+ KCDB_ATTR_ID_NAME &&\r
+ col == tbl->rows[row].col &&\r
+ x >= KHUI_SMICON_CX * 3 &&\r
+ x < KHUI_SMICON_CX * 4) {\r
+ nm_state |= CW_MOUSE_WICON | CW_MOUSE_WIDGET;\r
}\r
}\r
}\r
/* did the user drag the cursor off the current row? */\r
if((tbl->mouse_state & CW_MOUSE_LDOWN) &&\r
(nm_row != tbl->mouse_row)) {\r
- nm_state &= ~(CW_MOUSE_WIDGET | CW_MOUSE_WOUTLINE | CW_MOUSE_WSTICKY);\r
+ nm_state &= ~CW_MOUSE_WMASK;\r
}\r
\r
if(!(nm_state & CW_MOUSE_LDOWN) && \r
tbl->mouse_state = CW_MOUSE_WIDGET | CW_MOUSE_WSTICKY;\r
\r
return 0;\r
+ } else if ((nm_state & CW_MOUSE_WICON) &&\r
+ (tbl->mouse_state & CW_MOUSE_WICON)) {\r
+ /* click on an row icon */\r
+ cw_select_row(tbl, nm_row, wParam);\r
+ cw_properties(hwnd);\r
} else {\r
/* click on a row */\r
cw_select_row(tbl, nm_row, wParam);\r
return DefWindowProc(hwnd, uMsg, wParam, lParam);\r
}\r
\r
-LRESULT \r
-cw_wm_vscroll(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r
-{\r
- khui_credwnd_tbl * tbl;\r
- SCROLLINFO si;\r
+static void\r
+cw_vscroll_to_pos(HWND hwnd, khui_credwnd_tbl * tbl, int newpos) {\r
RECT cr;\r
RECT sr;\r
RECT lr;\r
int dy;\r
- int newpos;\r
\r
- tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
GetClientRect(hwnd, &cr);\r
cr.top += tbl->header_height;\r
dy = tbl->scr_top;\r
\r
- switch(LOWORD(wParam)) {\r
- case SB_LEFT:\r
- newpos = 0;\r
- break;\r
-\r
- case SB_BOTTOM:\r
- newpos = tbl->ext_height;\r
- break;\r
-\r
- case SB_LINEUP:\r
- newpos = tbl->scr_top - (tbl->ext_height / 12);\r
- break;\r
-\r
- case SB_LINEDOWN:\r
- newpos = tbl->scr_top + (tbl->ext_height / 12);\r
- break;\r
-\r
- case SB_PAGEUP:\r
- newpos = tbl->scr_top - (cr.bottom - cr.top);\r
- break;\r
-\r
- case SB_PAGEDOWN:\r
- newpos = tbl->scr_top + (cr.bottom - cr.top);\r
- break;\r
-\r
- case SB_THUMBTRACK:\r
- case SB_THUMBPOSITION:\r
- ZeroMemory(&si, sizeof(si));\r
- si.cbSize = sizeof(si);\r
- si.fMask = SIF_TRACKPOS;\r
- GetScrollInfo(hwnd, SB_VERT, &si);\r
-\r
- newpos = si.nTrackPos;\r
- break;\r
-\r
- default:\r
- return DefWindowProc(hwnd, uMsg, wParam, lParam);\r
- }\r
-\r
tbl->scr_top = newpos;\r
cw_update_extents(tbl, TRUE);\r
\r
if(lr.top < lr.bottom && lr.left < lr.right) {\r
InvalidateRect(hwnd, &lr, FALSE);\r
}\r
+}\r
+\r
+LRESULT \r
+cw_wm_vscroll(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r
+{\r
+ khui_credwnd_tbl * tbl;\r
+ SCROLLINFO si;\r
+ int newpos;\r
+ RECT cr;\r
+\r
+ tbl = (khui_credwnd_tbl *)(LONG_PTR) GetWindowLongPtr(hwnd, 0);\r
+\r
+ GetClientRect(hwnd, &cr);\r
+ cr.top += tbl->header_height;\r
+\r
+ switch(LOWORD(wParam)) {\r
+ case SB_LEFT:\r
+ newpos = 0;\r
+ break;\r
+\r
+ case SB_BOTTOM:\r
+ newpos = tbl->ext_height;\r
+ break;\r
+\r
+ case SB_LINEUP:\r
+ newpos = tbl->scr_top - (tbl->ext_height / 12);\r
+ break;\r
+\r
+ case SB_LINEDOWN:\r
+ newpos = tbl->scr_top + (tbl->ext_height / 12);\r
+ break;\r
+\r
+ case SB_PAGEUP:\r
+ newpos = tbl->scr_top - (cr.bottom - cr.top);\r
+ break;\r
+\r
+ case SB_PAGEDOWN:\r
+ newpos = tbl->scr_top + (cr.bottom - cr.top);\r
+ break;\r
+\r
+ case SB_THUMBTRACK:\r
+ case SB_THUMBPOSITION:\r
+ ZeroMemory(&si, sizeof(si));\r
+ si.cbSize = sizeof(si);\r
+ si.fMask = SIF_TRACKPOS;\r
+ GetScrollInfo(hwnd, SB_VERT, &si);\r
+\r
+ newpos = si.nTrackPos;\r
+ break;\r
+\r
+ default:\r
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);\r
+ }\r
+\r
+ cw_vscroll_to_pos(hwnd, tbl, newpos);\r
\r
return DefWindowProc(hwnd, uMsg, wParam, lParam);\r
}\r
\r
+static void\r
+cw_ensure_row_visible(HWND hwnd, khui_credwnd_tbl * tbl, int row) {\r
+ RECT r;\r
+ int newpos;\r
+\r
+ if (row < 0)\r
+ row = 0;\r
+ else if (row >= (int) tbl->n_rows)\r
+ row = (int) tbl->n_rows - 1;\r
+\r
+ GetClientRect(hwnd, &r);\r
+ r.top += tbl->header_height;\r
+\r
+ if (row * tbl->cell_height < tbl->scr_top) {\r
+ newpos = row * tbl->cell_height;\r
+ } else if ((row + 1) * tbl->cell_height\r
+ > tbl->scr_top + (r.bottom - r.top)) {\r
+ newpos = ((row + 1) * tbl->cell_height) - (r.bottom - r.top);\r
+ } else\r
+ return;\r
+\r
+ cw_vscroll_to_pos(hwnd, tbl, newpos);\r
+}\r
+\r
static INT_PTR CALLBACK \r
cw_pp_ident_proc(HWND hwnd,\r
UINT uMsg,\r
\r
case MAKEWPARAM(IDC_PP_CONFIG, BN_CLICKED):\r
{\r
+ khui_config_node cfg_id = NULL;\r
khui_config_node cfg_ids = NULL;\r
+ wchar_t idname[KCDB_IDENT_MAXCCH_NAME];\r
+ khm_size cb;\r
khm_int32 rv;\r
\r
khm_refresh_config();\r
if (KHM_FAILED(rv))\r
return TRUE;\r
\r
- khm_show_config_pane(cfg_ids);\r
+ cb = sizeof(idname);\r
+ if (KHM_SUCCEEDED(kcdb_identity_get_name(s->identity,\r
+ idname,\r
+ &cb))) {\r
+ rv = khui_cfg_open(cfg_ids,\r
+ idname,\r
+ &cfg_id);\r
+ }\r
+\r
+ if (cfg_id)\r
+ khm_show_config_pane(cfg_id);\r
+ else\r
+ khm_show_config_pane(cfg_ids);\r
\r
if (cfg_ids)\r
khui_cfg_release(cfg_ids);\r
+ if (cfg_id)\r
+ khui_cfg_release(cfg_id);\r
}\r
return TRUE;\r
}\r
InvalidateRect(tbl->hwnd, NULL, TRUE);\r
\r
khui_check_radio_action(khui_find_menu(KHUI_MENU_LAYOUT), KHUI_ACTION_LAYOUT_ID);\r
+ kmq_post_message(KMSG_ACT, KMSG_ACT_REFRESH, 0, 0);\r
}\r
break;\r
\r
\r
khui_check_radio_action(khui_find_menu(KHUI_MENU_LAYOUT), \r
KHUI_ACTION_LAYOUT_LOC);\r
+ kmq_post_message(KMSG_ACT, KMSG_ACT_REFRESH, 0, 0);\r
}\r
break;\r
\r
if(new_row < 0)\r
new_row = 0;\r
if(new_row >= (int) tbl->n_rows)\r
- new_row = (int) tbl->n_rows;\r
+ new_row = (int) tbl->n_rows - 1;\r
\r
if (LOWORD(wParam) == KHUI_PACTION_UP)\r
wp = 0;\r
#endif\r
\r
cw_select_row(tbl, new_row, wp);\r
+ cw_ensure_row_visible(hwnd, tbl, new_row);\r
}\r
break;\r
\r
if(new_row < 0)\r
new_row = 0;\r
if(new_row >= (int) tbl->n_rows)\r
- new_row = (int) tbl->n_rows;\r
+ new_row = (int) tbl->n_rows - 1;\r
\r
if (LOWORD(wParam) == KHUI_PACTION_DOWN)\r
wp = 0;\r
assert(FALSE);\r
#endif\r
cw_select_row(tbl, new_row, wp);\r
+ cw_ensure_row_visible(hwnd, tbl, new_row);\r
}\r
break;\r
\r
outline widget */\r
#define CW_MOUSE_WSTICKY 0x00000010 /* mouse is highlighting a\r
sticky widget */\r
+#define CW_MOUSE_WICON 0x00000020 /* an icon widget. represents\r
+ the icon next to identities\r
+ and next to credentials. */\r
+\r
+#define CW_MOUSE_WMASK 0x00000039 /* all widget bits */\r
\r
void khm_unregister_credwnd_class(void);\r
\r
IDI_CFG_APPLIED ICON "..\\..\\images\\cfg_applied.ico"\r
IDI_CFG_DELETED ICON "..\\..\\images\\cfg_deleted.ico"\r
IDI_ID ICON "..\\..\\images\\id.ico"\r
+IDI_APPICON_WARN ICON "..\\..\\images\\app_state_warn.ico"\r
+IDI_APPICON_EXP ICON "..\\..\\images\\app_state_exp.ico"\r
+IDI_APPICON_OK ICON "..\\..\\images\\app_state_ok.ico"\r
\r
/////////////////////////////////////////////////////////////////////////////\r
//\r
IDB_WDG_STICK BITMAP "..\\..\\images\\wdg_stick.bmp"\r
IDB_WDG_STICK_HI BITMAP "..\\..\\images\\wdg_stick_hi.bmp"\r
IDB_WDG_STUCK BITMAP "..\\..\\images\\wdg_stuck.bmp"\r
+IDB_FLAG_RENEW BITMAP "..\\..\\images\\flag_renewable.bmp"\r
\r
/////////////////////////////////////////////////////////////////////////////\r
//\r
FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
BEGIN\r
GROUPBOX "Startup",IDC_CFG_STARTUP_GROUP,7,7,241,50\r
- CONTROL "&Prompt for new credentials if there aren't any at startup",\r
+ CONTROL "&Obtain new credentials at startup (if none are present)",\r
IDC_CFG_AUTOINIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,\r
16,22,196,10\r
- CONTROL "&Start NetIDMgr when Windows starts",IDC_CFG_AUTOSTART,\r
+ CONTROL "&Start NetIDMgr during Windows logon",IDC_CFG_AUTOSTART,\r
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,16,\r
38,135,10\r
- GROUPBOX "Other",IDC_CFG_OTHER,7,63,241,70\r
- CONTROL "&Keep NetIDMgr running after closing window",\r
+ GROUPBOX "Other",IDC_CFG_OTHER,7,63,241,54\r
+ CONTROL "&Run NetIDMgr in system tray after window close",\r
IDC_CFG_KEEPRUNNING,"Button",BS_AUTOCHECKBOX | \r
- WS_TABSTOP,16,78,158,10\r
- CONTROL "Detect network connectivity",IDC_CFG_NETDETECT,"Button",\r
+ WS_TABSTOP,16,78,170,10\r
+ CONTROL "Monitor network connectivity",IDC_CFG_NETDETECT,"Button",\r
BS_AUTOCHECKBOX | WS_TABSTOP,16,96,106,10\r
- CONTROL "A&utomatically import credentials from Windows",\r
- IDC_CFG_AUTOIMPORT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,\r
- 16,113,165,10\r
+ CONTROL "A&utomatically import Windows logon identity",\r
+ IDC_CFG_AUTOIMPORT,"Button",BS_AUTOCHECKBOX | NOT \r
+ WS_VISIBLE | WS_TABSTOP,16,147,165,10\r
END\r
\r
IDD_CFG_IDENTITIES DIALOGEX 0, 0, 255, 182\r
EXSTYLE WS_EX_CONTROLPARENT\r
FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
BEGIN\r
- CONTROL "&Monitor credentials expiration",IDC_NOTIF_MONITOR,\r
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,139,10\r
- CONTROL "&Renew automatically",IDC_NOTIF_RENEW,"Button",\r
- BS_AUTOCHECKBOX | WS_TABSTOP,22,32,82,10\r
- EDITTEXT IDC_NOTIF_RENEW_THR,122,30,126,14,ES_AUTOHSCROLL\r
- CONTROL "Warn",IDC_NOTIF_WARN1,"Button",BS_AUTOCHECKBOX | \r
- WS_TABSTOP,22,57,33,10\r
- EDITTEXT IDC_NOTIF_WARN1_THR,122,55,126,14,ES_AUTOHSCROLL\r
- CONTROL "Warn again",IDC_NOTIF_WARN2,"Button",BS_AUTOCHECKBOX | \r
- WS_TABSTOP,22,82,67,10\r
- EDITTEXT IDC_NOTIF_WARN2_THR,122,80,126,14,ES_AUTOHSCROLL\r
+ CONTROL "&Monitor credential expiration",IDC_NOTIF_MONITOR,\r
+ "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,\r
+ 111,139,10\r
+ CONTROL "&Renew automatically at",IDC_NOTIF_RENEW,"Button",\r
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,9,100,10\r
+ EDITTEXT IDC_NOTIF_RENEW_THR,122,7,126,14,ES_AUTOHSCROLL\r
+ CONTROL "Initial warning at",IDC_NOTIF_WARN1,"Button",\r
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,31,100,10\r
+ EDITTEXT IDC_NOTIF_WARN1_THR,122,29,126,14,ES_AUTOHSCROLL\r
+ CONTROL "Final warning at",IDC_NOTIF_WARN2,"Button",\r
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,53,100,10\r
+ EDITTEXT IDC_NOTIF_WARN2_THR,122,51,126,14,ES_AUTOHSCROLL\r
END\r
\r
IDD_CFG_PLUGINS DIALOGEX 0, 0, 255, 182\r
EXSTYLE WS_EX_CONTROLPARENT\r
FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
BEGIN\r
- CONTROL "",IDC_CFG_IDENTS,"SysListView32",LVS_REPORT | \r
- LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | WS_BORDER | \r
- WS_TABSTOP,7,7,221,72\r
- GROUPBOX "Selected identity",IDC_CFG_IDENTITY,7,81,221,63\r
CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button",\r
- BS_3STATE | WS_DISABLED | WS_TABSTOP,13,92,107,10\r
- CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",BS_3STATE | \r
- WS_DISABLED | WS_TABSTOP,13,106,81,10\r
- CONTROL "Always show in the credentials list (Sticky)",\r
- IDC_CFG_STICKY,"Button",BS_3STATE | WS_DISABLED | \r
- WS_TABSTOP,13,120,151,10\r
- PUSHBUTTON "&Remove",IDC_CFG_REMOVE,174,126,50,14,WS_DISABLED\r
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10\r
+ CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",\r
+ BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10\r
+ CONTROL "Always show in the credentials list (Pinned)",\r
+ IDC_CFG_STICKY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,\r
+ 34,151,10\r
END\r
\r
IDD_CFG_ID_TAB DIALOGEX 0, 0, 235, 151\r
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU\r
+EXSTYLE WS_EX_CONTROLPARENT\r
FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
BEGIN\r
- CONTROL "Always show in the credentials list (Sticky)",\r
+ CONTROL "Always show in the credentials list (Pinned)",\r
IDC_CFG_STICKY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,\r
34,151,10\r
CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button",\r
BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10\r
CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",\r
BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10\r
+ PUSHBUTTON "Remove identity ...",IDC_CFG_REMOVE,139,122,78,14,NOT \r
+ WS_VISIBLE\r
END\r
\r
IDD_ABOUT DIALOGEX 0, 0, 268, 170\r
IDS_MENU_HELP "&Help"\r
IDS_ACTION_PROPERTIES "&Properties ..."\r
IDS_ACTION_EXIT "E&xit"\r
- IDS_CFG_ROOT_NAME "NetIDMgr"\r
+ IDS_CFG_ROOT_NAME "Network Identity Manager"\r
IDS_ACTION_SET_DEF_ID "Set as &default"\r
IDS_ACTION_SET_SRCH_ID "Allow applications to &search"\r
- IDS_CFG_ROOT_TITLE "NetIDMgr Configuration"\r
+ IDS_CFG_ROOT_TITLE "Network Identity Manager Configuration"\r
IDS_CFG_GENERAL_SHORT "General"\r
IDS_ACTION_NEW_CRED "&New credentials ..."\r
IDS_ACTION_PASSWD_ID "Change &password ..."\r
IDS_ACTION_HELP_CONTENTS "Contents ..."\r
IDS_ACTION_HELP_INDEX "Index ..."\r
IDS_ACTION_HELP_ABOUT "About NetIDMgr ..."\r
- IDS_CFG_GENERAL_LONG "General options for NetIDMgr"\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_WT_INIT_CREDS "Obtain initial credentials"\r
IDS_ACTION_CLOSE_APP "Close NetIDMgr window"\r
IDS_NC_FAILED_TITLE "Failed to acquire credentials"\r
IDS_CFG_IDENTITIES_SHORT "Identities"\r
- IDS_CFG_IDENTITIES_LONG "Options for all identities"\r
+ IDS_CFG_IDENTITIES_LONG "Global Identity settings"\r
IDS_CFG_NOTIF_SHORT "Notifications"\r
IDS_CFG_NOTIF_LONG "Notifications"\r
IDS_CFG_PLUGINS_SHORT "Plugins"\r
"This is quite possibly caused by the identity provider module failing to load properly."\r
IDS_NC_REN_FAILED_TITLE "Failed to renew credentials"\r
IDS_CW_DEFAULT "(Default)"\r
+ IDS_ACTION_OPT_PLUGINS "Plugins ..."\r
+ IDS_NC_SETDEF "&Set as default identity"\r
+ IDS_NC_ID_DEF "<p>This identity is the default</p>"\r
+ IDS_NC_ID_WDEF "<p>Will be the default. (<a id=""NotDef"">Don't make default</a>)</p>"\r
+ IDS_NC_ID_NDEF "<p>Not default identity. (<a id=""MakeDef"">make default</a>)</p>"\r
END\r
\r
#endif // English (U.S.) resources\r
\r
static wchar_t helpfile[MAX_PATH] = L"";\r
\r
-HWND khm_html_help(HWND hwnd, UINT command, DWORD_PTR data) {\r
+HWND khm_html_help(HWND hwnd, wchar_t * suffix,\r
+ UINT command, DWORD_PTR data) {\r
+\r
+ wchar_t gpath[MAX_PATH + MAX_PATH];\r
+\r
if (!*helpfile) {\r
DWORD dw;\r
wchar_t ppath[MAX_PATH];\r
}\r
}\r
\r
- return HtmlHelp(hwnd, helpfile, command, data);\r
+ StringCbCopy(gpath, sizeof(gpath), helpfile);\r
+\r
+ if (suffix)\r
+ StringCbCat(gpath, sizeof(gpath), suffix);\r
+\r
+ return HtmlHelp(hwnd, gpath, command, data);\r
}\r
\r
void khm_load_default_modules(void) {\r
def = khui_find_menu(act->cmd);\r
if(def) {\r
mii.fMask |= MIIM_SUBMENU;\r
- mii.hSubMenu = mm_create_menu_from_def(def);\r
+ mii.hSubMenu = mm_create_menu_from_def(def, FALSE);\r
}\r
\r
if(flags & KHUI_ACTIONREF_DEFAULT)\r
InsertMenuItem(hm,idx,TRUE,&mii);\r
}\r
\r
-static HMENU mm_create_menu_from_def(khui_menu_def * def) {\r
+static void refresh_menu(HMENU hm, khui_menu_def * def);\r
+\r
+static void refresh_menu_item(HMENU hm, khui_action * act, \r
+ int idx, int flags) {\r
+ MENUITEMINFO mii;\r
+\r
+ mii.cbSize = sizeof(mii);\r
+ mii.fMask = 0;\r
+\r
+ if (act == NULL)\r
+ return;\r
+ else {\r
+ khui_menu_def * def;\r
+\r
+ if(act->state & KHUI_ACTIONSTATE_DISABLED) {\r
+ mii.fMask |= MIIM_STATE;\r
+ mii.fState = MFS_DISABLED;\r
+ } else {\r
+ mii.fMask |= MIIM_STATE;\r
+ mii.fState = MFS_ENABLED;\r
+ }\r
+\r
+ if(act->type & KHUI_ACTIONTYPE_TOGGLE) {\r
+ mii.fMask |= MIIM_STATE;\r
+ if (act->state & KHUI_ACTIONSTATE_CHECKED) {\r
+ mii.fState |= MFS_CHECKED;\r
+ } else {\r
+ mii.fState |= MFS_UNCHECKED;\r
+ }\r
+ }\r
+\r
+ SetMenuItemInfo(hm, act->cmd, FALSE, &mii);\r
+\r
+ def = khui_find_menu(act->cmd);\r
+ if(def) {\r
+ MENUITEMINFO mii2;\r
+\r
+ mii2.cbSize = sizeof(mii2);\r
+ mii2.fMask = MIIM_SUBMENU;\r
+\r
+ if (GetMenuItemInfo(hm, act->cmd, FALSE, &mii2)) {\r
+ refresh_menu(mii2.hSubMenu, def);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+static void refresh_menu(HMENU hm, khui_menu_def * def) {\r
+ khui_action_ref * act;\r
+ int i;\r
+\r
+ act = def->items;\r
+ i = 0;\r
+ while ((def->n_items == -1 && act->action != KHUI_MENU_END) ||\r
+ (def->n_items >= 0 && i < (int) def->n_items)) {\r
+ refresh_menu_item(hm, khui_find_action(act->action), i, act->flags);\r
+ act++; i++;\r
+ }\r
+}\r
+\r
+static HMENU mm_create_menu_from_def(khui_menu_def * def, BOOL main) {\r
HMENU hm;\r
khui_action_ref * act;\r
int i;\r
\r
- hm = CreatePopupMenu();\r
+ if (main)\r
+ hm = CreateMenu();\r
+ else\r
+ hm = CreatePopupMenu();\r
+\r
act = def->items;\r
i = 0;\r
while((def->n_items == -1 && act->action != KHUI_MENU_END) ||\r
{\r
HMENU hm;\r
\r
- hm = mm_create_menu_from_def(def);\r
+ hm = mm_create_menu_from_def(def, FALSE);\r
\r
mm_hot_track = (mm_last_hot_item >= 0);\r
\r
} else if(menu_id == MENU_ACTIVATE_NONE) {\r
menu_id = -1;\r
}\r
-\r
\r
SendMessage(khui_main_menu_toolbar,\r
- TB_SETHOTITEM,\r
- menu_id,\r
- 0);\r
+ TB_SETHOTITEM,\r
+ menu_id,\r
+ 0);\r
\r
khm_menu_track_current();\r
\r
return ret;\r
}\r
\r
-void khm_menu_create_main(HWND rebar) {\r
+HMENU khui_hmenu_main = NULL;\r
+\r
+void khm_menu_refresh_items(void) {\r
+ khui_menu_def * def;\r
+\r
+ if (!khui_hmenu_main)\r
+ return;\r
+\r
+ def = khui_find_menu(KHUI_MENU_MAIN);\r
+\r
+ refresh_menu(khui_hmenu_main, def);\r
+\r
+ DrawMenuBar(khm_hwnd_main);\r
+}\r
+\r
+void khm_menu_create_main(HWND parent) {\r
+ HMENU hmenu;\r
+ khui_menu_def * def;\r
+\r
+ def = khui_find_menu(KHUI_MENU_MAIN);\r
+\r
+ hmenu = mm_create_menu_from_def(def, TRUE);\r
+\r
+ SetMenu(parent, hmenu);\r
+\r
+ khui_hmenu_main = hmenu;\r
+\r
+ return;\r
+\r
+#ifdef USE_EXPLORER_STYLE_MENU_BAR\r
HWND hwtb;\r
REBARBANDINFO rbi;\r
SIZE sz;\r
RB_INSERTBAND,\r
0,\r
(LPARAM) &rbi);\r
+#endif\r
}\r
void khm_menu_track_current(void);\r
LRESULT khm_menu_measure_item(WPARAM wParam, LPARAM lparam);\r
LRESULT khm_menu_draw_item(WPARAM wParam, LPARAM lparam);\r
+void khm_menu_refresh_items(void);\r
\r
-static HMENU mm_create_menu_from_def(khui_menu_def * def);\r
+static HMENU mm_create_menu_from_def(khui_menu_def * def, BOOL main);\r
static void mm_show_panel_def(khui_menu_def * def, LONG x, LONG y);\r
\r
void khui_init_menu(void);\r
break;\r
\r
case WM_HELP:\r
- MessageBox(khm_hwnd_main, L"WM_HELP", L"Notice", MB_OK);\r
+ khm_html_help(khm_hwnd_main, NULL, HH_HELP_CONTEXT, IDH_WELCOME);\r
break;\r
\r
case WM_COMMAND:\r
}\r
break;\r
\r
+ case KHUI_ACTION_OPT_PLUGINS: {\r
+ khui_config_node node;\r
+\r
+ khui_cfg_open(NULL, L"KhmPlugins", &node);\r
+ khm_show_config_pane(node);\r
+ }\r
+ break;\r
+\r
case KHUI_ACTION_HELP_CTX:\r
- khm_html_help(khm_hwnd_main, HH_HELP_CONTEXT, IDH_WELCOME);\r
+ khm_html_help(khm_hwnd_main, NULL, HH_HELP_CONTEXT, IDH_WELCOME);\r
break;\r
\r
case KHUI_ACTION_HELP_CONTENTS:\r
- khm_html_help(khm_hwnd_main, HH_DISPLAY_TOC, 0);\r
+ khm_html_help(khm_hwnd_main, NULL, HH_DISPLAY_TOC, 0);\r
break;\r
\r
case KHUI_ACTION_HELP_INDEX:\r
- khm_html_help(khm_hwnd_main, HH_DISPLAY_INDEX, (DWORD_PTR) L"");\r
+ khm_html_help(khm_hwnd_main, NULL, HH_DISPLAY_INDEX, (DWORD_PTR) L"");\r
break;\r
\r
case KHUI_ACTION_HELP_ABOUT:\r
kmq_wm_begin(lParam, &m);\r
if (m->type == KMSG_ACT &&\r
m->subtype == KMSG_ACT_REFRESH) {\r
+ khm_menu_refresh_items();\r
khm_update_standard_toolbar();\r
} else if (m->type == KMSG_ACT &&\r
m->subtype == KMSG_ACT_BEGIN_CMDLINE) {\r
khm_cred_begin_commandline();\r
+ } else if (m->type == KMSG_ACT &&\r
+ m->subtype == KMSG_ACT_CONTINUE_CMDLINE) {\r
+ khm_cred_process_commandline();\r
} else if (m->type == KMSG_CRED &&\r
m->subtype == KMSG_CRED_REFRESH) {\r
mw_restart_refresh_timer(hwnd);\r
REBARINFO rbi;\r
HWND hwRebar;\r
\r
+ khm_menu_create_main(hwnd_main);\r
+\r
hwRebar = \r
CreateWindowEx(WS_EX_TOOLWINDOW,\r
REBARCLASSNAME,\r
return;\r
\r
/* self attach */\r
- khm_menu_create_main(hwRebar);\r
khm_create_standard_toolbar(hwRebar);\r
khm_create_statusbar(hwnd_main);\r
\r
{\r
switch(uMsg) {\r
case WM_INITDIALOG:\r
+ {\r
+ khui_nc_wnd_data * d;\r
+\r
+ d = (khui_nc_wnd_data *) lParam;\r
\r
#pragma warning(push)\r
#pragma warning(disable: 4244)\r
- SetWindowLongPtr(hwnd, DWLP_USER, lParam);\r
+ SetWindowLongPtr(hwnd, DWLP_USER, lParam);\r
#pragma warning(pop)\r
-\r
+ if (d->nc->subtype == KMSG_CRED_PASSWORD) {\r
+ ShowWindow(GetDlgItem(hwnd, IDC_NC_OPTIONS),\r
+ SW_HIDE);\r
+ }\r
+ }\r
return TRUE;\r
\r
case WM_COMMAND:\r
kcdb_identity_get_name(d->nc->identities[0], id_name, &cbbuf);\r
\r
kcdb_identity_get_flags(d->nc->identities[0], &flags);\r
+\r
if (flags & KCDB_IDENT_FLAG_INVALID) {\r
LoadString(khm_hInstance, IDS_NC_CREDTEXT_ID_INVALID, \r
id_fmt, (int) ARRAYLENGTH(id_fmt));\r
StringCbPrintf(buf, NC_MAXCB_CREDTEXT - cch*sizeof(wchar_t), \r
main_fmt, id_string);\r
\r
+ if (flags & KCDB_IDENT_FLAG_VALID) {\r
+ if (flags & KCDB_IDENT_FLAG_DEFAULT)\r
+ LoadString(khm_hInstance, IDS_NC_ID_DEF,\r
+ id_string, ARRAYLENGTH(id_string));\r
+ else if (d->nc->set_default)\r
+ LoadString(khm_hInstance, IDS_NC_ID_WDEF,\r
+ id_string, ARRAYLENGTH(id_string));\r
+ else\r
+ LoadString(khm_hInstance, IDS_NC_ID_NDEF,\r
+ id_string, ARRAYLENGTH(id_string));\r
+\r
+ StringCbCat(buf, NC_MAXCB_CREDTEXT - cch * sizeof(wchar_t),\r
+ id_string);\r
+ }\r
+\r
} else if(d->nc->n_identities > 1) {\r
wchar_t *ids_string;\r
khm_size cb_ids_string;\r
\r
#define CW_PARAM DWLP_USER\r
\r
+static void\r
+nc_add_control_row(khui_nc_wnd_data * d, \r
+ HWND label,\r
+ HWND input,\r
+ khui_control_size size);\r
+\r
static LRESULT \r
nc_handle_wm_create(HWND hwnd,\r
UINT uMsg,\r
ShowWindow(ncd->dlg_ts, SW_HIDE);\r
\r
nc_position_credtext(ncd);\r
+\r
} else {\r
/* hide and show stuff */\r
ShowWindow(ncd->dlg_main, SW_SHOW);\r
selector controls */\r
c->ident_cb(c, WMNC_IDENT_INIT, NULL, 0, 0, (LPARAM) ncd->dlg_main);\r
\r
+#if 0\r
+ {\r
+ HWND hw;\r
+ wchar_t wcaption[64];\r
+\r
+ LoadString(khm_hInstance, IDS_NC_SETDEF, wcaption,\r
+ ARRAYLENGTH(wcaption));\r
+\r
+ /* Now create the set as default button */\r
+ hw = CreateWindow\r
+ (L"BUTTON",\r
+ wcaption,\r
+ WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX,\r
+ 0, 0, 100, 100,\r
+ ncd->dlg_main,\r
+ (HMENU) NC_BN_SET_DEF_ID,\r
+ khm_hInstance,\r
+ NULL);\r
+\r
+ nc_add_control_row(ncd, NULL, hw, KHUI_CTRLSIZE_HALF);\r
+ }\r
+#endif\r
/* we defer the creation of the tab buttons for later */\r
\r
/* add this to the dialog chain */\r
#endif\r
}\r
\r
- SetWindowPos(label,\r
- ((d->hwnd_last_idspec != NULL)?\r
- d->hwnd_last_idspec:\r
- HWND_TOP),\r
- r_label.left, r_label.top,\r
- r_label.right - r_label.left,\r
- r_label.bottom - r_label.top,\r
- SWP_DEFERERASE | SWP_NOACTIVATE |\r
- SWP_NOOWNERZORDER);\r
-\r
- SetWindowPos(input,\r
- label,\r
- r_input.left, r_input.top,\r
- r_input.right - r_input.left,\r
- r_input.bottom - r_input.top,\r
- SWP_DEFERERASE | SWP_NOACTIVATE |\r
- SWP_NOOWNERZORDER);\r
+ if (label)\r
+ SetWindowPos(label,\r
+ ((d->hwnd_last_idspec != NULL)?\r
+ d->hwnd_last_idspec:\r
+ HWND_TOP),\r
+ r_label.left, r_label.top,\r
+ r_label.right - r_label.left,\r
+ r_label.bottom - r_label.top,\r
+ SWP_DEFERERASE | SWP_NOACTIVATE |\r
+ SWP_NOOWNERZORDER);\r
+\r
+ if (input)\r
+ SetWindowPos(input,\r
+ (label ? label : ((d->hwnd_last_idspec != NULL)?\r
+ d->hwnd_last_idspec:\r
+ HWND_TOP)),\r
+ r_input.left, r_input.top,\r
+ r_input.right - r_input.left,\r
+ r_input.bottom - r_input.top,\r
+ SWP_DEFERERASE | SWP_NOACTIVATE |\r
+ SWP_NOOWNERZORDER);\r
\r
d->hwnd_last_idspec = input;\r
\r
}\r
return FALSE;\r
\r
+ case IDC_NC_HELP:\r
+ khm_html_help(hwnd, NULL, HH_HELP_CONTEXT, IDH_ACTION_NEW_ID);\r
+ return FALSE;\r
+\r
case IDC_NC_OPTIONS: \r
/* the Options button in the main window was clicked. we\r
respond by expanding the dialog. */\r
WMNC_DIALOG_SWITCH_PANEL),\r
0);\r
}\r
+ } else if (!wcsicmp(sid, L"NotDef")) {\r
+ d->nc->set_default = FALSE;\r
+ nc_update_credtext(d);\r
+ } else if (!wcsicmp(sid, L"MakeDef")) {\r
+ d->nc->set_default = TRUE;\r
+ nc_update_credtext(d);\r
}\r
}\r
return FALSE;\r
\r
+#if 0\r
+ case NC_BN_SET_DEF_ID:\r
+ {\r
+ d->nc->set_default =\r
+ (IsDlgButtonChecked(d->dlg_main, NC_BN_SET_DEF_ID)\r
+ == BST_CHECKED);\r
+ }\r
+ return FALSE;\r
+#endif\r
+\r
default:\r
/* if one of the tab strip buttons were pressed, then\r
we should switch to that panel */\r
\r
nc_notify_types(d->nc, KHUI_WM_NC_NOTIFY,\r
MAKEWPARAM(0, WMNC_IDENTITY_CHANGE), 0);\r
+\r
+ if (d->nc->subtype == KMSG_CRED_NEW_CREDS &&\r
+ d->nc->n_identities > 0 &&\r
+ d->nc->identities[0]) {\r
+ khm_int32 f = 0;\r
+\r
+ kcdb_identity_get_flags(d->nc->identities[0], &f);\r
+\r
+ if (!(f & KCDB_IDENT_FLAG_DEFAULT)) {\r
+ d->nc->set_default = FALSE;\r
+ }\r
+ }\r
+\r
nc_update_credtext(d);\r
+\r
}\r
break;\r
\r
SWP_NOACTIVATE | SWP_NOMOVE | \r
SWP_NOOWNERZORDER | SWP_NOSIZE | \r
SWP_SHOWWINDOW);\r
- \r
+\r
+ SendMessage(hw, EM_SETLIMITTEXT,\r
+ KHUI_MAXCCH_PROMPT_VALUE -1,\r
+ 0);\r
+\r
d->nc->prompts[i]->hwnd_edit = hw;\r
\r
hw_prev = hw;\r
\r
nc = d->nc;\r
\r
- /* reset state */\r
- nc->result = KHUI_NC_RESULT_CANCEL;\r
-\r
if(nc->response & KHUI_NC_RESPONSE_NOEXIT) {\r
HWND hw;\r
\r
+ /* reset state */\r
+ nc->result = KHUI_NC_RESULT_CANCEL;\r
+\r
hw = GetDlgItem(d->dlg_main, IDOK);\r
EnableWindow(hw, TRUE);\r
hw = GetDlgItem(d->dlg_main, IDCANCEL);\r
return TRUE;\r
}\r
\r
+static LRESULT nc_handle_wm_help(HWND hwnd,\r
+ UINT uMsg,\r
+ WPARAM wParam,\r
+ LPARAM lParam) {\r
+ static DWORD ctxids[] = {\r
+ NC_TS_CTRL_ID_MIN, IDH_NC_TABMAIN,\r
+ NC_TS_CTRL_ID_MIN + 1, IDH_NC_TABBUTTON,\r
+ NC_TS_CTRL_ID_MIN + 2, IDH_NC_TABBUTTON,\r
+ NC_TS_CTRL_ID_MIN + 3, IDH_NC_TABBUTTON,\r
+ NC_TS_CTRL_ID_MIN + 4, IDH_NC_TABBUTTON,\r
+ NC_TS_CTRL_ID_MIN + 5, IDH_NC_TABBUTTON,\r
+ NC_TS_CTRL_ID_MIN + 6, IDH_NC_TABBUTTON,\r
+ NC_TS_CTRL_ID_MIN + 7, IDH_NC_TABBUTTON,\r
+ IDOK, IDH_NC_OK,\r
+ IDCANCEL, IDH_NC_CANCEL,\r
+ IDC_NC_HELP, IDH_NC_HELP,\r
+ IDC_NC_OPTIONS, IDH_NC_OPTIONS,\r
+ IDC_NC_CREDTEXT, IDH_NC_CREDWND,\r
+ 0\r
+ };\r
+\r
+ HELPINFO * hlp;\r
+ HWND hw = NULL;\r
+ HWND hw_ctrl;\r
+ khui_nc_wnd_data * d;\r
+\r
+ d = (khui_nc_wnd_data *)(LONG_PTR) GetWindowLongPtr(hwnd, CW_PARAM);\r
+\r
+ hlp = (HELPINFO *) lParam;\r
+\r
+ if (d->nc->subtype != KMSG_CRED_NEW_CREDS &&\r
+ d->nc->subtype != KMSG_CRED_PASSWORD)\r
+ return TRUE;\r
+\r
+ if (hlp->iContextType != HELPINFO_WINDOW)\r
+ return TRUE;\r
+\r
+ if (hlp->hItemHandle != NULL &&\r
+ hlp->hItemHandle != hwnd) {\r
+ DWORD id;\r
+ int i;\r
+\r
+ hw_ctrl =hlp->hItemHandle;\r
+\r
+ id = GetWindowLong(hw_ctrl, GWL_ID);\r
+ for (i=0; ctxids[i] != 0; i += 2)\r
+ if (ctxids[i] == id)\r
+ break;\r
+\r
+ if (ctxids[i] != 0)\r
+ hw = khm_html_help(hw_ctrl,\r
+ ((d->nc->subtype == KMSG_CRED_NEW_CREDS)?\r
+ L"::popups_newcreds.txt":\r
+ L"::popups_password.txt"),\r
+ HH_TP_HELP_WM_HELP,\r
+ (DWORD_PTR) ctxids);\r
+ }\r
+\r
+ if (hw == NULL) {\r
+ khm_html_help(hwnd, NULL, HH_HELP_CONTEXT,\r
+ ((d->nc->subtype == KMSG_CRED_NEW_CREDS)?\r
+ IDH_ACTION_NEW_ID: IDH_ACTION_PASSWD_ID));\r
+ }\r
+\r
+ return TRUE;\r
+}\r
\r
static LRESULT CALLBACK nc_window_proc(HWND hwnd,\r
UINT uMsg,\r
case WM_MOVING:\r
return nc_handle_wm_moving(hwnd, uMsg, wParam, lParam);\r
\r
+ case WM_HELP:\r
+ return nc_handle_wm_help(hwnd, uMsg, wParam, lParam);\r
+\r
case KHUI_WM_NC_NOTIFY:\r
return nc_handle_wm_nc_notify(hwnd, uMsg, wParam, lParam);\r
}\r
/* Maximum control ID */\r
#define NC_TS_CTRL_ID_MAX (NC_TS_CTRL_ID_MIN + NC_TS_MAX_CTRLS - 1)\r
\r
+#define NC_BN_SET_DEF_ID 8012\r
+\r
/* the first control ID that may be used by an identity provider */\r
#define NC_IS_CTRL_ID_MIN 8016\r
\r
khm_int32 alert_queue_head = 0;\r
khm_int32 alert_queue_tail = 0;\r
\r
+int iid_normal = IDI_NOTIFY_NONE;\r
+\r
#define is_alert_queue_empty() (alert_queue_head == alert_queue_tail)\r
#define is_alert_queue_full() (((alert_queue_tail + 1) % KHUI_ALERT_QUEUE_MAX) == alert_queue_head)\r
\r
\r
case WM_LBUTTONUP:\r
/* fall through */\r
-\r
case NIN_SELECT:\r
+ /* fall through */\r
case NIN_KEYSELECT:\r
khm_show_main_window();\r
break;\r
ni.hWnd = hwnd_notifier;\r
ni.uID = KHUI_NOTIFY_ICON_ID;\r
ni.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;\r
- ni.hIcon = LoadIcon(khm_hInstance, MAKEINTRESOURCE(IDI_NOTIFY_NONE));\r
+ ni.hIcon = LoadIcon(khm_hInstance, MAKEINTRESOURCE(iid_normal));\r
ni.uCallbackMessage = KHUI_WM_NOTIFIER;\r
LoadString(khm_hInstance, IDS_NOTIFY_PREFIX, buf, ARRAYLENGTH(buf));\r
StringCbCopy(ni.szTip, sizeof(ni.szTip), buf);\r
iid = IDI_NOTIFY_ERROR;\r
} else {\r
ni.dwInfoFlags = NIIF_NONE;\r
- iid = IDI_NOTIFY_NONE;\r
+ iid = iid_normal;\r
}\r
\r
ni.hWnd = hwnd_notifier;\r
DestroyIcon(ni.hIcon);\r
}\r
\r
+void khm_notify_icon_expstate(enum khm_notif_expstate expseverity) {\r
+ int new_iid;\r
+\r
+ if (expseverity == KHM_NOTIF_OK)\r
+ new_iid = IDI_APPICON_OK;\r
+ else if (expseverity == KHM_NOTIF_WARN)\r
+ new_iid = IDI_APPICON_WARN;\r
+ else if (expseverity == KHM_NOTIF_EXP)\r
+ new_iid = IDI_APPICON_EXP;\r
+ else\r
+ new_iid = IDI_NOTIFY_NONE;\r
+\r
+ if (iid_normal == new_iid)\r
+ return;\r
+\r
+ iid_normal = new_iid;\r
+\r
+ if (current_alert == NULL)\r
+ khm_notify_icon_change(KHERR_NONE);\r
+}\r
+\r
void khm_notify_icon_change(khm_int32 severity) {\r
NOTIFYICONDATA ni;\r
wchar_t buf[256];\r
else if (severity == KHERR_ERROR)\r
iid = IDI_NOTIFY_ERROR;\r
else\r
- iid = IDI_NOTIFY_NONE;\r
+ iid = iid_normal;\r
\r
ZeroMemory(&ni, sizeof(ni));\r
\r
#ifndef __KHIMAIRA_NOTIFIER_H\r
#define __KHIMAIRA_NOTIFIER_H\r
\r
+extern HWND hwnd_notifier;\r
+\r
+enum khm_notif_expstate {\r
+ KHM_NOTIF_EMPTY,\r
+ KHM_NOTIF_OK,\r
+ KHM_NOTIF_WARN,\r
+ KHM_NOTIF_EXP\r
+};\r
+\r
void \r
khm_init_notifier(void);\r
\r
wchar_t * msg,\r
khm_int32 timeout);\r
\r
+void\r
+khm_notify_icon_expstate(enum khm_notif_expstate expseverity);\r
+\r
#endif\r
kcdb_identity_create(widname,\r
KCDB_IDENT_FLAG_CREATE,\r
&identity);\r
-\r
}\r
\r
+ widname[0] = 0;\r
+\r
do {\r
if (khm_cred_is_in_dialog()) {\r
- khm_cred_wait_for_dialog(INFINITE, NULL);\r
+ khm_cred_wait_for_dialog(INFINITE, NULL, NULL, 0);\r
}\r
\r
if (identity)\r
else\r
khui_context_reset();\r
\r
-\r
if (pdlginfo->dlgtype == NETID_DLGTYPE_TGT)\r
SendMessage(khm_hwnd_main, WM_COMMAND,\r
MAKEWPARAM(KHUI_ACTION_NEW_CRED, 0), 0);\r
else\r
break;\r
\r
- if (KHM_FAILED(khm_cred_wait_for_dialog(INFINITE, &result)))\r
+ if (KHM_FAILED(khm_cred_wait_for_dialog(INFINITE, &result,\r
+ widname,\r
+ sizeof(widname))))\r
continue;\r
else {\r
lr = (result != KHUI_NC_RESULT_GET_CREDS);\r
}\r
} while(TRUE);\r
\r
+#ifdef DEBUG\r
+ assert(lr || pdlginfo->dlgtype != NETID_DLGTYPE_TGT ||\r
+ widname[0]);\r
+#endif\r
+\r
+ if (!lr && pdlginfo->dlgtype == NETID_DLGTYPE_TGT &&\r
+ widname[0]) {\r
+ khm_handle out_ident;\r
+ wchar_t * atsign;\r
+\r
+ atsign = wcsrchr(widname, L'@');\r
+\r
+ if (atsign == NULL)\r
+ goto _exit;\r
+\r
+ if (KHM_SUCCEEDED(kcdb_identity_create(widname,\r
+ 0,\r
+ &out_ident))) {\r
+ khm_size cb;\r
+\r
+ pdlginfo->out.ccache[0] = 0;\r
+\r
+ cb = sizeof(pdlginfo->out.ccache);\r
+ kcdb_identity_get_attrib(out_ident,\r
+ L"Krb5CCName",\r
+ NULL,\r
+ pdlginfo->out.ccache,\r
+ &cb);\r
+ kcdb_identity_release(out_ident);\r
+ }\r
+#ifdef DEBUG\r
+ else {\r
+ assert(FALSE);\r
+ }\r
+#endif\r
+\r
+ *atsign++ = 0;\r
+\r
+ StringCbCopy(pdlginfo->out.username,\r
+ sizeof(pdlginfo->out.username),\r
+ widname);\r
+\r
+ StringCbCopy(pdlginfo->out.realm,\r
+ sizeof(pdlginfo->out.realm),\r
+ atsign);\r
+ }\r
+\r
+ _exit:\r
+\r
if (pdlginfo)\r
UnmapViewOfFile(pdlginfo);\r
if (hmap)\r
CloseHandle(hmap);\r
+ if (identity)\r
+ kcdb_identity_release(identity);\r
\r
return lr;\r
}\r
\r
-#if 0\r
+#ifdef DEPRECATED_REMOTE_CALL\r
/* deprecated */\r
case ID_OBTAIN_TGT_WITH_LPARAM:\r
{\r
#ifdef DEBUG\r
DWORD dw;\r
#endif\r
+\r
khm_register_reqdaemonwnd_class();\r
\r
#ifdef DEBUG\r
#define IDB_WDG_STUCK 201\r
#define IDS_ACTION_IMPORT 202\r
#define IDS_CTX_IMPORT 203\r
+#define IDB_FLAG_RENEW 203\r
#define IDS_CFG_PI_COL_PLUGINS 204\r
+#define IDI_APPICON_WARN 204\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 IDS_PISTATE_FAILDIS 208\r
#define IDS_PISTATE_FAILLOD 209\r
#define IDS_ERR_SUGG_NO_IDENTPRO 225\r
#define IDS_NC_REN_FAILED_TITLE 226\r
#define IDS_CW_DEFAULT 227\r
+#define IDS_ACTION_OPT_PLUGINS 228\r
+#define IDS_NC_SETDEF 229\r
+#define IDS_NC_ID_DEF 230\r
+#define IDS_NC_ID_WDEF 231\r
+#define IDS_NC_ID_NDEF 232\r
#define IDC_NC_USERNAME 1007\r
#define IDC_NC_PASSWORD 1008\r
#define IDC_NC_CREDTEXT_LABEL 1009\r
// \r
#ifdef APSTUDIO_INVOKED\r
#ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE 202\r
+#define _APS_NEXT_RESOURCE_VALUE 207\r
#define _APS_NEXT_COMMAND_VALUE 40010\r
-#define _APS_NEXT_CONTROL_VALUE 1105\r
+#define _APS_NEXT_CONTROL_VALUE 1107\r
#define _APS_NEXT_SYMED_VALUE 101\r
#endif\r
#endif\r
static void\r
tmr_fire_timer(void) {\r
int i;\r
- __int64 curtime;\r
- __int64 err;\r
- __int64 next_event;\r
+ unsigned __int64 curtime;\r
+ unsigned __int64 err;\r
+ unsigned __int64 next_event;\r
int tmr_count[KHUI_N_TTYPES];\r
- __int64 tmr_offset[KHUI_N_TTYPES];\r
+ unsigned __int64 tmr_offset[KHUI_N_TTYPES];\r
int t;\r
khm_handle eff_ident = NULL;\r
khui_timer_type eff_type = 0; /* meaningless */\r
int fire_count = 0;\r
+ FILETIME ft;\r
+\r
+ TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR_SMALL, &ft);\r
+ err = FtToInt(&ft);\r
+ GetSystemTimeAsFileTime(&ft);\r
+ curtime = FtToInt(&ft);\r
\r
- TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR_SMALL, \r
- (LPFILETIME) &err);\r
- GetSystemTimeAsFileTime((LPFILETIME) &curtime);\r
next_event = 0;\r
\r
ZeroMemory(tmr_count, sizeof(tmr_count));\r
wchar_t wtime[128];\r
wchar_t wmsg[256];\r
wchar_t wtitle[64];\r
- __int64 ft_second;\r
+ unsigned __int64 second;\r
khui_alert * alert = NULL;\r
\r
khm_size cb;\r
seconds' instead of '5 mins' and so on when converting to a\r
string. So we add half a second to make the message\r
neater. */\r
- TimetToFileTimeInterval(1, (LPFILETIME) &ft_second);\r
- next_event += ft_second / 2;\r
+ TimetToFileTimeInterval(1, &ft);\r
+ second = FtToInt(&ft);\r
+ next_event += second / 2;\r
\r
cb = sizeof(wtime);\r
-\r
- FtIntervalToString((LPFILETIME) &next_event,\r
+ ft = IntToFt(next_event);\r
+ FtIntervalToString(&ft,\r
wtime,\r
&cb);\r
\r
cb = sizeof(idname);\r
kcdb_identity_get_name(eff_ident, idname, &cb);\r
\r
- if (next_event < ft_second) {\r
+ if (next_event < second) {\r
LoadString(khm_hInstance, IDS_WARN_EXPIRED_ID,\r
fmt, ARRAYLENGTH(fmt));\r
\r
StringCbPrintf(wmsg, sizeof(wmsg), fmt, idname, wtime);\r
}\r
} else {\r
- if (next_event < ft_second) {\r
+ if (next_event < second) {\r
LoadString(khm_hInstance, IDS_WARN_EXPIRED,\r
wmsg, ARRAYLENGTH(wmsg));\r
} else {\r
khm_handle ident = NULL;\r
int mark_idx;\r
int idx;\r
- __int64 ft_expiry;\r
- __int64 ft_current;\r
- __int64 ft_cred_expiry;\r
- __int64 ft;\r
- __int64 fte;\r
- __int64 ft_reinst;\r
+ FILETIME ft_expiry;\r
+ FILETIME ft_current;\r
+ FILETIME ft_creinst;\r
+ FILETIME ft_cred_expiry;\r
+ FILETIME ft;\r
+ FILETIME fte;\r
+ FILETIME ft_reinst;\r
khm_size cb;\r
\r
kcdb_cred_get_identity(cred, &ident);\r
}\r
\r
/* and the current time */\r
- GetSystemTimeAsFileTime((LPFILETIME) &ft_current);\r
+ GetSystemTimeAsFileTime(&ft_current);\r
+\r
+ TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR, &ft_reinst);\r
\r
- TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR, (LPFILETIME) &ft_reinst);\r
+ ft_creinst = FtAdd(&ft_current, &ft_reinst);\r
\r
mark_idx = tmr_find(ident, KHUI_TTYPE_ID_MARK, 0, 0);\r
\r
khm_int32 to_crit = KHUI_DEF_TIMEOUT_CRIT;\r
khm_int32 to_renew = KHUI_DEF_TIMEOUT_RENEW;\r
\r
- if (ft_expiry < ft_current)\r
+ if (CompareFileTime(&ft_expiry, &ft_current) < 0)\r
/* already expired */\r
goto _done_with_ident;\r
\r
if (monitor && do_renew) {\r
int prev;\r
\r
- TimetToFileTimeInterval(to_renew, (LPFILETIME) &ft);\r
- fte = ft_expiry - ft;\r
+ TimetToFileTimeInterval(to_renew, &ft);\r
+ fte = FtSub(&ft_expiry, &ft);\r
\r
prev =\r
tmr_find(ident, KHUI_TTYPE_ID_RENEW, 0, 0);\r
This maybe because that NetIDMgr was started at the\r
last minute, or because for some reason the renew timer\r
could not be triggered earlier. */\r
- if (fte > ft_current ||\r
+ if (CompareFileTime(&fte, &ft_current) > 0 ||\r
prev == -1 ||\r
!(khui_timers[prev].flags & KHUI_TE_FLAG_EXPIRED)) {\r
\r
- if (fte <= ft_current)\r
+ if (CompareFileTime(&fte, &ft_current) < 0)\r
fte = ft_current;\r
\r
tmr_update(ident, KHUI_TTYPE_ID_RENEW, \r
- fte, ft, 0, fte > ft_current + ft_reinst);\r
+ FtToInt(&fte), FtToInt(&ft), 0,\r
+ CompareFileTime(&fte,&ft_creinst) > 0);\r
renew_done = TRUE;\r
} else {\r
/* special case. If the renew timer was in the past\r
failed we don't want to automatically retry\r
everytime we check the timers. */\r
tmr_update(ident, KHUI_TTYPE_ID_RENEW,\r
- fte, ft, 0, FALSE);\r
+ FtToInt(&fte), FtToInt(&ft), 0, FALSE);\r
}\r
}\r
\r
if (monitor && do_warn && !renew_done) {\r
- TimetToFileTimeInterval(to_warn, (LPFILETIME) &ft);\r
- fte = ft_expiry - ft;\r
\r
- if (fte > ft_current)\r
+ TimetToFileTimeInterval(to_warn, &ft);\r
+ fte = FtSub(&ft_expiry, &ft);\r
+\r
+ if (CompareFileTime(&fte, &ft_current) > 0)\r
tmr_update(ident, KHUI_TTYPE_ID_WARN,\r
- fte, ft, 0, fte > ft_current + ft_reinst);\r
+ FtToInt(&fte), FtToInt(&ft), 0,\r
+ CompareFileTime(&fte, &ft_creinst) > 0);\r
}\r
\r
if (monitor && do_crit && !renew_done) {\r
- TimetToFileTimeInterval(to_crit, (LPFILETIME) &ft);\r
- fte = ft_expiry - ft;\r
+ TimetToFileTimeInterval(to_crit, &ft);\r
+ fte = FtSub(&ft_expiry, &ft);\r
\r
- if (fte > ft_current)\r
+ if (CompareFileTime(&fte, &ft_current) > 0)\r
tmr_update(ident, KHUI_TTYPE_ID_CRIT,\r
- fte, ft, 0, fte > ft_current + ft_reinst);\r
+ FtToInt(&fte), FtToInt(&ft), 0,\r
+ CompareFileTime(&fte, &ft_creinst) > 0);\r
}\r
\r
if (monitor && !renew_done) {\r
- if (ft_expiry > ft_current)\r
+ if (CompareFileTime(&ft_expiry, &ft_current) > 0)\r
tmr_update(ident, KHUI_TTYPE_ID_EXP, \r
- ft_expiry, 0, 0, fte > ft_current + ft_reinst);\r
+ FtToInt(&ft_expiry), 0, 0,\r
+ CompareFileTime(&fte, &ft_creinst) > 0);\r
}\r
\r
_done_with_ident:\r
&cb)))\r
goto _cleanup;\r
\r
- TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR, (LPFILETIME) &ft);\r
+ TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR, &ft);\r
\r
- if (ft_cred_expiry >= ft_expiry ||\r
- (ft_expiry - ft_cred_expiry) < ft)\r
- goto _cleanup;\r
+ {\r
+ FILETIME ft_delta;\r
+\r
+ ft_delta = FtSub(&ft_expiry, &ft_cred_expiry);\r
+\r
+ if (CompareFileTime(&ft_cred_expiry, &ft_expiry) >= 0 ||\r
+ CompareFileTime(&ft_delta, &ft) < 0)\r
+ goto _cleanup;\r
+ }\r
\r
if ((idx = tmr_find(ident, KHUI_TTYPE_ID_WARN, 0, 0)) >= 0 &&\r
!(khui_timers[idx].flags & KHUI_TE_FLAG_STALE)) {\r
\r
- fte = ft_cred_expiry - khui_timers[idx].offset;\r
- if (fte > ft_current) {\r
- tmr_update(cred, KHUI_TTYPE_CRED_WARN, fte, \r
+ fte = IntToFt(FtToInt(&ft_cred_expiry) - khui_timers[idx].offset);\r
+ if (CompareFileTime(&fte, &ft_current) > 0) {\r
+ tmr_update(cred, KHUI_TTYPE_CRED_WARN,\r
+ FtToInt(&fte), \r
khui_timers[idx].offset, 0,\r
- fte > ft_current + ft_reinst);\r
+ CompareFileTime(&fte, &ft_creinst) > 0);\r
kcdb_cred_hold(cred);\r
}\r
}\r
if ((idx = tmr_find(ident, KHUI_TTYPE_ID_CRIT, 0, 0)) >= 0 &&\r
!(khui_timers[idx].flags & KHUI_TE_FLAG_STALE)) {\r
\r
- fte = ft_cred_expiry - khui_timers[idx].offset;\r
- if (fte > ft_current) {\r
- tmr_update(cred, KHUI_TTYPE_CRED_CRIT, fte,\r
+ fte = IntToFt(FtToInt(&ft_cred_expiry) - khui_timers[idx].offset);\r
+ if (CompareFileTime(&fte, &ft_current) > 0) {\r
+ tmr_update(cred, KHUI_TTYPE_CRED_CRIT,\r
+ FtToInt(&fte),\r
khui_timers[idx].offset, 0,\r
- fte > ft_current + ft_reinst);\r
+ CompareFileTime(&fte, &ft_creinst) > 0);\r
kcdb_cred_hold(cred);\r
}\r
}\r
if ((idx = tmr_find(ident, KHUI_TTYPE_ID_RENEW, 0, 0)) >= 0 &&\r
!(khui_timers[idx].flags & KHUI_TE_FLAG_STALE)) {\r
\r
- fte = ft_cred_expiry - khui_timers[idx].offset;\r
- if (fte > ft_current) {\r
- tmr_update(cred, KHUI_TTYPE_CRED_RENEW, fte,\r
+ fte = IntToFt(FtToInt(&ft_cred_expiry) - khui_timers[idx].offset);\r
+ if (CompareFileTime(&fte, &ft_current) > 0) {\r
+ tmr_update(cred, KHUI_TTYPE_CRED_RENEW,\r
+ FtToInt(&fte),\r
khui_timers[idx].offset, 0,\r
- fte > ft_current + ft_reinst);\r
+ CompareFileTime(&fte, &ft_creinst) > 0);\r
kcdb_cred_hold(cred);\r
}\r
}\r
if ((idx = tmr_find(ident, KHUI_TTYPE_ID_EXP, 0, 0)) >= 0 &&\r
!(khui_timers[idx].flags & KHUI_TE_FLAG_STALE)) {\r
\r
- if (ft_cred_expiry > ft_current) {\r
- tmr_update(cred, KHUI_TTYPE_CRED_EXP, ft_cred_expiry,\r
+ if (CompareFileTime(&ft_cred_expiry, &ft_current) > 0) {\r
+ tmr_update(cred, KHUI_TTYPE_CRED_EXP,\r
+ FtToInt(&ft_cred_expiry),\r
0, 0,\r
- ft_cred_expiry > ft_current + ft_reinst);\r
+ CompareFileTime(&ft_cred_expiry, &ft_creinst) > 0);\r
}\r
}\r
\r
void \r
khm_timer_refresh(HWND hwnd) {\r
int i;\r
- __int64 next_event = 0;\r
- __int64 curtime;\r
- __int64 diff;\r
+ unsigned __int64 next_event = 0;\r
+ unsigned __int64 curtime;\r
+ unsigned __int64 diff;\r
\r
EnterCriticalSection(&cs_timers);\r
\r
}\r
\r
if (next_event != 0) {\r
- GetSystemTimeAsFileTime((LPFILETIME) &curtime);\r
+ FILETIME ft;\r
+\r
+ GetSystemTimeAsFileTime(&ft);\r
+ curtime = FtToInt(&ft);\r
\r
- TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR_SMALL,\r
- (LPFILETIME) &diff);\r
+ TimetToFileTimeInterval(KHUI_TIMEEQ_ERROR_SMALL, &ft);\r
+ diff = FtToInt(&ft);\r
\r
if (curtime + diff > next_event) {\r
tmr_fire_timer();\r
goto _check_next_event;\r
} else {\r
diff = next_event - curtime;\r
+ ft = IntToFt(diff);\r
SetTimer(hwnd,\r
KHUI_TRIGGER_TIMER_ID,\r
- FtIntervalToMilliseconds((LPFILETIME) &diff),\r
+ FtIntervalToMilliseconds(&ft),\r
NULL);\r
}\r
}\r
khm_handle key;\r
khui_timer_type type;\r
\r
- __int64 expire; /* time at which the timer expires */\r
- __int64 offset; /* time offset at which the event that\r
+ unsigned __int64 expire; /* time at which the timer expires */\r
+ unsigned __int64 offset; /* time offset at which the event that\r
the timer warns of happens */\r
void * data;\r
khm_int32 flags;\r
\r
SendMessage(rebar,\r
RB_INSERTBAND,\r
- 1,\r
+ 0,\r
(LPARAM) &rbi);\r
}\r
CredWindow,KC_SPACE,0,Options for the credentials window\r
AutoInit,KC_INT32,0,Prompt for creds if there arent any\r
AutoStart,KC_INT32,0,Start Khimaira when Windows starts\r
- AutoImport,KC_INT32,0,Import Windows creds when Khimaira starts\r
+ AutoImport,KC_INT32,1,Import Windows creds when Khimaira starts\r
AutoDetectNet,KC_INT32,1,Automatically detect network connectivity changes\r
KeepRunning,KC_INT32,1,Keep running after closing Khimaira\r
DefaultView,KC_STRING,ByIdentity,\r
PaddingVertical,KC_INT32,2,\r
PaddingHeader,KC_INT32,16,\r
Monitor,KC_INT32,1,Monitor credentials\r
+ DefaultMonitor,KC_INT32,1,Default Monitor value for new identities\r
RefreshTimeout,KC_INT32,60,In seconds\r
WarnThreshold,KC_INT32,900,In seconds\r
AllowWarn,KC_INT32,1,Boolean. Enables warning.\r
AllowCritical,KC_INT32,1,Boolean. Enables critical.\r
AutoRenewThreshold,KC_INT32,600,In seconds\r
AllowAutoRenew,KC_INT32,1,Boolean.\r
+ DefaultAllowAutoRenew,KC_INT32,1,Default AllowAutoRenew value for new identities\r
+ DefaultSticky,KC_INT32,0,Default Sticky value for new identities\r
MaxThreshold,KC_INT32,86400,Max value for a threshold (1 day)\r
MinThreshold,KC_INT32,10,Min value for a threshold (0)\r
Windows,KC_SPACE,0,Window parameters\r
Custom_0,KC_ENDSPACE,0,\r
ByIdentity,KC_SPACE,0,The default view\r
Description,KC_STRING,View grouped by identity and credential type,\r
- ColumnList,KC_STRING,"_CWFlags,_CWTypeIcon,IdentityName,TypeName,Name,TimeLeft",\r
+ ColumnList,KC_STRING,"_CWFlags,IdentityName,TypeName,Name,TimeLeft",\r
Columns,KC_SPACE,0,Columns\r
_CWFlags,KC_SPACE,0,\r
Width,KC_INT32,20,\r
Flags,KC_INT32,112,\r
_CWFlags,KC_ENDSPACE,0,\r
- _CWTypeIcon,KC_SPACE,0,\r
- Width,KC_INT32,20,\r
- Flags,KC_INT32,112,\r
- _CWTypeIcon,KC_ENDSPACE,0,\r
+# _CWTypeIcon,KC_SPACE,0,\r
+# Width,KC_INT32,20,\r
+# Flags,KC_INT32,112,\r
+# _CWTypeIcon,KC_ENDSPACE,0,\r
IdentityName,KC_SPACE,0,\r
Width,KC_INT32,100,\r
SortIndex,KC_INT32,0,\r
ByIdentity,KC_ENDSPACE,0\r
ByLocation,KC_SPACE,0,View by location\r
Description,KC_STRING,View grouped by location,\r
- ColumnList,KC_STRING,"_CWFlags,_CWTypeIcon,Location,IdentityName,TypeName,Name,TimeLeft",\r
+ ColumnList,KC_STRING,"_CWFlags,Location,IdentityName,TypeName,Name,TimeLeft",\r
Columns,KC_SPACE,0,Columns\r
_CWFlags,KC_SPACE,0,\r
Width,KC_INT32,20,\r
Flags,KC_INT32,112,\r
_CWFlags,KC_ENDSPACE,0,\r
- _CWTypeIcon,KC_SPACE,0,\r
- Width,KC_INT32,20,\r
- Flags,KC_INT32,112,\r
- _CWTypeIcon,KC_ENDSPACE,0,\r
+# _CWTypeIcon,KC_SPACE,0,\r
+# Width,KC_INT32,20,\r
+# Flags,KC_INT32,112,\r
+# _CWTypeIcon,KC_ENDSPACE,0,\r
Location,KC_SPACE,0,\r
Width,KC_INT32,100,\r
SortIndex,KC_INT32,0,\r
KHUI_ACTION_EXIT,FCONTROL|FVIRTKEY,\'X\',KHUI_ACCEL_SCOPE_GLOBAL\r
KHUI_ACTION_VIEW_REFRESH,FVIRTKEY,VK_F5,KHUI_ACCEL_SCOPE_GLOBAL\r
KHUI_ACTION_NEW_CRED,FCONTROL|FVIRTKEY,\'N\',KHUI_ACCEL_SCOPE_GLOBAL\r
+KHUI_ACTION_RENEW_CRED,FCONTROL|FVIRTKEY,\'R\',KHUI_ACCEL_SCOPE_GLOBAL\r
+KHUI_ACTION_IMPORT,FCONTROL|FVIRTKEY,\'I\',KHUI_ACCEL_SCOPE_GLOBAL\r
+KHUI_ACTION_DESTROY_CRED,FCONTROL|FVIRTKEY,\'D\',KHUI_ACCEL_SCOPE_GLOBAL\r
KHUI_PACTION_SELALL,FCONTROL|FVIRTKEY,\'A\',KHUI_ACCEL_SCOPE_GLOBAL\r
MENU_ACTION(KHUI_ACTION_NEW_CRED),\r
MENU_SEP(),\r
MENU_ACTION(KHUI_ACTION_RENEW_CRED),\r
+ MENU_ACTION(KHUI_ACTION_IMPORT),\r
MENU_ACTION(KHUI_ACTION_DESTROY_CRED),\r
MENU_SEP(),\r
MENU_ACTION(KHUI_ACTION_SET_DEF_ID),\r
MENU_ACTION(KHUI_ACTION_SET_SRCH_ID),\r
MENU_SEP(),\r
MENU_ACTION(KHUI_ACTION_PASSWD_ID),\r
- MENU_SEP(),\r
- MENU_ACTION(KHUI_ACTION_IMPORT),\r
MENU_END()\r
};\r
\r
MENU_ACTION(KHUI_ACTION_OPT_KHIM),\r
MENU_ACTION(KHUI_ACTION_OPT_IDENTS),\r
MENU_ACTION(KHUI_ACTION_OPT_NOTIF),\r
+ MENU_ACTION(KHUI_ACTION_OPT_PLUGINS),\r
MENU_END()\r
};\r
\r
KHUI_ACTION_LAYOUT_ID,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_ID,0,0,KHUI_ACTIONSTATE_CHECKED\r
KHUI_ACTION_LAYOUT_TYPE,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_TYPE,0,0,KHUI_ACTIONSTATE_DISABLED\r
KHUI_ACTION_LAYOUT_LOC,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_LOC,0,0,0\r
-KHUI_ACTION_TB_STANDARD,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_TB_STANDARD,0,0,KHUI_ACTIONSTATE_CHECKED\r
+KHUI_ACTION_TB_STANDARD,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_TB_STANDARD,0,0,KHUI_ACTIONSTATE_CHECKED|KHUI_ACTIONSTATE_DISABLED\r
KHUI_ACTION_CHOOSE_COLS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_CHOOSE_COLS,0,IDH_ACTION_CHOOSE_COLS,KHUI_ACTIONSTATE_DISABLED\r
KHUI_ACTION_DEBUG_WINDOW,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_DEBUG_WINDOW,0,IDH_ACTION_DEBUG_WINDOW,KHUI_ACTIONSTATE_DISABLED\r
KHUI_ACTION_VIEW_REFRESH,KHUI_ACTIONTYPE_TRIGGER,,IDB_VW_REFRESH,0,0,IDB_VW_REFRESH_SM,0,IDS_ACTION_VIEW_REFRESH,0,IDH_ACTION_VIEW_REFRESH,0\r
KHUI_ACTION_OPT_IDENTS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_IDENTS,0,IDH_ACTION_OPT_INIT,0\r
KHUI_ACTION_OPT_KHIM,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_KHIM,0,IDH_ACTION_OPT_KHIM,0\r
KHUI_ACTION_OPT_NOTIF,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_NOTIF,0,IDH_ACTION_OPT_NOTIF,0\r
+KHUI_ACTION_OPT_PLUGINS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_PLUGINS,0,IDH_ACTION_OPT_KHIM,0\r
KHUI_ACTION_HELP_CTX,KHUI_ACTIONTYPE_TRIGGER,,IDB_HELP,0,0,IDB_HELP_SM,0,IDS_ACTION_HELP_CTX,0,0,0\r
KHUI_ACTION_HELP_CONTENTS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_HELP_CONTENTS,0,0,0\r
KHUI_ACTION_HELP_INDEX,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_HELP_INDEX,0,0,0\r
StringCbCopy(p->prompt, cb_prompt, prompt);\r
}\r
\r
- if(def) {\r
+ if(def && cb_def > 0) {\r
cb_def += sizeof(wchar_t);\r
p->def = PMALLOC(cb_def);\r
StringCbCopy(p->def, cb_def, def);\r
#define KHUI_ACTION_MENU_ACTIVATE (KHUI_ACTION_BASE + 26)\r
#define KHUI_ACTION_CLOSE_APP (KHUI_ACTION_BASE + 27)\r
#define KHUI_ACTION_IMPORT (KHUI_ACTION_BASE + 28)\r
+#define KHUI_ACTION_OPT_PLUGINS (KHUI_ACTION_BASE + 29)\r
/*@}*/\r
\r
/*! \name Pseudo actions \r
\r
CRITICAL_SECTION cs;\r
\r
+ khm_boolean set_default; /*!< After a successfull credentials\r
+ acquisition, set the primary\r
+ identity as the default. */\r
+\r
khm_handle *identities; /*!< The list of identities associated\r
with this request. The first\r
identity in this list (\a\r
@{*/\r
\r
/* Leash compatibility */\r
-#define ID_OBTAIN_TGT_WITH_LPARAM 32809\r
+#define ID_OBTAIN_TGT_WITH_LPARAM 32810\r
\r
#define KHUI_REQDAEMONWND_CLASS L"IDMgrRequestDaemonCls"\r
#define KHUI_REQDAEMONWND_NAME L"IDMgrRequestDaemon"\r
#define NETID_USERNAME_SZ 128\r
#define NETID_REALM_SZ 192\r
#define NETID_TITLE_SZ 256\r
-#define NETID_CCACHE_NAME_SZ 264\r
+#define NETID_CCACHE_NAME_SZ 264\r
\r
#define NETID_DLGTYPE_TGT 0\r
#define NETID_DLGTYPE_CHPASSWD 1\r
h->delr = delr;\r
h->hash = hash;\r
\r
- h->bins = calloc(sizeof(hash_bin *), n);\r
+ h->bins = PCALLOC(sizeof(hash_bin *), n);\r
\r
return h;\r
}\r
return dest;\r
}\r
\r
+KHMEXP void *\r
+perf_calloc(char * file, int line, size_t num, size_t size) {\r
+ void * ptr;\r
+ size_t tsize;\r
+\r
+ tsize = num * size;\r
+\r
+ ptr = perf_malloc(file,line,tsize);\r
+\r
+ if (ptr) {\r
+ ZeroMemory(ptr, tsize);\r
+ }\r
+\r
+ return ptr;\r
+}\r
+\r
KHMEXP void * \r
perf_malloc(char * file, int line, size_t s) {\r
allocation * a;\r
\r
#ifdef DEBUG\r
#define PMALLOC(s) perf_malloc(__FILE__,__LINE__,s)\r
+#define PCALLOC(n,s) perf_calloc(__FILE__,__LINE__,n,s)\r
#define PREALLOC(d,s) perf_realloc(__FILE__,__LINE__,d,s)\r
#define PFREE(p) perf_free(p)\r
#define PDUMP(f) perf_dump(f)\r
#define PSTRDUP(s) perf_strdup(__FILE__,__LINE__,s)\r
#else\r
#define PMALLOC(s) malloc(s)\r
+#define PCALLOC(n,s) calloc(n,s)\r
#define PREALLOC(d,s) realloc(d,s)\r
#define PFREE(p) free(p)\r
#define PDUMP(f) ((void) 0)\r
KHMEXP char *\r
perf_strdup(char * file, int line, const char * str);\r
\r
+KHMEXP void *\r
+perf_calloc(char * file, int line, size_t num, size_t size);\r
+\r
#endif\r