# Copyright (c) 2004 Massachusetts Institute of Technology\r
+# Copyright (c) 2007 Secure Endpoints Inc.\r
#\r
# Permission is hereby granted, free of charge, to any person\r
# obtaining a copy of this software and associated documentation files\r
\r
+KCDB_OP_DELCONFIG\r
# notification that the configuration information for an identity is to be removed.\r
+\r
+\r
+#----------------------------------------------------------------\r
+Version=7\r
+AppVersion=1.1.9.0\r
+Date=(TBD)\r
+# Released with KFW 3.2.0\r
+\r
++KHUI_ACTION_UICB\r
+# Internal action to dispatch a UI callback
\ No newline at end of file
# in the build tree.\r
#\r
# Copyright (c) 2004,2005,2006 Massachusetts Institute of Technology\r
-# Copyright (c) 2006 Secure Endpoints Inc.\r
+# Copyright (c) 2006,2007 Secure Endpoints Inc.\r
#\r
# Permission is hereby granted, free of charge, to any person\r
# obtaining a copy of this software and associated documentation files\r
# Version info\r
NETIDMGR_VERSION_MAJOR=1\r
NETIDMGR_VERSION_MINOR=1\r
-NETIDMGR_VERSION_PATCH=8\r
+NETIDMGR_VERSION_PATCH=9\r
NETIDMGR_VERSION_AUX=0\r
NETIDMGR_RELEASEDESC=\r
\r
#\r
# Changes to the API version numbers should be documented in\r
# apiversion.txt at the root of the source tree.\r
-NETIDMGR_VERSION_API=6\r
+NETIDMGR_VERSION_API=7\r
\r
# Minimum backwards compatible version. API versions from\r
# NETIDMGR_VERSION_API_MINCOMPAT through NETIDMGR_VERSION_API\r
# in the build tree.\r
#\r
# Copyright (c) 2004,2005,2006 Massachusetts Institute of Technology\r
-# Copyright (c) 2006 Secure Endpoints Inc.\r
+# Copyright (c) 2006,2007 Secure Endpoints Inc.\r
#\r
# Permission is hereby granted, free of charge, to any person\r
# obtaining a copy of this software and associated documentation files\r
# Version info\r
NETIDMGR_VERSION_MAJOR=1\r
NETIDMGR_VERSION_MINOR=1\r
-NETIDMGR_VERSION_PATCH=8\r
+NETIDMGR_VERSION_PATCH=9\r
NETIDMGR_VERSION_AUX=0\r
NETIDMGR_RELEASEDESC=\r
\r
#\r
# Changes to the API version numbers should be documented in\r
# apiversion.txt at the root of the source tree.\r
-NETIDMGR_VERSION_API=6\r
+NETIDMGR_VERSION_API=7\r
\r
# Minimum backwards compatible version. API versions from\r
# NETIDMGR_VERSION_API_MINCOMPAT through NETIDMGR_VERSION_API\r
<td>\r
<address style="align:right;">\r
<small>Generated on $datetime for $projectname $projectnumber by <a href="http://www.doxygen.org/index.html">Doxygen</a> $doxygenversion<br>\r
- © 2004 Massachusetts Institute of Technology. Contact <a href="mailto:khimaira@mit.edu">khimaira@mit.edu</a><br>\r
+ © 2004-2007 Massachusetts Institute of Technology. Contact <a href="mailto:khimaira@mit.edu">khimaira@mit.edu</a><br>\r
</small>\r
</address>\r
</td>\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
- \subpage bugs\r
- \subpage releases\r
\r
- © 2004 Massachusetts Institute of Technology\r
+ © 2004-2007 Massachusetts Institute of Technology\r
*/\r
\r
/*!\r
\r
\section license_l MIT License\r
\r
- Copyright © 2004 Massachusetts Institute of Technology\r
+ Copyright © 2004,2005,2006,2007 Massachusetts Institute of Technology\r
\r
Permission is hereby granted, free of charge, to any person\r
obtaining a copy of this software and associated documentation\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
/* we should never hit this case */\r
#ifdef DEBUG\r
assert(FALSE);\r
-#else\r
- code = KHM_ERROR_INVALID_OPERATION;\r
#endif\r
+ code = KHM_ERROR_INVALID_OPERATION;\r
} else {\r
#endif\r
code = type->dup(\r
if(attrib->flags & KCDB_ATTR_FLAG_COMPUTED) {\r
#ifdef DEBUG\r
assert(FALSE);\r
-#else\r
- code = KHM_ERROR_INVALID_OPERATION;\r
#endif\r
+ code = KHM_ERROR_INVALID_OPERATION;\r
} else {\r
#endif\r
if(kcdb_buf_exist(&id->buf, slot)) {\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+* Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
/* $Id$ */\r
\r
#include<windows.h>\r
-#include<khdefs.h>\r
-#include<kherror.h>\r
+#include<netidmgr.h>\r
#include<dynimport.h>\r
\r
HINSTANCE hKrb4 = 0;\r
OSVERSIONINFO osvi;\r
int imp_rv = 1;\r
\r
-#define CKRV if(!imp_rv) goto _err_ret\r
+#define CKRV(m) \\r
+ do { \\r
+ if(!imp_rv) { \\r
+ _reportf(L"Can't locate all required exports from module [%S]", (m)); \\r
+ goto _err_ret; \\r
+ } \\r
+ } while (FALSE)\r
\r
#ifndef _WIN64\r
imp_rv = LoadFuncs(KRB4_DLL, k4_fi, &hKrb4, 0, 1, 0, 0);\r
- CKRV;\r
+ CKRV(KRB4_DLL);\r
#endif\r
\r
imp_rv = LoadFuncs(KRB5_DLL, k5_fi, &hKrb5, 0, 1, 0, 0);\r
- CKRV;\r
+ CKRV(KRB5_DLL);\r
\r
imp_rv = LoadFuncs(COMERR_DLL, ce_fi, &hComErr, 0, 0, 1, 0);\r
- CKRV;\r
+ CKRV(COMERR_DLL);\r
\r
imp_rv = LoadFuncs(SERVICE_DLL, service_fi, &hService, 0, 1, 0, 0);\r
- CKRV;\r
+ CKRV(SERVICE_DLL);\r
\r
imp_rv = LoadFuncs(SECUR32_DLL, lsa_fi, &hSecur32, 0, 1, 1, 1);\r
- CKRV;\r
+ CKRV(SECUR32_DLL);\r
\r
imp_rv = LoadFuncs(KRB524_DLL, k524_fi, &hKrb524, 0, 1, 1, 1);\r
- CKRV;\r
+ CKRV(KRB524_DLL);\r
\r
imp_rv = LoadFuncs(PROFILE_DLL, profile_fi, &hProfile, 0, 1, 0, 0);\r
- CKRV;\r
+ CKRV(PROFILE_DLL);\r
\r
imp_rv = LoadFuncs(CCAPI_DLL, ccapi_fi, &hCCAPI, 0, 1, 0, 0);\r
/* CCAPI_DLL is optional. No error check. */\r
{\r
// Windows 9x\r
imp_rv = LoadFuncs(TOOLHELPDLL, toolhelp_fi, &hToolHelp32, 0, 1, 0, 0);\r
- CKRV;\r
+ CKRV(TOOLHELPDLL);\r
\r
hPsapi = 0;\r
} \r
{\r
// Windows NT\r
imp_rv = LoadFuncs(PSAPIDLL, psapi_fi, &hPsapi, 0, 1, 0, 0);\r
- CKRV;\r
+ CKRV(PSAPIDLL);\r
\r
hToolHelp32 = 0;\r
}\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
_end_task();\r
}\r
\r
+void khm_cred_destroy_identity(khm_handle identity)\r
+{\r
+ khui_action_context * pctx;\r
+ wchar_t idname[KCDB_IDENT_MAXCCH_NAME];\r
+ khm_size cb;\r
+\r
+ if (identity == NULL)\r
+ return;\r
+\r
+ pctx = PMALLOC(sizeof(*pctx));\r
+#ifdef DEBUG\r
+ assert(pctx);\r
+#endif\r
+\r
+ khui_context_create(pctx,\r
+ KHUI_SCOPE_IDENT,\r
+ identity,\r
+ KCDB_CREDTYPE_INVALID,\r
+ NULL);\r
+\r
+ cb = sizeof(idname);\r
+ kcdb_identity_get_name(identity, idname, &cb);\r
+\r
+ _begin_task(KHERR_CF_TRANSITIVE);\r
+ _report_sr1(KHERR_NONE, IDS_CTX_DESTROY_ID, _dupstr(idname));\r
+ _describe();\r
+\r
+ kmq_post_message(KMSG_CRED,\r
+ KMSG_CRED_DESTROY_CREDS,\r
+ 0,\r
+ (void *) pctx);\r
+\r
+ _end_task();\r
+}\r
+\r
void khm_cred_renew_identity(khm_handle identity)\r
{\r
khui_new_creds * c;\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
khm_cred_destroy_creds(khm_boolean sync,\r
khm_boolean quiet);\r
\r
+void\r
+khm_cred_destroy_identity(khm_handle identity);\r
+\r
void \r
khm_cred_renew_identity(khm_handle identity);\r
\r
--- /dev/null
+/*\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person\r
+ * obtaining a copy of this software and associated documentation\r
+ * files (the "Software"), to deal in the Software without\r
+ * restriction, including without limitation the rights to use, copy,\r
+ * modify, merge, publish, distribute, sublicense, and/or sell copies\r
+ * of the Software, and to permit persons to whom the Software is\r
+ * furnished to do so, subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be\r
+ * included in all copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ */\r
+\r
+/* $Id$ */\r
+\r
+#ifndef __NETIDMGR_ACTION_H_INTERNAL\r
+#define __NETIDMGR_ACTION_H_INTERNAL\r
+\r
+/* Internal declarations for exports and data structured used in\r
+ nidmgr32.dll and netidmgr.exe */\r
+\r
+extern HWND khui_hwnd_main;\r
+\r
+typedef struct tag_khui_ui_callback_data {\r
+ khm_int32 magic;\r
+ khm_ui_callback cb;\r
+ void * rock;\r
+ khm_int32 rv;\r
+} khui_ui_callback_data;\r
+\r
+#define KHUI_UICBDATA_MAGIC 0x8a08572a\r
+\r
+#endif\r
BEGIN\r
IDS_NC_REN_FAILED_TITLE_I "Failed to renew creds for %s"\r
IDS_CFG_IDNAME_NON "No identity selected. Please select an identity and try again."\r
+ IDS_MENU_DESTROY_CRED "Destroy ..."\r
+ IDS_MENU_RENEW_CRED "Renew ..."\r
+ IDS_ACTION_DESTROY_ALL "All identities"\r
+ IDS_ACTION_RENEW_ALL "All identities"\r
+ IDS_IDACTION_RENEW "Renew credentials for %s"\r
+ IDS_IDACTION_DESTROY "Destroy credentials for %s"\r
+ IDS_CTX_DESTROY_ID "Destroying identity %1!s!"\r
END\r
\r
#endif // English (U.S.) resources\r
void khm_add_property_sheet(khui_property_sheet * s) {\r
if(_n_ui_propsheets < MAX_UI_PROPSHEETS)\r
_ui_propsheets[_n_ui_propsheets++] = s;\r
+ else {\r
#ifdef DEBUG\r
- else\r
assert(FALSE);\r
#endif\r
+ }\r
}\r
\r
void khm_del_property_sheet(khui_property_sheet * s) {\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
return ret;\r
}\r
\r
+struct identity_action_map {\r
+ khm_handle identity;\r
+ khm_int32 renew_cmd;\r
+ khm_int32 destroy_cmd;\r
+ int refreshcycle;\r
+};\r
+\r
+#define IDMAP_ALLOC_INCR 8\r
+\r
+struct identity_action_map * id_action_map = NULL;\r
+khm_size n_id_action_map = 0;\r
+khm_size nc_id_action_map = 0;\r
+\r
+int idcmd_refreshcycle = 0;\r
+\r
+static struct identity_action_map *\r
+create_identity_cmd_map(khm_handle ident) {\r
+\r
+ struct identity_action_map * actmap;\r
+ wchar_t idname[KCDB_IDENT_MAXCCH_NAME];\r
+ wchar_t fmt[128];\r
+ wchar_t tooltip[KHUI_MAXCCH_SHORT_DESC];\r
+ khm_size cb;\r
+\r
+ if (n_id_action_map + 1 > nc_id_action_map) {\r
+ nc_id_action_map = UBOUNDSS(n_id_action_map + 1,\r
+ IDMAP_ALLOC_INCR,\r
+ IDMAP_ALLOC_INCR);\r
+#ifdef DEBUG\r
+ assert(nc_id_action_map > n_id_action_map + 1);\r
+#endif\r
+ id_action_map = PREALLOC(id_action_map,\r
+ nc_id_action_map * sizeof(id_action_map[0]));\r
+#ifdef DEBUG\r
+ assert(id_action_map);\r
+#endif\r
+ ZeroMemory(&id_action_map[n_id_action_map],\r
+ sizeof(id_action_map[0]) * (nc_id_action_map - n_id_action_map));\r
+ }\r
+\r
+ actmap = &id_action_map[n_id_action_map];\r
+ n_id_action_map++;\r
+\r
+ cb = sizeof(idname);\r
+ kcdb_identity_get_name(ident, idname, &cb);\r
+\r
+ actmap->identity = ident;\r
+ kcdb_identity_hold(ident);\r
+\r
+ fmt[0] = L'\0';\r
+ LoadString(khm_hInstance, IDS_IDACTION_RENEW,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(tooltip, sizeof(tooltip), fmt, idname);\r
+\r
+ actmap->renew_cmd =\r
+ khui_action_create(NULL, idname, tooltip, NULL,\r
+ KHUI_ACTIONTYPE_TRIGGER, NULL);\r
+\r
+ fmt[0] = L'\0';\r
+ LoadString(khm_hInstance, IDS_IDACTION_DESTROY,\r
+ fmt, ARRAYLENGTH(fmt));\r
+ StringCbPrintf(tooltip, sizeof(tooltip), fmt, idname);\r
+\r
+ actmap->destroy_cmd =\r
+ khui_action_create(NULL, idname, tooltip, NULL,\r
+ KHUI_ACTIONTYPE_TRIGGER, NULL);\r
+\r
+ actmap->refreshcycle = idcmd_refreshcycle;\r
+\r
+ return actmap;\r
+}\r
+\r
+static void\r
+purge_identity_cmd_map(void) {\r
+ khm_size i;\r
+\r
+ for (i=0; i < n_id_action_map; i++) {\r
+ khm_handle ident;\r
+\r
+ if (id_action_map[i].refreshcycle != idcmd_refreshcycle) {\r
+ ident = id_action_map[i].identity;\r
+ id_action_map[i].identity = NULL;\r
+ kcdb_identity_release(ident);\r
+\r
+ khui_action_delete(id_action_map[i].renew_cmd);\r
+ khui_action_delete(id_action_map[i].destroy_cmd);\r
+\r
+ id_action_map[i].renew_cmd = 0;\r
+ id_action_map[i].destroy_cmd = 0;\r
+ }\r
+ }\r
+}\r
+\r
+static struct identity_action_map *\r
+get_identity_cmd_map(khm_handle ident) {\r
+ khm_size i;\r
+\r
+ for (i=0; i < n_id_action_map; i++) {\r
+ if (kcdb_identity_is_equal(id_action_map[i].identity,\r
+ ident))\r
+ break;\r
+ }\r
+\r
+ if (i < n_id_action_map) {\r
+ id_action_map[i].refreshcycle = idcmd_refreshcycle;\r
+ return &id_action_map[i];\r
+ } else {\r
+ return create_identity_cmd_map(ident);\r
+ }\r
+}\r
+\r
+static khm_int32\r
+get_identity_renew_command(khm_handle ident) {\r
+ struct identity_action_map * map;\r
+\r
+ map = get_identity_cmd_map(ident);\r
+\r
+ if (map)\r
+ return map->renew_cmd;\r
+ else\r
+ return 0;\r
+}\r
+\r
+static khm_int32\r
+get_identity_destroy_command(khm_handle ident) {\r
+ struct identity_action_map * map;\r
+\r
+ map = get_identity_cmd_map(ident);\r
+\r
+ if (map)\r
+ return map->destroy_cmd;\r
+ else\r
+ return 0;\r
+}\r
+\r
+void\r
+khm_refresh_identity_menus(void) {\r
+ khui_menu_def * renew_def = NULL;\r
+ khui_menu_def * dest_def = NULL;\r
+ wchar_t * idlist = NULL;\r
+ wchar_t * idname = NULL;\r
+ khm_size cb = 0;\r
+ khm_size n_idents = 0;\r
+ khm_size t;\r
+ khm_int32 rv = KHM_ERROR_SUCCESS;\r
+\r
+ idcmd_refreshcycle++;\r
+\r
+ do {\r
+ if (idlist)\r
+ PFREE(idlist);\r
+ idlist = NULL;\r
+ cb = 0;\r
+\r
+ rv = kcdb_identity_enum(KCDB_IDENT_FLAG_ACTIVE | KCDB_IDENT_FLAG_EMPTY,\r
+ KCDB_IDENT_FLAG_ACTIVE,\r
+ NULL,\r
+ &cb,\r
+ &n_idents);\r
+ if (rv != KHM_ERROR_TOO_LONG || cb == 0 || cb == sizeof(wchar_t) * 2)\r
+ break;\r
+\r
+ idlist = PMALLOC(cb);\r
+#ifdef DEBUG\r
+ assert(idlist);\r
+#endif\r
+\r
+ rv = kcdb_identity_enum(KCDB_IDENT_FLAG_ACTIVE | KCDB_IDENT_FLAG_EMPTY,\r
+ KCDB_IDENT_FLAG_ACTIVE,\r
+ idlist,\r
+ &cb,\r
+ &n_idents);\r
+ if (rv == KHM_ERROR_TOO_LONG)\r
+ continue;\r
+\r
+ if (KHM_FAILED(rv)) {\r
+ /* something else went wrong. hmm. */\r
+ if (idlist)\r
+ PFREE(idlist);\r
+ idlist = NULL;\r
+ }\r
+ break;\r
+\r
+ } while(TRUE);\r
+\r
+ renew_def = khui_find_menu(KHUI_MENU_RENEW_CRED);\r
+ dest_def = khui_find_menu(KHUI_MENU_DESTROY_CRED);\r
+#ifdef DEBUG\r
+ assert(renew_def);\r
+ assert(dest_def);\r
+#endif\r
+\r
+ t = khui_menu_get_size(renew_def);\r
+ while(t) {\r
+ khui_menu_remove_action(renew_def, 0);\r
+ t--;\r
+ }\r
+ khui_menu_insert_action(renew_def, 0, KHUI_ACTION_RENEW_ALL, 0);\r
+\r
+ t = khui_menu_get_size(dest_def);\r
+ while(t) {\r
+ khui_menu_remove_action(dest_def, 0);\r
+ t--;\r
+ }\r
+ khui_menu_insert_action(dest_def, 0, KHUI_ACTION_DESTROY_ALL, 0);\r
+\r
+ if (idlist != NULL && n_idents > 0) {\r
+ khui_menu_insert_action(renew_def, 1, KHUI_MENU_SEP, 0);\r
+ khui_menu_insert_action(dest_def, 1, KHUI_MENU_SEP, 0);\r
+ }\r
+\r
+ for (idname = idlist; idname && idname[0];\r
+ idname = multi_string_next(idname)) {\r
+ khm_handle identity = NULL;\r
+\r
+ if (KHM_FAILED(kcdb_identity_create(idname, 0, &identity))) {\r
+#ifdef DEBUG\r
+ assert(FALSE);\r
+#endif\r
+ continue;\r
+ }\r
+\r
+ khui_menu_insert_action(renew_def, 1000,\r
+ get_identity_renew_command(identity),\r
+ 0);\r
+\r
+ khui_menu_insert_action(dest_def, 1000,\r
+ get_identity_destroy_command(identity),\r
+ 0);\r
+ }\r
+\r
+ if (idlist)\r
+ PFREE(idlist);\r
+\r
+ purge_identity_cmd_map();\r
+}\r
+\r
+khm_boolean\r
+khm_check_identity_menu_action(khm_int32 act_id) {\r
+\r
+ if (act_id == KHUI_ACTION_DESTROY_ALL) {\r
+ khm_size i;\r
+\r
+ for (i=0; i < n_id_action_map; i++) {\r
+ if (id_action_map[i].identity != NULL) {\r
+ khm_cred_destroy_identity(id_action_map[i].identity);\r
+ }\r
+ }\r
+\r
+ return TRUE;\r
+ } else if (act_id == KHUI_ACTION_RENEW_ALL) {\r
+ khm_size i;\r
+\r
+ for (i=0; i < n_id_action_map; i++) {\r
+ if (id_action_map[i].identity != NULL) {\r
+ khm_cred_renew_identity(id_action_map[i].identity);\r
+ }\r
+ }\r
+\r
+ return TRUE;\r
+ } else {\r
+ khm_size i;\r
+\r
+ for (i=0; i < n_id_action_map; i++) {\r
+ if (id_action_map[i].identity == NULL)\r
+ continue;\r
+\r
+ if (id_action_map[i].renew_cmd == act_id) {\r
+ khm_cred_renew_identity(id_action_map[i].identity);\r
+ return TRUE;\r
+ }\r
+\r
+ if (id_action_map[i].destroy_cmd == act_id) {\r
+ khm_cred_destroy_identity(id_action_map[i].identity);\r
+ return TRUE;\r
+ }\r
+ }\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
+\r
HMENU khui_hmenu_main = NULL;\r
\r
void khm_menu_refresh_items(void) {\r
if(!hwtb) {\r
#ifdef DEBUG\r
assert(FALSE);\r
-#else\r
- return;\r
#endif\r
+ return;\r
}\r
\r
khui_main_menu_toolbar = hwtb;\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
LRESULT khm_menu_measure_item(WPARAM wParam, LPARAM lparam);\r
LRESULT khm_menu_draw_item(WPARAM wParam, LPARAM lparam);\r
void khm_menu_refresh_items(void);\r
+khm_boolean khm_check_identity_menu_action(khm_int32 act_id);\r
+void khm_refresh_identity_menus(void);\r
\r
static HMENU mm_create_menu_from_def(khui_menu_def * def, BOOL main);\r
static void mm_show_panel_def(khui_menu_def * def, LONG x, LONG y);\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
/* $Id$ */\r
\r
#include<khmapp.h>\r
+#include<intaction.h>\r
#include<assert.h>\r
\r
ATOM khm_main_window_class;\r
&timeout)))\r
timeout = MW_REFRESH_TIMEOUT;\r
khc_close_space(csp_cw);\r
- } else\r
+ } else {\r
timeout = MW_REFRESH_TIMEOUT;\r
+ }\r
\r
timeout *= 1000; /* convert to milliseconds */\r
\r
papp_ver->code = KHM_ERROR_SUCCESS;\r
}\r
\r
+static void\r
+khm_ui_cb(LPARAM lParam) {\r
+ khui_ui_callback_data * pcbdata;\r
+\r
+ pcbdata = (khui_ui_callback_data *) lParam;\r
+\r
+ if (pcbdata == NULL || pcbdata->magic != KHUI_UICBDATA_MAGIC) {\r
+#ifdef DEBUG\r
+ assert(FALSE);\r
+#endif\r
+ return;\r
+ }\r
+\r
+#ifdef DEBUG\r
+ assert(pcbdata->cb);\r
+#endif\r
+\r
+ /* make the call */\r
+ pcbdata->rv = (*pcbdata->cb)(khm_hwnd_main, pcbdata->rock);\r
+}\r
+\r
LRESULT CALLBACK \r
khm_main_wnd_proc(HWND hwnd,\r
UINT uMsg,\r
return SendMessage(khm_hwnd_main_cred, uMsg, \r
wParam, lParam);\r
\r
+ case KHUI_ACTION_UICB:\r
+ khm_ui_cb(lParam);\r
+ break;\r
+\r
/* menu commands */\r
case KHUI_PACTION_MENU:\r
if(HIWORD(lParam) == 1)\r
{\r
khui_action * act;\r
\r
+ /* check if this is an identity menu action. (custom\r
+ actions that were created for renewing or\r
+ destroying specific identities). */\r
+ if (khm_check_identity_menu_action(LOWORD(wParam)))\r
+ break;\r
+\r
act = khui_find_action(LOWORD(wParam));\r
if (act && act->listener) {\r
kmq_post_sub_msg(act->listener, KMSG_ACT, KMSG_ACT_ACTIVATE, act->cmd, NULL);\r
} else if (m->type == KMSG_CRED &&\r
m->subtype == KMSG_CRED_ADDR_CHANGE) {\r
khm_cred_addr_change();\r
+ } else if (m->type == KMSG_CRED &&\r
+ m->subtype == KMSG_CRED_ROOTDELTA) {\r
+ khm_refresh_identity_menus();\r
} else if (m->type == KMSG_KMM &&\r
m->subtype == KMSG_KMM_I_DONE) {\r
kmq_post_message(KMSG_ACT, KMSG_ACT_BEGIN_CMDLINE, 0, 0);\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
} else {\r
#ifdef DEBUG\r
assert(FALSE);\r
-#else\r
- continue;\r
#endif\r
+ continue;\r
}\r
}\r
\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
pdlginfo->out.ccache,\r
&cb);\r
kcdb_identity_release(out_ident);\r
- }\r
+ } else {\r
#ifdef DEBUG\r
- else {\r
assert(FALSE);\r
- }\r
#endif\r
+ }\r
\r
*atsign++ = 0;\r
\r
#define IDS_NC_PWD_FAILED_TITLE_I 287\r
#define IDS_NC_REN_FAILED_TITLE_I 288\r
#define IDS_CFG_IDNAME_NON 289\r
+#define IDS_MENU_DESTROY_CRED 290\r
+#define IDS_MENU_RENEW_CRED 291\r
+#define IDS_ACTION_DESTROY_ALL 292\r
+#define IDS_ACTION_RENEW_ALL 293\r
+#define IDS_IDACTION_RENEW 294\r
+#define IDS_IDACTION_DESTROY 295\r
+#define IDS_CTX_DESTROY_ID 296\r
#define IDC_NC_USERNAME 1007\r
#define IDC_NC_PASSWORD 1008\r
#define IDC_NC_CREDTEXT_LABEL 1009\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
if (!def) {\r
#ifdef DEBUG\r
assert(FALSE);\r
-#else\r
- return;\r
#endif\r
+ return;\r
}\r
\r
hwtb = CreateWindowEx(0\r
if(!hwtb) {\r
#ifdef DEBUG\r
assert(FALSE);\r
-#else\r
- return;\r
#endif\r
+ return;\r
}\r
\r
hiList = ImageList_Create(\r
--- /dev/null
+/*\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person\r
+ * obtaining a copy of this software and associated documentation\r
+ * files (the "Software"), to deal in the Software without\r
+ * restriction, including without limitation the rights to use, copy,\r
+ * modify, merge, publish, distribute, sublicense, and/or sell copies\r
+ * of the Software, and to permit persons to whom the Software is\r
+ * furnished to do so, subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be\r
+ * included in all copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ */\r
+\r
+/* $Id$ */\r
+\r
+#include<khuidefs.h>\r
+#include<intaction.h>\r
+\r
+#ifdef DEBUG\r
+#include <assert.h>\r
+#endif\r
+\r
+KHMEXP khm_int32 KHMAPI\r
+khui_request_UI_callback(khm_ui_callback cb, void * rock) {\r
+\r
+ khui_ui_callback_data cbdata;\r
+\r
+#ifdef DEBUG\r
+ assert(khui_hwnd_main);\r
+#endif\r
+\r
+ if (khui_hwnd_main == NULL)\r
+ return KHM_ERROR_NOT_READY;\r
+\r
+ ZeroMemory(&cbdata, sizeof(cbdata));\r
+ cbdata.magic = KHUI_UICBDATA_MAGIC;\r
+ cbdata.cb = cb;\r
+ cbdata.rock = rock;\r
+ cbdata.rv = KHM_ERROR_NOT_IMPLEMENTED;\r
+\r
+ SendMessage(khui_hwnd_main, WM_COMMAND,\r
+ MAKEWPARAM(KHUI_ACTION_UICB, 0),\r
+ (LPARAM) &cbdata);\r
+\r
+ return KHM_ERROR_SUCCESS;\r
+}\r
+\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
\r
#define NOEXPORT\r
#include<khuidefs.h>\r
+#include<intaction.h>\r
#include<utils.h>\r
#include<assert.h>\r
\r
MENU_DEFACTION(KHUI_ACTION_CLOSE_APP),\r
MENU_SEP(),\r
MENU_ACTION(KHUI_ACTION_NEW_CRED),\r
- MENU_ACTION(KHUI_ACTION_RENEW_CRED),\r
- MENU_ACTION(KHUI_ACTION_DESTROY_CRED),\r
+ MENU_SUBMENU(KHUI_MENU_RENEW_CRED),\r
+ MENU_SUBMENU(KHUI_MENU_DESTROY_CRED),\r
MENU_SEP(),\r
MENU_ACTION(KHUI_ACTION_EXIT),\r
MENU_END()\r
MENU_END()\r
};\r
\r
+khui_action_ref khui_menu_destroy_cred[] = {\r
+ MENU_DEFACTION(KHUI_ACTION_DESTROY_ALL),\r
+ MENU_END()\r
+};\r
+\r
+khui_action_ref khui_menu_renew_cred[] = {\r
+ MENU_DEFACTION(KHUI_ACTION_RENEW_ALL),\r
+ MENU_END()\r
+};\r
+\r
khui_action_ref khui_pmenu_tok_sel[] = {\r
MENU_ACTION(KHUI_ACTION_RENEW_CRED),\r
MENU_ACTION(KHUI_ACTION_DESTROY_CRED),\r
CONSTMENU(KHUI_MENU_OPTIONS, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_options),\r
CONSTMENU(KHUI_MENU_HELP, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_help),\r
CONSTMENU(KHUI_MENU_COLUMNS, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_columns),\r
+ CONSTMENU(KHUI_MENU_RENEW_CRED, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_renew_cred),\r
+ CONSTMENU(KHUI_MENU_DESTROY_CRED, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_menu_destroy_cred),\r
\r
/* toolbars */\r
CONSTMENU(KHUI_TOOLBAR_STANDARD, KHUI_MENUSTATE_CONSTANT | KHUI_MENUSTATE_SYSTEM, khui_toolbar_standard),\r
KHUI_MENU_LAYOUT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_LAYOUT,0,0,0\r
KHUI_MENU_TOOLBARS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_TOOLBARS,0,0,0\r
KHUI_MENU_COLUMNS,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_CHOOSE_COLS,0,IDH_ACTION_CHOOSE_COLS,0\r
+KHUI_MENU_DESTROY_CRED,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_DESTROY_CRED,0,0,0\r
+KHUI_MENU_RENEW_CRED,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_MENU_RENEW_CRED,0,0,0\r
KHUI_ACTION_PROPERTIES,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_PROPERTIES,IDS_ACTIONT_PROPERTIES,IDH_ACTION_PROPERTIES,0\r
KHUI_ACTION_EXIT,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_EXIT,IDS_ACTIONT_EXIT,IDH_ACTION_EXIT,0\r
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\r
KHUI_ACTION_OPEN_APP,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_OPEN_APP,0,0,0\r
KHUI_ACTION_CLOSE_APP,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_CLOSE_APP,0,0,0\r
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\r
+KHUI_ACTION_DESTROY_ALL,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_DESTROY_ALL,0,0,0\r
+KHUI_ACTION_RENEW_ALL,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_ACTION_RENEW_ALL,0,0,0\r
KHUI_PACTION_OK,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_OK,0,0,0\r
KHUI_PACTION_CANCEL,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_CANCEL,0,0,0\r
KHUI_PACTION_CLOSE,KHUI_ACTIONTYPE_TRIGGER,,0,0,0,0,0,IDS_PACTION_CLOSE,0,0,0\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
#define KHUI_ACTION_LAYOUT_CUST (KHUI_ACTION_BASE + 30)\r
#define KHUI_ACTION_OPT_APPEAR (KHUI_ACTION_BASE + 31)\r
#define KHUI_ACTION_LAYOUT_RELOAD (KHUI_ACTION_BASE + 32)\r
+#define KHUI_ACTION_RENEW_ALL (KHUI_ACTION_BASE + 33)\r
+#define KHUI_ACTION_DESTROY_ALL (KHUI_ACTION_BASE + 34)\r
+#define KHUI_ACTION_UICB (KHUI_ACTION_BASE + 35)\r
/*@}*/\r
\r
/*! \name Pseudo actions \r
#define KHUI_PACTION_PGUP (KHUI_PACTION_BASE + 26)\r
#define KHUI_PACTION_PGUP_EXTEND (KHUI_PACTION_BASE + 27)\r
#define KHUI_PACTION_PGDN_EXTEND (KHUI_PACTION_BASE + 28)\r
+\r
/*@}*/\r
\r
/*! \name Menus\r
#define KHUI_PMENU_TOK_SEL (KHUI_MENU_BASE + 10)\r
#define KHUI_PMENU_ID_SEL (KHUI_MENU_BASE + 11)\r
\r
-/* Next menu: 14 */\r
+#define KHUI_MENU_DESTROY_CRED (KHUI_MENU_BASE + 16)\r
+#define KHUI_MENU_RENEW_CRED (KHUI_MENU_BASE + 17)\r
+\r
/*@}*/\r
\r
/*! \name Toolbars\r
/*\r
* Copyright (c) 2005 Massachusetts Institute of Technology\r
+ * Copyright (c) 2007 Secure Endpoints Inc.\r
*\r
* Permission is hereby granted, free of charge, to any person\r
* obtaining a copy of this software and associated documentation\r
KHMEXP khm_ui_4 KHMAPI\r
khm_get_commctl_version(khm_version * pdvi);\r
\r
+typedef khm_int32\r
+(KHMAPI *khm_ui_callback)(HWND hwnd_main_wnd, void * rock);\r
+\r
+KHMEXP khm_int32 KHMAPI\r
+khui_request_UI_callback(khm_ui_callback cb, void * rock);\r
+\r
/*!@}*/\r
\r
#endif\r