summaryrefslogtreecommitdiffstats
path: root/src/windows/leash/KrbConfigOptions.cpp
blob: 3e69bb0a1239904d3e15e86239557e333b0e6600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
//	**************************************************************************************
//	File:			KrbConfigOptions.cpp
//	By:				Arthur David Leather
//	Created:		12/02/98
//	Copyright		@1998 Massachusetts Institute of Technology - All rights reserved.
//	Description:	CPP file for KrbProperties.h. Contains variables and functions
//					for Kerberos Four and Five Properties
//
//	History:
//
//	MM/DD/YY	Inits	Description of Change
//	2/01/98	ADL		Original
//	**************************************************************************************


#include "stdafx.h"
#include "Leash.h"
#include "KrbProperties.h"
#include "KrbConfigOptions.h"
#include "LeashFileDialog.h"
#include "LeashMessageBox.h"
#include "wshelper.h"
#include "lglobals.h"
#include <io.h>
#include <direct.h>
#include "reminder.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


///////////////////////////////////////////////////////////////////////
// CKrbConfigOptions property page

CString CKrbConfigOptions::m_newDefaultRealm;
CString CKrbConfigOptions::m_hostServer;
CComboBox CKrbConfigOptions::m_krbRealmEditbox;
BOOL CKrbConfigOptions::m_profileError;
BOOL CKrbConfigOptions::m_dupEntriesError;

IMPLEMENT_DYNCREATE(CKrbConfigOptions, CPropertyPage)

CKrbConfigOptions::CKrbConfigOptions() : CPropertyPage(CKrbConfigOptions::IDD)
{
	m_initDefaultRealm = _T("");
	m_newDefaultRealm = _T("");
	m_startupPage2 = TRUE;
	m_noKrbFileError = FALSE;
	m_noKrbhostWarning = FALSE;
	m_dupEntriesError = FALSE;
	m_profileError	= FALSE;
	m_noRealm = FALSE;

	//{{AFX_DATA_INIT(CKrbConfigOptions)
	//}}AFX_DATA_INIT
}

CKrbConfigOptions::~CKrbConfigOptions()
{
}

VOID CKrbConfigOptions::DoDataExchange(CDataExchange* pDX)
{
	TRACE("Entering CKrbConfigOptions::DoDataExchange -- %d\n",
	      pDX->m_bSaveAndValidate);
	CPropertyPage::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CKrbConfigOptions)
	DDX_Control(pDX, IDC_EDIT_DEFAULT_REALM, m_krbRealmEditbox);
	//}}AFX_DATA_MAP
}

static char far * near parse_str(char far*buffer,char far*result)
{
        while (isspace(*buffer))
                buffer++;
        while (!isspace(*buffer))
                *result++=*buffer++;
        *result='\0';
        return buffer;
}

#ifndef NO_KRB4
int krb_get_krbhst(char* h, char* r, int n)
{
	char lbstorage[BUFSIZ];
    char tr[REALM_SZ];
    static FILE *cnffile; /*XXX pbh added static because of MS bug in fgets() */
    static char FAR *linebuf; /*XXX pbh added static because of MS bug in fgets() */
    int i;
    char *p;

    //static char buffer[80];
    //krb_get_krbconf(buffer);
    memset(lbstorage, '\0', BUFSIZ ); /* 4-22-94 */
    linebuf = &lbstorage[0];

    if ((cnffile = fopen(CKrbProperties::m_krbPath,"r")) == NULL) {
        if (n==1) {
            (void) strcpy(h,KRB_HOST);
            return(KSUCCESS);
        } else {
            return(KFAILURE);
        }
    }
    /* linebuf=(char FAR *)malloc(BUFSIZ); */ /*4-22-94*/
    if (fgets(linebuf,BUFSIZ,cnffile)==NULL) {
            /* free(linebuf); */ /* 4-22-94 */

            return(KFAILURE);
    }
    /* bzero( tr, sizeof(tr) ); */   /* pbh 2-24-93 */
    memset(tr, '\0', sizeof(tr) );
    parse_str(linebuf,tr);
    if (*tr=='\0') {
            return (KFAILURE);
    }
    /* run through the file, looking for the nth server for this realm */
    for (i = 1; i <= n;) {
        if (fgets(linebuf, BUFSIZ, cnffile) == NULL) {
            /* free(linebuf); */ /*4-22-94*/
            (void) fclose(cnffile);
            return(KFAILURE);
        }
        /* bzero( tr, sizeof(tr) ); */   /* pbh 2-24-93 */
        memset(tr, '\0', sizeof(tr) );
        p=parse_str(linebuf,tr);
        if (*tr=='\0')
                continue;
        memset(h, '\0', lstrlen(h) );
        parse_str(p,h);
        if (*tr=='\0')
                continue;
        if (!lstrcmp(tr,r))
                i++;
    }
    /* free(linebuf); */ /*4-22-94*/
    (void) fclose(cnffile);
    return(KSUCCESS);
}
#endif

