summaryrefslogtreecommitdiffstats
path: root/src/windows/leashdll
diff options
context:
space:
mode:
authorKevin Wasserman <kevin.wasserman@painless-security.com>2012-06-21 13:22:39 -0400
committerBen Kaduk <kaduk@mit.edu>2012-08-24 15:54:50 -0400
commit88f425a7169a1f1d38b89d80a167f58e8ce475e8 (patch)
tree186dc1838bed4a465757e71b976193feac8034c5 /src/windows/leashdll
parent648f70f51ce7d130a2ba921c33f6cc152f097440 (diff)
downloadkrb5-88f425a7169a1f1d38b89d80a167f58e8ce475e8.tar.gz
krb5-88f425a7169a1f1d38b89d80a167f58e8ce475e8.tar.xz
krb5-88f425a7169a1f1d38b89d80a167f58e8ce475e8.zip
Add 'read-only principal' flag
Reserve the high-order 16 bits of dlgtype for flags. Add DLGFLAG_READONLY_PRINC. When specified, the get tickets dialog does not allow the user to change the principal. Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com> ticket: 7274 (new) queue: kfw target_version: 1.10.4 tags: pullup
Diffstat (limited to 'src/windows/leashdll')
-rw-r--r--src/windows/leashdll/lsh_pwd.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/windows/leashdll/lsh_pwd.c b/src/windows/leashdll/lsh_pwd.c
index 06b7a69d3f..1a1c6e4862 100644
--- a/src/windows/leashdll/lsh_pwd.c
+++ b/src/windows/leashdll/lsh_pwd.c
@@ -354,8 +354,6 @@ int Leash_kinit_dlg_ex(HWND hParent, LPLSH_DLGINFO_EX lpdlginfo)
return 1; /* pretend the dialog was displayed and succeeded */
}
- lpdlginfo->dlgtype = DLGTYPE_PASSWD;
-
/* set the help file */
Leash_set_help_file(NULL);
@@ -1495,6 +1493,8 @@ AuthenticateProc(
long realm_count = 0;
int disable_noaddresses = 0;
HWND hEditCtrl=0;
+ HWND hFocusCtrl=0;
+ BOOL bReadOnlyPrinc=0;
switch (message) {
@@ -1513,13 +1513,15 @@ AuthenticateProc(
if ((lpdi->size != LSH_DLGINFO_EX_V1_SZ &&
lpdi->size != LSH_DLGINFO_EX_V2_SZ &&
lpdi->size < LSH_DLGINFO_EX_V3_SZ) ||
- lpdi->dlgtype != DLGTYPE_PASSWD) {
+ (lpdi->dlgtype & DLGTYPE_MASK) != DLGTYPE_PASSWD) {
MessageBox(hDialog, "An incorrect initialization data structure was provided.",
"AuthenticateProc()",
MB_OK | MB_ICONSTOP);
return FALSE;
}
+ bReadOnlyPrinc = (lpdi->dlgtype & DLGFLAG_READONLYPRINC) ?
+ TRUE : FALSE;
if ( lpdi->size >= LSH_DLGINFO_EX_V2_SZ ) {
lpdi->out.username[0] = 0;
@@ -1535,17 +1537,6 @@ AuthenticateProc(
SetWindowText(hDialog, lpdi->title);
SetProp(hDialog, "HANDLES_HELP", (HANDLE)1);
-// @TODO: in/out principal
-/*
- if ( lpdi->size >= LSH_DLGINFO_EX_V3_SZ )
- lstrcpy(username, lpdi->in.username);
- else if (lpdi->username)
- lstrcpy(username, lpdi->username);
- if ( lpdi->size >= LSH_DLGINFO_EX_V3_SZ )
- lstrcpy(realm, lpdi->in.realm);
- else if (lpdi->realm)
- lstrcpy(realm, lpdi->realm);
-*/
if (lpdi->use_defaults) {
lifetime = Leash_get_default_lifetime();
if (lifetime <= 0)
@@ -1576,7 +1567,14 @@ AuthenticateProc(
proxiable = lpdi->proxiable;
publicip = lpdi->publicip;
}
-
+ if (lpdi->username && (strlen(lpdi->username) > 0) &&
+ lpdi->realm && (strlen(lpdi->realm) > 0)) {
+ sprintf_s(principal, sizeof(principal), "%s@%s", lpdi->username,
+ lpdi->realm);
+ } else {
+ principal[0] = 0;
+ }
+ Edit_SetReadOnly(hEditCtrl, bReadOnlyPrinc);
CSetDlgItemText(hDialog, IDC_EDIT_PRINCIPAL, principal);
CSetDlgItemText(hDialog, IDC_EDIT_PASSWORD, "");
@@ -1658,9 +1656,11 @@ AuthenticateProc(
/* Take keyboard focus */
SetActiveWindow(hDialog);
SetForegroundWindow(hDialog);
- if (GetDlgCtrlID((HWND) wParam) != IDC_EDIT_PRINCIPAL)
- {
- SetFocus(GetDlgItem(hDialog, IDC_EDIT_PRINCIPAL));
+ /* put focus on password if princ is read-only */
+ hFocusCtrl = bReadOnlyPrinc ?
+ GetDlgItem(hDialog, IDC_EDIT_PASSWORD) : hEditCtrl;
+ if (((HWND)wParam) != hFocusCtrl) {
+ SetFocus(hFocusCtrl);
}
break;