c8fa66cb6115375829e10ff15a0b616e23b7441c
[platform/upstream/krb5.git] / src / windows / leash / KrbConfigOptions.cpp
1 //      **************************************************************************************
2 //      File:                   KrbConfigOptions.cpp
3 //      By:                             Arthur David Leather
4 //      Created:                12/02/98
5 //      Copyright               @1998 Massachusetts Institute of Technology - All rights reserved.
6 //      Description:    CPP file for KrbProperties.h. Contains variables and functions
7 //                                      for Kerberos Four and Five Properties
8 //
9 //      History:
10 //
11 //      MM/DD/YY        Inits   Description of Change
12 //      2/01/98 ADL             Original
13 //      **************************************************************************************
14
15
16 #include "stdafx.h"
17 #include "Leash.h"
18 #include "KrbProperties.h"
19 #include "KrbConfigOptions.h"
20 #include "LeashFileDialog.h"
21 #include "LeashMessageBox.h"
22 #include "wshelper.h"
23 #include "lglobals.h"
24 #include <io.h>
25 #include <direct.h>
26 #include "reminder.h"
27
28 #ifdef _DEBUG
29 #define new DEBUG_NEW
30 #undef THIS_FILE
31 static char THIS_FILE[] = __FILE__;
32 #endif
33
34
35 ///////////////////////////////////////////////////////////////////////
36 // CKrbConfigOptions property page
37
38 CString CKrbConfigOptions::m_newDefaultRealm;
39 CString CKrbConfigOptions::m_hostServer;
40 CComboBox CKrbConfigOptions::m_krbRealmEditbox;
41 BOOL CKrbConfigOptions::m_profileError;
42 BOOL CKrbConfigOptions::m_dupEntriesError;
43
44 IMPLEMENT_DYNCREATE(CKrbConfigOptions, CPropertyPage)
45
46 CKrbConfigOptions::CKrbConfigOptions() : CPropertyPage(CKrbConfigOptions::IDD)
47 {
48         m_initDefaultRealm = _T("");
49         m_newDefaultRealm = _T("");
50         m_startupPage2 = TRUE;
51         m_noKrbFileError = FALSE;
52         m_noKrbhostWarning = FALSE;
53         m_dupEntriesError = FALSE;
54         m_profileError  = FALSE;
55         m_noRealm = FALSE;
56
57         //{{AFX_DATA_INIT(CKrbConfigOptions)
58         //}}AFX_DATA_INIT
59 }
60
61 CKrbConfigOptions::~CKrbConfigOptions()
62 {
63 }
64
65 VOID CKrbConfigOptions::DoDataExchange(CDataExchange* pDX)
66 {
67         TRACE("Entering CKrbConfigOptions::DoDataExchange -- %d\n",
68               pDX->m_bSaveAndValidate);
69         CPropertyPage::DoDataExchange(pDX);
70         //{{AFX_DATA_MAP(CKrbConfigOptions)
71         DDX_Control(pDX, IDC_EDIT_DEFAULT_REALM, m_krbRealmEditbox);
72         //}}AFX_DATA_MAP
73 }
74
75 static char far * near parse_str(char far*buffer,char far*result)
76 {
77         while (isspace(*buffer))
78                 buffer++;
79         while (!isspace(*buffer))
80                 *result++=*buffer++;
81         *result='\0';
82         return buffer;
83 }
84
85 #ifndef NO_KRB4
86 int krb_get_krbhst(char* h, char* r, int n)
87 {
88         char lbstorage[BUFSIZ];
89     char tr[REALM_SZ];
90     static FILE *cnffile; /*XXX pbh added static because of MS bug in fgets() */
91     static char FAR *linebuf; /*XXX pbh added static because of MS bug in fgets() */
92     int i;
93     char *p;
94
95     //static char buffer[80];
96     //krb_get_krbconf(buffer);
97     memset(lbstorage, '\0', BUFSIZ ); /* 4-22-94 */
98     linebuf = &lbstorage[0];
99
100     if ((cnffile = fopen(CKrbProperties::m_krbPath,"r")) == NULL) {
101         if (n==1) {
102             (void) strcpy(h,KRB_HOST);
103             return(KSUCCESS);
104         } else {
105             return(KFAILURE);
106         }
107     }
108     /* linebuf=(char FAR *)malloc(BUFSIZ); */ /*4-22-94*/
109     if (fgets(linebuf,BUFSIZ,cnffile)==NULL) {
110             /* free(linebuf); */ /* 4-22-94 */
111
112             return(KFAILURE);
113     }
114     /* bzero( tr, sizeof(tr) ); */   /* pbh 2-24-93 */
115     memset(tr, '\0', sizeof(tr) );
116     parse_str(linebuf,tr);
117     if (*tr=='\0') {
118             return (KFAILURE);
119     }
120     /* run through the file, looking for the nth server for this realm */
121     for (i = 1; i <= n;) {
122         if (fgets(linebuf, BUFSIZ, cnffile) == NULL) {
123             /* free(linebuf); */ /*4-22-94*/
124             (void) fclose(cnffile);
125             return(KFAILURE);
126         }
127         /* bzero( tr, sizeof(tr) ); */   /* pbh 2-24-93 */
128         memset(tr, '\0', sizeof(tr) );
129         p=parse_str(linebuf,tr);
130         if (*tr=='\0')
131                 continue;
132         memset(h, '\0', lstrlen(h) );
133         parse_str(p,h);
134         if (*tr=='\0')
135                 continue;
136         if (!lstrcmp(tr,r))
137                 i++;
138     }
139     /* free(linebuf); */ /*4-22-94*/
140     (void) fclose(cnffile);
141     return(KSUCCESS);
142 }
143 #endif
144
145 BOOL CKrbConfigOptions::OnInitDialog()
146 {
147     m_initDefaultRealm = _T("");
148     m_newDefaultRealm = _T("");
149     m_noKrbFileError = FALSE;
150     m_noKrbhostWarning = FALSE;
151     m_dupEntriesError = FALSE;
152     m_profileError      = FALSE;
153     m_noRealm = FALSE;
154
155     CPropertyPage::OnInitDialog();
156
157 #ifndef NO_KRB4
158         if (CLeashApp::m_hKrb4DLL && !CLeashApp::m_hKrb5DLL)
159         {  // Krb4 NOT krb5
160                 // Fill in all edit boxes
161                 char krbRealm[REALM_SZ + 1];
162                 char krbhst[MAX_HSTNM + 1];
163                 CStdioFile krbCon;
164                 if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeRead))
165                 {
166                         SetDlgItemText(IDC_EDIT_DEFAULT_REALM, KRB_REALM);
167                         SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, KRB_MASTER);
168                         //CheckRadioButton(IDC_RADIO_ADMIN_SERVER, IDC_RADIO_NO_ADMIN_SERVER, IDC_RADIO_NO_ADMIN_SERVER);
169                         m_initDefaultRealm = m_newDefaultRealm = KRB_REALM;
170                 }
171                 else
172                 { // place krbRealm in Edit box
173                         memset(krbRealm, '\0', sizeof(krbRealm));
174                         if (!krbCon.ReadString(krbRealm, sizeof(krbRealm)) || '\r' == *krbRealm  ||
175                                 '\n' == *krbRealm || '\0' == *krbRealm)
176                         {
177                                 SetDlgItemText(IDC_EDIT_DEFAULT_REALM, KRB_REALM);
178                                 SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, KRB_MASTER);
179                                 m_initDefaultRealm = m_newDefaultRealm = KRB_REALM;
180                         }
181                         else
182                         {
183                                 *(krbRealm + strlen(krbRealm) - 1) = 0;
184                                 LPSTR pSpace = strchr(krbRealm, ' ');
185                                 if (pSpace)
186                                   *pSpace = 0;
187
188                                 m_initDefaultRealm = m_newDefaultRealm = krbRealm;
189
190                                 memset(krbhst, '\0', sizeof(krbhst));
191                                 krbCon.Close();
192
193                                 // Check for Host
194                                 // don't use KRB4 - krb_get_krbhst - would have to re-logon, on file location
195                                 // change, to use this function
196                                 if (KFAILURE == pkrb_get_krbhst(krbhst, krbRealm, 1))
197                                 {
198                                         m_noKrbhostWarning = TRUE;
199                                 }
200                                 else
201                                 { // place hostname in Edit Box
202                                         //SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, krbhst);
203
204                                         m_hostServer = krbhst;
205
206                                         // New stuff to put realms in Combo Box
207                                         CStdioFile krbCon;
208                                         if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeRead))
209                                         {
210                                                 m_noKrbFileError = TRUE;
211                                                 m_noRealm = TRUE;
212                                         } else {
213
214                                                 LPSTR space = NULL;
215                                                 CHAR lineBuf[REALM_SZ + MAX_HSTNM + 20];
216                                                 CHAR localRealm[REALM_SZ + MAX_HSTNM + 20];
217                                                 memset(lineBuf, '\0', sizeof(lineBuf));
218                                                 memset(localRealm, '\0', sizeof(localRealm));
219
220                                                 if (krbCon.ReadString(localRealm, sizeof(localRealm)))
221                                                   *(localRealm + strlen(localRealm) - 1) = 0;
222                                                 else
223                                                   return FALSE;
224
225                                                 space = strchr(localRealm, ' ');
226                                                 if (space)
227                                                   *space = 0;
228
229                                                 while (TRUE)
230                                                 {
231                                                         if (!krbCon.ReadString(lineBuf, sizeof(lineBuf)))
232                                                           break;
233
234                                                         *(lineBuf + sizeof(lineBuf) - 1) = 0;
235
236                                                         if (strlen(lineBuf) == 0)
237                                                                 continue;
238
239                                                         space = strchr(lineBuf, ' ');
240                                                         if (!space) space = strchr(lineBuf, '\t');
241                                                         if (space)
242                                                           *space = 0;
243                                                         else
244                                                           ASSERT(0);
245
246                             // skip Kerberos Options
247                             if ( !strncmp(".KERBEROS.OPTION.",lineBuf,17) )
248                                 continue;
249
250                                                         if (CB_ERR == m_krbRealmEditbox.FindStringExact(-1, lineBuf))
251                                                         { // no dups
252                                                                 if (LB_ERR == m_krbRealmEditbox.AddString(lineBuf))
253                                                                 {
254                                                                         MessageBox("OnInitDialog::Can't add to Kerberos Realm Combobox",
255                                                                                    "Leash", MB_OK);
256                                                                         return FALSE;
257                                                                 }
258                                                         }
259                                                 }
260
261                                                 m_krbRealmEditbox.SelectString(-1, krbRealm);
262
263                                         } // end of 'else'
264                                 } // end of 'place hostname in Edit Box' else statement
265                         } // end of 'Check for Host' else statement
266                 } // end of 'place krbRealm in Edit box' else
267         }
268         else
269 #endif
270         if (CLeashApp::m_hKrb5DLL)
271         { // Krb5 OR krb5 AND krb4
272                 char *realm = NULL;
273                 pkrb5_get_default_realm(CLeashApp::m_krbv5_context, &realm);
274
275                 if (!realm)
276                         m_noRealm = TRUE;
277
278                 m_initDefaultRealm = m_newDefaultRealm = realm;
279
280             if ( !CLeashApp::m_krbv5_profile ) {
281             CHAR confname[MAX_PATH];
282             if (!CLeashApp::GetProfileFile(confname, sizeof(confname)))
283             {
284                 const char *filenames[2];
285                 filenames[0] = confname;
286                 filenames[1] = NULL;
287                 pprofile_init(filenames, &CLeashApp::m_krbv5_profile);
288             }
289             }
290
291         CHAR selRealm[REALM_SZ];
292         strcpy(selRealm, m_newDefaultRealm);
293         const char*  Section[] = {"realms", selRealm, "kdc", NULL};
294         const char** section = Section;
295         char **values = NULL;
296         char * value  = NULL;
297
298         long retval = pprofile_get_values(CLeashApp::m_krbv5_profile,
299                                            section, &values);
300
301         if (!retval && values)
302             m_hostServer = *values;
303         else {
304             int dns_in_use = 0;
305             // Determine if we are using DNS for KDC lookups
306             retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
307                                           "dns_lookup_kdc", 0, 0, &value);
308             if (value == 0 && retval == 0)
309                 retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
310                                               "dns_fallback", 0, 0, &value);
311             if (value == 0) {
312                 dns_in_use = 1;
313             } else {
314                 dns_in_use = config_boolean_to_int(value);
315                 pprofile_release_string(value);
316             }
317             if (dns_in_use)
318                 m_hostServer = "DNS SRV record lookups will be used to find KDC";
319             else {
320                 m_hostServer = "No KDC information available";
321             }
322         }
323         SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);
324
325         if ( realm )
326             pkrb5_free_default_realm(CLeashApp::m_krbv5_context, realm);
327     }
328
329         // Set host and domain names in their Edit Boxes, respectively.
330         char hostName[80]="";
331         char domainName[80]="";
332         int ckHost = wsh_gethostname(hostName, sizeof(hostName));
333         int ckdomain = wsh_getdomainname(domainName, sizeof(domainName));
334         CString dot_DomainName = ".";
335         dot_DomainName += domainName;
336
337         SetDlgItemText(IDC_EDIT_HOSTNAME, ckHost == 0 ? hostName : "");
338         SetDlgItemText(IDC_EDIT_DOMAINNAME, ckdomain == 0 ? dot_DomainName : "");
339
340         return m_noRealm;
341 }
342
343 BOOL CKrbConfigOptions::OnApply()
344 {
345         // If no changes were made, quit this function
346         if (0 == m_initDefaultRealm.CompareNoCase(m_newDefaultRealm))
347           return TRUE;
348
349         m_newDefaultRealm.TrimLeft();
350         m_newDefaultRealm.TrimRight();
351
352         if (m_newDefaultRealm.IsEmpty())
353         {
354                 MessageBox("OnApply::Your Kerberos Realm field must be filled in!",
355                     "Leash", MB_OK);
356                 m_newDefaultRealm = m_initDefaultRealm;
357                 SetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newDefaultRealm);
358                 return TRUE;
359         }
360
361         CStdioFile krbCon;
362         if (!krbCon.Open(CKrbProperties::m_krbPath, CFile::modeCreate |
363                           CFile::modeNoTruncate |
364                           CFile::modeRead))
365         {
366                 LeashErrorBox("OnApply::Can't open configuration file",
367                                           CKrbProperties::m_krbPath);
368                 return TRUE;
369         }
370
371         CStdioFile krbCon2;
372         CString krbCon2File = CKrbProperties::m_krbPath;
373         krbCon2File += "___";
374         if (!krbCon2.Open(krbCon2File, CFile::modeCreate | CFile::modeWrite))
375         {
376                 LeashErrorBox("OnApply:: Can't open configuration file",
377                                           CKrbProperties::m_krbPath);
378                 return TRUE;
379         }
380
381         CString readWrite;
382         krbCon.ReadString(readWrite);
383         krbCon2.WriteString(m_newDefaultRealm);
384         krbCon2.WriteString("\n");
385         while (krbCon.ReadString(readWrite))
386         {
387                 krbCon2.WriteString(readWrite);
388                 krbCon2.WriteString("\n");
389         }
390
391         krbCon.Close();
392         krbCon2.Close();
393         krbCon2.Remove(CKrbProperties::m_krbPath);
394         krbCon2.Rename(krbCon2File, CKrbProperties::m_krbPath);
395
396         if (CLeashApp::m_hKrb5DLL)
397         { // Krb5 OR krb5 AND krb4
398             if ( !CLeashApp::m_krbv5_profile ) {
399             CHAR confname[MAX_PATH];
400             if (!CLeashApp::GetProfileFile(confname, sizeof(confname)))
401             {
402                 const char *filenames[2];
403                 filenames[0] = confname;
404                 filenames[1] = NULL;
405                 pprofile_init(filenames, &CLeashApp::m_krbv5_profile);
406             }
407             }
408
409                 const char*  Names[] = {"libdefaults", "default_realm", NULL};
410                 const char** names = Names;
411
412                 long retval = pprofile_update_relation(CLeashApp::m_krbv5_profile,
413                                                         names, m_initDefaultRealm, m_newDefaultRealm);
414
415                 if (retval)
416                 {
417                         MessageBox("OnApply::The previous value cannot be found, the profile will not be saved!!!\
418                         \nIf this error persists after restarting Leash, contact your administrator.",
419                                            "Leash", MB_OK);
420                         return TRUE;
421                 }
422
423                 // Save to Kerberos Five config. file "Krb5.ini"
424             retval = pprofile_flush(CLeashApp::m_krbv5_profile);
425         }
426
427         m_initDefaultRealm = m_newDefaultRealm;
428         return TRUE;
429 }
430
431 void CKrbConfigOptions::OnSelchangeEditDefaultRealm()
432 {
433         if (!m_startupPage2)
434         {
435                 GetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newDefaultRealm);
436                 SetModified(TRUE);
437
438                 if (CLeashApp::m_hKrb5DLL)
439                 {
440                         CHAR selRealm[REALM_SZ];
441                         strcpy(selRealm, m_newDefaultRealm);
442                         const char*  Section[] = {"realms", selRealm, "kdc", NULL};
443                         const char** section = Section;
444                         char **values = NULL;
445                         char * value  = NULL;
446
447                         long retval = pprofile_get_values(CLeashApp::m_krbv5_profile,
448                                                                                            section, &values);
449
450                         if (!retval && values)
451                           SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, *values);
452                         else {
453                                 int dns_in_use = 0;
454                                 // Determine if we are using DNS for KDC lookups
455                                 retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
456                                                                          "dns_lookup_kdc", 0, 0, &value);
457                                 if (value == 0 && retval == 0)
458                                         retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
459                                                                                  "dns_fallback", 0, 0, &value);
460                                 if (value == 0) {
461                                 dns_in_use = 1;
462                                 } else {
463                                         dns_in_use = config_boolean_to_int(value);
464                                         pprofile_release_string(value);
465                                 }
466                                 if (dns_in_use)
467                                         SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "DNS SRV record lookups will be used to find KDC");
468                                 else
469                                         SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "No KDC information available");
470                         }
471                 }
472 #ifndef NO_KRB4
473                 else
474                 {
475                         CHAR krbhst[MAX_HSTNM + 1];
476                         CHAR krbrlm[REALM_SZ + 1];
477
478                         strcpy(krbrlm, CKrbConfigOptions::m_newDefaultRealm);
479                         memset(krbhst, '\0', sizeof(krbhst));
480
481                         // Check for Host
482                         // don't use KRB4 - krb_get_krbhst - would have to re-logon, on file location
483                         // change, to use this function
484                         if (KFAILURE == pkrb_get_krbhst(krbhst, krbrlm, 1))
485                         {
486                                 MessageBox("OnSelchangeEditDefaultRealm::Unable to find the Host Server for your Default Realm!!!\
487                             \n 'Apply' your changes and try again.",
488                                                 "Leash", MB_OK);
489                             SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, "");
490                                 return;
491                         }
492
493                         m_hostServer = krbhst;
494                         if (strlen(krbhst))
495                           SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);
496                 }
497 #endif
498         }
499 }
500
501 void CKrbConfigOptions::OnEditchangeEditDefaultRealm()
502 {
503         if (!m_startupPage2)
504         {
505                 GetDlgItemText(IDC_EDIT_DEFAULT_REALM, m_newDefaultRealm);
506                 SetModified(TRUE);
507         }
508 }
509
510 void CKrbConfigOptions::OnShowWindow(BOOL bShow, UINT nStatus)
511 {
512         CPropertyPage::OnShowWindow(bShow, nStatus);
513
514         if (CLeashApp::m_hKrb5DLL)
515           ResetDefaultRealmComboBox();
516
517         SetDlgItemText(IDC_EDIT_REALM_HOSTNAME, m_hostServer);
518 }
519
520 void CKrbConfigOptions::ResetDefaultRealmComboBox()
521 { // Krb5 is loaded
522         // Reset Config Tab's Default Realm Combo Editbox
523         const char*  rootSection[] = {"realms", NULL};
524         const char** rootsec = rootSection;
525         char **sections = NULL,
526                  **cpp = NULL,
527          *value = 0;
528     int dns;
529
530     long retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
531                                   "dns_lookup_kdc", 0, 0, &value);
532     if (value == 0 && retval == 0)
533         retval = pprofile_get_string(CLeashApp::m_krbv5_profile, "libdefaults",
534                                       "dns_fallback", 0, 0, &value);
535     if (value == 0) {
536         dns = 1;
537     } else {
538         dns = config_boolean_to_int(value);
539         pprofile_release_string(value);
540     }
541
542     retval = pprofile_get_subsection_names(CLeashApp::m_krbv5_profile,
543                                                     rootsec , &sections);
544
545         if (retval)
546         {
547         m_hostServer = _T("");
548
549         // This is not a fatal error if DNS KDC Lookup is being used.
550         // Determine the starting value for DNS KDC Lookup Checkbox
551         if ( dns )
552             return;
553
554         m_profileError = TRUE;
555         }
556
557         m_krbRealmEditbox.ResetContent();
558
559     if ( !m_profileError ) {
560         for (cpp = sections; *cpp; cpp++)
561         {
562                 if (CB_ERR == m_krbRealmEditbox.FindStringExact(-1, *cpp))
563                 { // no dups
564                         if (CB_ERR == m_krbRealmEditbox.AddString(*cpp))
565                         {
566                                 ::MessageBox(NULL, "ResetDefaultRealmComboBox::Can't add to Kerberos Realm Combobox",
567                                                          "Leash", MB_OK);
568                                 return;
569                         }
570                 }
571                 else
572                   m_dupEntriesError = TRUE;
573         }
574     }
575
576     if (!m_newDefaultRealm.IsEmpty()) {
577
578                 if (CB_ERR == m_krbRealmEditbox.FindStringExact(-1, m_newDefaultRealm))
579                 { // no dups
580                         m_krbRealmEditbox.AddString(m_newDefaultRealm);
581                 }
582                 m_krbRealmEditbox.SelectString(-1, m_newDefaultRealm);
583
584                 const char*  Section[] = {"realms", m_newDefaultRealm, "kdc", NULL}; //theSection
585                 const char** section = Section;
586                 char **values = NULL;
587
588                 retval = pprofile_get_values(CLeashApp::m_krbv5_profile,
589                                              section, &values);
590
591         if (!retval && values)
592             m_hostServer = *values;
593         else {
594             if (dns)
595                 m_hostServer = "DNS SRV record lookups will be used to find KDC";
596             else {
597                 m_hostServer = "No KDC information available";
598             }
599                 }
600         }
601 }
602
603 BOOL CKrbConfigOptions::PreTranslateMessage(MSG* pMsg)
604 {
605         if (!m_startupPage2)
606         {
607                 if (m_noKrbFileError)
608                 {
609                         LeashErrorBox("PreTranslateMessage::Unable to open configuration file",
610                                 !strlen(CKrbProperties::m_krbPath) ? KRB_FILE :
611                                 CKrbProperties::m_krbPath);
612                         m_noKrbFileError = FALSE;
613                 }
614
615                 if (m_noKrbhostWarning)
616                 {
617                         MessageBox("PreTranslateMessage::Unable to locate the Kerberos Host for your Kerberos Realm!",
618                                            "Leash", MB_OK);
619                         m_noKrbhostWarning = FALSE;
620                 }
621
622                 if (m_dupEntriesError)
623                 {
624                         MessageBox("PreTranslateMessage::Found duplicate entries in the Kerberos 5 Config. File!!!\
625                         \nPlease contact your Administrator.",
626                                            "Leash", MB_OK);
627
628                         m_dupEntriesError = FALSE;
629                 }
630
631                 if (m_profileError)
632                 {
633                         MessageBox("PreTranslateMessage::Unable to open Kerberos 5 Config. File!!!\
634                         \nIf this error persists, contact your administrator.",
635                                        "Leash", MB_OK);
636                         m_profileError  = FALSE;
637                 }
638
639                 if (m_noRealm)
640                 {
641                         MessageBox("PreTranslateMessage::Unable to determine the Default Realm.\
642                         \n Contact your Administrator!",
643                                            "Leash", MB_OK);
644
645                         m_noRealm = FALSE;
646                 }
647         }
648
649         m_startupPage2 = FALSE;
650         return CPropertyPage::PreTranslateMessage(pMsg);
651 }
652
653
654 BEGIN_MESSAGE_MAP(CKrbConfigOptions, CPropertyPage)
655         //{{AFX_MSG_MAP(CKrbConfigOptions)
656         ON_WM_SHOWWINDOW()
657         ON_CBN_EDITCHANGE(IDC_EDIT_DEFAULT_REALM, OnEditchangeEditDefaultRealm)
658         ON_CBN_SELCHANGE(IDC_EDIT_DEFAULT_REALM, OnSelchangeEditDefaultRealm)
659         ON_BN_CLICKED(IDC_BUTTON_KRB_HELP, OnButtonKrbHelp)
660         ON_BN_CLICKED(IDC_BUTTON_KRBREALM_HELP, OnButtonKrbrealmHelp)
661         //}}AFX_MSG_MAP
662 END_MESSAGE_MAP()
663
664
665
666 void CKrbConfigOptions::OnButtonKrbHelp()
667 {
668         MessageBox("No Help Available!", "Leash", MB_OK);
669 }
670
671 void CKrbConfigOptions::OnButtonKrbrealmHelp()
672 {
673         MessageBox("No Help Available!", "Leash", MB_OK);
674 }