BOOL CKrbConfigOptions::OnInitDialog()
{
    m_initDefaultRealm = _T("");
    m_newDefaultRealm = _T("");
    m_noKrbFileError = FALSE;
    m_noKrbhostWarning = FALSE;
    m_dupEntriesError = FALSE;
    m_profileError	= FALSE;
    m_noRealm = FALSE;

    CPropertyPage::OnInitDialog();

#ifndef NO_KRB4
	if (CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL)
	{  // Krb4 NOT krb5
		// Fill in all edit boxes
		char krbRealm[REALM_SZ + 1];
		char krbhst[MAX_HSTNM + 1];
		CStdioFile krbCon;
		if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeRead))
		{
			SetDlgItemText(IDC_EDIT_DEFAULT_REALM, KRB_REALM);
			SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, KRB_MASTER);
			//CheckRadioButton(IDC_RADIO_ADMIN_SERVER, IDC_RADIO_NO_ADMIN_SERVER, IDC_RADIO_NO_ADMIN_SERVER);
			m_initDefaultRealm = m_newDefaultRealm = KRB_REALM;
		}
		else
		{ // place krbRealm in Edit box
			memset(krbRealm, '\0', sizeof(krbRealm));
			if (!krbCon.ReadString(krbRealm, sizeof(krbRealm)) || '\r' == *krbRealm  ||
				'\n' == *krbRealm || '\0' == *krbRealm)
			{
				SetDlgItemText(IDC_EDIT_DEFAULT_REALM, KRB_REALM);
				SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, KRB_MASTER);
				m_initDefaultRealm = m_newDefaultRealm = KRB_REALM;
			}
			else
			{
				*(krbRealm + strlen(krbRealm) - 1) = 0;
				LPSTR pSpace = strchr(krbRealm, ' ');
				if (pSpace)
				  *pSpace = 0;

				m_initDefaultRealm = m_newDefaultRealm = krbRealm;

				memset(krbhst, '\0', sizeof(krbhst));
				krbCon.Close();

				// Check for Host
				// don't use KRB4 - krb_get_krbhst - would have to re-logon, on file location
				// change, to use this function
				if (KFAILURE == pkrb_get_krbhst(krbhst, krbRealm, 1))
				{
					m_noKrbhostWarning = TRUE;
				}
				else
				{ // place hostname in Edit Box
					//SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, krbhst);

					m_hostServer = krbhst;

					// New stuff to put realms in Combo Box
					CStdioFile krbCon;
					if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeRead))
					{
						m_noKrbFileError = TRUE;
						m_noRealm = TRUE;
					} else {

						LPSTR space = NULL;
						CHAR lineBuf[REALM_SZ + MAX_HSTNM + 20];
						CHAR localRealm[REALM_SZ + MAX_HSTNM + 20];
						memset(lineBuf, '\0', sizeof(lineBuf));
						memset(localRealm, '\0', sizeof(localRealm));

						if (krbCon.ReadString(localRealm, sizeof(localRealm)))
						  *(localRealm + strlen(localRealm) - 1) = 0;
						else
						  return FALSE;

						space = strchr(localRealm, ' ');
						if (space)
						  *space = 0;

						while (TRUE)
						{
							if (!krbCon.ReadString(lineBuf, sizeof(lineBuf)))
							  break;

							*(lineBuf + sizeof(lineBuf) - 1) = 0;

							if (strlen(lineBuf) == 0)
								continue;

							space = strchr(lineBuf, ' ');
							if (!space) space = strchr(lineBuf, '\t');
							if (space)
							  *space = 0;
							else
							  ASSERT(0);

                            // skip Kerberos Options
                            if ( !strncmp(".KERBEROS.OPTION.",lineBuf,17) )
                                continue;

							if (CB_ERR == m_krbRealmEditbox.FindStringExact(-1, lineBuf))
							{ // no dups
								if (LB_ERR == m_krbRealmEditbox.AddString(lineBuf))
								{
									MessageBox("OnInitDialog::Can't add to Kerberos Realm Combobox",
										   "Leash", MB_OK);
									return FALSE;
								}
							}
						}

						m_krbRealmEditbox.SelectString(-1, krbRealm);

					} // end of 'else'
				} // end of 'place hostname in Edit Box' else statement
			} // end of 'Check for Host' else statement
		} // end of 'place krbRealm in Edit box' else
	}
	else
