[krbdev.mit.edu #5610] NIM password prompt does not identify itself
Kevin Koch via RT
rt at krbdev.mit.edu
Mon Sep 24 14:49:50 EDT 2007
This patch solves the titlebar problem by putting the explanatory
prompt in the dialog. It uses two registry settings:
PluginManager/NameSpaceName: The word 'Kerberos' which is prepended
to the Username input label.
PluginManager/NewCredPromptText: 'Enter your Kerberos password.'
Either registry entry can be omitted.
This patch embeds knowledge of the New Cedentials dialog in the krb5
plugin, which is not a valid long term solution. Why? The patch or
something like it needs to be included in KfW 3.2.2 before midweek.
C:\KfW\pismere\athena\auth\krb5\src\windows\identity>svn diff
plugins\krb5\krb5identpro.c
Index: plugins/krb5/krb5identpro.c
===================================================================
--- plugins/krb5/krb5identpro.c (revision 19911)
+++ plugins/krb5/krb5identpro.c (working copy)
@@ -31,7 +31,11 @@
#include<strsafe.h>
#include<krb5.h>
#include<assert.h>
+#include <string.h>
+#include <memory.h>
+#include <wchar.h>
+
#define K5_NCID_UN_LABEL (KHUI_CW_ID_MIN + 0)
#define K5_NCID_UN (KHUI_CW_ID_MIN + 1)
#define K5_NCID_REALM_LABEL (KHUI_CW_ID_MIN + 2)
@@ -49,6 +53,8 @@
HWND hw_realm;
} k5_new_cred_data;
+#define IDC_ENTUNAME 1145 /* Hack! */
+
static
void
trim_str(wchar_t * s, khm_size cch) {
@@ -397,6 +403,7 @@
return FALSE;
}
+
/* UI Callback
runs in UI thread */
@@ -427,6 +434,12 @@
khm_int32 rv;
khm_handle hident;
+ khm_handle csp_pm = NULL;
+ wchar_t namespace[KCONF_MAXCCH_NAME];
+ khm_size cbsize;
+ wchar_t promptText[KCONF_MAXCCH_NAME];
+ HWND hw_prompt;
+
hw_parent = (HWND) lParam;
defident[0] = L'\0';
@@ -435,6 +448,16 @@
assert(hw_parent != NULL);
#endif
+ if (!KHM_FAILED(khc_open_space(NULL, L"PluginManager",
KHM_PERM_READ, &csp_pm))) {
+ ZeroMemory(namespace, sizeof(namespace) * sizeof
(wchar_t));
+ ZeroMemory(promptText, sizeof(promptText) * sizeof
(wchar_t));
+ cbsize = sizeof(namespace);
+ khc_read_string(csp_pm, L"NameSpaceName", namespace,
&cbsize);
+ cbsize = sizeof(promptText);
+ khc_read_string(csp_pm, L"NewCredPromptText",
promptText, &cbsize);
+ khc_close_space(csp_pm);
+ }
+
d = PMALLOC(sizeof(*d));
assert(d);
ZeroMemory(d, sizeof(*d));
@@ -446,10 +469,17 @@
LoadString(hResModule, IDS_NC_USERNAME,
wbuf, ARRAYLENGTH(wbuf));
+ /* Find and set IDC_ENTUNAME: */
+ hw_prompt = GetDlgItem(hw_parent, IDC_ENTUNAME);
+ if (hw_prompt) SendMessage(hw_prompt, WM_SETTEXT, 0,
(LPARAM)promptText);
+
+ /* Build up username prompt from NameSpaceName and
Username: */
+ wcsncat(namespace, wbuf, KCONF_MAXCCH_NAME);
+
d->hw_username_label = CreateWindow
(L"STATIC",
- wbuf,
- SS_SIMPLE | WS_CHILD | WS_VISIBLE,
+ namespace,
+ WS_CHILD | WS_VISIBLE,
0, 0, 100, 100, /* bogus values */
hw_parent,
(HMENU) K5_NCID_UN_LABEL,
@@ -713,6 +743,7 @@
WM_SETTEXT,
0,
(LPARAM) defident);
+
}
set_identity_from_ui(nc, d);
C:\KfW\pismere\athena\auth\krb5\src\windows\identity>svn diff
ui/resource.h
Index: ui/resource.h
===================================================================
--- ui/resource.h (revision 19911)
+++ ui/resource.h (working copy)
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by C:\work\pismere\athena\auth\krb5
\src\windows\identity\ui\lang\en_us\khapp.rc
+// Used by C:\KfW\pismere\athena\auth\krb5
\src\windows\identity\ui\lang\en_us\khapp.rc
//
#define IDI_MAIN_APP 104
#define IDD_PP_CRED 106
@@ -397,6 +397,7 @@
#define IDC_CFG_NOTACT_STATIC 1142
#define IDC_NC_BASIC 1143
#define IDC_CONTENT 1144
+#define IDC_ENTUNAME 1145
#define IDA_ACTIVATE_MENU 40003
#define IDA_UP 40004
#define IDA_DOWN 40005
@@ -411,7 +412,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 214
#define _APS_NEXT_COMMAND_VALUE 40010
-#define _APS_NEXT_CONTROL_VALUE 1145
+#define _APS_NEXT_CONTROL_VALUE 1146
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
khapp.rc was editted with Visual Studio so the line wraps are
different. A prompt line was added to the new credentials dialog and
the BBAR OK button was made the same height as the other buttons. svn
diff crashes.
More information about the krb5-bugs
mailing list