svn rev #25339: trunk/src/ windows/ windows/leash/

hartmans@MIT.EDU hartmans at MIT.EDU
Fri Oct 14 10:42:38 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=25339
Commit By: hartmans
Log Message:
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 <aamelnikov at gmail.com>

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 <kevin.wasserman at painless-security.com>


Changed Files:
U   trunk/src/Makefile.in
U   trunk/src/windows/Makefile.in
U   trunk/src/windows/leash/Krb4EditDomainRealmList.cpp
U   trunk/src/windows/leash/KrbConfigOptions.cpp
U   trunk/src/windows/leash/KrbDomainRealmMaintenance.cpp
U   trunk/src/windows/leash/KrbMiscConfigOpt.cpp
U   trunk/src/windows/leash/KrbProperties.cpp
U   trunk/src/windows/leash/KrbProperties.h
U   trunk/src/windows/leash/Leash.cpp
U   trunk/src/windows/leash/Leash.h
U   trunk/src/windows/leash/LeashAboutBox.cpp
U   trunk/src/windows/leash/LeashDebugWindow.cpp
U   trunk/src/windows/leash/LeashProperties.cpp
U   trunk/src/windows/leash/LeashView.cpp
U   trunk/src/windows/leash/LeashView.h
U   trunk/src/windows/leash/Lglobals.h
A   trunk/src/windows/leash/Makefile.in
A   trunk/src/windows/leash/ver.rc
Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/Makefile.in	2011-10-14 14:42:37 UTC (rev 25339)
@@ -195,7 +195,8 @@
 	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 @@
 ##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 @@
 	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

Modified: trunk/src/windows/Makefile.in
===================================================================
--- trunk/src/windows/Makefile.in	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/Makefile.in	2011-10-14 14:42:37 UTC (rev 25339)
@@ -1,3 +1,3 @@
 BUILDTOP=..
 NO_OUTPRE=1
-SUBDIRS= lib leashdll cns gina ms2mit kfwlogon
+SUBDIRS= lib leashdll leash cns gina ms2mit kfwlogon

Modified: trunk/src/windows/leash/Krb4EditDomainRealmList.cpp
===================================================================
--- trunk/src/windows/leash/Krb4EditDomainRealmList.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/Krb4EditDomainRealmList.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -42,8 +42,12 @@
 	  *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("");

Modified: trunk/src/windows/leash/KrbConfigOptions.cpp
===================================================================
--- trunk/src/windows/leash/KrbConfigOptions.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/KrbConfigOptions.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -82,6 +82,7 @@
         return buffer;
 }
 
+#ifndef NO_KRB4
 int krb_get_krbhst(char* h, char* r, int n)
 {
 	char lbstorage[BUFSIZ];
@@ -139,6 +140,7 @@
     (void) fclose(cnffile);
     return(KSUCCESS);
 }
+#endif
 
 BOOL CKrbConfigOptions::OnInitDialog()
 {
@@ -152,6 +154,7 @@
 
     CPropertyPage::OnInitDialog();
 
+#ifndef NO_KRB4
 	if (CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL)
 	{  // Krb4 NOT krb5
 		// Fill in all edit boxes
@@ -200,7 +203,7 @@
 
 					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 @@
 			} // 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 @@
 					SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "No KDC information available");
 			}
 		}
+#ifndef NO_KRB4
 		else
 		{
 			CHAR krbhst[MAX_HSTNM + 1];
@@ -496,6 +502,7 @@
 			if (strlen(krbhst))
 			  SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);
 		}
+#endif
 	}
 }
 

Modified: trunk/src/windows/leash/KrbDomainRealmMaintenance.cpp
===================================================================
--- trunk/src/windows/leash/KrbDomainRealmMaintenance.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/KrbDomainRealmMaintenance.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -140,6 +140,7 @@
 		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 @@
 	}
 
 	krbrealmCon.Close();
+#endif
+
 	return TRUE;
 }
 
@@ -190,6 +193,8 @@
 
 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 @@
 			GetDlgItem(IDC_BUTTON_HOST_EDIT)->EnableWindow();
 		}
 	}
-
+#endif
 }
 
 void CKrbDomainRealmMaintenance::OnButtonHostEdit()

Modified: trunk/src/windows/leash/KrbMiscConfigOpt.cpp
===================================================================
--- trunk/src/windows/leash/KrbMiscConfigOpt.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/KrbMiscConfigOpt.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -282,14 +282,20 @@
         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 @@
                    "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);