#endif
	if (CLeashApp::m_hKrb5DLL)
	{ // Krb5 OR krb5 AND krb4
		char *realm = NULL;
		pkrb5_get_default_realm(CLeashApp::m_krbv5_context, &realm);

		if (!realm)
			m_noRealm = TRUE;

		m_initDefaultRealm = m_newDefaultRealm = realm;

	    if ( !CLeashApp::m_krbv5_profile ) {
            CHAR confname[MAX_PATH];
            if (!CLeashApp::GetProfileFile(confname, sizeof(confname)))
            {
                const char *filenames[2];
                filenames[0] = confname;
                filenames[1] = NULL;
                pprofile_init(filenames, &CLeashApp::m_krbv5_profile);
            }
	    }

        CHAR selRealm[REALM_SZ];
        strcpy(selRealm, m_newDefaultRealm);
        const char*  Section[] = {"realms", selRealm, "kdc", NULL};
        const char** section = Section;
        char **values = NULL;
        char * value  = NULL;

        long retval = pprofile_get_values(CLeashApp::m_krbv5_profile,
                                           section, &values);

        if (!retval && values)
            m_hostServer = *values;
        else {
            int dns_in_use = 0;
            // Determine if we are using DNS for KDC lookups
            retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
                                          "dns_lookup_kdc", 0, 0, &value);
            if (value == 0 && retval == 0)
                retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
                                              "dns_fallback", 0, 0, &value);
            if (value == 0) {
#if KRB5_DNS_LOOKUP_KDC
                dns_in_use = 1;
#else
                dns_in_use = 0;
#endif
            } else {
                dns_in_use = config_boolean_to_int(value);
                pprofile_release_string(value);
            }
            if (dns_in_use)
                m_hostServer = "DNS SRV record lookups will be used to find KDC";
            else {
                m_hostServer = "No KDC information available";
            }
        }
        SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);

        if ( realm )
            pkrb5_free_default_realm(CLeashApp::m_krbv5_context, realm);
    }

	// Set host and domain names in their Edit Boxes, respectively.
	char hostName[80]="";
	char domainName[80]="";
	int ckHost = wsh_gethostname(hostName, sizeof(hostName));
	int ckdomain = wsh_getdomainname(domainName, sizeof(domainName));
	CString dot_DomainName = ".";
	dot_DomainName += domainName;

	SetDlgItemText(IDC_EDIT_HOSTNAME, ckHost == 0 ? hostName : "");
	SetDlgItemText(IDC_EDIT_DOMAINNAME, ckdomain == 0 ? dot_DomainName : "");

	return m_noRealm;
}

BOOL CKrbConfigOptions::OnApply()
{
	// If no changes were made, quit this function
	if (0 == m_initDefaultRealm.CompareNoCase(m_newDefaultRealm))
	  return TRUE;

	m_newDefaultRealm.TrimLeft();
	m_newDefaultRealm.TrimRight();

	if (m_newDefaultRealm.IsEmpty())
	{
		MessageBox("OnApply::Your Kerberos Realm field must be filled in!",
                    "Leash", MB_OK);
		m_newDefaultRealm = m_initDefaultRealm;
		SetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newDefaultRealm);
		return TRUE;
	}

	CStdioFile krbCon;
	if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeCreate |
			  CFile::modeNoTruncate |
			  CFile::modeRead))
	{
		LeashErrorBox("OnApply::Can't open configuration file",
					  CKrbProperties::m_krbPath);
		return TRUE;
	}

	CStdioFile krbCon2;
	CString krbCon2File = CKrbProperties::m_krbPath;
	krbCon2File += "___";
	if (!krbCon2.Open(krbCon2File, CFile::modeCreate | CFile::modeWrite))
	{
		LeashErrorBox("OnApply:: Can't open configuration file",
					  CKrbProperties::m_krbPath);
		return TRUE;
	}

	CString readWrite;
	krbCon.ReadString(readWrite);
	krbCon2.WriteString(m_newDefaultRealm);
	krbCon2.WriteString("\n");
	while (krbCon.ReadString(readWrite))
	{
		krbCon2.WriteString(readWrite);
		krbCon2.WriteString("\n");
	}

	krbCon.Close();
	krbCon2.Close();
	krbCon2.Remove(CKrbProperties::m_krbPath);
	krbCon2.Rename(krbCon2File, CKrbProperties::m_krbPath);

	if (CLeashApp::m_hKrb5DLL)
	{ // Krb5 OR krb5 AND krb4
	    if ( !CLeashApp::m_krbv5_profile ) {
            CHAR confname[MAX_PATH];
            if (!CLeashApp::GetProfileFile(confname, sizeof(confname)))
            {
                const char *filenames[2];
                filenames[0] = confname;
                filenames[1] = NULL;
                pprofile_init(filenames, &CLeashApp::m_krbv5_profile);
            }
	    }

		const char*  Names[] = {"libdefaults", "default_realm", NULL};
		const char** names = Names;

		long retval = pprofile_update_relation(CLeashApp::m_krbv5_profile,
							names, m_initDefaultRealm, m_newDefaultRealm);

		if (retval)
		{
			MessageBox("OnApply::The previous value cannot be found, the profile will not be saved!!!\
                        \nIf this error persists after restarting Leash, contact your administrator.",
					   "Leash", MB_OK);
			return TRUE;
		}

		// Save to Kerberos Five config. file "Krb5.ini"
	    retval = pprofile_flush(CLeashApp::m_krbv5_profile);
	}

	m_initDefaultRealm = m_newDefaultRealm;
	return TRUE;
}

