From 9f097418620513813ecc086bcd9002b6e07bf2a1 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Fri, 14 Oct 2011 14:42:37 +0000 Subject: Further attempt at removing K4 specific code from the leash executable Updates to leash Makefile.in to make it link on Windows 64 Signed-off-by: Alexey Melnikov leash link fixes: fix mfc library and fix path to wshelper MFC100D.lib for mscv2010; util\wshelper instead of windows\wshelper Add ver.rc for leash Signed-off-by: Kevin Wasserman git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25339 dc483132-0cff-0310-8789-dd5450dbe970 --- src/Makefile.in | 7 +- src/windows/Makefile.in | 2 +- src/windows/leash/Krb4EditDomainRealmList.cpp | 4 + src/windows/leash/KrbConfigOptions.cpp | 11 ++- src/windows/leash/KrbDomainRealmMaintenance.cpp | 7 +- src/windows/leash/KrbMiscConfigOpt.cpp | 14 ++- src/windows/leash/KrbProperties.cpp | 8 +- src/windows/leash/KrbProperties.h | 6 ++ src/windows/leash/Leash.cpp | 39 ++++++++- src/windows/leash/Leash.h | 12 ++- src/windows/leash/LeashAboutBox.cpp | 2 + src/windows/leash/LeashDebugWindow.cpp | 8 +- src/windows/leash/LeashProperties.cpp | 8 ++ src/windows/leash/LeashView.cpp | 112 ++++++++++++++++++++++-- src/windows/leash/LeashView.h | 11 +++ src/windows/leash/Lglobals.h | 16 +--- src/windows/leash/Makefile.in | 98 +++++++++++++++++++++ src/windows/leash/ver.rc | 3 + 18 files changed, 329 insertions(+), 39 deletions(-) create mode 100644 src/windows/leash/Makefile.in create mode 100644 src/windows/leash/ver.rc diff --git a/src/Makefile.in b/src/Makefile.in index c03ddd46cf..625fb58d7b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -195,7 +195,8 @@ WINMAKEFILES=Makefile \ windows\Makefile windows\lib\Makefile \ windows\cns\Makefile windows\gina\Makefile \ windows\ms2mit\Makefile \ - windows\wintel\Makefile windows\kfwlogon\Makefile windows\leashdll\Makefile + windows\wintel\Makefile windows\kfwlogon\Makefile \ + windows\leashdll\Makefile windows\leash\Makefile ##DOS##Makefile-windows:: $(MKFDEP) $(WINMAKEFILES) @@ -323,6 +324,8 @@ WINMAKEFILES=Makefile \ ##DOS## $(WCONFIG) config < $@.in > $@ ##DOS##windows\leashdll\Makefile: windows\leashdll\Makefile.in $(MKFDEP) ##DOS## $(WCONFIG) config < $@.in > $@ +##DOS##windows\leash\Makefile: windows\leash\Makefile.in $(MKFDEP) +##DOS## $(WCONFIG) config < $@.in > $@ clean-windows:: Makefile-windows @@ -367,7 +370,7 @@ WINFILES= \ ccapi/test/* \ util/windows/* windows/* windows/wshelper/* windows/lib/* windows/cns/* \ windows/wintel/* windows/gina/* windows/ms2mit/* \ - windows/kfwlogon/* windows/leashdll/* + windows/kfwlogon/* windows/leashdll/* windows/leash/* WINBINARYFILES= windows/*/*.ico windows/*/*.doc windows/*/*.hlp \ windows/*/*.hpj diff --git a/src/windows/Makefile.in b/src/windows/Makefile.in index 79fe8160cb..da1427f700 100644 --- a/src/windows/Makefile.in +++ b/src/windows/Makefile.in @@ -1,3 +1,3 @@ BUILDTOP=.. NO_OUTPRE=1 -SUBDIRS= lib leashdll cns gina ms2mit kfwlogon +SUBDIRS= lib leashdll leash cns gina ms2mit kfwlogon diff --git a/src/windows/leash/Krb4EditDomainRealmList.cpp b/src/windows/leash/Krb4EditDomainRealmList.cpp index 0470448340..e2773bf0f4 100644 --- a/src/windows/leash/Krb4EditDomainRealmList.cpp +++ b/src/windows/leash/Krb4EditDomainRealmList.cpp @@ -42,8 +42,12 @@ CKrb4EditDomainRealmList::CKrb4EditDomainRealmList(LPSTR editItem, CWnd* pParent *findSpace = 0; else { +////@#+This hack doesn't seem right +#ifndef NO_KRB4 + LeashErrorBox("This is a defective entry in file", CKrb4ConfigFileLocation::m_newKrbrealmFile); +#endif ASSERT(0); m_initDomainHost = m_newDomainHost = editItem; m_initRealm = m_newRealm = _T(""); diff --git a/src/windows/leash/KrbConfigOptions.cpp b/src/windows/leash/KrbConfigOptions.cpp index 2e1599c289..3e69bb0a12 100644 --- a/src/windows/leash/KrbConfigOptions.cpp +++ b/src/windows/leash/KrbConfigOptions.cpp @@ -82,6 +82,7 @@ static char far * near parse_str(char far*buffer,char far*result) return buffer; } +#ifndef NO_KRB4 int krb_get_krbhst(char* h, char* r, int n) { char lbstorage[BUFSIZ]; @@ -139,6 +140,7 @@ int krb_get_krbhst(char* h, char* r, int n) (void) fclose(cnffile); return(KSUCCESS); } +#endif BOOL CKrbConfigOptions::OnInitDialog() { @@ -152,6 +154,7 @@ BOOL CKrbConfigOptions::OnInitDialog() CPropertyPage::OnInitDialog(); +#ifndef NO_KRB4 if (CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL) { // Krb4 NOT krb5 // Fill in all edit boxes @@ -200,7 +203,7 @@ BOOL CKrbConfigOptions::OnInitDialog() m_hostServer = krbhst; - // New suff to put realms in Combo Box + // New stuff to put realms in Combo Box CStdioFile krbCon; if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeRead)) { @@ -262,7 +265,9 @@ BOOL CKrbConfigOptions::OnInitDialog() } // end of 'Check for Host' else statement } // end of 'place krbRealm in Edit box' else } - else if (CLeashApp::m_hKrb5DLL) + else +#endif + if (CLeashApp::m_hKrb5DLL) { // Krb5 OR krb5 AND krb4 char *realm = NULL; pkrb5_get_default_realm(CLeashApp::m_krbv5_context, &realm); @@ -472,6 +477,7 @@ void CKrbConfigOptions::OnSelchangeEditDefaultRealm() SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "No KDC information available"); } } +#ifndef NO_KRB4 else { CHAR krbhst[MAX_HSTNM + 1]; @@ -496,6 +502,7 @@ void CKrbConfigOptions::OnSelchangeEditDefaultRealm() if (strlen(krbhst)) SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer); } +#endif } } diff --git a/src/windows/leash/KrbDomainRealmMaintenance.cpp b/src/windows/leash/KrbDomainRealmMaintenance.cpp index cb13137d87..da9e883cc7 100644 --- a/src/windows/leash/KrbDomainRealmMaintenance.cpp +++ b/src/windows/leash/KrbDomainRealmMaintenance.cpp @@ -140,6 +140,7 @@ BOOL CKrbDomainRealmMaintenance::OnApply() return TRUE; } +#ifndef NO_KRB4 // Save to Kerberos Four config. file "Krb.con" CStdioFile krbrealmCon; if (!krbrealmCon.Open(CKrbProperties::m_krbrealmPath, CFile::modeCreate | @@ -165,6 +166,8 @@ BOOL CKrbDomainRealmMaintenance::OnApply() } krbrealmCon.Close(); +#endif + return TRUE; } @@ -190,6 +193,8 @@ void CKrbDomainRealmMaintenance::OnCancel() void CKrbDomainRealmMaintenance::OnButtonHostAdd() { +////I don't understand why this is doing K4 operations here +#ifndef NO_KRB4 CKrb4AddToDomainRealmList addToDomainRealmList; if (IDOK == addToDomainRealmList.DoModal()) { @@ -239,7 +244,7 @@ void CKrbDomainRealmMaintenance::OnButtonHostAdd() GetDlgItem(IDC_BUTTON_HOST_EDIT)->EnableWindow(); } } - +#endif } void CKrbDomainRealmMaintenance::OnButtonHostEdit() diff --git a/src/windows/leash/KrbMiscConfigOpt.cpp b/src/windows/leash/KrbMiscConfigOpt.cpp index cdb4c677d7..2c7153ef87 100644 --- a/src/windows/leash/KrbMiscConfigOpt.cpp +++ b/src/windows/leash/KrbMiscConfigOpt.cpp @@ -282,14 +282,20 @@ BOOL CKrbMiscConfigOpt::OnInitDialog() GetDlgItem(IDC_EDIT_RENEW_MAX_M)->EnableWindow(FALSE); } - +#ifndef NO_KRB4 m_initUseKrb4 = m_newUseKrb4 = (CLeashApp::m_hKrb4DLL ? pLeash_get_default_use_krb4() : 0); - CheckDlgButton(IDC_CHECK_REQUEST_KRB4, m_initUseKrb4); + CheckDlgButton(IDC_CHECK_REQUEST_KRB4, m_initUseKrb4); if ( !CLeashApp::m_hKrb4DLL ) GetDlgItem(IDC_CHECK_REQUEST_KRB4)->EnableWindow(FALSE); +#else +////Or remove these completely? + m_initUseKrb4 = m_newUseKrb4 = 0; + CheckDlgButton(IDC_CHECK_REQUEST_KRB4, 0); + GetDlgItem(IDC_CHECK_REQUEST_KRB4)->EnableWindow(FALSE); +#endif m_initKinitPreserve = m_newKinitPreserve = pLeash_get_default_preserve_kinit_settings(); - CheckDlgButton(IDC_CHECK_PRESERVE_KINIT_OPTIONS, m_initKinitPreserve); + CheckDlgButton(IDC_CHECK_PRESERVE_KINIT_OPTIONS, m_initKinitPreserve); return(TRUE); } @@ -402,9 +408,11 @@ BOOL CKrbMiscConfigOpt::OnApply() "Leash", MB_OK); } +#ifndef NO_KRB4 if ( m_initUseKrb4 != m_newUseKrb4 ) { pLeash_set_default_use_krb4(m_newUseKrb4); } +#endif if ( m_initKinitPreserve != m_newKinitPreserve ) { pLeash_set_default_preserve_kinit_settings(m_newKinitPreserve); diff --git a/src/windows/leash/KrbProperties.cpp b/src/windows/leash/KrbProperties.cpp index d26987e4af..0a64142530 100644 --- a/src/windows/leash/KrbProperties.cpp +++ b/src/windows/leash/KrbProperties.cpp @@ -59,19 +59,23 @@ CKrbProperties::CKrbProperties(LPCTSTR pszCaption, CWnd* pParentWnd, } #endif /* COMMENT */ +#ifndef NO_KRB4 CLeashApp::GetKrb4ConFile(m_krbPath,sizeof(m_krbPath)); CLeashApp::GetKrb4RealmFile(m_krbrealmPath,sizeof(m_krbrealmPath)); - +#endif AddPage(&m_configOptions); AddPage(&m_miscConfigOpt); +#ifndef NO_KRB4 if (CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL) { AddPage(&m_krb4RealmHostMaintenance); AddPage(&m_krb4DomainRealmMaintenance); } - else if (CLeashApp::m_hKrb5DLL) + else +#endif + if (CLeashApp::m_hKrb5DLL) { AddPage(&m_realmHostMaintenance); AddPage(&m_domainRealmMaintenance); diff --git a/src/windows/leash/KrbProperties.h b/src/windows/leash/KrbProperties.h index c73ca6e688..f476ac1a26 100644 --- a/src/windows/leash/KrbProperties.h +++ b/src/windows/leash/KrbProperties.h @@ -25,8 +25,10 @@ #include "KrbConfigOptions.h" #include "KrbRealmHostMaintenance.h" #include "KrbDomainRealmMaintenance.h" +#ifndef NO_KRB4 #include "Krb4DomainRealmMaintenance.h" #include "Krb4RealmHostMaintenance.h" +#endif #include "KrbMiscConfigOpt.h" ////////////////////////////////////////////////////////////////////// @@ -40,9 +42,13 @@ private: public: //CKrbConfigFileLocation m_fileLocation; CKrbConfigOptions m_configOptions; +#ifndef NO_KRB4 CKrb4RealmHostMaintenance m_krb4RealmHostMaintenance; +#endif CKrbRealmHostMaintenance m_realmHostMaintenance; +#ifndef NO_KRB4 CKrb4DomainRealmMaintenance m_krb4DomainRealmMaintenance; +#endif CKrbDomainRealmMaintenance m_domainRealmMaintenance; CKrbMiscConfigOpt m_miscConfigOpt; diff --git a/src/windows/leash/Leash.cpp b/src/windows/leash/Leash.cpp index dbd2fe5134..88ee7356a0 100644 --- a/src/windows/leash/Leash.cpp +++ b/src/windows/leash/Leash.cpp @@ -54,7 +54,10 @@ HANDLE m_tgsReqMutex = 0; HWND CLeashApp::m_hProgram = 0; HINSTANCE CLeashApp::m_hLeashDLL = 0; +////@#+Remove +#ifndef NO_KRB4 HINSTANCE CLeashApp::m_hKrb4DLL = 0; +#endif HINSTANCE CLeashApp::m_hKrb5DLL = 0; HINSTANCE CLeashApp::m_hKrb5ProfileDLL= 0; HINSTANCE CLeashApp::m_hAfsDLL = 0; @@ -120,7 +123,9 @@ CLeashApp::~CLeashApp() #endif #endif AfxFreeLibrary(m_hLeashDLL); +#ifndef NO_KRB4 AfxFreeLibrary(m_hKrb4DLL); +#endif AfxFreeLibrary(m_hKrb5DLL); AfxFreeLibrary(m_hKrb5ProfileDLL); AfxFreeLibrary(m_hAfsDLL); @@ -580,6 +585,8 @@ FUNC_INFO leash_fi[] = { END_FUNC_INFO }; +//// +#ifndef NO_KRB4 // krb4 functions DECL_FUNC_PTR(set_krb_debug); DECL_FUNC_PTR(set_krb_ap_req_debug); @@ -609,6 +616,7 @@ FUNC_INFO krb4_fi[] = { MAKE_FUNC_INFO(krb_get_tf_realm), END_FUNC_INFO }; +#endif // psapi functions @@ -718,7 +726,9 @@ FUNC_INFO profile_fi[] = { BOOL CLeashApp::InitDLLs() { m_hLeashDLL = AfxLoadLibrary(LEASHDLL); +#ifndef NO_KRB4 m_hKrb4DLL = AfxLoadLibrary(KERB4DLL); +#endif m_hKrb5DLL = AfxLoadLibrary(KERB5DLL); m_hKrb5ProfileDLL = AfxLoadLibrary(KERB5_PPROFILE_DLL); @@ -750,6 +760,8 @@ BOOL CLeashApp::InitDLLs() return FALSE; } +//// +#ifndef NO_KRB4 if (m_hKrb4DLL) { if (!LoadFuncs(KERB4DLL, krb4_fi, 0, 0, 1, 0, 0)) @@ -760,6 +772,7 @@ BOOL CLeashApp::InitDLLs() "Error", MB_OK); } } +#endif if (m_hKrb5DLL) { @@ -1121,6 +1134,8 @@ CLeashApp::ValidateConfigFiles() } } +//// +#ifndef NO_KRB4 } else if ( m_hKrb4DLL ) { if ( !realm[0] ) { /* Open ticket file */ @@ -1164,16 +1179,23 @@ CLeashApp::ValidateConfigFiles() } else krbCon.Close(); } +#endif } } +////@#+Should this be just deleted or reworked? BOOL CLeashApp::GetKrb4ConFile( LPSTR confname, UINT szConfname ) { - if (m_hKrb5DLL && !m_hKrb4DLL) + if (m_hKrb5DLL +//// +#ifndef NO_KRB4 + && !m_hKrb4DLL +#endif + ) { // hold krb.con where krb5.ini is located CHAR krbConFile[MAX_PATH]=""; //strcpy(krbConFile, CLeashApp::m_krbv5_profile->first_file->filename); @@ -1200,6 +1222,8 @@ CLeashApp::GetKrb4ConFile( strncpy(confname, krbConFile, szConfname); confname[szConfname-1] = '\0'; } +//// +#ifndef NO_KRB4 else if (m_hKrb4DLL) { unsigned int size = szConfname; @@ -1214,6 +1238,8 @@ CLeashApp::GetKrb4ConFile( confname[szConfname-1] = '\0'; } } +#endif + return FALSE; } @@ -1223,7 +1249,12 @@ CLeashApp::GetKrb4RealmFile( UINT szConfname ) { - if (m_hKrb5DLL && !m_hKrb4DLL) + if (m_hKrb5DLL +//// +#ifndef NO_KRB4 + && !m_hKrb4DLL +#endif + ) { // hold krb.con where krb5.ini is located CHAR krbRealmConFile[MAX_PATH]; //strcpy(krbRealmConFile, CLeashApp::m_krbv5_profile->first_file->filename); @@ -1250,6 +1281,8 @@ CLeashApp::GetKrb4RealmFile( strncpy(confname, krbRealmConFile, szConfname); confname[szConfname-1] = '\0'; } +//// +#ifndef NO_KRB4 else if (m_hKrb4DLL) { unsigned int size = szConfname; @@ -1265,6 +1298,8 @@ CLeashApp::GetKrb4RealmFile( return TRUE; } } +#endif + return FALSE; } diff --git a/src/windows/leash/Leash.h b/src/windows/leash/Leash.h index 74c9d5d0a8..7975987d1f 100644 --- a/src/windows/leash/Leash.h +++ b/src/windows/leash/Leash.h @@ -68,7 +68,8 @@ #define HID_KERBEROS_PROPERTIES_EDITHOST 131271 #define HID_KERBEROS_PROPERTIES_LISTDOM 131279 -#define USE_HTMLHELP +////@#+This might be problematic with the latest Platform SDK... +////#define USE_HTMLHELP #ifdef USE_HTMLHELP #if _MSC_VER >= 1300 @@ -76,6 +77,12 @@ #endif #endif +////Is this a good place for these defines? +#if !defined(MAX_HSTNM) +#define MAX_HSTNM 100 +#endif + + #include "resource.h" // main symbols #include "lglobals.h" @@ -98,7 +105,10 @@ private: public: static HWND m_hProgram; static HINSTANCE m_hLeashDLL; +//// +#ifndef NO_KRB4 static HINSTANCE m_hKrb4DLL; +#endif static HINSTANCE m_hKrb5DLL; static HINSTANCE m_hKrb5ProfileDLL; static HINSTANCE m_hAfsDLL; diff --git a/src/windows/leash/LeashAboutBox.cpp b/src/windows/leash/LeashAboutBox.cpp index 972514feeb..8c6f7f425b 100644 --- a/src/windows/leash/LeashAboutBox.cpp +++ b/src/windows/leash/LeashAboutBox.cpp @@ -302,8 +302,10 @@ void CLeashAboutBox::OnNotLoadedModules() { m_LB_DLLsLoaded.ResetContent(); +#ifndef NO_KRB4 if (!CLeashApp::m_hKrb4DLL) m_LB_DLLsLoaded.AddString(KERB4DLL); +#endif if (!CLeashApp::m_hKrb5DLL) m_LB_DLLsLoaded.AddString(KERB5DLL); diff --git a/src/windows/leash/LeashDebugWindow.cpp b/src/windows/leash/LeashDebugWindow.cpp index 6e12903aec..e8c4553eea 100644 --- a/src/windows/leash/LeashDebugWindow.cpp +++ b/src/windows/leash/LeashDebugWindow.cpp @@ -81,8 +81,8 @@ void CLeashDebugWindow::OnCancel() pApp = AfxGetApp(); pApp->WriteProfileInt("Settings", "DebugWindow", FALSE_FLAG); m_pView->PostMessage(WM_GOODBYE, IDCANCEL); // modeless case - pset_krb_debug(OFF); - pset_krb_ap_req_debug(OFF); +//// pset_krb_debug(OFF); +//// pset_krb_ap_req_debug(OFF); } else { @@ -109,8 +109,8 @@ BOOL CLeashDebugWindow::OnInitDialog() CDialog::OnInitDialog(); // Set Debug flags - pset_krb_debug(ON); //(int)m_debugListBox.GetSafeHwnd() - pset_krb_ap_req_debug(ON); +//// pset_krb_debug(ON); //(int)m_debugListBox.GetSafeHwnd() +//// pset_krb_ap_req_debug(ON); if (*m_debugFilePath != 0) SetDlgItemText(IDC_LOG_FILE_LOCATION_TEXT, m_debugFilePath); diff --git a/src/windows/leash/LeashProperties.cpp b/src/windows/leash/LeashProperties.cpp index 2854231739..0089baf5aa 100644 --- a/src/windows/leash/LeashProperties.cpp +++ b/src/windows/leash/LeashProperties.cpp @@ -26,6 +26,14 @@ static char THIS_FILE[] = __FILE__; #endif +////Some unknown Platform SDK/VC uglines +#if defined(__HTMLHELP_H__) +#ifdef HtmlHelp +#undef HtmlHelp +#endif +#endif + + ///////////////////////////////////////////////////////////////////////////// // CLeashProperties dialog diff --git a/src/windows/leash/LeashView.cpp b/src/windows/leash/LeashView.cpp index e97ab762d2..14f9fc1314 100644 --- a/src/windows/leash/LeashView.cpp +++ b/src/windows/leash/LeashView.cpp @@ -130,7 +130,10 @@ extern HANDLE m_tgsReqMutex; CLeashView::CLeashView(): CFormView(CLeashView::IDD) { +////@#+Need removing as well! +#ifndef NO_KRB4 m_listKrb4 = NULL; +#endif m_listKrb5 = NULL; m_listAfs = NULL; m_startup = TRUE; @@ -343,8 +346,14 @@ VOID CLeashView::OnShowWindow(BOOL bShow, UINT nStatus) SetTimer(1, ONE_SECOND, TimerProc); - if (!CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL && !CLeashApp::m_hAfsDLL) + if ( +//// +#ifndef NO_KRB4 + !CLeashApp::m_hKrb4DLL && +#endif + !CLeashApp::m_hKrb5DLL && !CLeashApp::m_hAfsDLL) { +////Update not to mention K4 AfxMessageBox("Neither Kerberos Four, Kerberos Five nor AFS is loaded!!!" "\r\nYou will not be able to retrieve tickets and/or " "tokens.", @@ -540,7 +549,12 @@ UINT CLeashView::ImportTicket(void * hWnd) #ifndef KRB5_TC_NOTICKET ReleaseMutex(m_tgsReqMutex); #endif - if (!CLeashApp::m_hAfsDLL || !CLeashApp::m_hKrb4DLL) + if (!CLeashApp::m_hAfsDLL +////@#+Need to rework this logic. I am confused what !m_hKrb4DLL means in this case! +#ifndef NO_KRB4 + || !CLeashApp::m_hKrb4DLL +#endif + ) whatToDo = AfxMessageBox("You are about to replace your existing ticket(s)\n" "with a ticket imported from the Windows credential cache!", MB_OKCANCEL, 0); @@ -829,9 +843,11 @@ VOID CLeashView::OnUpdateDisplay() TV_INSERTSTRUCT m_tvinsert; +#ifndef NO_KRB4 INT ticketIconStatusKrb4; INT ticketIconStatus_SelectedKrb4; INT iconStatusKrb4; +#endif INT ticketIconStatusKrb5; INT ticketIconStatus_SelectedKrb5; @@ -841,15 +857,19 @@ VOID CLeashView::OnUpdateDisplay() INT ticketIconStatus_SelectedAfs; INT iconStatusAfs; +#ifndef NO_KRB4 LONG krb4Error; +#endif LONG krb5Error; LONG afsError; if (WaitForSingleObject( ticketinfo.lockObj, 100 ) != WAIT_OBJECT_0) throw("Unable to lock ticketinfo"); +#ifndef NO_KRB4 // Get Kerb 4 tickets in list krb4Error = pLeashKRB4GetTickets(&ticketinfo.Krb4, &m_listKrb4); +#endif // Get Kerb 5 tickets in list krb5Error = pLeashKRB5GetTickets(&ticketinfo.Krb5, &m_listKrb5, @@ -889,6 +909,8 @@ VOID CLeashView::OnUpdateDisplay() * to select the appropriate Icon for the Parent Node */ +////Might need to delete dependent stuff as well!!! +#ifndef NO_KRB4 /* Krb4 */ UpdateTicketTime(ticketinfo.Krb4); m_ticketStatusKrb4 = GetLowTicketStatus(4); @@ -918,6 +940,8 @@ VOID CLeashView::OnUpdateDisplay() ticketIconStatus_SelectedKrb4 = EXPIRED_CLOCK; iconStatusKrb4 = TICKET_NOT_INSTALLED; } +#endif + /* Krb5 */ UpdateTicketTime(ticketinfo.Krb5); @@ -1005,6 +1029,8 @@ VOID CLeashView::OnUpdateDisplay() m_tvinsert.item.iSelectedImage = EXPIRED_PARENT_NODE; break; } +//// +#ifndef NO_KRB4 } else if (CLeashApp::m_hKrb4DLL && m_listKrb4) { m_tvinsert.item.pszText = ticketinfo.Krb4.principal; switch ( iconStatusKrb4 ) { @@ -1018,6 +1044,7 @@ VOID CLeashView::OnUpdateDisplay() m_tvinsert.item.iSelectedImage = EXPIRED_PARENT_NODE; break; } +#endif } else { m_tvinsert.item.iSelectedImage = NONE_PARENT_NODE; } @@ -1094,6 +1121,7 @@ VOID CLeashView::OnUpdateDisplay() // Krb4 m_tvinsert.hParent = m_hPrincipal; +#ifndef NO_KRB4 if (CLeashApp::m_hKrb4DLL) { m_tvinsert.item.pszText = "Kerberos Four Tickets"; @@ -1102,12 +1130,17 @@ VOID CLeashView::OnUpdateDisplay() } else { +#endif +////Can this be removed altogether? ticketinfo.Krb4.btickets = NO_TICKETS; m_tvinsert.item.pszText = "Kerberos Four Tickets (Not Available)"; m_tvinsert.item.iImage = TICKET_NOT_INSTALLED; m_tvinsert.item.iSelectedImage = TICKET_NOT_INSTALLED; +#ifndef NO_KRB4 } +#endif +#ifndef NO_KRB4 m_hKerb4 = m_pTree ->InsertItem(&m_tvinsert); if (m_hPrincipalState == NODE_IS_EXPANDED) @@ -1117,6 +1150,8 @@ VOID CLeashView::OnUpdateDisplay() m_tvinsert.item.iImage = ticketIconStatusKrb4; m_tvinsert.item.iSelectedImage = ticketIconStatus_SelectedKrb4; + +////What does the original do? tempList = m_listKrb4, *killList; while (tempList) { @@ -1129,7 +1164,7 @@ VOID CLeashView::OnUpdateDisplay() if (m_hKerb4State == NODE_IS_EXPANDED) m_pTree->Expand(m_hKerb4, TVE_EXPAND); - +#endif // AFS m_tvinsert.hParent = m_hPrincipal; @@ -1369,10 +1404,13 @@ VOID CLeashView::OnActivateView(BOOL bActivate, CView* pActivateView, CFormView::OnActivateView(bActivate, pActivateView, pDeactiveView); } +////@#+Is this KRB4 only? VOID CLeashView::OnDebugMode() { +#ifndef NO_KRB4 if (!pset_krb_debug) return; +#endif if (!m_pDebugWindow) { @@ -1422,8 +1460,11 @@ VOID CLeashView::OnDebugMode() m_pApp->WriteProfileInt("Settings", "DebugWindow", FALSE_FLAG); m_pDebugWindow->DestroyWindow(); +//// +#ifndef NO_KRB4 pset_krb_debug(OFF); pset_krb_ap_req_debug(OFF); +#endif return; } else @@ -1616,7 +1657,9 @@ VOID CLeashView::OnUppercaseRealm() VOID CLeashView::ResetTreeNodes() { m_hPrincipalState = 0; +#ifndef NO_KRB4 m_hKerb4State = 0; +#endif m_hKerb5State = 0; m_hAFSState = 0; } @@ -1666,7 +1709,12 @@ VOID CLeashView::OnUpdateInitTicket(CCmdUI* pCmdUI) else pCmdUI->SetText("&Get Ticket(s)/Token(s)\tCtrl+T"); - if (!CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL && + if ( +////Is this logic correct? +#ifndef NO_KRB4 + !CLeashApp::m_hKrb4DLL && +#endif + !CLeashApp::m_hKrb5DLL && !CLeashApp::m_hAfsDLL) pCmdUI->Enable(FALSE); else @@ -1682,8 +1730,16 @@ VOID CLeashView::OnUpdateRenewTicket(CCmdUI* pCmdUI) if (WaitForSingleObject( ticketinfo.lockObj, INFINITE ) != WAIT_OBJECT_0) throw("Unable to lock ticketinfo"); - BOOL b_enable = !(ticketinfo.Krb4.btickets || ticketinfo.Krb5.btickets) || - !CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL && !CLeashApp::m_hAfsDLL; + BOOL b_enable = !( +#ifndef NO_KRB4 + ticketinfo.Krb4.btickets || +#endif + ticketinfo.Krb5.btickets) || +////Not sure about the boolean logic here +#ifndef NO_KRB4 + !CLeashApp::m_hKrb4DLL && +#endif + !CLeashApp::m_hKrb5DLL && !CLeashApp::m_hAfsDLL; ReleaseMutex(ticketinfo.lockObj); if (b_enable) @@ -1768,8 +1824,16 @@ LRESULT CLeashView::OnTrayIcon(WPARAM wParam, LPARAM lParam) #endif if (WaitForSingleObject( ticketinfo.lockObj, INFINITE ) != WAIT_OBJECT_0) throw("Unable to lock ticketinfo"); - if (!(ticketinfo.Krb4.btickets || ticketinfo.Krb5.btickets) || - !CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL && + if (!( +#ifndef NO_KRB4 + ticketinfo.Krb4.btickets || +#endif + ticketinfo.Krb5.btickets) || +////Not entirely sure about the logic +#ifndef NO_KRB4 + !CLeashApp::m_hKrb4DLL && +#endif + !CLeashApp::m_hKrb5DLL && !CLeashApp::m_hAfsDLL) nFlags = MF_STRING | MF_GRAYED; else @@ -1850,8 +1914,10 @@ VOID CLeashView::OnItemexpandedTreeview(NMHDR* pNMHDR, LRESULT* pResult) if (m_hPrincipal == pNMTreeView->itemNew.hItem) m_hPrincipalState = pNMTreeView->action; +#ifndef NO_KRB4 else if (m_hKerb4 == pNMTreeView->itemNew.hItem) m_hKerb4State = pNMTreeView->action; +#endif else if (m_hKerb5 == pNMTreeView->itemNew.hItem) m_hKerb5State = pNMTreeView->action; else if (m_hAFS == pNMTreeView->itemNew.hItem) @@ -1863,18 +1929,30 @@ VOID CLeashView::OnItemexpandedTreeview(NMHDR* pNMHDR, LRESULT* pResult) VOID CLeashView::OnUpdateDebugMode(CCmdUI* pCmdUI) { +//// +#ifndef NO_KRB4 if (!pset_krb_debug) +#endif pCmdUI->Enable(FALSE); +//// +#ifndef NO_KRB4 else pCmdUI->Enable(TRUE); +#endif } VOID CLeashView::OnUpdateCfgFiles(CCmdUI* pCmdUI) { +//// +#ifndef NO_KRB4 if (!pkrb_get_krbconf2) +#endif pCmdUI->Enable(FALSE); +//// +#ifndef NO_KRB4 else pCmdUI->Enable(TRUE); +#endif } VOID CLeashView::OnLeashProperties() @@ -1891,8 +1969,10 @@ VOID CLeashView::OnKrbProperties() VOID CLeashView::OnKrb4Properties() { +#ifndef NO_KRB4 CKrb4Properties krb4Properties("Kerberos Four Properties"); krb4Properties.DoModal(); +#endif } VOID CLeashView::OnKrb5Properties() @@ -2102,6 +2182,7 @@ BOOL CLeashView::PreTranslateMessage(MSG* pMsg) } //KRB5 +#ifndef NO_KRB4 if (CLeashApp::m_hKrb4DLL) { // KRB4 @@ -2196,6 +2277,8 @@ BOOL CLeashView::PreTranslateMessage(MSG* pMsg) } else { +#endif +////Should this be removed altogether? // not installed ticketStatusKrb4.Format("Kerb-4: Not Available"); @@ -2204,8 +2287,10 @@ BOOL CLeashView::PreTranslateMessage(MSG* pMsg) CMainFrame::m_wndStatusBar.SetPaneInfo(2, 111111, SBPS_NORMAL, 130); CMainFrame::m_wndStatusBar.SetPaneText(2, ticketStatusKrb4, SBT_POPOUT); } +#ifndef NO_KRB4 } // KRB4 +#endif if (CLeashApp::m_hAfsDLL) { @@ -2707,7 +2792,11 @@ VOID CLeashView::AlarmBeep() VOID CLeashView::OnUpdateProperties(CCmdUI* pCmdUI) { - if (CLeashApp::m_hKrb5DLL || CLeashApp::m_hKrb4DLL) + if (CLeashApp::m_hKrb5DLL +#ifndef NO_KRB4 + || CLeashApp::m_hKrb4DLL +#endif + ) pCmdUI->Enable(); else pCmdUI->Enable(FALSE); @@ -2715,9 +2804,11 @@ VOID CLeashView::OnUpdateProperties(CCmdUI* pCmdUI) VOID CLeashView::OnUpdateKrb4Properties(CCmdUI* pCmdUI) { +#ifndef NO_KRB4 if (CLeashApp::m_hKrb4DLL) pCmdUI->Enable(); else +#endif pCmdUI->Enable(FALSE); } @@ -2731,10 +2822,13 @@ VOID CLeashView::OnUpdateKrb5Properties(CCmdUI* pCmdUI) VOID CLeashView::OnUpdateAfsControlPanel(CCmdUI* pCmdUI) { +////Is the comment even correct? +#ifndef NO_KRB4 // need Krb 4 to get AFS tokens if (CLeashApp::m_hAfsDLL && CLeashApp::m_hKrb4DLL) pCmdUI->Enable(); else +#endif pCmdUI->m_pMenu->DeleteMenu(pCmdUI->m_nID, MF_BYCOMMAND); } diff --git a/src/windows/leash/LeashView.h b/src/windows/leash/LeashView.h index 36d842306d..e469058ae0 100644 --- a/src/windows/leash/LeashView.h +++ b/src/windows/leash/LeashView.h @@ -70,7 +70,10 @@ class CLeashDebugWindow; class CLeashView : public CFormView { private: +////@#+Remove +#ifndef NO_KRB4 TicketList* m_listKrb4; +#endif TicketList* m_listKrb5; TicketList* m_listAfs; CLeashDebugWindow* m_pDebugWindow; @@ -79,7 +82,10 @@ private: CTreeCtrl* m_pTree; CWinApp* m_pApp; HTREEITEM m_hPrincipal; +////@#+Remove +#ifndef NO_KRB4 HTREEITEM m_hKerb4; +#endif HTREEITEM m_hKerb5; HTREEITEM m_hk5tkt; HTREEITEM m_hAFS; @@ -95,7 +101,9 @@ private: INT m_largeIcons; INT m_lowTicketAlarm; INT m_hPrincipalState; +#ifndef NO_KRB4 INT m_hKerb4State; +#endif INT m_hKerb5State; INT m_hAFSState; BOOL m_bIconAdded; @@ -103,13 +111,16 @@ private: static INT m_autoRenewTickets; static INT m_ticketStatusAfs; +////Remove as well? static INT m_ticketStatusKrb4; static INT m_ticketStatusKrb5; static INT m_autoRenewalAttempted; static INT m_warningOfTicketTimeLeftAfs; +////Remove as well? static INT m_warningOfTicketTimeLeftKrb4; static INT m_warningOfTicketTimeLeftKrb5; static INT m_warningOfTicketTimeLeftLockAfs; +////Remove as well? static INT m_warningOfTicketTimeLeftLockKrb4; static INT m_warningOfTicketTimeLeftLockKrb5; static INT m_updateDisplayCount; diff --git a/src/windows/leash/Lglobals.h b/src/windows/leash/Lglobals.h index 7407b3b811..777e056bb4 100644 --- a/src/windows/leash/Lglobals.h +++ b/src/windows/leash/Lglobals.h @@ -18,7 +18,7 @@ #include #include -#include +////#include #include #include @@ -151,23 +151,13 @@ extern DECL_FUNC_PTR(Leash_importable); extern DECL_FUNC_PTR(Leash_renew); extern DECL_FUNC_PTR(Leash_reset_defaults); +////Do we still need this one? #define pLeashKRB4GetTickets pnot_an_API_LeashKRB4GetTickets #define pLeashKRB5GetTickets pnot_an_API_LeashKRB5GetTickets #define pLeashAFSGetToken pnot_an_API_LeashAFSGetToken #define pLeashFreeTicketList pnot_an_API_LeashFreeTicketList #define pLeashGetTimeServerName pnot_an_API_LeashGetTimeServerName -// krb4 functions -extern DECL_FUNC_PTR(set_krb_debug); -extern DECL_FUNC_PTR(set_krb_ap_req_debug); -extern DECL_FUNC_PTR(krb_get_krbconf2); -extern DECL_FUNC_PTR(krb_get_krbrealm2); -extern DECL_FUNC_PTR(tkt_string); -extern DECL_FUNC_PTR(krb_set_tkt_string); -extern DECL_FUNC_PTR(krb_realmofhost); -extern DECL_FUNC_PTR(krb_get_lrealm); -extern DECL_FUNC_PTR(krb_get_krbhst); - // psapi functions extern DECL_FUNC_PTR(GetModuleFileNameExA); extern DECL_FUNC_PTR(EnumProcessModules); @@ -235,6 +225,7 @@ extern DECL_FUNC_PTR(profile_release_string); #define KRB_FILE "KRB.CON" #define KRBREALM_FILE "KRBREALM.CON" #define TICKET_FILE "TICKET.KRB" +////Wow. Why? #define WIN95_AUTOEXEC "C:\\AUTOEXEC.BAT" #define LEASH_HELP_FILE "leash32.chm" @@ -263,6 +254,7 @@ public: class TicketInfoWrapper { public: HANDLE lockObj; +////Can this be commented out? TICKETINFO Krb4; TICKETINFO Krb5; TICKETINFO Afs; diff --git a/src/windows/leash/Makefile.in b/src/windows/leash/Makefile.in new file mode 100644 index 0000000000..1b1ae69056 --- /dev/null +++ b/src/windows/leash/Makefile.in @@ -0,0 +1,98 @@ +# makefile: Leash executable +# + +#TODO Fix later: +NO_AFS=1 + +!ifndef NO_AFS +###AFS_BASE= +AFS_INCLUDES=-I$(AFS_BASE)\Include +AFS_LIB=$(AFS_BASE)\lib +AFS_LIBS=$(AFS_LIB)\afsauthent.lib +!else +AFS_INCLUDES= +AFS_LIBS= +!endif + +MFCLIB=MFC100D.LIB +EXE_NAME=leash32 +WSHELPER=wshelp32 + +!if ("$(CPU)" == "IA64") || ("$(CPU)" == "AMD64") || ("$(CPU)" == "ALPHA64") +EXE_NAME=leash64 +WSHELPER=wshelp64 +!endif + +OBJS= \ + $(OUTPRE)Krb4EditDomainRealmList.obj \ + $(OUTPRE)CLeashDragListBox.obj \ + $(OUTPRE)Krb5Properties.obj \ + $(OUTPRE)KrbAddHostServer.obj \ + $(OUTPRE)KrbAddRealm.obj \ + $(OUTPRE)KrbConfigOptions.obj \ + $(OUTPRE)KrbDomainRealmMaintenance.obj \ + $(OUTPRE)KrbEditHostServer.obj \ + $(OUTPRE)KrbEditRealm.obj \ + $(OUTPRE)KrbProperties.obj \ + $(OUTPRE)KrbRealmHostMaintenance.obj \ + $(OUTPRE)Leash.obj \ + $(OUTPRE)LeashAboutBox.obj \ + $(OUTPRE)LeashDebugWindow.obj \ + $(OUTPRE)LeashDoc.obj \ + $(OUTPRE)LeashFileDialog.obj \ + $(OUTPRE)LeashFrame.obj \ + $(OUTPRE)LeashMessageBox.obj \ + $(OUTPRE)LeashProperties.obj \ + $(OUTPRE)LeashView.obj \ + $(OUTPRE)lglobals.obj \ + $(OUTPRE)MainFrm.obj \ + $(OUTPRE)StdAfx.obj \ + $(OUTPRE)AfsProperties.obj \ + $(OUTPRE)VSroutines.obj \ + $(OUTPRE)KrbMiscConfigOpt.obj + +RESFILE = $(OUTPRE)Leash.res +XOBJS = $(RESFILE) + +##### Options +# Set NODEBUG if building release instead of debug +BUILDTOP=..\.. + +LOCALINCLUDES= -I$(BUILDTOP) -I$(BUILDTOP)\include -I$(BUILDTOP)\windows\include + +##### RC Compiler +RFLAGS = $(LOCALINCLUDES) +RCFLAGS = $(RFLAGS) -D_WIN32 -DLEASH_APP + +DEFINES = -DWINSOCK -DWIN32 -DWINDOWS -D_AFXDLL -D_MBCS -DNO_KRB4 +!ifdef NODEBUG +DEFINES = $(DEFINES) +!else +DEFINES = $(DEFINES) -DDBG +!endif + +!ifdef NO_AFS +DEFINES = $(DEFINES) -DNO_AFS +!endif + +##### Linker +LINK = link +LIBS = $(GLIB) $(CLIB) $(WLIB) +SYSLIBS = kernel32.lib Iphlpapi.lib ws2_32.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib version.lib +LFLAGS = /nologo $(LOPTS) + +all:: Makefile $(OUTPRE)$(EXE_NAME).exe + +$(OUTPRE)$(EXE_NAME).exe: $(OBJS) $(XOBJS) $(LIBS) + $(LINK) $(LFLAGS) /out:$@ /ENTRY:WinMainCRTStartup $(OBJS) $(XOBJS) \ + $(LIBS) $(SYSLIBS) $(BUILDTOP)\util\wshelper\$(OUTPRE)$(WSHELPER).lib \ + ../lib/$(OUTPRE)libwin.lib atl.lib $(MFCLIB) $(SCLIB) + +$(RESFILE): ..\version.rc Leash.rc + +clean:: + if exist $(OUTPRE)*.exe del $(OUTPRE)*.exe + if exist $(OUTPRE)*.obj del $(OUTPRE)*.obj + if exist $(OUTPRE)*.res del $(OUTPRE)*.res + if exist $(OUTPRE)*.pdb del $(OUTPRE)*.pdb + if exist *.err del *.err diff --git a/src/windows/leash/ver.rc b/src/windows/leash/ver.rc new file mode 100644 index 0000000000..b93fcc46a3 --- /dev/null +++ b/src/windows/leash/ver.rc @@ -0,0 +1,3 @@ +#define VER_FILEDESCRIPTION_STR "Leash Application" + +#include -- cgit