Modified: trunk/src/windows/leash/KrbProperties.cpp
===================================================================
--- trunk/src/windows/leash/KrbProperties.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/KrbProperties.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -59,19 +59,23 @@
 	}
 #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);

Modified: trunk/src/windows/leash/KrbProperties.h
===================================================================
--- trunk/src/windows/leash/KrbProperties.h	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/KrbProperties.h	2011-10-14 14:42:37 UTC (rev 25339)
@@ -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 @@
 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;
 

Modified: trunk/src/windows/leash/Leash.cpp
===================================================================
--- trunk/src/windows/leash/Leash.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/Leash.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -54,7 +54,10 @@
 
 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 @@
 #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 @@
     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 @@
     MAKE_FUNC_INFO(krb_get_tf_realm),
     END_FUNC_INFO
 };
+#endif
 
 
 // psapi functions
@@ -718,7 +726,9 @@
 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 @@
         return FALSE;
     }
 
+////
+#ifndef NO_KRB4
     if (m_hKrb4DLL)
     {
         if (!LoadFuncs(KERB4DLL, krb4_fi, 0, 0, 1, 0, 0))
@@ -760,6 +772,7 @@
                        "Error", MB_OK);
         }
     }
+#endif
 
     if (m_hKrb5DLL)
     {
@@ -1121,6 +1134,8 @@
             }
 
         }
+////
+#ifndef NO_KRB4
     } else if ( m_hKrb4DLL ) {
         if ( !realm[0] ) {
             /* Open ticket file */
@@ -1164,16 +1179,23 @@
             } 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 @@
 		strncpy(confname, krbConFile, szConfname);
         confname[szConfname-1] = '\0';
 	}
+////
+#ifndef NO_KRB4
 	else if (m_hKrb4DLL)
 	{
         unsigned int size = szConfname;
@@ -1214,6 +1238,8 @@
             confname[szConfname-1] = '\0';
 		}
 	}
+#endif
+
     return FALSE;
 }
 
@@ -1223,7 +1249,12 @@
     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 @@
 		strncpy(confname, krbRealmConFile, szConfname);
         confname[szConfname-1] = '\0';
 	}
+////
+#ifndef NO_KRB4
 	else if (m_hKrb4DLL)
 	{
         unsigned int size = szConfname;
@@ -1265,6 +1298,8 @@
             return TRUE;
 		}
 	}
+#endif
+
     return FALSE;
 }
 

Modified: trunk/src/windows/leash/Leash.h
===================================================================
--- trunk/src/windows/leash/Leash.h	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/Leash.h	2011-10-14 14:42:37 UTC (rev 25339)
@@ -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 @@
 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;

Modified: trunk/src/windows/leash/LeashAboutBox.cpp
===================================================================
--- trunk/src/windows/leash/LeashAboutBox.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/LeashAboutBox.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -302,8 +302,10 @@
 {
     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);

Modified: trunk/src/windows/leash/LeashDebugWindow.cpp
===================================================================
--- trunk/src/windows/leash/LeashDebugWindow.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/LeashDebugWindow.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -81,8 +81,8 @@
 		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 @@
 	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);

Modified: trunk/src/windows/leash/LeashProperties.cpp
===================================================================
--- trunk/src/windows/leash/LeashProperties.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/LeashProperties.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -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
 

Modified: trunk/src/windows/leash/LeashView.cpp
===================================================================
--- trunk/src/windows/leash/LeashView.cpp	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/LeashView.cpp	2011-10-14 14:42:37 UTC (rev 25339)
@@ -130,7 +130,10 @@
 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 @@
 
     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 @@
 #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 @@
 
     TV_INSERTSTRUCT m_tvinsert;
 
+#ifndef NO_KRB4
     INT ticketIconStatusKrb4;
     INT ticketIconStatus_SelectedKrb4;
     INT iconStatusKrb4;
+#endif
 
     INT ticketIconStatusKrb5;
     INT ticketIconStatus_SelectedKrb5;
@@ -841,15 +857,19 @@
     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 @@
      * 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,7 +940,9 @@
         ticketIconStatus_SelectedKrb4 = EXPIRED_CLOCK;
         iconStatusKrb4 = TICKET_NOT_INSTALLED;
     }
+#endif
 
+
     /* Krb5 */
     UpdateTicketTime(ticketinfo.Krb5);
     m_ticketStatusKrb5 = GetLowTicketStatus(5);
@@ -1005,6 +1029,8 @@
             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 @@
             m_tvinsert.item.iSelectedImage = EXPIRED_PARENT_NODE;
             break;
         }
