From 1df41f81af35c6ba7f5f54b079c0de7d182684a5 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Wed, 19 Jul 2006 22:36:00 +0000 Subject: [PATCH] Windows NetIDMgr post-1.5 branch commits The following patch updates the NetIDMgr: * allow plug-ins to be marked "do not unload" in order to support DLLs that create threads that are not properly cleaned up as part of library unload. * allow plug-ins to be marked "disabled" * Additional changes to deal with Microsoft's efforts to deprecate all of the str C runtime functions. * Improvements to Manifest processing in the build system * Addition of Tooltip support to the Toolbar. Dragging the mouse over toolbar buttons displays textual descriptions. * Correct the behavior of the New Credentials Dialog to disable the "Ok" button after it has been pressed. * Add support to allow plugin configuration data to be distributed as part of transforms to the MSI installer. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18344 dc483132-0cff-0310-8789-dd5450dbe970 --- src/windows/identity/apiversion.txt | 22 + src/windows/identity/config/Makefile.w32 | 8 + src/windows/identity/kconfig/api.c | 152 +++++-- src/windows/identity/kconfig/kconfig.h | 137 ++++-- .../identity/kconfig/kconfiginternal.h | 4 +- src/windows/identity/kmm/kmm.h | 2 +- src/windows/identity/kmm/kmm_plugin.c | 15 +- src/windows/identity/kmm/kmm_reg.c | 5 +- src/windows/identity/kmm/kmm_registrar.c | 27 +- src/windows/identity/kmm/kmmconfig.csv | 8 +- src/windows/identity/kmm/kmminternal.h | 23 +- src/windows/identity/nidmgrdll/Makefile | 1 + src/windows/identity/plugins/krb4/Makefile | 1 + .../identity/plugins/krb4/krb4configdlg.c | 126 +++++- src/windows/identity/plugins/krb4/krb4funcs.c | 4 +- .../identity/plugins/krb4/krb4newcreds.c | 4 +- .../identity/plugins/krb4/krb4plugin.c | 2 + .../identity/plugins/krb4/krbconfig.csv | 2 +- src/windows/identity/plugins/krb5/Makefile | 1 + .../identity/plugins/krb5/krb5configcc.c | 2 - .../identity/plugins/krb5/krb5configdlg.c | 3 - .../identity/plugins/krb5/krb5configid.c | 2 - .../identity/plugins/krb5/krb5configids.c | 7 +- src/windows/identity/plugins/krb5/krb5funcs.c | 4 +- .../identity/plugins/krb5/krb5newcreds.c | 427 +++++++++++------- .../identity/plugins/krb5/krbconfig.csv | 2 + src/windows/identity/plugins/krb5/krbcred.h | 10 +- src/windows/identity/ui/Makefile | 1 + src/windows/identity/ui/aboutwnd.c | 5 +- src/windows/identity/ui/configwnd.c | 3 +- src/windows/identity/ui/lang/en_us/khapp.rc | 222 ++++----- src/windows/identity/ui/main.c | 2 + src/windows/identity/ui/newcredwnd.c | 24 +- src/windows/identity/ui/resource.h | 15 + src/windows/identity/ui/toolbar.c | 190 +++++--- src/windows/identity/uilib/actions.csv | 30 +- src/windows/identity/uilib/khnewcred.h | 7 + src/windows/identity/uilib/khuidefs.h | 2 - src/windows/identity/util/perfstat.c | 2 +- 39 files changed, 959 insertions(+), 545 deletions(-) diff --git a/src/windows/identity/apiversion.txt b/src/windows/identity/apiversion.txt index 72456acd3..813dcd699 100644 --- a/src/windows/identity/apiversion.txt +++ b/src/windows/identity/apiversion.txt @@ -158,3 +158,25 @@ Date=(TBD) !_report_ts0, _report_ts1, _report_ts2, _report_ts3 # modified to use _vnull() instead of 0 for NULL parameters ++KCONF_FLAG_WRITEIFMOD +# new flag for khc_open_space() indicating that the specified handle should only write to a configuration space if the value read from the handle is different from the value being written + ++KCONF_FLAG_IFMODCI +# indicates that the string comparison function used for KCONF_FLAG_WRITEIFMOD should be case insensitive. + +!khc_write_int32(), khc_write_int64(), khc_write_string(), khc_write_multi_string() +# Change of behavior. If the configuration handle has KCONF_FLAG_WRITEIFMOD flag set, only writes if the value being written to is different from the value being read. + +!khc_read_string(), khc_read_multi_string(), khc_read_int32(), khc_read_int64(), khc_read_binary(), khc_write_string(), khc_write_int32(), khc_write_int64(), khc_write_binary(), khc_get_type(), khc_value_exists(), khc_remove_value() +# The value name parameter is now a constant pointer + +!khc_load_schema(), khc_unload_schema() +# The schema pointer is now a constant pointer + +-Schema:NetIDMgr\PluginManager\Modules\\Flags +-Schema:NetIDMgr\PluginManager\Plugins\\Flags +# Deprecated. Replaced by separate values for each of the bits in Flags. This allows each setting to be deployed independently via GPO. + ++Schema:NetIDMgr\PluginManager\Modules\\Disabled ++Schema:NetIDMgr\PluginManager\Plugins\\Disabled +# If non-zero, the corresponding module or plug-in is disabled. diff --git a/src/windows/identity/config/Makefile.w32 b/src/windows/identity/config/Makefile.w32 index 503e44dc1..4ffba0c81 100644 --- a/src/windows/identity/config/Makefile.w32 +++ b/src/windows/identity/config/Makefile.w32 @@ -325,6 +325,14 @@ if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest _VC_MANIFEST_EMBED_DLL=$(_VC_MANIFEST_EMBED_EXE) +# Note that if you are merging manifests, then the VS generated +# manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???. +# This ensures that even if the DLL or EXE is executed in-place, the +# embedded manifest will be used. Otherwise the $@.manifest file will +# be used. +_VC_MANIFEST_CLEAN= \ +if exist $@.manifest $(RM) $@.manifest + # End of manifest handling !endif diff --git a/src/windows/identity/kconfig/api.c b/src/windows/identity/kconfig/api.c index ef182fe32..4ee210d6c 100644 --- a/src/windows/identity/kconfig/api.c +++ b/src/windows/identity/kconfig/api.c @@ -24,6 +24,7 @@ /* $Id$ */ +#include #include #include @@ -314,6 +315,11 @@ khcint_RegOpenKeyEx(HKEY hkey, LPCWSTR sSubKey, DWORD ulOptions, return rv; } +/*! \internal + + \note This function is not a good replacement for RegDeleteKey since + it deletes all the subkeys in addition to the key being deleted. + */ LONG khcint_RegDeleteKey(HKEY hKey, LPCWSTR lpSubKey) { @@ -345,7 +351,15 @@ khcint_RegDeleteKey(HKEY hKey, /* bingo! ?? */ if ((sk_name[cch] == L'\0' || sk_name[cch] == L'~')) { - rv = RegDeleteKey(hKey, sk_name); + + /* instead of calling RegDeleteKey we call SHDeleteKey + because we want to blow off all the subkeys as + well. This is different from the behavior of + RegDeleteKey making khcint_RegDeleteKey not a very + good case sensitive replacement for + RegDeleteKey. */ + + rv = SHDeleteKey(hKey, sk_name); goto _cleanup; } } @@ -891,7 +905,7 @@ khc_close_space(khm_handle csp) { KHMEXP khm_int32 KHMAPI khc_read_string(khm_handle pconf, - wchar_t * pvalue, + const wchar_t * pvalue, wchar_t * buf, khm_size * bufsize) { @@ -904,7 +918,7 @@ khc_read_string(khm_handle pconf, do { HKEY hku = NULL; HKEY hkm = NULL; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; DWORD size; @@ -928,7 +942,7 @@ khc_read_string(khm_handle pconf, free_space = 1; #if 0 - wchar_t * back, * forward; + const wchar_t * back, * forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1053,7 +1067,7 @@ _exit: } KHMEXP khm_int32 KHMAPI -khc_read_int32(khm_handle pconf, wchar_t * pvalue, khm_int32 * buf) { +khc_read_int32(khm_handle pconf, const wchar_t * pvalue, khm_int32 * buf) { kconf_conf_space * c; khm_int32 rv = KHM_ERROR_SUCCESS; @@ -1070,7 +1084,7 @@ khc_read_int32(khm_handle pconf, wchar_t * pvalue, khm_int32 * buf) { HKEY hku = NULL; HKEY hkm = NULL; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1089,7 +1103,7 @@ khc_read_int32(khm_handle pconf, wchar_t * pvalue, khm_int32 * buf) { goto _shadow; free_space = 1; #if 0 - wchar_t * back, * forward; + const wchar_t * back, * forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1175,7 +1189,7 @@ _exit: } KHMEXP khm_int32 KHMAPI -khc_read_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 * buf) { +khc_read_int64(khm_handle pconf, const wchar_t * pvalue, khm_int64 * buf) { kconf_conf_space * c; khm_int32 rv = KHM_ERROR_SUCCESS; @@ -1189,7 +1203,7 @@ khc_read_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 * buf) { HKEY hku = NULL; HKEY hkm = NULL; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1208,7 +1222,7 @@ khc_read_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 * buf) { goto _shadow; free_space = 1; #if 0 - wchar_t * back, *forward; + const wchar_t * back, *forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1294,7 +1308,7 @@ _exit: } KHMEXP khm_int32 KHMAPI -khc_read_binary(khm_handle pconf, wchar_t * pvalue, +khc_read_binary(khm_handle pconf, const wchar_t * pvalue, void * buf, khm_size * bufsize) { kconf_conf_space * c; khm_int32 rv = KHM_ERROR_SUCCESS; @@ -1309,7 +1323,7 @@ khc_read_binary(khm_handle pconf, wchar_t * pvalue, HKEY hku = NULL; HKEY hkm = NULL; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1326,7 +1340,7 @@ khc_read_binary(khm_handle pconf, wchar_t * pvalue, goto _shadow; free_space = 1; #if 0 - wchar_t * back, *forward; + const wchar_t * back, *forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1419,7 +1433,7 @@ _exit: KHMEXP khm_int32 KHMAPI khc_write_string(khm_handle pconf, - wchar_t * pvalue, + const wchar_t * pvalue, wchar_t * buf) { HKEY pk = NULL; @@ -1427,7 +1441,7 @@ khc_write_string(khm_handle pconf, khm_int32 rv = KHM_ERROR_SUCCESS; LONG hr; size_t cbsize; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1438,20 +1452,53 @@ khc_write_string(khm_handle pconf, if(pconf && !khc_is_machine_handle(pconf) && !khc_is_user_handle(pconf)) return KHM_ERROR_INVALID_OPERATION; + if(FAILED(StringCbLength(buf, KCONF_MAXCB_STRING, &cbsize))) { + rv = KHM_ERROR_INVALID_PARAM; + goto _exit; + } + + cbsize += sizeof(wchar_t); + + if (khc_handle_flags(pconf) & KCONF_FLAG_WRITEIFMOD) { + wchar_t tmpbuf[512]; + wchar_t * buffer; + size_t tmpsize = cbsize; + khm_boolean is_equal = FALSE; + + if (cbsize <= sizeof(tmpbuf)) { + buffer = tmpbuf; + } else { + buffer = PMALLOC(cbsize); + } + + if (KHM_SUCCEEDED(khc_read_string(pconf, pvalue, buffer, &tmpsize)) && + tmpsize == cbsize) { + if (khc_handle_flags(pconf) & KCONF_FLAG_IFMODCI) + is_equal = !_wcsicmp(buffer, buf); + else + is_equal = !wcscmp(buffer, buf); + } + + if (buffer != tmpbuf) + PFREE(buffer); + + if (is_equal) { + return KHM_ERROR_SUCCESS; + } + } + if(wcschr(pvalue, L'\\') #if 0 || wcschr(pvalue, L'/') #endif ) { - if(KHM_FAILED(khc_open_space( - pconf, - pvalue, - KCONF_FLAG_TRAILINGVALUE | (pconf?khc_handle_flags(pconf):0), - &conf))) + if(KHM_FAILED(khc_open_space(pconf, pvalue, + KCONF_FLAG_TRAILINGVALUE | (pconf?khc_handle_flags(pconf):0), + &conf))) return KHM_ERROR_INVALID_PARAM; free_space = 1; #if 0 - wchar_t * back, *forward; + const wchar_t * back, *forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1472,13 +1519,6 @@ khc_write_string(khm_handle pconf, c = khc_space_from_handle(conf); - if(FAILED(StringCbLength(buf, KCONF_MAXCB_STRING, &cbsize))) { - rv = KHM_ERROR_INVALID_PARAM; - goto _exit; - } - - cbsize += sizeof(wchar_t); - if(khc_is_user_handle(conf)) { pk = khcint_space_open_key(c, KHM_PERM_WRITE | KHM_FLAG_CREATE); } else { @@ -1498,14 +1538,14 @@ _exit: KHMEXP khm_int32 KHMAPI khc_write_int32(khm_handle pconf, - wchar_t * pvalue, + const wchar_t * pvalue, khm_int32 buf) { HKEY pk = NULL; kconf_conf_space * c; khm_int32 rv = KHM_ERROR_SUCCESS; LONG hr; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1516,6 +1556,15 @@ khc_write_int32(khm_handle pconf, if(pconf && !khc_is_machine_handle(pconf) && !khc_is_user_handle(pconf)) return KHM_ERROR_INVALID_OPERATION; + if (khc_handle_flags(pconf) & KCONF_FLAG_WRITEIFMOD) { + khm_int32 tmpvalue; + + if (KHM_SUCCEEDED(khc_read_int32(pconf, pvalue, &tmpvalue)) && + tmpvalue == buf) { + return KHM_ERROR_SUCCESS; + } + } + if(wcschr(pvalue, L'\\') #if 0 || wcschr(pvalue, L'/') @@ -1529,7 +1578,7 @@ khc_write_int32(khm_handle pconf, return KHM_ERROR_INVALID_PARAM; free_space = 1; #if 0 - wchar_t * back, *forward; + const wchar_t * back, *forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1566,12 +1615,12 @@ khc_write_int32(khm_handle pconf, } KHMEXP khm_int32 KHMAPI -khc_write_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 buf) { +khc_write_int64(khm_handle pconf, const wchar_t * pvalue, khm_int64 buf) { HKEY pk = NULL; kconf_conf_space * c; khm_int32 rv = KHM_ERROR_SUCCESS; LONG hr; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1582,6 +1631,15 @@ khc_write_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 buf) { if(pconf && !khc_is_machine_handle(pconf) && !khc_is_user_handle(pconf)) return KHM_ERROR_INVALID_OPERATION; + if (khc_handle_flags(pconf) & KCONF_FLAG_WRITEIFMOD) { + khm_int64 tmpvalue; + + if (KHM_SUCCEEDED(khc_read_int64(pconf, pvalue, &tmpvalue)) && + tmpvalue == buf) { + return KHM_ERROR_SUCCESS; + } + } + if(wcschr(pvalue, L'\\') #if 0 || wcschr(pvalue, L'/') @@ -1595,7 +1653,7 @@ khc_write_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 buf) { return KHM_ERROR_INVALID_PARAM; free_space = 1; #if 0 - wchar_t * back, *forward; + const wchar_t * back, *forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1633,13 +1691,13 @@ khc_write_int64(khm_handle pconf, wchar_t * pvalue, khm_int64 buf) { KHMEXP khm_int32 KHMAPI khc_write_binary(khm_handle pconf, - wchar_t * pvalue, + const wchar_t * pvalue, void * buf, khm_size bufsize) { HKEY pk = NULL; kconf_conf_space * c; khm_int32 rv = KHM_ERROR_SUCCESS; LONG hr; - wchar_t * value = NULL; + const wchar_t * value = NULL; int free_space = 0; khm_handle conf = NULL; @@ -1663,7 +1721,7 @@ khc_write_binary(khm_handle pconf, return KHM_ERROR_INVALID_PARAM; free_space = 1; #if 0 - wchar_t * back, *forward; + const wchar_t * back, *forward; back = wcsrchr(pvalue, L'\\'); forward = wcsrchr(pvalue, L'/'); @@ -1761,7 +1819,7 @@ khc_get_config_space_parent(khm_handle conf, khm_handle * parent) { } KHMEXP khm_int32 KHMAPI -khc_get_type(khm_handle conf, wchar_t * value) { +khc_get_type(khm_handle conf, const wchar_t * value) { HKEY hkm = NULL; HKEY hku = NULL; kconf_conf_space * c; @@ -1819,7 +1877,7 @@ khc_get_type(khm_handle conf, wchar_t * value) { } KHMEXP khm_int32 KHMAPI -khc_value_exists(khm_handle conf, wchar_t * value) { +khc_value_exists(khm_handle conf, const wchar_t * value) { HKEY hku = NULL; HKEY hkm = NULL; kconf_conf_space * c; @@ -1858,7 +1916,7 @@ khc_value_exists(khm_handle conf, wchar_t * value) { } KHMEXP khm_int32 KHMAPI -khc_remove_value(khm_handle conf, wchar_t * value, khm_int32 flags) { +khc_remove_value(khm_handle conf, const wchar_t * value, khm_int32 flags) { HKEY hku = NULL; HKEY hkm = NULL; kconf_conf_space * c; @@ -2030,7 +2088,7 @@ khcint_is_valid_name(wchar_t * name) } khm_int32 -khcint_validate_schema(kconf_schema * schema, +khcint_validate_schema(const kconf_schema * schema, int begin, int *end) { @@ -2092,7 +2150,7 @@ khcint_validate_schema(kconf_schema * schema, } khm_int32 -khcint_load_schema_i(khm_handle parent, kconf_schema * schema, +khcint_load_schema_i(khm_handle parent, const kconf_schema * schema, int begin, int * end) { int i; @@ -2153,7 +2211,7 @@ khcint_load_schema_i(khm_handle parent, kconf_schema * schema, } KHMEXP khm_int32 KHMAPI -khc_load_schema(khm_handle conf, kconf_schema * schema) +khc_load_schema(khm_handle conf, const kconf_schema * schema) { khm_int32 rv = KHM_ERROR_SUCCESS; @@ -2174,7 +2232,7 @@ khc_load_schema(khm_handle conf, kconf_schema * schema) } khm_int32 -khcint_unload_schema_i(khm_handle parent, kconf_schema * schema, +khcint_unload_schema_i(khm_handle parent, const kconf_schema * schema, int begin, int * end) { int i; @@ -2235,7 +2293,7 @@ khcint_unload_schema_i(khm_handle parent, kconf_schema * schema, } KHMEXP khm_int32 KHMAPI -khc_unload_schema(khm_handle conf, kconf_schema * schema) +khc_unload_schema(khm_handle conf, const kconf_schema * schema) { khm_int32 rv = KHM_ERROR_SUCCESS; @@ -2363,7 +2421,7 @@ khc_enum_subspaces(khm_handle conf, } KHMEXP khm_int32 KHMAPI -khc_write_multi_string(khm_handle conf, wchar_t * value, wchar_t * buf) +khc_write_multi_string(khm_handle conf, const wchar_t * value, wchar_t * buf) { size_t cb; wchar_t vbuf[KCONF_MAXCCH_STRING]; @@ -2394,7 +2452,7 @@ khc_write_multi_string(khm_handle conf, wchar_t * value, wchar_t * buf) } KHMEXP khm_int32 KHMAPI -khc_read_multi_string(khm_handle conf, wchar_t * value, +khc_read_multi_string(khm_handle conf, const wchar_t * value, wchar_t * buf, khm_size * bufsize) { wchar_t vbuf[KCONF_MAXCCH_STRING]; diff --git a/src/windows/identity/kconfig/kconfig.h b/src/windows/identity/kconfig/kconfig.h index 5ec65f703..518dc4f46 100644 --- a/src/windows/identity/kconfig/kconfig.h +++ b/src/windows/identity/kconfig/kconfig.h @@ -143,6 +143,31 @@ typedef struct tag_kconf_schema { /*! \brief Indicates that the last component of the given configuration path is to be considered to be a configuration value */ #define KCONF_FLAG_TRAILINGVALUE 0x00000020 +/*! \brief Only write values back there is a change + + Any write operations using the handle with check if the value + being written is different from the value being read from the + handle. It will only be written if the value is different. + + \note Note that the value being read from a handle takes schema and + shadowed configuration handles into consideration while the value + being written is only written to the topmost layer of + configuration that can be written to. + + \note Note also that this flag does not affect binary values. + */ +#define KCONF_FLAG_WRITEIFMOD 0x00000040 + +/*! \brief Use case-insensitive comparison for KCONF_FLAG_WRITEIFMOD + + When used in combination with \a KCONF_FLAG_WRITEIFMOD , the + string comparison used when determining whether the string read + from the configuration handle is the same as the string being + written will be case insensitive. If this flag is not set, the + comparison will be case sensitive. + */ +#define KCONF_FLAG_IFMODCI 0x00000080 + /*! \brief Do not parse the configuration space name If set, disables the parsing of the configuration space for @@ -262,7 +287,7 @@ khc_close_space(khm_handle conf); /*! \brief Read a string value from a configuration space - The \a value parameter specifies the value to read from the + The \a value_name parameter specifies the value to read from the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -290,6 +315,10 @@ khc_close_space(khm_handle conf); in the call to khc_open_space() is equivalent to specifying all three. + If the value is not found in the configuration space and any + shadowed configuration spaces, the function returns \a + KHM_ERROR_NOT_FOUND. In this case, the buffer is left unmodified. + \param[in] buf Buffer to copy the string to. Specify NULL to just retrieve the number of required bytes. @@ -303,18 +332,19 @@ khc_close_space(khm_handle conf); \retval KHM_ERROR_TYPE_MISMATCH The specified value is not a string \retval KHM_ERROR_TOO_LONG \a buf was NULL or the size of the buffer was insufficient. The required size is in bufsize. \retval KHM_ERROR_SUCCESS Success. The number of bytes copied is in bufsize. + \retval KHM_ERROR_NOT_FOUND The value was not found. \see khc_open_space() */ KHMEXP khm_int32 KHMAPI khc_read_string(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, wchar_t * buf, khm_size * bufsize); /*! \brief Read a multi-string value from a configuration space - The \a value parameter specifies the value to read from the + The \a value_name parameter specifies the value to read from the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -350,6 +380,10 @@ khc_read_string(khm_handle conf, in the call to khc_open_space() is equivalent to specifying all three. + If the value is not found in the configuration space and any + shadowed configuration spaces, the function returns \a + KHM_ERROR_NOT_FOUND. In this case, the buffer is left unmodified. + \param[in] buf Buffer to copy the multi-string to. Specify NULL to just retrieve the number of required bytes. @@ -363,18 +397,19 @@ khc_read_string(khm_handle conf, \retval KHM_ERROR_TYPE_MISMATCH The specified value is not a string \retval KHM_ERROR_TOO_LONG \a buf was NULL or the size of the buffer was insufficient. The required size is in bufsize. \retval KHM_ERROR_SUCCESS Success. The number of bytes copied is in bufsize. + \retval KHM_ERROR_NOT_FOUND The value was not found. \see khc_open_space() */ KHMEXP khm_int32 KHMAPI khc_read_multi_string(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, wchar_t * buf, khm_size * bufsize); /*! \brief Read a 32 bit integer value from a configuration space - The \a value parameter specifies the value to read from the + The \a value_name parameter specifies the value to read from the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -402,6 +437,10 @@ khc_read_multi_string(khm_handle conf, in the call to khc_open_space() is equivalent to specifying all three. + If the value is not found in the configuration space and any + shadowed configuration spaces, the function returns \a + KHM_ERROR_NOT_FOUND. In this case, the buffer is left unmodified. + \param[in] conf Handle to a configuration space \param[in] value The value to query \param[out] buf The buffer to receive the value @@ -415,12 +454,12 @@ khc_read_multi_string(khm_handle conf, */ KHMEXP khm_int32 KHMAPI khc_read_int32(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, khm_int32 * buf); /*! \brief Read a 64 bit integer value from a configuration space - The \a value parameter specifies the value to read from the + The \a value_name parameter specifies the value to read from the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -448,8 +487,12 @@ khc_read_int32(khm_handle conf, in the call to khc_open_space() is equivalent to specifying all three. + If the value is not found in the configuration space and any + shadowed configuration spaces, the function returns \a + KHM_ERROR_NOT_FOUND. In this case, the buffer is left unmodified. + \param[in] conf Handle to a configuration space - \param[in] value The value to query + \param[in] value_name The value to query \param[out] buf The buffer to receive the value \retval KHM_ERROR_NOT_READY The configuration provider has not started @@ -462,12 +505,12 @@ khc_read_int32(khm_handle conf, */ KHMEXP khm_int32 KHMAPI khc_read_int64(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, khm_int64 * buf); /*! \brief Read a binary value from a configuration space - The \a value parameter specifies the value to read from the + The \a value_name parameter specifies the value to read from the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -493,6 +536,10 @@ khc_read_int64(khm_handle conf, three. Also note that the schema store (KCONF_FLAG_SCHEMA) does not support binary values. + If the value is not found in the configuration space and any + shadowed configuration spaces, the function returns \a + KHM_ERROR_NOT_FOUND. In this case, the buffer is left unmodified. + \param[in] buf Buffer to copy the string to. Specify NULL to just retrieve the number of required bytes. @@ -509,13 +556,13 @@ khc_read_int64(khm_handle conf, */ KHMEXP khm_int32 KHMAPI khc_read_binary(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, void * buf, khm_size * bufsize); /*! \brief Write a string value to a configuration space - The \a value parameter specifies the value to write to the + The \a value_name parameter specifies the value to write to the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -530,31 +577,40 @@ khc_read_binary(khm_handle conf, khc_open_space(). The precedence of configuration stores are as follows: - - If KCONF_FLAG_USER was specified, then the user configuration + - If \a KCONF_FLAG_USER was specified, then the user configuration space. - - Otherwise, if KCONF_FLAG_MACHINE was specified, then the machine - configuration space. + - Otherwise, if \a KCONF_FLAG_MACHINE was specified, then the + machine configuration space. Note that not specifying any of the configuration store specifiers in the call to khc_open_space() is equivalent to specifying all three. Also note that the schema store (KCONF_FLAG_SCHEMA) is readonly. + If the \a KCONF_FLAG_WRITEIFMOD flag is specified in the call to + khc_open_space() for obtaining the configuration handle, the + specified string will only be written if it is different from the + value being read from the handle. + + If the \a KCONF_FLAG_IFMODCI flag is specified along with the \a + KCONF_FLAG_WRITEIFMOD flag, then the string comparison used will + be case insensitive. + \param[in] conf Handle to a configuration space - \param[in] value Name of value to write + \param[in] value_name Name of value to write \param[in] buf A NULL terminated unicode string not exceeding KCONF_MAXCCH_STRING in characters including terminating NULL \see khc_open_space() */ KHMEXP khm_int32 KHMAPI khc_write_string(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, wchar_t * buf); /*! \brief Write a multi-string value to a configuration space - The \a value parameter specifies the value to write to the + The \a value_name parameter specifies the value to write to the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -586,16 +642,25 @@ khc_write_string(khm_handle conf, three. Also note that the schema store (KCONF_FLAG_SCHEMA) is readonly. + If the \a KCONF_FLAG_WRITEIFMOD flag is specified in the call to + khc_open_space() for obtaining the configuration handle, the + specified string will only be written if it is different from the + value being read from the handle. + + If the \a KCONF_FLAG_IFMODCI flag is specified along with the \a + KCONF_FLAG_WRITEIFMOD flag, then the string comparison used will + be case insensitive. + \see khc_open_space() */ KHMEXP khm_int32 KHMAPI khc_write_multi_string(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, wchar_t * buf); /*! \brief Write a 32 bit integer value to a configuration space - The \a value parameter specifies the value to write to the + The \a value_name parameter specifies the value to write to the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -621,16 +686,21 @@ khc_write_multi_string(khm_handle conf, three. Also note that the schema store (KCONF_FLAG_SCHEMA) is readonly. + If the \a KCONF_FLAG_WRITEIFMOD flag is specified in the call to + khc_open_space() for obtaining the configuration handle, the + specified string will only be written if it is different from the + value being read from the handle. + \see khc_open_space() */ KHMEXP khm_int32 KHMAPI khc_write_int32(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, khm_int32 buf); /*! \brief Write a 64 bit integer value to a configuration space - The \a value parameter specifies the value to write to the + The \a value_name parameter specifies the value to write to the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -656,16 +726,21 @@ khc_write_int32(khm_handle conf, three. Also note that the schema store (KCONF_FLAG_SCHEMA) is readonly. + If the \a KCONF_FLAG_WRITEIFMOD flag is specified in the call to + khc_open_space() for obtaining the configuration handle, the + specified string will only be written if it is different from the + value being read from the handle. + \see khc_open_space() */ KHMEXP khm_int32 KHMAPI khc_write_int64(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, khm_int64 buf); /*! \brief Write a binary value to a configuration space - The \a value parameter specifies the value to write to the + The \a value_name parameter specifies the value to write to the configuration space. This can be either a value name or a value path consisting of a series nested configuration space names followed by the value name all separated by backslashes or forward @@ -695,7 +770,7 @@ khc_write_int64(khm_handle conf, */ KHMEXP khm_int32 KHMAPI khc_write_binary(khm_handle conf, - wchar_t * value, + const wchar_t * value_name, void * buf, khm_size bufsize); @@ -705,7 +780,7 @@ khc_write_binary(khm_handle conf, KC_NONE if the value does not exist. */ KHMEXP khm_int32 KHMAPI -khc_get_type(khm_handle conf, wchar_t * value); +khc_get_type(khm_handle conf, const wchar_t * value_name); /*! \brief Check which configuration stores contain a specific value. @@ -722,7 +797,7 @@ khc_get_type(khm_handle conf, wchar_t * value); value. */ KHMEXP khm_int32 KHMAPI -khc_value_exists(khm_handle conf, wchar_t * value); +khc_value_exists(khm_handle conf, const wchar_t * value); /*! \brief Remove a value from a configuration space @@ -745,7 +820,7 @@ khc_value_exists(khm_handle conf, wchar_t * value); \param[in] conf Handle to configuration space to remove value from - \param[in] value Value to remove + \param[in] value_name Value to remove \param[in] flags Specifies which configuration stores will be affected by the removal. See above. @@ -763,7 +838,7 @@ khc_value_exists(khm_handle conf, wchar_t * value); other stores. */ KHMEXP khm_int32 KHMAPI -khc_remove_value(khm_handle conf, wchar_t * value, khm_int32 flags); +khc_remove_value(khm_handle conf, const wchar_t * value_name, khm_int32 flags); /*! \brief Get the name of a configuration space @@ -805,13 +880,13 @@ khc_get_config_space_parent(khm_handle conf, */ KHMEXP khm_int32 KHMAPI khc_load_schema(khm_handle conf, - kconf_schema * schema); + const kconf_schema * schema); /*! \brief Unload a schema from a configuration space */ KHMEXP khm_int32 KHMAPI khc_unload_schema(khm_handle conf, - kconf_schema * schema); + const kconf_schema * schema); /*! \brief Enumerate the subspaces of a configuration space diff --git a/src/windows/identity/kconfig/kconfiginternal.h b/src/windows/identity/kconfig/kconfiginternal.h index 24929a989..b4c39ee2d 100644 --- a/src/windows/identity/kconfig/kconfiginternal.h +++ b/src/windows/identity/kconfig/kconfiginternal.h @@ -28,11 +28,11 @@ #define __KHIMAIRA_KCONFIGINTERNAL_H #include -#include #include #include #include #include +#include /* TODO: Implement configuration provider interfaces @@ -56,7 +56,7 @@ typedef struct kconf_conf_space_t { khm_int32 refcount; khm_int32 flags; - kconf_schema * schema; + const kconf_schema * schema; khm_int32 nSchema; TDCL(struct kconf_conf_space_t); diff --git a/src/windows/identity/kmm/kmm.h b/src/windows/identity/kmm/kmm.h index be2981b96..d10f2150e 100644 --- a/src/windows/identity/kmm/kmm.h +++ b/src/windows/identity/kmm/kmm.h @@ -161,7 +161,7 @@ typedef struct tag_kmm_plugin_info { flags , but the \a state of the plugin will indicate that the plugin is running. */ -#define KMM_PLUGIN_FLAG_DISABLED 0x0400 +#define KMM_PLUGIN_FLAG_DISABLED 0x00000400 /*! \name Plugin types @{*/ diff --git a/src/windows/identity/kmm/kmm_plugin.c b/src/windows/identity/kmm/kmm_plugin.c index 665eb6330..18a46b7c4 100644 --- a/src/windows/identity/kmm/kmm_plugin.c +++ b/src/windows/identity/kmm/kmm_plugin.c @@ -165,7 +165,6 @@ kmm_enable_plugin(kmm_plugin p, khm_boolean enable) { kmm_plugin_i * pi; khm_int32 rv = KHM_ERROR_NOT_FOUND; /* default to error */ khm_handle csp_plugin = NULL; - khm_int32 flags; EnterCriticalSection(&cs_kmm); if (!kmm_is_plugin(p)) { @@ -179,19 +178,7 @@ kmm_enable_plugin(kmm_plugin p, khm_boolean enable) { goto _cleanup; } - if (KHM_FAILED(rv = khc_read_int32(csp_plugin, L"Flags", &flags))) { - goto _cleanup; - } - - if (enable) { - flags &= ~KMM_PLUGIN_FLAG_DISABLED; - pi->flags &= ~KMM_PLUGIN_FLAG_DISABLED; - } else { - flags |= KMM_PLUGIN_FLAG_DISABLED; - pi->flags |= KMM_PLUGIN_FLAG_DISABLED; - } - - if (KHM_FAILED(rv = khc_write_int32(csp_plugin, L"Flags", flags))) { + if (KHM_FAILED(rv = khc_write_int32(csp_plugin, L"Disabled", !enable))) { goto _cleanup; } diff --git a/src/windows/identity/kmm/kmm_reg.c b/src/windows/identity/kmm/kmm_reg.c index 98b3cdd92..dcc75d13e 100644 --- a/src/windows/identity/kmm/kmm_reg.c +++ b/src/windows/identity/kmm/kmm_reg.c @@ -188,7 +188,8 @@ kmm_register_plugin(kmm_plugin_reg * plugin, khm_int32 config_flags) rv = khc_write_int32(csp_plugin, L"Type", plugin->type); CKRV; - rv = khc_write_int32(csp_plugin, L"Flags", plugin->flags); + rv = khc_write_int32(csp_plugin, L"Disabled", + !!(plugin->flags & KMM_PLUGIN_FLAG_DISABLED)); CKRV; { @@ -259,7 +260,7 @@ kmm_register_module(kmm_module_reg * module, khm_int32 config_flags) rv = khc_write_string(csp_module, L"ImagePath", module->path); CKRV; - rv = khc_write_int32(csp_module, L"Flags", 0); + rv = khc_write_int32(csp_module, L"Disabled", 0); CKRV; /* FileVersion and ProductVersion will be set when the module diff --git a/src/windows/identity/kmm/kmm_registrar.c b/src/windows/identity/kmm/kmm_registrar.c index 742ccc7d7..f93363e58 100644 --- a/src/windows/identity/kmm/kmm_registrar.c +++ b/src/windows/identity/kmm/kmm_registrar.c @@ -342,8 +342,7 @@ void kmmint_init_plugin(kmm_plugin_i * p) { goto _exit; } - if(KHM_FAILED(kmm_get_plugin_config(p->p.name, 0, &csp_plugin)) || - KHM_FAILED(khc_read_int32(csp_plugin, L"Flags", &t))) { + if(KHM_FAILED(kmm_get_plugin_config(p->p.name, 0, &csp_plugin))) { if(KHM_FAILED(kmm_register_plugin(&(p->p), 0))) { _report_mr0(KHERR_ERROR, MSG_IP_NOT_REGISTERED); @@ -357,17 +356,9 @@ void kmmint_init_plugin(kmm_plugin_i * p) { p->state = KMM_PLUGIN_STATE_FAIL_NOT_REGISTERED; goto _exit; } - - if(KHM_FAILED(khc_read_int32(csp_plugin, L"Flags", &t))) { - _report_mr0(KHERR_ERROR, MSG_IP_NOT_REGISTERED); - - p->state = KMM_PLUGIN_STATE_FAIL_NOT_REGISTERED; - goto _exit; - } - } - if(t & KMM_PLUGIN_FLAG_DISABLED) { + if (KHM_SUCCEEDED(khc_read_int32(csp_plugin, L"Disabled", &t)) && t) { p->flags |= KMM_PLUGIN_FLAG_DISABLED; p->state = KMM_PLUGIN_STATE_FAIL_DISABLED; goto _exit; @@ -619,15 +610,17 @@ void kmmint_init_module(kmm_module_i * m) { goto _exit; } - if(KHM_SUCCEEDED(khc_read_int32(csp_mod, L"Flags", &i)) && - (i & KMM_MODULE_FLAG_DISABLED)) { - + if(KHM_SUCCEEDED(khc_read_int32(csp_mod, L"Disabled", &i)) && i) { _report_mr0(KHERR_INFO, MSG_IM_DISABLED); m->state = KMM_MODULE_STATE_FAIL_DISABLED; goto _exit; } + if(KHM_SUCCEEDED(khc_read_int32(csp_mod, L"NoUnload", &i)) && i) { + m->flags |= KMM_MODULE_FLAG_NOUNLOAD; + } + if(KHM_SUCCEEDED(khc_read_int32(csp_mod, L"FailureCount", &i))) { khm_int64 tm; khm_int64 ct; @@ -963,11 +956,13 @@ void kmmint_exit_module(kmm_module_i * m) { LeaveCriticalSection(&cs_kmm); - if(m->h_module) { + if(!(m->flags & KMM_MODULE_FLAG_NOUNLOAD) && + m->h_module) { FreeLibrary(m->h_module); } - if(m->h_resource && (m->h_resource != m->h_module)) { + if(!(m->flags & KMM_MODULE_FLAG_NOUNLOAD) && + m->h_resource && (m->h_resource != m->h_module)) { FreeLibrary(m->h_resource); } diff --git a/src/windows/identity/kmm/kmmconfig.csv b/src/windows/identity/kmm/kmmconfig.csv index 171d667dd..43bb48cdc 100644 --- a/src/windows/identity/kmm/kmmconfig.csv +++ b/src/windows/identity/kmm/kmmconfig.csv @@ -8,7 +8,9 @@ PluginManager,KC_SPACE,0,Plugin Manager Configuration Description,KC_STRING,,Description of the plugin Dependencies,KC_STRING,,Multi string of plugin names of plugins that this plugin depends on Type,KC_INT32,0,The type of the plugin - Flags,KC_INT32,0,Flags +# Flags,KC_INT32,0,Flags (Deprecated) + Disabled,KC_INT32,0,Plug-in is disabled (Boolean) + NoUnload,KC_INT32,0,Do not unload the plugin (Boolean) FailureCount,KC_INT32,0,Number of failed loads FailureTime,KC_INT64,0,FILETIME of first failure FailureReason,KC_INT32,0,Reason for first failure. One of the plugin status values. @@ -21,12 +23,14 @@ PluginManager,KC_SPACE,0,Plugin Manager Configuration ModuleFailureCountResetTime,KC_INT64,72000,Time after first failure at which the failure count is reset _Schema,KC_SPACE,0,Module schema ImagePath,KC_STRING,,Path to the DLL (including DLL name) - Flags,KC_INT32,0,Flags +# Flags,KC_INT32,0,Flags (Deprecated) + Disabled,KC_INT32,0,Module is disabled (Boolean) FailureCount,KC_INT32,0,Number of failed loads FailureTime,KC_INT64,0,FILETIME of first failure FailureReason,KC_INT32,0,Reason for last failure. One of the module status values. PluginList,KC_STRING,,List of plugins implemented in the module _Schema,KC_ENDSPACE,0, +# The OpenAFS plug-in is installed separately. # OpenAFS,KC_SPACE,0,OpenAFS Module # ImagePath,KC_STRING,afscred.dll, # PluginList,KC_STRING,AfsCred, diff --git a/src/windows/identity/kmm/kmminternal.h b/src/windows/identity/kmm/kmminternal.h index e0ce6b270..41eaa7365 100644 --- a/src/windows/identity/kmm/kmminternal.h +++ b/src/windows/identity/kmm/kmminternal.h @@ -85,21 +85,24 @@ typedef struct kmm_module_i_t { #define kmm_handle_from_module(m) ((kmm_module) m) /* LoadLibrary succeeded for module */ -#define KMM_MODULE_FLAG_LOADED 1 +#define KMM_MODULE_FLAG_LOADED 0x00000001 /* init_module entry called */ -#define KMM_MODULE_FLAG_INITP 2 +#define KMM_MODULE_FLAG_INITP 0x00000002 /* the resources have been loaded */ -#define KMM_MODULE_FLAG_RES_LOADED 8 +#define KMM_MODULE_FLAG_RES_LOADED 0x00000008 /* the signature has been verified */ -#define KMM_MODULE_FLAG_SIG 16 +#define KMM_MODULE_FLAG_SIG 0x00000010 /* the module is disabled by the user - (option specifed in configuration) */ -#define KMM_MODULE_FLAG_DISABLED 1024 + (option specified in configuration) */ +#define KMM_MODULE_FLAG_DISABLED 0x00000400 +/* the module should not be unloaded + (option specified in configuration)*/ +#define KMM_MODULE_FLAG_NOUNLOAD 0x00000800 typedef struct kmm_plugin_i_t { kmm_plugin_reg p; @@ -131,15 +134,15 @@ typedef struct kmm_plugin_i_t { #define kmm_plugin_from_handle(ph) ((kmm_plugin_i *) ph) /* the plugin has already been marked for unload */ -#define KMM_PLUGIN_FLAG_UNLOAD 0x0001 +#define KMM_PLUGIN_FLAG_UNLOAD 0x00000001 /* the plugin is in the kmm_listed_plugins list */ -#define KMM_PLUGIN_FLAG_IN_LIST 0x0002 +#define KMM_PLUGIN_FLAG_IN_LIST 0x00000002 /* the plugin is in the module's plugin list */ -#define KMM_PLUGIN_FLAG_IN_MODLIST 0x0004 +#define KMM_PLUGIN_FLAG_IN_MODLIST 0x00000004 -#define KMM_PLUGIN_FLAG_IN_QUEUE 0x0010 +#define KMM_PLUGIN_FLAG_IN_QUEUE 0x00000010 /* the plugin is disabled by the user (option specified in configuration) */ diff --git a/src/windows/identity/nidmgrdll/Makefile b/src/windows/identity/nidmgrdll/Makefile index 701a79d7d..d18ac510d 100644 --- a/src/windows/identity/nidmgrdll/Makefile +++ b/src/windows/identity/nidmgrdll/Makefile @@ -114,6 +114,7 @@ SCLIB= $(DLLFILE): $(OBJFILES) $(RESFILES) $(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB) $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) all: mkdirs $(DLLFILE) diff --git a/src/windows/identity/plugins/krb4/Makefile b/src/windows/identity/plugins/krb4/Makefile index c5226aaaa..d57a213aa 100644 --- a/src/windows/identity/plugins/krb4/Makefile +++ b/src/windows/identity/plugins/krb4/Makefile @@ -71,6 +71,7 @@ $(OBJ)\krb4config.c: krbconfig.csv $(CONFDIR)\csvschema.cfg $(DLLFILE): $(OBJFILES) $(VERRESFILE) $(MSGRESFILE) $(DLLGUILINK) $(LIBFILES) $(SDKLIBFILES) $(SCLIB) $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) all: mkdirs $(MSGRESFILE) $(DLLFILE) lang diff --git a/src/windows/identity/plugins/krb4/krb4configdlg.c b/src/windows/identity/plugins/krb4/krb4configdlg.c index e6eb890df..3186633c4 100644 --- a/src/windows/identity/plugins/krb4/krb4configdlg.c +++ b/src/windows/identity/plugins/krb4/krb4configdlg.c @@ -150,10 +150,26 @@ krb4_id_config_proc(HWND hwnd, khm_size cb; khui_config_init_data * d; khm_handle ident = NULL; + khm_handle csp_ident = NULL; + khm_handle csp_idk4 = NULL; khm_int32 gettix = 0; khm_int32 flags = 0; + khm_int32 t; + khm_boolean is_default_ident = FALSE; - d = (khui_config_init_data *) lParam; + d = PMALLOC(sizeof(khui_config_init_data)); + + if (!d) + break; + + ZeroMemory(d, sizeof(*d)); + + *d = *((khui_config_init_data *) lParam); + +#pragma warning(push) +#pragma warning(disable: 4244) + SetWindowLongPtr(hwnd, DWLP_USER, (LONG_PTR) d); +#pragma warning(pop) khc_read_int32(csp_params, L"Krb4NewCreds", &gettix); if (gettix == 0) @@ -172,14 +188,118 @@ krb4_id_config_proc(HWND hwnd, kcdb_identity_get_flags(ident, &flags); - kcdb_identity_release(ident); + if (!(flags & KCDB_IDENT_FLAG_DEFAULT)) { + gettix = 0; + goto set_ui; + } + + is_default_ident = TRUE; + + if (KHM_FAILED(kcdb_identity_get_config(ident, 0, &csp_ident))) + goto set_ui; - if (!(flags & KCDB_IDENT_FLAG_DEFAULT)) + if (KHM_FAILED(khc_open_space(csp_ident, CSNAME_KRB4CRED, + 0, &csp_idk4))) + goto close_config; + + if (KHM_SUCCEEDED(khc_read_int32(csp_idk4, L"Krb4NewCreds", &t)) && + !t) gettix = 0; + close_config: + if (csp_ident) + khc_close_space(csp_ident); + + if (csp_idk4) + khc_close_space(csp_idk4); + set_ui: CheckDlgButton(hwnd, IDC_CFG_GETTIX, (gettix)?BST_CHECKED: BST_UNCHECKED); + EnableWindow(GetDlgItem(hwnd, IDC_CFG_GETTIX), + is_default_ident); + + if (ident) + kcdb_identity_release(ident); + } + break; + + case KHUI_WM_CFG_NOTIFY: + { + khui_config_init_data * d; + + d = (khui_config_init_data *) (LONG_PTR) + GetWindowLongPtr(hwnd, DWLP_USER); + + if (!d) + break; + + if (HIWORD(wParam) == WMCFG_APPLY) { + wchar_t idname[KCDB_IDENT_MAXCCH_NAME]; + khm_size cb_idname = sizeof(idname); + khm_handle ident = NULL; + khm_int32 flags = 0; + khm_handle csp_ident = NULL; + khm_handle csp_idk4 = NULL; + khm_int32 gettix = 0; + khm_int32 applied = FALSE; + + khui_cfg_get_name(d->ctx_node, idname, &cb_idname); + + kcdb_identity_create(idname, 0, &ident); + + if (ident == NULL) + break; + + kcdb_identity_get_flags(ident, &flags); + + if (!(flags & KCDB_IDENT_FLAG_DEFAULT)) + goto done_apply; + + if (IsDlgButtonChecked(hwnd, IDC_CFG_GETTIX) == BST_CHECKED) + gettix = TRUE; + + if (KHM_FAILED(kcdb_identity_get_config(ident, KHM_FLAG_CREATE, + &csp_ident))) + goto done_apply; + + if (KHM_FAILED(khc_open_space(csp_ident, CSNAME_KRB4CRED, + KHM_FLAG_CREATE | KCONF_FLAG_WRITEIFMOD, + &csp_idk4))) + goto done_apply; + + khc_write_int32(csp_idk4, L"Krb4NewCreds", gettix); + + applied = TRUE; + + done_apply: + if (ident) + kcdb_identity_release(ident); + + if (csp_ident) + khc_close_space(csp_ident); + + if (csp_idk4) + khc_close_space(csp_ident); + + khui_cfg_set_flags_inst(d, + ((applied)? KHUI_CNFLAG_APPLIED: 0), + (KHUI_CNFLAG_APPLIED | KHUI_CNFLAG_MODIFIED)); + } + } + break; + + case WM_DESTROY: + { + khui_config_init_data * d; + + d = (khui_config_init_data *) (LONG_PTR) + GetWindowLongPtr(hwnd, DWLP_USER); + + if (!d) + break; + + PFREE(d); } break; } diff --git a/src/windows/identity/plugins/krb4/krb4funcs.c b/src/windows/identity/plugins/krb4/krb4funcs.c index 18c05981f..728d2db4a 100644 --- a/src/windows/identity/plugins/krb4/krb4funcs.c +++ b/src/windows/identity/plugins/krb4/krb4funcs.c @@ -425,9 +425,9 @@ wchar_t * khm_krb5_get_realm_list(void) #if _MSC_VER >= 1400 !fopen_s(&file, krb_conf, "rt") #else - (file = fopen(krb_conf, "rt")) + (file = fopen(krb_conf, "rt")) #endif - ) + ) { char lineBuf[256]; diff --git a/src/windows/identity/plugins/krb4/krb4newcreds.c b/src/windows/identity/plugins/krb4/krb4newcreds.c index 407c30fed..851f2e85a 100644 --- a/src/windows/identity/plugins/krb4/krb4newcreds.c +++ b/src/windows/identity/plugins/krb4/krb4newcreds.c @@ -220,7 +220,9 @@ void k4_write_identity_data(k4_dlg_data * d) { KHM_SUCCEEDED(kcdb_identity_get_config(d->nc->identities[0], KHM_FLAG_CREATE, &csp_ident))) { - khc_open_space(csp_ident, CSNAME_KRB4CRED, KHM_FLAG_CREATE, &csp_k4); + khc_open_space(csp_ident, CSNAME_KRB4CRED, + KHM_FLAG_CREATE | KCONF_FLAG_WRITEIFMOD, + &csp_k4); if (csp_k4) { khc_write_int32(csp_k4, L"Krb4NewCreds", !!d->k4_enabled); diff --git a/src/windows/identity/plugins/krb4/krb4plugin.c b/src/windows/identity/plugins/krb4/krb4plugin.c index fb6a88307..c47f5c828 100644 --- a/src/windows/identity/plugins/krb4/krb4plugin.c +++ b/src/windows/identity/plugins/krb4/krb4plugin.c @@ -209,6 +209,8 @@ krb4_msg_system(khm_int32 msg_type, khm_int32 msg_subtype, case KMSG_SYSTEM_EXIT: #ifdef _WIN64 + /* See above. On 64-bit platforms, we don't support Krb4 at + all. */ return 0; #else if(credtype_id_krb4 >= 0) diff --git a/src/windows/identity/plugins/krb4/krbconfig.csv b/src/windows/identity/plugins/krb4/krbconfig.csv index 9aa7cd944..d77abbffa 100644 --- a/src/windows/identity/plugins/krb4/krbconfig.csv +++ b/src/windows/identity/plugins/krb4/krbconfig.csv @@ -6,7 +6,7 @@ Krb4Cred,KC_SPACE,0,"Kerberos IV Credentials Provider" Type,KC_INT32,1, Flags,KC_INT32,0, Parameters,KC_SPACE,0,Parameters for KrbCred - Krb4NewCreds,KC_INT32,1,Obtain Kerberos 4 tickets + Krb4NewCreds,KC_INT32,1,Obtain Kerberos 4 tickets (Boolean) Krb4Method,KC_INT32,0,Method for acquiring K4 tix. 0-Auto;1-Password;2-K524 CreateMissingConfig,KC_INT32,0,Create missing configuration files DefaultLifetime,KC_INT32,36000,Default ticket lifetime diff --git a/src/windows/identity/plugins/krb5/Makefile b/src/windows/identity/plugins/krb5/Makefile index cfee907b2..cc797893a 100644 --- a/src/windows/identity/plugins/krb5/Makefile +++ b/src/windows/identity/plugins/krb5/Makefile @@ -75,6 +75,7 @@ $(OBJ)\krb5config.c: krbconfig.csv $(CONFDIR)\csvschema.cfg $(DLLFILE): $(OBJFILES) $(VERRESFILE) $(DLLGUILINK) $(MSGRESFILE) $(LIBFILES) $(SDKLIBFILES) $(SCLIB) $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) $(MSGRESFILE): $(OBJ)\krb5_msgs.rc diff --git a/src/windows/identity/plugins/krb5/krb5configcc.c b/src/windows/identity/plugins/krb5/krb5configcc.c index 425d13430..5edc02b1f 100644 --- a/src/windows/identity/plugins/krb5/krb5configcc.c +++ b/src/windows/identity/plugins/krb5/krb5configcc.c @@ -29,8 +29,6 @@ #define _WIN32_WINNT 0x501 #endif -#define STRSAFE_NO_DEPRECATE - #include #include #include diff --git a/src/windows/identity/plugins/krb5/krb5configdlg.c b/src/windows/identity/plugins/krb5/krb5configdlg.c index 65f010840..b8bdc55f9 100644 --- a/src/windows/identity/plugins/krb5/krb5configdlg.c +++ b/src/windows/identity/plugins/krb5/krb5configdlg.c @@ -24,15 +24,12 @@ /* $Id$ */ -#define STRSAFE_NO_DEPRECATE - #include #include #include #include #include #include - #include typedef struct tag_k5_realm_kdc { diff --git a/src/windows/identity/plugins/krb5/krb5configid.c b/src/windows/identity/plugins/krb5/krb5configid.c index ebec91e99..6e3a45173 100644 --- a/src/windows/identity/plugins/krb5/krb5configid.c +++ b/src/windows/identity/plugins/krb5/krb5configid.c @@ -24,8 +24,6 @@ /* $Id$ */ -#define STRSAFE_NO_DEPRECATE - #include #include #include diff --git a/src/windows/identity/plugins/krb5/krb5configids.c b/src/windows/identity/plugins/krb5/krb5configids.c index 579b9f712..afd86e541 100644 --- a/src/windows/identity/plugins/krb5/krb5configids.c +++ b/src/windows/identity/plugins/krb5/krb5configids.c @@ -24,18 +24,13 @@ /* $Id$ */ -#define STRSAFE_NO_DEPRECATE - #include #include #include #include #include - -#pragma warning(push) -#pragma warning(disable: 4995) #include -#pragma warning(pop) + typedef struct tag_k5_ids_dlg_data { khui_config_init_data cfg; diff --git a/src/windows/identity/plugins/krb5/krb5funcs.c b/src/windows/identity/plugins/krb5/krb5funcs.c index 1f7b2bdad..316263119 100644 --- a/src/windows/identity/plugins/krb5/krb5funcs.c +++ b/src/windows/identity/plugins/krb5/krb5funcs.c @@ -1918,9 +1918,9 @@ khm_krb5_get_realm_list(void) #if _MSC_VER >= 1400 !fopen_s(&file, krb_conf, "rt") #else - (file = fopen(krb_conf, "rt")) + (file = fopen(krb_conf, "rt")) #endif - ) + ) { char lineBuf[256]; diff --git a/src/windows/identity/plugins/krb5/krb5newcreds.c b/src/windows/identity/plugins/krb5/krb5newcreds.c index daa80b845..179ec4ede 100644 --- a/src/windows/identity/plugins/krb5/krb5newcreds.c +++ b/src/windows/identity/plugins/krb5/krb5newcreds.c @@ -656,6 +656,10 @@ k5_cached_kinit_prompter(void) { goto _cleanup; + /* we found a prompt cache. We take this to imply that the + principal is valid. */ + g_fjob.valid_principal = TRUE; + /* check if there are any prompts currently showing. If there are we check if they are the same as the ones we are going to show. In which case we just reuse the exisitng prompts */ @@ -821,6 +825,9 @@ k5_kinit_prompter(krb5_context context, khm_handle csp_prcache = NULL; + /* we got prompts? Then we assume that the principal is valid */ + g_fjob.valid_principal = TRUE; + nc = g_fjob.nc; if(pkrb5_get_prompt_types) @@ -1102,6 +1109,128 @@ k5_kinit_prompter(krb5_context context, return code; } +/* + + The configuration information for each identity comes from a + multitude of layers organized as follows. The ordering is + decreasing in priority. When looking up a value, the value will be + looked up in each layer in turn starting at level 0. The first + instance of the value found will be the effective value. + + 0 : \Krb5Cred + + 0.1: per user + + 0.2: per machine + + 1 : \Parameters\Realms\ + + 1.1: per user + + 1.2: per machine + + 2 : \Parameters + + 2.1: per user + + 2.2: per machine + + 2.3: schema + + */ +khm_int32 +k5_open_config_handle(khm_handle ident, + khm_int32 flags, + khm_handle * ret_csp) { + + khm_int32 rv = KHM_ERROR_SUCCESS; + khm_handle csp_i = NULL; + khm_handle csp_ik5 = NULL; + khm_handle csp_realms = NULL; + khm_handle csp_realm = NULL; + khm_handle csp_plugins = NULL; + khm_handle csp_krbcfg = NULL; + khm_handle csp_rv = NULL; + wchar_t realm[KCDB_IDENT_MAXCCH_NAME]; + + realm[0] = L'\0'; + + if (ident) { + wchar_t idname[KCDB_IDENT_MAXCCH_NAME]; + wchar_t * trealm; + khm_size cb_idname = sizeof(idname); + + rv = kcdb_identity_get_name(ident, idname, &cb_idname); + if (KHM_SUCCEEDED(rv) && + (trealm = khm_get_realm_from_princ(idname)) != NULL) { + StringCbCopy(realm, sizeof(realm), trealm); + } + } + + if (ident) { + rv = kcdb_identity_get_config(ident, flags, &csp_i); + if (KHM_FAILED(rv)) + goto done; + + rv = khc_open_space(csp_i, CSNAME_KRB5CRED, flags, &csp_ik5); + if (KHM_FAILED(rv)) + goto done; + + if (realm[0] == L'\0') + goto done_shadow_realm; + + rv = khc_open_space(csp_params, CSNAME_REALMS, flags, &csp_realms); + if (KHM_FAILED(rv)) + goto done_shadow_realm; + + rv = khc_open_space(csp_realms, realm, flags, &csp_realm); + if (KHM_FAILED(rv)) + goto done_shadow_realm; + + rv = khc_shadow_space(csp_realm, csp_params); + + done_shadow_realm: + + if (csp_realm) + rv = khc_shadow_space(csp_ik5, csp_realm); + else + rv = khc_shadow_space(csp_ik5, csp_params); + + csp_rv = csp_ik5; + + } else { + + /* No valid identity specified. We default to the parameters key. */ + rv = kmm_get_plugins_config(0, &csp_plugins); + if (KHM_FAILED(rv)) + goto done; + + rv = khc_open_space(csp_plugins, CSNAME_KRB5CRED, flags, &csp_krbcfg); + if (KHM_FAILED(rv)) + goto done; + + rv = khc_open_space(csp_krbcfg, CSNAME_PARAMS, flags, &csp_rv); + } + + done: + + *ret_csp = csp_rv; + + /* leave csp_ik5. If it's non-NULL, then it's the return value */ + /* leave csp_rv. It's the return value. */ + if (csp_i) + khc_close_space(csp_i); + if (csp_realms) + khc_close_space(csp_realms); + if (csp_realm) + khc_close_space(csp_realm); + if (csp_plugins) + khc_close_space(csp_plugins); + if (csp_krbcfg) + khc_close_space(csp_krbcfg); + + return rv; +} void k5_read_dlg_params(khm_handle conf, @@ -1173,11 +1302,11 @@ k5_write_dlg_params(khm_handle conf, khc_write_int32(conf, L"Addressless", d->addressless); khc_write_int32(conf, L"PublicIP", d->publicIP); - khc_write_int32(conf, L"DefaultLifetime", + khc_write_int32(conf, L"DefaultLifetime", (khm_int32) d->tc_lifetime.current); - khc_write_int32(conf, L"MaxLifetime", + khc_write_int32(conf, L"MaxLifetime", (khm_int32) d->tc_lifetime.max); - khc_write_int32(conf, L"MinLifetime", + khc_write_int32(conf, L"MinLifetime", (khm_int32) d->tc_lifetime.min); khc_write_int32(conf, L"DefaultRenewLifetime", @@ -1241,6 +1370,7 @@ k5_prep_kinit_job(khui_new_creds * nc) g_fjob.code = 0; g_fjob.identity = ident; g_fjob.prompt_set = 0; + g_fjob.valid_principal = FALSE; /* if we have external parameters, we should use them as well */ if (nc->ctx.cb_vparam == sizeof(NETID_DLGINFO) && @@ -1346,6 +1476,106 @@ k5_find_tgt_filter(khm_handle cred, return rv; } +khm_int32 +k5_update_LRU(khm_handle identity) +{ + wchar_t * wbuf = NULL; + wchar_t * idname = NULL; + wchar_t * realm = NULL; + khm_size cb; + khm_size cb_ms; + khm_int32 rv = KHM_ERROR_SUCCESS; + + rv = kcdb_identity_get_name(identity, NULL, &cb); + assert(rv == KHM_ERROR_TOO_LONG); + + idname = PMALLOC(cb); + assert(idname); + + rv = kcdb_identity_get_name(identity, idname, &cb); + assert(KHM_SUCCEEDED(rv)); + + rv = khc_read_multi_string(csp_params, L"LRUPrincipals", NULL, &cb_ms); + if (rv != KHM_ERROR_TOO_LONG) + cb_ms = cb + sizeof(wchar_t); + else + cb_ms += cb + sizeof(wchar_t); + + wbuf = PMALLOC(cb_ms); + assert(wbuf); + + cb = cb_ms; + + if (rv == KHM_ERROR_TOO_LONG) { + rv = khc_read_multi_string(csp_params, L"LRUPrincipals", wbuf, &cb); + assert(KHM_SUCCEEDED(rv)); + + if (multi_string_find(wbuf, idname, KHM_CASE_SENSITIVE) != NULL) { + /* it's already there. We remove it here and add it at + the top of the LRU list. */ + multi_string_delete(wbuf, idname, KHM_CASE_SENSITIVE); + } + } else { + multi_string_init(wbuf, cb_ms); + } + + cb = cb_ms; + rv = multi_string_prepend(wbuf, &cb, idname); + assert(KHM_SUCCEEDED(rv)); + + rv = khc_write_multi_string(csp_params, L"LRUPrincipals", wbuf); + + realm = khm_get_realm_from_princ(idname); + if (realm == NULL || *realm == L'\0') + goto _done_with_LRU; + + cb = cb_ms; + rv = khc_read_multi_string(csp_params, L"LRURealms", wbuf, &cb); + + if (rv == KHM_ERROR_TOO_LONG) { + PFREE(wbuf); + wbuf = PMALLOC(cb); + assert(wbuf); + + cb_ms = cb; + + rv = khc_read_multi_string(csp_params, L"LRURealms", wbuf, &cb); + + assert(KHM_SUCCEEDED(rv)); + } else if (rv == KHM_ERROR_SUCCESS) { + if (multi_string_find(wbuf, realm, KHM_CASE_SENSITIVE) != NULL) { + /* remove the realm and add it at the top later. */ + multi_string_delete(wbuf, realm, KHM_CASE_SENSITIVE); + } + } else { + multi_string_init(wbuf, cb_ms); + } + + cb = cb_ms; + rv = multi_string_prepend(wbuf, &cb, realm); + + if (rv == KHM_ERROR_TOO_LONG) { + wbuf = PREALLOC(wbuf, cb); + + rv = multi_string_prepend(wbuf, &cb, realm); + + assert(KHM_SUCCEEDED(rv)); + } + + rv = khc_write_multi_string(csp_params, L"LRURealms", wbuf); + + assert(KHM_SUCCEEDED(rv)); + + _done_with_LRU: + + if (wbuf) + PFREE(wbuf); + if (idname) + PFREE(idname); + + return rv; +} + /* Handler for CRED type messages Runs in the context of the Krb5 plugin @@ -1508,34 +1738,22 @@ k5_msg_cred_dialog(khm_int32 msg_type, if(/* !d->dirty && */ nc->n_identities > 0 && nc->subtype == KMSG_CRED_NEW_CREDS) { - khm_handle h_id = NULL; - khm_handle h_idk5 = NULL; + khm_handle h_idcfg = NULL; do { - if(KHM_FAILED - (kcdb_identity_get_config(nc->identities[0], - 0, - &h_id))) + if (KHM_FAILED + (k5_open_config_handle(nc->identities[0], + 0, &h_idcfg))) break; - if(KHM_FAILED - (khc_open_space(h_id, CSNAME_KRB5CRED, - 0, &h_idk5))) - break; - - if(KHM_FAILED(khc_shadow_space(h_idk5, csp_params))) - break; - - k5_read_dlg_params(h_idk5, d); + k5_read_dlg_params(h_idcfg, d); PostMessage(nct->hwnd_panel, KHUI_WM_NC_NOTIFY, MAKEWPARAM(0,WMNC_DIALOG_SETUP), 0); } while(FALSE); - if(h_id) - khc_close_space(h_id); - if(h_idk5) - khc_close_space(h_idk5); + if(h_idcfg) + khc_close_space(h_idcfg); } khui_cw_unlock_nc(nc); @@ -1825,17 +2043,18 @@ k5_msg_cred_dialog(khm_int32 msg_type, assert(g_fjob.state == FIBER_STATE_NONE); #endif + if (g_fjob.valid_principal && + nc->n_identities > 0 && + nc->identities[0]) { + /* the principal was valid, so we can go ahead + and update the LRU */ + k5_update_LRU(nc->identities[0]); + } + } else if (nc->result == KHUI_NC_RESULT_PROCESS && g_fjob.state == FIBER_STATE_NONE) { - khm_handle sp = NULL; - khm_handle ep = NULL; + khm_handle csp_idcfg = NULL; krb5_context ctx = NULL; - wchar_t * wbuf; - wchar_t * idname; - wchar_t * atsign; - khm_size cb; - khm_size cb_ms; - khm_int32 rv; _reportf(L"Tickets successfully acquired"); @@ -1849,20 +2068,16 @@ k5_msg_cred_dialog(khm_int32 msg_type, assert(nc->n_identities > 0); assert(nc->identities[0]); - if(KHM_SUCCEEDED - (kcdb_identity_get_config(nc->identities[0], - KHM_FLAG_CREATE, - &sp)) && - KHM_SUCCEEDED - (khc_open_space(sp, CSNAME_KRB5CRED, - KHM_FLAG_CREATE, &ep))) { - k5_write_dlg_params(ep, d); + if (KHM_SUCCEEDED + (k5_open_config_handle(nc->identities[0], + KHM_FLAG_CREATE | + KCONF_FLAG_WRITEIFMOD, + &csp_idcfg))) { + k5_write_dlg_params(csp_idcfg, d); } - if(ep != NULL) - khc_close_space(ep); - if(sp != NULL) - khc_close_space(sp); + if(csp_idcfg != NULL) + khc_close_space(csp_idcfg); /* We should also quickly refresh the credentials so that the identity flags and ccache @@ -1892,135 +2107,11 @@ k5_msg_cred_dialog(khm_int32 msg_type, } } - /* also add the principal and the realm in to the - LRU lists */ - rv = kcdb_identity_get_name(nc->identities[0], - NULL, - &cb); - assert(rv == KHM_ERROR_TOO_LONG); - - idname = PMALLOC(cb); - assert(idname); - - rv = kcdb_identity_get_name(nc->identities[0], - idname, - &cb); - assert(KHM_SUCCEEDED(rv)); + /* and update the LRU */ + k5_update_LRU(nc->identities[0]); - rv = khc_read_multi_string(csp_params, - L"LRUPrincipals", - NULL, - &cb_ms); - if (rv != KHM_ERROR_TOO_LONG) - cb_ms = cb + sizeof(wchar_t); - else - cb_ms += cb + sizeof(wchar_t); - - wbuf = PMALLOC(cb_ms); - assert(wbuf); - - cb = cb_ms; - - if (rv == KHM_ERROR_TOO_LONG) { - rv = khc_read_multi_string(csp_params, - L"LRUPrincipals", - wbuf, - &cb); - assert(KHM_SUCCEEDED(rv)); - - if (multi_string_find(wbuf, - idname, - KHM_CASE_SENSITIVE) - != NULL) { - /* it's already there. We remove it here - and add it at the top of the LRU - list. */ - multi_string_delete(wbuf, idname, KHM_CASE_SENSITIVE); - } - } else { - multi_string_init(wbuf, cb_ms); - } - - cb = cb_ms; - rv = multi_string_prepend(wbuf, &cb, idname); - assert(KHM_SUCCEEDED(rv)); - - rv = khc_write_multi_string(csp_params, - L"LRUPrincipals", - wbuf); - - atsign = wcschr(idname, L'@'); - if (atsign == NULL) - goto _done_with_LRU; - - atsign++; - - if (*atsign == L'\0') - goto _done_with_LRU; - - cb = cb_ms; - rv = khc_read_multi_string(csp_params, - L"LRURealms", - wbuf, - &cb); - - if (rv == KHM_ERROR_TOO_LONG) { - PFREE(wbuf); - wbuf = PMALLOC(cb); - assert(wbuf); - - cb_ms = cb; - - rv = khc_read_multi_string(csp_params, - L"LRURealms", - wbuf, - &cb); - - assert(KHM_SUCCEEDED(rv)); - } else if (rv == KHM_ERROR_SUCCESS) { - if (multi_string_find(wbuf, - atsign, - KHM_CASE_SENSITIVE) - != NULL) { - /* remove the realm and add it at the top - later. */ - multi_string_delete(wbuf, atsign, KHM_CASE_SENSITIVE); - } - } else { - multi_string_init(wbuf, cb_ms); - } - - cb = cb_ms; - rv = multi_string_prepend(wbuf, - &cb, - atsign); - - if (rv == KHM_ERROR_TOO_LONG) { - wbuf = PREALLOC(wbuf, cb); - - rv = multi_string_prepend(wbuf, - &cb, - atsign); - - assert(KHM_SUCCEEDED(rv)); - } - - rv = khc_write_multi_string(csp_params, - L"LRURealms", - wbuf); - assert(KHM_SUCCEEDED(rv)); - - _done_with_LRU: - if (ctx != NULL) pkrb5_free_context(ctx); - - if (idname) - PFREE(idname); - - if (wbuf) - PFREE(wbuf); - } else if (g_fjob.state == FIBER_STATE_NONE) { /* the user cancelled the operation */ r = KHUI_NC_RESPONSE_EXIT | diff --git a/src/windows/identity/plugins/krb5/krbconfig.csv b/src/windows/identity/plugins/krb5/krbconfig.csv index 49da4f2df..b6754409e 100644 --- a/src/windows/identity/plugins/krb5/krbconfig.csv +++ b/src/windows/identity/plugins/krb5/krbconfig.csv @@ -36,5 +36,7 @@ Krb5Cred,KC_SPACE,0,Kerberos V Credentials Provider Flags,KC_INT32,0, (n),KC_ENDSPACE,0, PromptCache,KC_ENDSPACE,0, + Realms,KC_SPACE,0,Realm specific configuration (same schema as per identity config) + Realms,KC_ENDSPACE,0, Parameters,KC_ENDSPACE,0, Krb5Cred,KC_ENDSPACE,0, diff --git a/src/windows/identity/plugins/krb5/krbcred.h b/src/windows/identity/plugins/krb5/krbcred.h index 4b9373d08..f31bde4e6 100644 --- a/src/windows/identity/plugins/krb5/krbcred.h +++ b/src/windows/identity/plugins/krb5/krbcred.h @@ -35,13 +35,7 @@ #define KHERR_FACILITY k5_facility #define KHERR_FACILITY_ID 64 -#include -#include -#include -#include -#include -#include -#include +#include #include #include @@ -105,6 +99,7 @@ extern khm_ui_4 k5_commctl_version; #define CSNAME_KRB5CRED L"Krb5Cred" #define CSNAME_PARAMS L"Parameters" #define CSNAME_PROMPTCACHE L"PromptCache" +#define CSNAME_REALMS L"Realms" /* plugin constants */ #define KRB5_PLUGIN_NAME L"Krb5Cred" @@ -173,6 +168,7 @@ typedef struct _fiber_job_t { int prompt_set; BOOL null_password; + BOOL valid_principal; } fiber_job; extern fiber_job g_fjob; /* global fiber job object */ diff --git a/src/windows/identity/ui/Makefile b/src/windows/identity/ui/Makefile index 35c19bdba..c3355041d 100644 --- a/src/windows/identity/ui/Makefile +++ b/src/windows/identity/ui/Makefile @@ -97,5 +97,6 @@ SCLIB= $(EXEFILE): $(OBJFILES) $(RESFILES) $(LIBFILES) $(EXEGUILINK) $(SDKLIBFILES) $(SCLIB) $(_VC_MANIFEST_EMBED_EXE) $(MANIFESTFILE) + $(_VC_MANIFEST_CLEAN) all: mkdirs $(MANIFESTFILE) $(EXEFILE) diff --git a/src/windows/identity/ui/aboutwnd.c b/src/windows/identity/ui/aboutwnd.c index da7abdfee..242b1c589 100644 --- a/src/windows/identity/ui/aboutwnd.c +++ b/src/windows/identity/ui/aboutwnd.c @@ -118,13 +118,14 @@ about_dlg_proc(HWND hwnd, return FALSE; case WM_DESTROY: - khm_leave_modal(); khm_del_dialog(hwnd); return TRUE; case WM_COMMAND: - if (wParam == MAKEWPARAM(IDOK, BN_CLICKED)) + if (wParam == MAKEWPARAM(IDOK, BN_CLICKED)) { + khm_leave_modal(); DestroyWindow(hwnd); + } return TRUE; } diff --git a/src/windows/identity/ui/configwnd.c b/src/windows/identity/ui/configwnd.c index 5059dba28..24f9a619c 100644 --- a/src/windows/identity/ui/configwnd.c +++ b/src/windows/identity/ui/configwnd.c @@ -581,7 +581,6 @@ cfgui_dlgproc(HWND hwnd, khui_delete_bitmap(&d->kbmp_logo); DeleteObject(d->hbr_white); - khm_leave_modal(); khm_del_dialog(hwnd); SetForegroundWindow(khm_hwnd_main); @@ -643,6 +642,7 @@ cfgui_dlgproc(HWND hwnd, case WM_COMMAND: switch(wParam) { case MAKEWPARAM(IDCANCEL, BN_CLICKED): + khm_leave_modal(); DestroyWindow(hwnd); break; @@ -652,6 +652,7 @@ cfgui_dlgproc(HWND hwnd, case MAKEWPARAM(IDOK, BN_CLICKED): cfgui_apply_settings(NULL); + khm_leave_modal(); DestroyWindow(hwnd); break; } diff --git a/src/windows/identity/ui/lang/en_us/khapp.rc b/src/windows/identity/ui/lang/en_us/khapp.rc index 5a795dd99..93e780575 100644 --- a/src/windows/identity/ui/lang/en_us/khapp.rc +++ b/src/windows/identity/ui/lang/en_us/khapp.rc @@ -167,24 +167,15 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LTEXT "UI Row2",IDC_NC_TPL_ROW_LG,7,31,287,18,NOT WS_VISIBLE | - WS_BORDER - LTEXT "TplPanel",IDC_NC_TPL_PANEL,7,7,287,153,NOT WS_VISIBLE | - WS_BORDER - LTEXT "UI Row",IDC_NC_TPL_ROW,7,7,287,18,NOT WS_VISIBLE | - WS_BORDER - LTEXT "TplLabel",IDC_NC_TPL_LABEL,7,8,45,10,NOT WS_VISIBLE | - WS_BORDER - LTEXT "TplInput",IDC_NC_TPL_INPUT,54,7,240,13,NOT WS_VISIBLE | - WS_BORDER - LTEXT "TplLabelLg",IDC_NC_TPL_LABEL_LG,7,33,146,10,NOT - WS_VISIBLE | WS_BORDER - LTEXT "TplInputLg",IDC_NC_TPL_INPUT_LG,155,31,139,13,NOT - WS_VISIBLE | WS_BORDER - LTEXT "&Credentials",IDC_NC_CREDTEXT_LABEL,7,66,41,10,NOT - WS_GROUP - CONTROL "",IDC_NC_CREDTEXT,"KhmHtWnd",WS_TABSTOP,54,65,240,73, - WS_EX_CLIENTEDGE + LTEXT "UI Row2",IDC_NC_TPL_ROW_LG,7,31,287,18,NOT WS_VISIBLE | WS_BORDER + LTEXT "TplPanel",IDC_NC_TPL_PANEL,7,7,287,153,NOT WS_VISIBLE | WS_BORDER + LTEXT "UI Row",IDC_NC_TPL_ROW,7,7,287,18,NOT WS_VISIBLE | WS_BORDER + LTEXT "TplLabel",IDC_NC_TPL_LABEL,7,8,45,10,NOT WS_VISIBLE | WS_BORDER + LTEXT "TplInput",IDC_NC_TPL_INPUT,54,7,240,13,NOT WS_VISIBLE | WS_BORDER + LTEXT "TplLabelLg",IDC_NC_TPL_LABEL_LG,7,33,146,10,NOT WS_VISIBLE | WS_BORDER + LTEXT "TplInputLg",IDC_NC_TPL_INPUT_LG,155,31,139,13,NOT WS_VISIBLE | WS_BORDER + LTEXT "&Credentials",IDC_NC_CREDTEXT_LABEL,7,66,41,10,NOT WS_GROUP + CONTROL "",IDC_NC_CREDTEXT,"KhmHtWnd",WS_TABSTOP,54,65,240,73,WS_EX_CLIENTEDGE PUSHBUTTON "&Ok",IDOK,57,142,89,18,WS_DISABLED PUSHBUTTON "&Cancel",IDCANCEL,158,142,54,18 PUSHBUTTON "&Options >>",IDC_NC_OPTIONS,223,142,71,18 @@ -214,18 +205,12 @@ CAPTION "Identity" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Name",IDC_STATIC,7,8,19,12 - LTEXT "IdentityName",IDC_PP_IDNAME,34,7,194,12,NOT WS_GROUP, - WS_EX_CLIENTEDGE - CONTROL "Default identity",IDC_PP_IDDEF,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,34,22,71,12 - CONTROL "Searchable",IDC_PP_IDSEARCH,"Button",BS_AUTOCHECKBOX | - WS_DISABLED | WS_TABSTOP,117,36,74,12 - CONTROL "Custom1",IDC_PP_PROPLIST,"NetIDMgrPropertyWnd", - WS_TABSTOP,7,51,221,80 - CONTROL "Always visible (sticky)",IDC_PP_STICKY,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,117,22,85,12 - PUSHBUTTON "Identity configuration ...",IDC_PP_CONFIG,117,135,111, - 14 + LTEXT "IdentityName",IDC_PP_IDNAME,34,7,194,12,NOT WS_GROUP,WS_EX_CLIENTEDGE + CONTROL "Default identity",IDC_PP_IDDEF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,34,22,71,12 + CONTROL "Searchable",IDC_PP_IDSEARCH,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,117,36,74,12 + CONTROL "Custom1",IDC_PP_PROPLIST,"NetIDMgrPropertyWnd",WS_TABSTOP,7,51,221,80 + CONTROL "Always visible (sticky)",IDC_PP_STICKY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,117,22,85,12 + PUSHBUTTON "Identity configuration ...",IDC_PP_CONFIG,117,135,111,14 END IDD_PP_CRED DIALOGEX 0, 0, 236, 158 @@ -233,25 +218,19 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION CAPTION "Credential" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - CONTROL "Check1",IDC_PP_DUMMY,"Button",BS_AUTOCHECKBOX | NOT - WS_VISIBLE | WS_TABSTOP,0,1,39,10 - CONTROL "Custom1",IDC_PP_CPROPLIST,"NetIDMgrPropertyWnd", - WS_TABSTOP,7,7,222,144 + CONTROL "Check1",IDC_PP_DUMMY,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,0,1,39,10 + CONTROL "Custom1",IDC_PP_CPROPLIST,"NetIDMgrPropertyWnd",WS_TABSTOP,7,7,222,144 END IDD_CFG_MAIN DIALOGEX 0, 0, 357, 222 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | - WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTEXTHELP CAPTION "NetIDMgr Configuration" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Title",IDC_CFG_TITLE,0,0,357,20,SS_CENTERIMAGE - CONTROL "",IDC_CFG_NODELIST,"SysTreeView32",TVS_HASBUTTONS | - TVS_HASLINES | TVS_LINESATROOT | TVS_TRACKSELECT | - WS_TABSTOP | 0x800,0,20,100,182 - LTEXT "Static",IDC_CFG_PANE,102,20,255,182,NOT WS_VISIBLE | - WS_BORDER + CONTROL "",IDC_CFG_NODELIST,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_TRACKSELECT | WS_TABSTOP | 0x800,0,20,100,182 + LTEXT "Static",IDC_CFG_PANE,102,20,255,182,NOT WS_VISIBLE | WS_BORDER PUSHBUTTON "&Ok",IDOK,162,205,78,16 PUSHBUTTON "&Cancel",IDCANCEL,246,205,51,16 PUSHBUTTON "&Apply",IDAPPLY,303,205,51,16,WS_DISABLED @@ -261,8 +240,7 @@ IDD_CFG_GENERIC DIALOGEX 0, 0, 255, 182 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CTEXT "Please select one of the configuration categories on the left.", - IDC_STATIC,21,17,212,18,SS_CENTERIMAGE,WS_EX_TRANSPARENT + CTEXT "Please select one of the configuration categories on the left.",IDC_STATIC,21,17,212,18,SS_CENTERIMAGE,WS_EX_TRANSPARENT END IDD_CFG_GENERAL DIALOGEX 0, 0, 255, 182 @@ -270,29 +248,22 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Startup / Shutdown",IDC_CFG_STARTUP_GROUP,7,7,241,50 - CONTROL "&Obtain new credentials at startup (if none are present)", - IDC_CFG_AUTOINIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 16,22,196,10 + CONTROL "&Obtain new credentials at startup (if none are present)",IDC_CFG_AUTOINIT, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,22,196,10 CONTROL "&Destroy all credentials on exit",IDC_CFG_DESTROYALL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,39,111,10 CONTROL "&Start NetIDMgr during Windows logon",IDC_CFG_AUTOSTART, - "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | - WS_TABSTOP,16,48,135,10 + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,16,48,135,10 GROUPBOX "Other",IDC_CFG_OTHER,7,63,241,85 - CONTROL "&Run NetIDMgr in system tray after window close", - IDC_CFG_KEEPRUNNING,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,16,78,170,10 - CONTROL "Monitor network connectivity",IDC_CFG_NETDETECT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,96,106,10 - CONTROL "Log trace events to trace log at the following location:", - IDC_CFG_LOGTOFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 16,113,225,10 - EDITTEXT IDC_CFG_LOGPATH,16,127,173,14,ES_AUTOHSCROLL | - ES_READONLY + CONTROL "&Run NetIDMgr in system tray after window close",IDC_CFG_KEEPRUNNING, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,78,170,10 + CONTROL "Monitor network connectivity",IDC_CFG_NETDETECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,96,106,10 + CONTROL "Log trace events to trace log at the following location:",IDC_CFG_LOGTOFILE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,113,225,10 + EDITTEXT IDC_CFG_LOGPATH,16,127,173,14,ES_AUTOHSCROLL | ES_READONLY PUSHBUTTON "Show log ...",IDC_CFG_SHOWLOG,193,127,50,14 - CONTROL "A&utomatically import Windows logon identity", - IDC_CFG_AUTOIMPORT,"Button",BS_AUTOCHECKBOX | NOT - WS_VISIBLE | WS_TABSTOP,16,158,165,10 + CONTROL "A&utomatically import Windows logon identity",IDC_CFG_AUTOIMPORT, + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,16,158,165,10 END IDD_CFG_IDENTITIES DIALOGEX 0, 0, 255, 182 @@ -301,8 +272,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "",IDC_CFG_TAB,"SysTabControl32",WS_TABSTOP,7,7,241,168 - LTEXT "Static",IDC_CFG_TARGET,10,21,235,151,NOT WS_VISIBLE | - WS_BORDER + LTEXT "Static",IDC_CFG_TARGET,10,21,235,151,NOT WS_VISIBLE | WS_BORDER END IDD_CFG_NOTIF DIALOGEX 0, 0, 255, 182 @@ -310,21 +280,16 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "&Renew automatically at",IDC_NOTIF_RENEW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,9,100,10 + CONTROL "&Renew automatically at",IDC_NOTIF_RENEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,9,100,10 EDITTEXT IDC_NOTIF_RENEW_THR,122,7,126,14,ES_AUTOHSCROLL - CONTROL "Renew at &half life intervals when possible", - IDC_NOTIF_HALFLIFE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 48,27,148,10 - CONTROL "Initial warning at",IDC_NOTIF_WARN1,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,46,100,10 + CONTROL "Renew at &half life intervals when possible",IDC_NOTIF_HALFLIFE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,48,27,148,10 + CONTROL "Initial warning at",IDC_NOTIF_WARN1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,46,100,10 EDITTEXT IDC_NOTIF_WARN1_THR,122,44,126,14,ES_AUTOHSCROLL - CONTROL "Final warning at",IDC_NOTIF_WARN2,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,68,100,10 + CONTROL "Final warning at",IDC_NOTIF_WARN2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,68,100,10 EDITTEXT IDC_NOTIF_WARN2_THR,122,66,126,14,ES_AUTOHSCROLL CONTROL "&Monitor credential expiration",IDC_NOTIF_MONITOR, - "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7, - 103,139,10 + "Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,7,103,139,10 END IDD_CFG_PLUGINS DIALOGEX 0, 0, 255, 182 @@ -332,33 +297,23 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "",IDC_CFG_PLUGINS,"SysListView32",LVS_REPORT | - LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | - WS_TABSTOP,7,7,75,168 + CONTROL "",IDC_CFG_PLUGINS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,7,75,168 ICON IDI_CFG_PLUGIN,IDC_CFG_ICON,87,11,20,20 - EDITTEXT IDC_CFG_DESC,128,7,120,30,ES_MULTILINE | ES_AUTOVSCROLL | - ES_READONLY + EDITTEXT IDC_CFG_DESC,128,7,120,30,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY LTEXT "&Module",IDC_CFG_LBL_MOD,87,43,24,8 - EDITTEXT IDC_CFG_MODULE,128,43,120,12,ES_AUTOHSCROLL | - ES_READONLY + EDITTEXT IDC_CFG_MODULE,128,43,120,12,ES_AUTOHSCROLL | ES_READONLY LTEXT "&Version",IDC_STATIC,87,59,24,8 - EDITTEXT IDC_CFG_VERSION,128,59,120,12,ES_AUTOHSCROLL | - ES_READONLY + EDITTEXT IDC_CFG_VERSION,128,59,120,12,ES_AUTOHSCROLL | ES_READONLY LTEXT "Ve&ndor",IDC_CFG_LBL_VEN,87,75,24,8 - EDITTEXT IDC_CFG_VENDOR,128,75,120,12,ES_AUTOHSCROLL | - ES_READONLY + EDITTEXT IDC_CFG_VENDOR,128,75,120,12,ES_AUTOHSCROLL | ES_READONLY LTEXT "De&pends on",IDC_CFG_LBL_DEPS,87,93,39,8 - LISTBOX IDC_CFG_DEPS,128,93,120,34,LBS_SORT | - LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_CFG_DEPS,128,93,120,34,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LTEXT "&Status",IDC_CFG_LBL_STATE,87,129,22,8 - EDITTEXT IDC_CFG_STATE,128,129,120,12,ES_AUTOHSCROLL | - ES_READONLY + EDITTEXT IDC_CFG_STATE,128,129,120,12,ES_AUTOHSCROLL | ES_READONLY PUSHBUTTON "&Enable ...",IDC_CFG_ENABLE,128,144,50,14,WS_DISABLED PUSHBUTTON "&Disable ...",IDC_CFG_DISABLE,198,144,50,14,WS_DISABLED - PUSHBUTTON "&Unregister plugin ...",IDC_CFG_UNREGISTER,87,161,72,14, - WS_DISABLED - PUSHBUTTON "&Register new plugin ...",IDC_CFG_REGISTER,169,161,79, - 14,NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "&Unregister plugin ...",IDC_CFG_UNREGISTER,87,161,72,14,WS_DISABLED + PUSHBUTTON "&Register new plugin ...",IDC_CFG_REGISTER,169,161,79,14,NOT WS_VISIBLE | WS_DISABLED END IDD_CFG_IDENTITY DIALOGEX 0, 0, 255, 182 @@ -367,8 +322,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN CONTROL "",IDC_CFG_TAB,"SysTabControl32",WS_TABSTOP,7,7,241,168 - LTEXT "Static",IDC_CFG_TARGET,10,21,235,151,NOT WS_VISIBLE | - WS_BORDER + LTEXT "Static",IDC_CFG_TARGET,10,21,235,151,NOT WS_VISIBLE | WS_BORDER END IDD_CFG_IDS_TAB DIALOGEX 0, 0, 235, 151 @@ -376,13 +330,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10 - CONTROL "Automatically renew",IDC_CFG_RENEW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10 - CONTROL "Always show in the credentials list (Pinned)", - IDC_CFG_STICKY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7, - 34,151,10 + CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10 + CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10 + CONTROL "Always show in the credentials list (Pinned)",IDC_CFG_STICKY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,151,10 PUSHBUTTON "&Add new identity...",IDC_CFG_ADDIDENT,17,120,86,14 END @@ -391,30 +342,24 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - CONTROL "Always show in the credentials list (Pinned)", - IDC_CFG_STICKY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7, - 34,151,10 - CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10 - CONTROL "Automatically renew",IDC_CFG_RENEW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10 + CONTROL "Always show in the credentials list (Pinned)",IDC_CFG_STICKY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,34,151,10 + CONTROL "Monitor credential expiration",IDC_CFG_MONITOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,7,107,10 + CONTROL "Automatically renew",IDC_CFG_RENEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,20,81,10 PUSHBUTTON "Remove identity ...",IDC_CFG_REMOVE,139,122,78,14 END IDD_ABOUT DIALOGEX 0, 0, 268, 170 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | - WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "About Network Identity Manager" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,211,7,50,14 LTEXT "Productname",IDC_PRODUCT,41,7,163,13,NOT WS_GROUP - LTEXT "© 2005 Massachusetts Institute of Technology", - IDC_COPYRIGHT,41,23,220,18,NOT WS_GROUP + LTEXT "© 2005 Massachusetts Institute of Technology",IDC_COPYRIGHT,41,23,220,18,NOT WS_GROUP LTEXT "BuildInfo",IDC_BUILDINFO,41,41,220,17,NOT WS_GROUP ICON IDI_MAIN_APP,IDC_STATIC,6,7,21,20 - CONTROL "",IDC_MODULES,"SysListView32",LVS_REPORT | - LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,41,72,220,91 + CONTROL "",IDC_MODULES,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,41,72,220,91 LTEXT "Loaded modules",IDC_STATIC,41,60,52,8 END @@ -425,27 +370,18 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Font for credentials display",IDC_STATIC,7,7,241,137 LTEXT "&Font name",IDC_STATIC,17,22,35,8 - COMBOBOX IDC_CFG_FONTS,62,20,178,30,CBS_DROPDOWNLIST | CBS_SORT | - WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_CFG_FONTS,62,20,178,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "&Size",IDC_STATIC,62,43,14,8 - COMBOBOX IDC_CFG_SIZE,87,41,48,14,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - CONTROL "&Bold",IDC_CFG_BOLD,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,162,42,29,10 - CONTROL "&Italics",IDC_CFG_ITALICS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,205,42,35,10 - EDITTEXT IDC_CFG_SAMPLE_NORMAL,62,66,178,21,ES_AUTOHSCROLL | - ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP, - WS_EX_STATICEDGE - EDITTEXT IDC_CFG_SAMPLE_BOLD,62,91,178,21,ES_AUTOHSCROLL | - ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP, - WS_EX_STATICEDGE + COMBOBOX IDC_CFG_SIZE,87,41,48,14,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "&Bold",IDC_CFG_BOLD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,42,29,10 + CONTROL "&Italics",IDC_CFG_ITALICS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,205,42,35,10 + EDITTEXT IDC_CFG_SAMPLE_NORMAL,62,66,178,21,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE + EDITTEXT IDC_CFG_SAMPLE_BOLD,62,91,178,21,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP,WS_EX_STATICEDGE PUSHBUTTON "&Revert to default",IDC_CFG_REVERT,168,122,72,14 END IDD_CFG_ADDIDENT DIALOGEX 0, 0, 325, 70 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | - WS_SYSMENU +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Add new identity" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN @@ -631,7 +567,7 @@ BEGIN IDS_ACTION_PASSWD_ID "Change &password ..." IDS_ACTION_CHOOSE_COLS "View columns" IDS_ACTION_DEBUG_WINDOW "Debug window ..." - IDS_ACTION_VIEW_REFRESH "Refresh" + IDS_ACTION_VIEW_REFRESH "Refresh view" IDS_MENU_LAYOUT "Layout" IDS_MENU_TOOLBARS "Toolbars" END @@ -645,7 +581,7 @@ BEGIN IDS_ACTION_OPT_KHIM "General ..." IDS_ACTION_OPT_IDENTS "Identities ..." IDS_ACTION_OPT_NOTIF "Notifications ..." - IDS_ACTION_HELP_CTX "Context" + IDS_ACTION_HELP_CTX "Help Index" IDS_ACTION_HELP_CONTENTS "Contents ..." IDS_ACTION_HELP_INDEX "Index ..." IDS_ACTION_HELP_ABOUT "About NetIDMgr ..." @@ -814,6 +750,26 @@ BEGIN IDS_CFG_IDNAME_CCC "Can't create identity configuration. This may be caused by lack or resources or not having the correct permissions to create the configuration space. The code returned was %d." IDS_CFG_LOGF_CS "Can't show log file" IDS_CFG_LOGF_CSR "The log file %s does not exist." + IDS_ACTIONT_PROPERTIES "Show properties for the current selection" +END + +STRINGTABLE +BEGIN + IDS_ACTIONT_EXIT "Exit Network Identity Manager" + IDS_ACTIONT_SET_DEF_ID "Set the currently selected identity as the default identity" + IDS_ACTIONT_PASSWD_ID "Change the password the currently selected identity" + IDS_ACTIONT_NEW_CRED "Obtain new credentials" + IDS_ACTIONT_RENEW_CRED "Renew or re-obtain credentials for the currently selected identity" + IDS_ACTIONT_DESTROY_CRED "Destroy the selected credentials or identities" + IDS_ACTIONT_VIEW_REFRESH + "Re-obtain information about credentials and refresh the credentials display" + IDS_ACTIONT_OPT_IDENTS "Change options for identities" + IDS_ACTIONT_OPT_KHIM "Change general application settings for NetIDMgr" + IDS_ACTIONT_OPT_NOTIF "Change notification options" + IDS_ACTIONT_OPT_PLUGINS "Change options for plug-ins and modules" + IDS_ACTIONT_OPT_APPEAR "Change appearance and display settings" + IDS_ACTIONT_HELP_CTX "Display user documentation" + IDS_ACTIONT_IMPORT "Import credentials from external sources such as the Windows LSA" END #endif // English (U.S.) resources diff --git a/src/windows/identity/ui/main.c b/src/windows/identity/ui/main.c index cad5dc566..ad39de7ee 100644 --- a/src/windows/identity/ui/main.c +++ b/src/windows/identity/ui/main.c @@ -226,8 +226,10 @@ void khm_leave_modal(void) { } EnableWindow(khm_hwnd_main, TRUE); +#if 0 if (khui_main_window_active) SetForegroundWindow(khm_hwnd_main); +#endif khui_modal_dialog = NULL; } diff --git a/src/windows/identity/ui/newcredwnd.c b/src/windows/identity/ui/newcredwnd.c index e263f7c87..39e670179 100644 --- a/src/windows/identity/ui/newcredwnd.c +++ b/src/windows/identity/ui/newcredwnd.c @@ -466,16 +466,18 @@ nc_update_credtext(khui_nc_wnd_data * d) } } - if(validId || d->nc->subtype == KMSG_CRED_PASSWORD) { - /* TODO: check if all the required fields have valid values - before enabling the Ok button */ - okEnable = TRUE; - } + if (!(d->nc->response & KHUI_NC_RESPONSE_PROCESSING)) { + if(validId || d->nc->subtype == KMSG_CRED_PASSWORD) { + /* TODO: check if all the required fields have valid values + before enabling the Ok button */ + okEnable = TRUE; + } - hw = GetDlgItem(d->dlg_main, IDOK); - EnableWindow(hw, okEnable); - hw = GetDlgItem(d->dlg_bb, IDOK); - EnableWindow(hw, okEnable); + hw = GetDlgItem(d->dlg_main, IDOK); + EnableWindow(hw, okEnable); + hw = GetDlgItem(d->dlg_bb, IDOK); + EnableWindow(hw, okEnable); + } } #define CW_PARAM DWLP_USER @@ -908,7 +910,7 @@ nc_handle_wm_command(HWND hwnd, case IDCANCEL: /* the default value for d->nc->result is set to KHUI_NC_RESULT_CANCEL */ - d->nc->response = 0; + d->nc->response = KHUI_NC_RESPONSE_PROCESSING; nc_notify_types(d->nc, KHUI_WM_NC_NOTIFY, @@ -1640,6 +1642,8 @@ static LRESULT nc_handle_wm_nc_notify(HWND hwnd, nc = d->nc; + nc->response &= ~KHUI_NC_RESPONSE_PROCESSING; + if(nc->response & KHUI_NC_RESPONSE_NOEXIT) { HWND hw; diff --git a/src/windows/identity/ui/resource.h b/src/windows/identity/ui/resource.h index 77e9dcee1..49fcf70e4 100644 --- a/src/windows/identity/ui/resource.h +++ b/src/windows/identity/ui/resource.h @@ -275,6 +275,21 @@ #define IDS_CFG_IDNAME_CCC 268 #define IDS_CFG_LOGF_CS 269 #define IDS_CFG_LOGF_CSR 270 +#define IDS_ACTIONT_PROPERTIES 271 +#define IDS_ACTIONT_EXIT 272 +#define IDS_ACTIONT_SET_DEF_ID 273 +#define IDS_ACTIONT_PASSWD_ID 274 +#define IDS_ACTIONT_NEW_CRED 275 +#define IDS_ACTIONT_RENEW_CRED 276 +#define IDS_ACTIONT_DESTROY_CRED 277 +#define IDS_ACTIONT_VIEW_REFRESH 278 +#define IDS_ACTIONT_OPT_IDENTS 279 +#define IDS_ACTIONT_OPT_KHIM 280 +#define IDS_ACTIONT_OPT_NOTIF 281 +#define IDS_ACTIONT_OPT_PLUGINS 282 +#define IDS_ACTIONT_OPT_APPEAR 283 +#define IDS_ACTIONT_HELP_CTX 284 +#define IDS_ACTIONT_IMPORT 285 #define IDC_NC_USERNAME 1007 #define IDC_NC_PASSWORD 1008 #define IDC_NC_CREDTEXT_LABEL 1009 diff --git a/src/windows/identity/ui/toolbar.c b/src/windows/identity/ui/toolbar.c index 801d6cc52..7157563e4 100644 --- a/src/windows/identity/ui/toolbar.c +++ b/src/windows/identity/ui/toolbar.c @@ -42,72 +42,135 @@ void khui_exit_toolbar(void) { LRESULT khm_toolbar_notify(LPNMHDR notice) { switch(notice->code) { - case NM_CUSTOMDRAW: - { - LPNMTBCUSTOMDRAW nmcd = (LPNMTBCUSTOMDRAW) notice; - if(nmcd->nmcd.dwDrawStage == CDDS_PREPAINT) { - return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTERASE; - } else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { - return CDRF_NOTIFYPOSTPAINT; - } else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) { - /* draw the actual icon */ - int iidx; - int ibmp; - HBITMAP hbmp; - RECT r; - - khui_action * act = - khui_find_action((int) nmcd->nmcd.dwItemSpec); - - if(!act || !act->ib_normal) - return CDRF_DODEFAULT; - - if((act->state & KHUI_ACTIONSTATE_DISABLED) && - act->ib_disabled) { - ibmp = act->ib_disabled; - } else if(act->ib_hot && - ((nmcd->nmcd.uItemState & CDIS_HOT) || - (nmcd->nmcd.uItemState & CDIS_SELECTED))){ - ibmp = act->ib_hot; - } else { - ibmp = act->ib_normal; - } - - iidx = khui_ilist_lookup_id(ilist_toolbar, ibmp); - if(iidx < 0) { - hbmp = LoadImage(khm_hInstance, - MAKEINTRESOURCE(ibmp), - IMAGE_BITMAP, - KHUI_TOOLBAR_IMAGE_WIDTH, - KHUI_TOOLBAR_IMAGE_HEIGHT, 0); - iidx = - khui_ilist_add_masked_id(ilist_toolbar, - hbmp, - KHUI_TOOLBAR_BGCOLOR, - ibmp); - DeleteObject(hbmp); + case TBN_GETINFOTIP: + { + LPNMTBGETINFOTIP git = (LPNMTBGETINFOTIP) notice; + int cmd; + khui_action * a; + + cmd = git->iItem; + a = khui_find_action(cmd); + + if (a) { + if (a->caption) { + StringCchCopy(git->pszText, git->cchTextMax, a->caption); + } else if (a->tooltip) { + StringCchCopy(git->pszText, git->cchTextMax, a->tooltip); + } else if (a->is_caption) { + wchar_t buf[INFOTIPSIZE]; + + buf[0] = L'\0'; + LoadString(khm_hInstance, a->is_caption, + buf, ARRAYLENGTH(buf)); + + StringCchCopy(git->pszText, git->cchTextMax, buf); + } else { + StringCchCopy(git->pszText, git->cchTextMax, L""); + } + } else { + StringCchCopy(git->pszText, + git->cchTextMax, + L""); + } + } + break; + + case TBN_HOTITEMCHANGE: + { + LPNMTBHOTITEM hi = (LPNMTBHOTITEM) notice; + + if (hi->dwFlags & HICF_LEAVING) { + khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, L""); + } else { + khui_action * a; + int cmd; + wchar_t buf[256]; + + cmd = hi->idNew; + a = khui_find_action(cmd); + + buf[0] = L'\0'; + + if (a) { + if (a->tooltip) + StringCbCopy(buf, sizeof(buf), a->tooltip); + else if (a->is_tooltip) { + LoadString(khm_hInstance, a->is_tooltip, + buf, ARRAYLENGTH(buf)); } + } - if(iidx < 0) - return CDRF_DODEFAULT; + khm_statusbar_set_part(KHUI_SBPART_INFO, NULL, buf); + } + } + break; + + case NM_CUSTOMDRAW: + { + LPNMTBCUSTOMDRAW nmcd = (LPNMTBCUSTOMDRAW) notice; + if(nmcd->nmcd.dwDrawStage == CDDS_PREPAINT) { + return CDRF_NOTIFYITEMDRAW | CDRF_NOTIFYPOSTERASE; + } else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPREPAINT) { + return CDRF_NOTIFYPOSTPAINT; + } else if(nmcd->nmcd.dwDrawStage == CDDS_ITEMPOSTPAINT) { + /* draw the actual icon */ + int iidx; + int ibmp; + HBITMAP hbmp; + RECT r; + + khui_action * act = + khui_find_action((int) nmcd->nmcd.dwItemSpec); + + if(!act || !act->ib_normal) + return CDRF_DODEFAULT; - CopyRect(&r, &(nmcd->nmcd.rc)); - r.left += ((r.right - r.left) - - KHUI_TOOLBAR_IMAGE_WIDTH) / 2; - r.top += ((r.bottom - r.top) - - KHUI_TOOLBAR_IMAGE_HEIGHT) / 2; + if((act->state & KHUI_ACTIONSTATE_DISABLED) && + act->ib_disabled) { + ibmp = act->ib_disabled; + } else if(act->ib_hot && + ((nmcd->nmcd.uItemState & CDIS_HOT) || + (nmcd->nmcd.uItemState & CDIS_SELECTED))){ + ibmp = act->ib_hot; + } else { + ibmp = act->ib_normal; + } - khui_ilist_draw(ilist_toolbar, - iidx, - nmcd->nmcd.hdc, - r.left, - r.top, - 0); + iidx = khui_ilist_lookup_id(ilist_toolbar, ibmp); + if(iidx < 0) { + hbmp = LoadImage(khm_hInstance, + MAKEINTRESOURCE(ibmp), + IMAGE_BITMAP, + KHUI_TOOLBAR_IMAGE_WIDTH, + KHUI_TOOLBAR_IMAGE_HEIGHT, 0); + iidx = + khui_ilist_add_masked_id(ilist_toolbar, + hbmp, + KHUI_TOOLBAR_BGCOLOR, + ibmp); + DeleteObject(hbmp); + } + if(iidx < 0) return CDRF_DODEFAULT; - } + + CopyRect(&r, &(nmcd->nmcd.rc)); + r.left += ((r.right - r.left) - + KHUI_TOOLBAR_IMAGE_WIDTH) / 2; + r.top += ((r.bottom - r.top) - + KHUI_TOOLBAR_IMAGE_HEIGHT) / 2; + + khui_ilist_draw(ilist_toolbar, + iidx, + nmcd->nmcd.hdc, + r.left, + r.top, + 0); + + return CDRF_DODEFAULT; } - break; + } + break; } return 0; } @@ -246,6 +309,14 @@ void khm_create_standard_toolbar(HWND rebar) { def = khui_find_menu(KHUI_TOOLBAR_STANDARD); + if (!def) { +#ifdef DEBUG + assert(FALSE); +#else + return; +#endif + } + hwtb = CreateWindowEx(0 #if (_WIN32_IE >= 0x0501) | TBSTYLE_EX_MIXEDBUTTONS @@ -257,6 +328,7 @@ void khm_create_standard_toolbar(HWND rebar) { TBSTYLE_FLAT | TBSTYLE_AUTOSIZE | TBSTYLE_LIST | + TBSTYLE_TOOLTIPS | CCS_NORESIZE | CCS_NOPARENTALIGN | CCS_ADJUSTABLE | diff --git a/src/windows/identity/uilib/actions.csv b/src/windows/identity/uilib/actions.csv index 554977667..50c19d4f5 100644 --- a/src/windows/identity/uilib/actions.csv +++ b/src/windows/identity/uilib/actions.csv @@ -7,33 +7,33 @@ KHUI_MENU_HELP,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_HELP,0,IDH_MENU_HELP, KHUI_MENU_LAYOUT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_LAYOUT,0,0,0 KHUI_MENU_TOOLBARS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_TOOLBARS,0,0,0 KHUI_MENU_COLUMNS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_CHOOSE_COLS,0,IDH_ACTION_CHOOSE_COLS,0 -KHUI_ACTION_PROPERTIES,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_PROPERTIES,0,IDH_ACTION_PROPERTIES,0 -KHUI_ACTION_EXIT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_EXIT,0,IDH_ACTION_EXIT,0 -KHUI_ACTION_SET_DEF_ID,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_SET_DEF_ID,0,IDH_ACTION_SET_DEF_ID,0 +KHUI_ACTION_PROPERTIES,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_PROPERTIES,IDS_ACTIONT_PROPERTIES,IDH_ACTION_PROPERTIES,0 +KHUI_ACTION_EXIT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_EXIT,IDS_ACTIONT_EXIT,IDH_ACTION_EXIT,0 +KHUI_ACTION_SET_DEF_ID,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_SET_DEF_ID,IDS_ACTIONT_SET_DEF_ID,IDH_ACTION_SET_DEF_ID,0 KHUI_ACTION_SET_SRCH_ID,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_SET_SRCH_ID,0,IDH_ACTION_SET_SRCH_ID,KHUI_ACTIONSTATE_DISABLED -KHUI_ACTION_PASSWD_ID,KHUI_ACTIONTYPE_TRIGGER,,IDB_CHPW,0,IDB_CHPW_DIS,IDB_CHPW_SM,IDB_CHPW_DIS_SM,IDS_ACTION_PASSWD_ID,0,IDH_ACTION_PASSWD_ID,0 -KHUI_ACTION_NEW_CRED,KHUI_ACTIONTYPE_TRIGGER,,IDB_TK_NEW,0,IDB_TK_NEW_DIS,IDB_TK_NEW_SM,IDB_TK_NEW_DIS_SM,IDS_ACTION_NEW_CRED,0,IDH_ACTION_NEW_CRED,0 -KHUI_ACTION_RENEW_CRED,KHUI_ACTIONTYPE_TRIGGER,,IDB_TK_REFRESH,0,IDB_TK_REFRESH_DIS,IDB_TK_REFRESH_SM,IDB_TK_REFRESH_DIS_SM,IDS_ACTION_RENEW_CRED,0,0,0 -KHUI_ACTION_DESTROY_CRED,KHUI_ACTIONTYPE_TRIGGER,,IDB_TK_DELETE,0,IDB_TK_DELETE_DIS,IDB_TK_DELETE_SM,IDB_TK_DELETE_DIS_SM,IDS_ACTION_DESTROY_CRED,0,0,0 +KHUI_ACTION_PASSWD_ID,KHUI_ACTIONTYPE_TRIGGER,,IDB_CHPW,0,IDB_CHPW_DIS,IDB_CHPW_SM,IDB_CHPW_DIS_SM,IDS_ACTION_PASSWD_ID,IDS_ACTIONT_PASSWD_ID,IDH_ACTION_PASSWD_ID,0 +KHUI_ACTION_NEW_CRED,KHUI_ACTIONTYPE_TRIGGER,,IDB_TK_NEW,0,IDB_TK_NEW_DIS,IDB_TK_NEW_SM,IDB_TK_NEW_DIS_SM,IDS_ACTION_NEW_CRED,IDS_ACTIONT_NEW_CRED,IDH_ACTION_NEW_CRED,0 +KHUI_ACTION_RENEW_CRED,KHUI_ACTIONTYPE_TRIGGER,,IDB_TK_REFRESH,0,IDB_TK_REFRESH_DIS,IDB_TK_REFRESH_SM,IDB_TK_REFRESH_DIS_SM,IDS_ACTION_RENEW_CRED,IDS_ACTIONT_RENEW_CRED,0,0 +KHUI_ACTION_DESTROY_CRED,KHUI_ACTIONTYPE_TRIGGER,,IDB_TK_DELETE,0,IDB_TK_DELETE_DIS,IDB_TK_DELETE_SM,IDB_TK_DELETE_DIS_SM,IDS_ACTION_DESTROY_CRED,IDS_ACTIONT_DESTROY_CRED,0,0 KHUI_ACTION_LAYOUT_ID,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_ID,0,0,KHUI_ACTIONSTATE_CHECKED KHUI_ACTION_LAYOUT_TYPE,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_TYPE,0,0,0 KHUI_ACTION_LAYOUT_LOC,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_LOC,0,0,0 KHUI_ACTION_LAYOUT_CUST,KHUI_ACTIONTYPE_TRIGGER | KHUI_ACTIONTYPE_TOGGLE,,0,0,0,0,0,IDS_ACTION_LAYOUT_CUST,0,0,0 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 KHUI_ACTION_DEBUG_WINDOW,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_DEBUG_WINDOW,0,IDH_ACTION_DEBUG_WINDOW,KHUI_ACTIONSTATE_DISABLED -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 -KHUI_ACTION_OPT_IDENTS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_IDENTS,0,IDH_ACTION_OPT_INIT,0 -KHUI_ACTION_OPT_KHIM,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_KHIM,0,IDH_ACTION_OPT_KHIM,0 -KHUI_ACTION_OPT_NOTIF,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_NOTIF,0,IDH_ACTION_OPT_NOTIF,0 -KHUI_ACTION_OPT_PLUGINS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_PLUGINS,0,IDH_ACTION_OPT_KHIM,0 -KHUI_ACTION_OPT_APPEAR,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_APPEAR,0,0,0 -KHUI_ACTION_HELP_CTX,KHUI_ACTIONTYPE_TRIGGER,,IDB_HELP,0,0,IDB_HELP_SM,0,IDS_ACTION_HELP_CTX,0,0,0 +KHUI_ACTION_VIEW_REFRESH,KHUI_ACTIONTYPE_TRIGGER,,IDB_VW_REFRESH,0,0,IDB_VW_REFRESH_SM,0,IDS_ACTION_VIEW_REFRESH,IDS_ACTIONT_VIEW_REFRESH,IDH_ACTION_VIEW_REFRESH,0 +KHUI_ACTION_OPT_IDENTS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_IDENTS,IDS_ACTIONT_OPT_IDENTS,IDH_ACTION_OPT_INIT,0 +KHUI_ACTION_OPT_KHIM,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_KHIM,IDS_ACTIONT_OPT_KHIM,IDH_ACTION_OPT_KHIM,0 +KHUI_ACTION_OPT_NOTIF,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_NOTIF,IDS_ACTIONT_OPT_NOTIF,IDH_ACTION_OPT_NOTIF,0 +KHUI_ACTION_OPT_PLUGINS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_PLUGINS,IDS_ACTIONT_OPT_PLUGINS,IDH_ACTION_OPT_KHIM,0 +KHUI_ACTION_OPT_APPEAR,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPT_APPEAR,IDS_ACTIONT_OPT_APPEAR,0,0 +KHUI_ACTION_HELP_CTX,KHUI_ACTIONTYPE_TRIGGER,,IDB_HELP,0,0,IDB_HELP_SM,0,IDS_ACTION_HELP_CTX,IDS_ACTIONT_HELP_CTX,0,0 KHUI_ACTION_HELP_CONTENTS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_HELP_CONTENTS,0,0,0 KHUI_ACTION_HELP_INDEX,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_HELP_INDEX,0,0,0 KHUI_ACTION_HELP_ABOUT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_HELP_ABOUT,0,0,0 KHUI_ACTION_OPEN_APP,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPEN_APP,0,0,0 KHUI_ACTION_CLOSE_APP,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_CLOSE_APP,0,0,0 -KHUI_ACTION_IMPORT,KHUI_ACTIONTYPE_TRIGGER,,IDB_IMPORT,0,IDB_IMPORT_DIS,IDB_IMPORT_SM,IDB_IMPORT_SM_DIS,IDS_ACTION_IMPORT,0,0,0 +KHUI_ACTION_IMPORT,KHUI_ACTIONTYPE_TRIGGER,,IDB_IMPORT,0,IDB_IMPORT_DIS,IDB_IMPORT_SM,IDB_IMPORT_SM_DIS,IDS_ACTION_IMPORT,IDS_ACTIONT_IMPORT,0,0 KHUI_PACTION_OK,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_OK,0,0,0 KHUI_PACTION_CANCEL,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_CANCEL,0,0,0 KHUI_PACTION_CLOSE,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_CLOSE,0,0,0 diff --git a/src/windows/identity/uilib/khnewcred.h b/src/windows/identity/uilib/khnewcred.h index e561eb108..dc553f740 100644 --- a/src/windows/identity/uilib/khnewcred.h +++ b/src/windows/identity/uilib/khnewcred.h @@ -367,6 +367,13 @@ typedef struct tag_khui_new_creds { */ #define KHUI_NC_RESPONSE_COMPLETED 0x00000020 +/*! \brief Processing + + This is an internal flag set while the credentials acquisition + process is executing. + */ +#define KHUI_NC_RESPONSE_PROCESSING 0x00010000 + #define KHUI_NCMASK_RESPONSE (KHUI_NC_RESPONSE_EXIT|KHUI_NC_RESPONSE_NOEXIT) #define KHUI_NCMASK_RESULT (KHUI_NC_RESPONSE_SUCCESS|KHUI_NC_RESPONSE_FAILED|KHUI_NC_RESPONSE_PENDING) /*@}*/ diff --git a/src/windows/identity/uilib/khuidefs.h b/src/windows/identity/uilib/khuidefs.h index 67d8db33d..de2897925 100644 --- a/src/windows/identity/uilib/khuidefs.h +++ b/src/windows/identity/uilib/khuidefs.h @@ -46,8 +46,6 @@ #include -#include - /*! \internal */ KHMEXP void KHMAPI khm_version_init(void); diff --git a/src/windows/identity/util/perfstat.c b/src/windows/identity/util/perfstat.c index c9996b31c..4d7e8fa7c 100644 --- a/src/windows/identity/util/perfstat.c +++ b/src/windows/identity/util/perfstat.c @@ -253,7 +253,7 @@ perf_dump(char * file) { #else f = fopen(file, "w"); if (!f) - return; + return; #endif fprintf(f, "Leaked allocations list ....\n"); -- 2.26.2