void CKrbConfigOptions::OnSelchangeEditDefaultRealm()
{
	if (!m_startupPage2)
	{
		GetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newDefaultRealm);
		SetModified(TRUE);

		if (CLeashApp::m_hKrb5DLL)
		{
			CHAR selRealm[REALM_SZ];
			strcpy(selRealm, m_newDefaultRealm);
			const char*  Section[] = {"realms", selRealm, "kdc", NULL};
			const char** section = Section;
			char **values = NULL;
			char * value  = NULL;

			long retval = pprofile_get_values(CLeashApp::m_krbv5_profile,
											   section, &values);

			if (!retval && values)
			  SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, *values);
			else {
				int dns_in_use = 0;
				// Determine if we are using DNS for KDC lookups
				retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
							                 "dns_lookup_kdc", 0, 0, &value);
				if (value == 0 && retval == 0)
					retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
								                 "dns_fallback", 0, 0, &value);
				if (value == 0) {
#if KRB5_DNS_LOOKUP_KDC
			        dns_in_use = 1;
#else
					dns_in_use = 0;
#endif
				} else {
					dns_in_use = config_boolean_to_int(value);
					pprofile_release_string(value);
				}
				if (dns_in_use)
					SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "DNS SRV record lookups will be used to find KDC");
				else
					SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "No KDC information available");
			}
		}
#ifndef NO_KRB4
		else
		{
			CHAR krbhst[MAX_HSTNM + 1];
			CHAR krbrlm[REALM_SZ + 1];

			strcpy(krbrlm, CKrbConfigOptions::m_newDefaultRealm);
			memset(krbhst, '\0', sizeof(krbhst));

			// Check for Host
			// don't use KRB4 - krb_get_krbhst - would have to re-logon, on file location
			// change, to use this function
			if (KFAILURE == pkrb_get_krbhst(krbhst, krbrlm, 1))
			{
				MessageBox("OnSelchangeEditDefaultRealm::Unable to find the Host Server for your Default Realm!!!\
                            \n 'Apply' your changes and try again.",
					        "Leash", MB_OK);
			    SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "");
				return;
			}

			m_hostServer = krbhst;
			if (strlen(krbhst))
			  SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);
		}
#endif
	}
}

void CKrbConfigOptions::OnEditchangeEditDefaultRealm()
{
	if (!m_startupPage2)
	{
		GetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newDefaultRealm);
		SetModified(TRUE);
	}
}

void CKrbConfigOptions::OnShowWindow(BOOL bShow, UINT nStatus)
{
	CPropertyPage::OnShowWindow(bShow, nStatus);

	if (CLeashApp::m_hKrb5DLL)
	  ResetDefaultRealmComboBox();

	SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);
}