+#endif
     } else {
         m_tvinsert.item.iSelectedImage = NONE_PARENT_NODE;
     }
@@ -1094,6 +1121,7 @@
     // Krb4
     m_tvinsert.hParent = m_hPrincipal;
 
+#ifndef NO_KRB4
     if (CLeashApp::m_hKrb4DLL)
     {
         m_tvinsert.item.pszText = "Kerberos Four Tickets";
@@ -1102,12 +1130,17 @@
     }
     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 @@
     m_tvinsert.item.iImage = ticketIconStatusKrb4;
     m_tvinsert.item.iSelectedImage = ticketIconStatus_SelectedKrb4;
 
+
+////What does the original do?
     tempList = m_listKrb4, *killList;
     while (tempList)
     {
@@ -1129,8 +1164,8 @@
 
     if (m_hKerb4State == NODE_IS_EXPANDED)
         m_pTree->Expand(m_hKerb4, TVE_EXPAND);
+#endif
 
-
     // AFS
     m_tvinsert.hParent = m_hPrincipal;
 
@@ -1369,10 +1404,13 @@
     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 @@
 
         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::ResetTreeNodes()
 {
     m_hPrincipalState = 0;
+#ifndef NO_KRB4
     m_hKerb4State = 0;
+#endif
     m_hKerb5State = 0;
     m_hAFSState = 0;
 }
@@ -1666,7 +1709,12 @@
     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 @@
 
     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 @@
 #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 @@
 
     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::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::OnKrb4Properties()
 {
+#ifndef NO_KRB4
     CKrb4Properties krb4Properties("Kerberos Four Properties");
     krb4Properties.DoModal();
+#endif
 }
 
 VOID CLeashView::OnKrb5Properties()
@@ -2102,6 +2182,7 @@
             }
             //KRB5
 
+#ifndef NO_KRB4
             if (CLeashApp::m_hKrb4DLL)
             {
                 // KRB4
@@ -2196,6 +2277,8 @@
             }
             else
             {
+#endif
+////Should this be removed altogether?
                 // not installed
                 ticketStatusKrb4.Format("Kerb-4: Not Available");
 
@@ -2204,8 +2287,10 @@
                     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::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::OnUpdateKrb4Properties(CCmdUI* pCmdUI)
 {
+#ifndef NO_KRB4
     if (CLeashApp::m_hKrb4DLL)
         pCmdUI->Enable();
     else
+#endif
         pCmdUI->Enable(FALSE);
 }
 
@@ -2731,10 +2822,13 @@
 
 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);
 }
 

Modified: trunk/src/windows/leash/LeashView.h
===================================================================
--- trunk/src/windows/leash/LeashView.h	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/LeashView.h	2011-10-14 14:42:37 UTC (rev 25339)
@@ -70,7 +70,10 @@
 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 @@
     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 @@
 	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 @@
 
     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;

Modified: trunk/src/windows/leash/Lglobals.h
===================================================================
--- trunk/src/windows/leash/Lglobals.h	2011-10-14 14:40:36 UTC (rev 25338)
+++ trunk/src/windows/leash/Lglobals.h	2011-10-14 14:42:37 UTC (rev 25339)
@@ -18,7 +18,7 @@
 
 #include <tlhelp32.h>
 #include <loadfuncs-krb5.h>
-#include <loadfuncs-krb.h>
+////#include <loadfuncs-krb.h>
 #include <loadfuncs-profile.h>
 #include <loadfuncs-leash.h>
 
@@ -151,23 +151,13 @@
 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 @@
 #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 @@
 class TicketInfoWrapper {
   public:
     HANDLE     lockObj;
+////Can this be commented out?
     TICKETINFO Krb4;
     TICKETINFO Krb5;
     TICKETINFO Afs;

Added: trunk/src/windows/leash/Makefile.in
===================================================================
--- trunk/src/windows/leash/Makefile.in	                        (rev 0)
+++ trunk/src/windows/leash/Makefile.in	2011-10-14 14:42:37 UTC (rev 25339)
@@ -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

Added: trunk/src/windows/leash/ver.rc
===================================================================
--- trunk/src/windows/leash/ver.rc	                        (rev 0)
+++ trunk/src/windows/leash/ver.rc	2011-10-14 14:42:37 UTC (rev 25339)
@@ -0,0 +1,3 @@
+#define VER_FILEDESCRIPTION_STR 	"Leash Application"
+
+#include <kerberos.ver>




More information about the cvs-krb5 mailing list