BOOL CKrb4ConfigFileLocation::OnApply() { // Krb.con if (0 != m_initKrbFile.CompareNoCase(m_newKrbFile)) { // Commit changes if (SetRegistryVariable("krb.conf", m_newKrbFile, "Software\\MIT\\Kerberos4")) { MessageBox("Failed to set \"Krb.conf\"!", "Error", MB_OK); } m_initKrbFile = m_newKrbFile; } // Krbrealms.con if (0 != m_initKrbrealmFile.CompareNoCase(m_newKrbrealmFile)) { // Commit changes if (SetRegistryVariable("krb.realms", m_newKrbrealmFile, "Software\\MIT\\Kerberos4")) { MessageBox("Failed to set \"krb.realms\"!", "Error", MB_OK); } m_initKrbrealmFile = m_newKrbrealmFile; } // Ticket file if (0 != m_initTicketFile.CompareNoCase(m_newTicketFile)) { if (getenv("KRBTKFILE")) { // Just in case they set (somehow) KRBTKFILE while this box is up MessageBox("OnApply::Ticket file is set in your System's\ Environment!\nYou must first remove it.", "Error", MB_OK); return TRUE; } // Commit changes if (SetRegistryVariable("ticketfile", m_newTicketFile, "Software\\MIT\\Kerberos4")) { MessageBox("Failed to set \"ticketfile\"!", "Error", MB_OK); } m_initTicketFile = m_newTicketFile; }
void CLeashProperties::OnOK() { CString timeServer_; GetDlgItemText(IDC_EDIT_TIME_SERVER, timeServer_); if (getenv(TIMEHOST)) { // Check system for TIMEHOST, just in case it gets set (somehow) MessageBox("Can't change the time host unless you remove it from the environment!", "Error", MB_OK); return; } if( getenv("USEKRB4") != NULL) { MessageBox("Kerberos 4 ticket requests are being controlled by the environment" "variable USEKRB4 instead of the registry. Leash cannot modify" "the environment. Use the System control panel instead.", "Leash", MB_OK); return; } if (SetRegistryVariable(TIMEHOST, timeServer_)) { MessageBox("There was an error putting your entry into the Registry!", "Error", MB_OK); } if ( m_initMissingFiles != m_newMissingFiles ) { CWinApp * pApp = AfxGetApp(); if (pApp) pApp->WriteProfileInt("Settings", "CreateMissingConfig", m_newMissingFiles ? TRUE_FLAG : FALSE_FLAG); if ( m_newMissingFiles ) CLeashApp::ValidateConfigFiles(); } if ( dw_initMslsaImport != dw_newMslsaImport ) { pLeash_set_default_mslsa_import(dw_newMslsaImport); } CDialog::OnOK(); }