void CKrbConfigOptions::ResetDefaultRealmComboBox()
{ // Krb5 is loaded
	// Reset Config Tab's Default Realm Combo Editbox
	const char*  rootSection[] = {"realms", NULL};
	const char** rootsec = rootSection;
	char **sections = NULL,
		 **cpp = NULL,
         *value = 0;
    int dns;

    long retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
                                  "dns_lookup_kdc", 0, 0, &value);
    if (value == 0 && retval == 0)
        retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
                                      "dns_fallback", 0, 0, &value);
    if (value == 0) {
#if KRB5_DNS_LOOKUP_KDC
        dns = 1;
#else
        dns = 0;
#endif
    } else {
        dns = config_boolean_to_int(value);
        pprofile_release_string(value);
    }

    retval = pprofile_get_subsection_names(CLeashApp::m_krbv5_profile,
						    rootsec , &sections);

	if (retval)
	{
        m_hostServer = _T("");

        // This is not a fatal error if DNS KDC Lookup is being used.
        // Determine the starting value for DNS KDC Lookup Checkbox
        if ( dns )
            return;

        m_profileError = TRUE;
	}

	m_krbRealmEditbox.ResetContent();

    if ( !m_profileError ) {
	for (cpp = sections; *cpp; cpp++)
	{
		if (CB_ERR == m_krbRealmEditbox.FindStringExact(-1, *cpp))
		{ // no dups
			if (CB_ERR == m_krbRealmEditbox.AddString(*cpp))
			{
				::MessageBox(NULL, "ResetDefaultRealmComboBox::Can't add to Kerberos Realm Combobox",
							 "Leash", MB_OK);
				return;
			}
		}
		else
		  m_dupEntriesError = TRUE;
	}
    }

    if (!m_newDefaultRealm.IsEmpty()) {

		if (CB_ERR == m_krbRealmEditbox.FindStringExact(-1, m_newDefaultRealm))
		{ // no dups
			m_krbRealmEditbox.AddString(m_newDefaultRealm);
		}
		m_krbRealmEditbox.SelectString(-1, m_newDefaultRealm);

		const char*  Section[] = {"realms", m_newDefaultRealm, "kdc", NULL}; //theSection
		const char** section = Section;
		char **values = NULL;

		retval = pprofile_get_values(CLeashApp::m_krbv5_profile,
					     section, &values);

        if (!retval && values)
            m_hostServer = *values;
        else {
            if (dns)
                m_hostServer = "DNS SRV record lookups will be used to find KDC";
            else {
                m_hostServer = "No KDC information available";
            }
		}
	}
}

BOOL CKrbConfigOptions::PreTranslateMessage(MSG* pMsg)
{
	if (!m_startupPage2)
	{
		if (m_noKrbFileError)
		{
			LeashErrorBox("PreTranslateMessage::Unable to open configuration file",
				!strlen(CKrbProperties::m_krbPath) ? KRB_FILE :
				CKrbProperties::m_krbPath);
			m_noKrbFileError = FALSE;
		}

		if (m_noKrbhostWarning)
		{
			MessageBox("PreTranslateMessage::Unable to locate the Kerberos Host for your Kerberos Realm!",
					   "Leash", MB_OK);
			m_noKrbhostWarning = FALSE;
		}

		if (m_dupEntriesError)
		{
			MessageBox("PreTranslateMessage::Found duplicate entries in the Kerberos 5 Config. File!!!\
                        \nPlease contact your Administrator.",
					   "Leash", MB_OK);

			m_dupEntriesError = FALSE;
		}

		if (m_profileError)
		{
			MessageBox("PreTranslateMessage::Unable to open Kerberos 5 Config. File!!!\
                        \nIf this error persists, contact your administrator.",
				       "Leash", MB_OK);
			m_profileError	= FALSE;
		}

		if (m_noRealm)
		{
			MessageBox("PreTranslateMessage::Unable to determine the Default Realm.\
                        \n Contact your Administrator!",
					   "Leash", MB_OK);

			m_noRealm = FALSE;
		}
	}

	m_startupPage2 = FALSE;
	return CPropertyPage::PreTranslateMessage(pMsg);
}


BEGIN_MESSAGE_MAP(CKrbConfigOptions, CPropertyPage)
	//{{AFX_MSG_MAP(CKrbConfigOptions)
	ON_WM_SHOWWINDOW()
	ON_CBN_EDITCHANGE(IDC_EDIT_DEFAULT_REALM, OnEditchangeEditDefaultRealm)
	ON_CBN_SELCHANGE(IDC_EDIT_DEFAULT_REALM, OnSelchangeEditDefaultRealm)
	ON_BN_CLICKED(IDC_BUTTON_KRB_HELP, OnButtonKrbHelp)
	ON_BN_CLICKED(IDC_BUTTON_KRBREALM_HELP, OnButtonKrbrealmHelp)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()



void CKrbConfigOptions::OnButtonKrbHelp()
{
	MessageBox("No Help Available!", "Leash", MB_OK);
}

void CKrbConfigOptions::OnButtonKrbrealmHelp()
{
	MessageBox("No Help Available!", "Leash", MB_OK);
}