Skip to content

Commit

Permalink
Add Forget Principals to Get Tickets dialog
Browse files Browse the repository at this point in the history
And remove remnants of it from the "more" panel.

Clear the registry key that stores the principal list.
Also clear the autocomplete strings on the active control.

[kaduk@mit.edu: squashed commits and rewrote commit message.]

ticket: 7269 (new)
subject: forget principals functionality
queue: kfw
target_version: 1.10.4
tags: pullup
  • Loading branch information
Kevin Wasserman authored and kaduk committed Aug 24, 2012
1 parent 58441c9 commit 1b80ae9
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 14 deletions.
6 changes: 0 additions & 6 deletions src/windows/leash/LeashView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ BEGIN_MESSAGE_MAP(CLeashView, CListView)
ON_NOTIFY_REFLECT(LVN_ITEMACTIVATE, &CLeashView::OnLvnItemActivate)
ON_NOTIFY_REFLECT(LVN_KEYDOWN, &CLeashView::OnLvnKeydown)
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, &CLeashView::OnNMCustomdraw)
ON_COMMAND(ID_FORGET_PRINCIPALS, &CLeashView::OnForgetPrincipals)
END_MESSAGE_MAP()


Expand Down Expand Up @@ -2918,8 +2917,3 @@ void CLeashView::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
break;
}
}


void CLeashView::OnForgetPrincipals()
{
}
1 change: 0 additions & 1 deletion src/windows/leash/LeashView.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ class CLeashView : public CListView
afx_msg void OnLvnItemActivate(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnLvnKeydown(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnForgetPrincipals();
};

/*
Expand Down
2 changes: 1 addition & 1 deletion src/windows/leash/res/ribbon1.mfcribbon-ms

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/windows/leashdll/leashids.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
#define IDC_STATIC_NOTICE 1089
#define IDC_STATIC_RENEW 1090
#define IDD_PASSWORD 1091
#define IDC_BUTTON_CLEAR_HISTORY 1092
#define IDC_EDIT_PASSWORD2 1192
#define IDC_STATIC_PWD2 1193
#define IDC_EDIT_PASSWORD3 1194
Expand Down
2 changes: 1 addition & 1 deletion src/windows/leashdll/leashw32.def
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ EXPORTS
not_an_API_LeashKRB4GetTickets
not_an_API_LeashGetTimeServerName
not_an_API_Leash_AcquireInitialTicketsIfNeeded
not_an_API_LeashKRB5FreeTickets
not_an_API_LeashKRB5FreeTickets
9 changes: 7 additions & 2 deletions src/windows/leashdll/lsh_pwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,7 @@ AdjustOptions(HWND hDialog, int show, int hideDiff)
ShowWindow(GetDlgItem(hDialog,IDC_CHECK_NOADDRESS),show);
ShowWindow(GetDlgItem(hDialog,IDC_CHECK_RENEWABLE),show);
ShowWindow(GetDlgItem(hDialog,IDC_STATIC_KRB5),show);
ShowWindow(GetDlgItem(hDialog,IDC_BUTTON_CLEAR_HISTORY),show);

GetWindowRect( hDialog, &dlgRect );
diff = dlgRect.top + GetSystemMetrics(SM_CYCAPTION)
Expand All @@ -1453,14 +1454,15 @@ AdjustOptions(HWND hDialog, int show, int hideDiff)
dlgRect.bottom-dlgRect.top+(show ? 1 : - 1) * hideDiff,
SWP_NOZORDER|SWP_NOMOVE);

CSetDlgItemText(hDialog, IDC_BUTTON_OPTIONS, show ?
"Hide Advanced Settings" : "Show Advanced Settings");
CSetDlgItemText(hDialog, IDC_BUTTON_OPTIONS,
show ? "Hide Advanced" : "Show Advanced");

}

extern void *lacInit(HWND hEditCtl);
extern void lacTerm(void *pAutoComplete);
extern void lacAddPrincipal(char *principal);
extern void Leash_pec_clear_history(void *pec);

/* Callback function for the Authentication Dialog box that initializes and
renews tickets. */
Expand Down Expand Up @@ -1719,6 +1721,9 @@ AuthenticateProc(

}
break;
case IDC_BUTTON_CLEAR_HISTORY:
Leash_pec_clear_history(pAutoComplete);
break;
case IDC_CHECK_RENEWABLE:
{
if (IsDlgButtonChecked(hDialog, IDC_CHECK_RENEWABLE)) {
Expand Down
3 changes: 2 additions & 1 deletion src/windows/leashdll/lsh_pwd.rc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ BEGIN
ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,302,219,49,14
PUSHBUTTON "Cancel",IDCANCEL,249,219,49,14
PUSHBUTTON "Hide Advanced Settings",IDC_BUTTON_OPTIONS,146,219,89,14
PUSHBUTTON "Hide Advanced",IDC_BUTTON_OPTIONS,146,219,89,14
PUSHBUTTON "Clear Principal History",IDC_BUTTON_CLEAR_HISTORY,13,203,120,14
CONTROL "Ticket Lifetime",IDC_SLIDER_LIFETIME,"msctls_trackbar32",
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,90,97,258,15
CONTROL "Forwardable (can be forwarded to other machines)",
Expand Down
25 changes: 23 additions & 2 deletions src/windows/leashdll/lshutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ class DynEnumString : public IEnumString
}

virtual ~DynEnumString()
{
RemoveAll();
}

void RemoveAll()
{
for (m_iter = m_aStrings.begin();
m_iter != m_aStrings.end();
Expand Down Expand Up @@ -354,6 +359,7 @@ class PrincipalEditControl : public HookWindow
,m_bUpperCaseRealm(bUpperCaseRealm)
,m_defaultRealm(NULL)
,m_ctx(0)
,m_enumString(NULL)
,m_acdd(NULL)
,m_princStr(NULL)
{
Expand All @@ -373,6 +379,18 @@ class PrincipalEditControl : public HookWindow
pkrb5_free_context(m_ctx);
}

void ClearHistory()
{
if (m_enumString != NULL)
m_enumString->RemoveAll();
if (m_acdd != NULL)
m_acdd->ResetEnumerator();
if (m_princStr != NULL) {
delete[] m_princStr;
m_princStr = NULL;
}
}

protected:
// Convert str to upper case
// This should be more-or-less _UNICODE-agnostic
Expand Down Expand Up @@ -565,10 +583,13 @@ extern "C" void lacAddPrincipal(char *principal)
RegCloseKey(hKey);
}

extern "C" void lacReset()
extern "C" void Leash_pec_clear_history(void *pec)
{
// clear princs from registry
//RegDeleteKeyEx()
RegDeleteKey(HKEY_CURRENT_USER,
LEASH_REGISTRY_PRINCIPALS_KEY_NAME);
// ...and from the specified widget
static_cast<PrincipalEditControl *>(pec)->ClearHistory();
}


Expand Down

0 comments on commit 1b80ae9

Please sign in to comment.