From: Keith Vetter Date: Thu, 27 Apr 1995 21:00:34 +0000 (+0000) Subject: Changes in the CNS program for the new config file X-Git-Tag: krb5-1.0-beta5~173 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7aa5c7b72c2dd877fd2a4a558c5089ac1bd5f56c;p=krb5.git Changes in the CNS program for the new config file git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5579 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/cns/changelo b/src/windows/cns/changelo index 59f8c88da..9e70e5f50 100644 --- a/src/windows/cns/changelo +++ b/src/windows/cns/changelo @@ -1,3 +1,9 @@ +Thu Apr 27 11:46:42 1995 Keith Vetter (keithv@fusion.com) + + * cns.c, cns.rc, krbini.h: K5 no longer has conf and realms files + but one generic config file. Changed options menu to so we can + specify where it lives. + Thu Apr 20 12:17:34 1995 Keith Vetter (keithv@fusion.com) * cns.c, tktlist.c, krbini.h: Fixed up #include so it diff --git a/src/windows/cns/cns.c b/src/windows/cns/cns.c index a93113de7..844777b3b 100644 --- a/src/windows/cns/cns.c +++ b/src/windows/cns/cns.c @@ -801,6 +801,7 @@ opts_initdialog ( WPARAM wparam, LPARAM lparam) { + char wdir[FILENAME_MAX]; char defname[FILENAME_MAX]; char newname[FILENAME_MAX]; UINT rc; @@ -808,36 +809,32 @@ opts_initdialog ( center_dialog(hwnd); set_dialog_font(hwnd, hfontdialog); - -/* krb.conf file */ - rc = GetWindowsDirectory(defname, sizeof(defname)); + rc = GetWindowsDirectory(wdir, sizeof(wdir)); assert(rc > 0); + strcat (wdir, "\\"); - strcat(defname, "\\"); + /* krb.conf file */ + strcpy(defname, wdir); strcat(defname, DEF_KRB_CONF); GetPrivateProfileString(INI_FILES, INI_KRB_CONF, defname, newname, sizeof(newname), KERBEROS_INI); _strupr(newname); SetDlgItemText(hwnd, IDD_CONF, newname); + + #ifdef KRB4 + /* krb.realms file */ + strcpy(defname, wdir); + strcat(defname, DEF_KRB_REALMS); + GetPrivateProfileString(INI_FILES, INI_KRB_REALMS, defname, + newname, sizeof(newname), KERBEROS_INI); + _strupr(newname); + SetDlgItemText(hwnd, IDD_REALMS, newname); + #endif /* KRB4 */ -/* krb.realms file */ - rc = GetWindowsDirectory(defname, sizeof(defname)); - assert(rc > 0); - - strcat(defname, "\\"); - strcat(defname, DEF_KRB_REALMS); - GetPrivateProfileString(INI_FILES, INI_KRB_REALMS, defname, - newname, sizeof(newname), KERBEROS_INI); - _strupr(newname); - SetDlgItemText(hwnd, IDD_REALMS, newname); - -/* Credential cache file */ + /* Credential cache file */ #ifdef KRB5 - rc = GetWindowsDirectory(defname, sizeof(defname)); - assert(rc > 0); - - strcat(defname, "\\"); - strcat(defname, "krb5cc"); + strcpy(defname, wdir); + strcat(defname, INI_KRB_CCACHE); GetPrivateProfileString(INI_FILES, INI_KRB_CCACHE, defname, ccname, sizeof(ccname), KERBEROS_INI); _strupr(ccname); @@ -882,6 +879,7 @@ opts_command ( WPARAM wparam, LPARAM lparam) { + char wdir[FILENAME_MAX]; char defname[FILENAME_MAX]; char newname[FILENAME_MAX]; char *p; @@ -891,6 +889,10 @@ opts_command ( switch (wparam) { case IDOK: + rc = GetWindowsDirectory(wdir, sizeof(wdir)); + assert(rc > 0); + strcat(wdir, "\\"); + /* Ticket duration */ lifetime = GetDlgItemInt(hwnd, IDD_LIFETIME, &b, FALSE); @@ -906,48 +908,32 @@ opts_command ( /* krb.conf file */ GetDlgItemText(hwnd, IDD_CONF, newname, sizeof(newname)); trim(newname); - rc = GetWindowsDirectory(defname, sizeof(defname)); - assert(rc > 0); - - strcat(defname, "\\"); + strcpy(defname, wdir); strcat(defname, DEF_KRB_CONF); - if (_stricmp(newname, defname) == 0 || !newname[0]) - p = NULL; - else - p = newname; + p = (*newname && _stricmp(newname, defname)) ? newname : NULL; b = WritePrivateProfileString(INI_FILES, INI_KRB_CONF, p, KERBEROS_INI); assert(b); /* krb.realms file */ - GetDlgItemText(hwnd, IDD_REALMS, newname, sizeof(newname)); - trim(newname); - rc = GetWindowsDirectory(defname, sizeof(defname)); - assert(rc > 0); - - strcat(defname, "\\"); - strcat(defname, DEF_KRB_REALMS); - if (_stricmp(newname, defname) == 0 || !newname[0]) - p = NULL; - else - p = newname; - b = WritePrivateProfileString(INI_FILES, INI_KRB_REALMS, p, KERBEROS_INI); - assert(b); + #ifdef KRB4 + GetDlgItemText(hwnd, IDD_REALMS, newname, sizeof(newname)); + trim(newname); + strcpy(defname, wdir); + strcat(defname, DEF_KRB_REALMS); + p = (*newname && _stricmp(newname, defname)) ? newname : NULL; + b = WritePrivateProfileString(INI_FILES, INI_KRB_REALMS, p, KERBEROS_INI); + assert(b); + #endif /* KRB4 */ /* Credential cache file */ #ifdef KRB5 GetDlgItemText(hwnd, IDD_CCACHE, newname, sizeof(newname)); trim(newname); - rc = GetWindowsDirectory(defname, sizeof(defname)); - assert(rc > 0); - - strcat(defname, "\\"); + strcpy(defname, wdir); strcat(defname, "krb5cc"); - if (*newname == '\0') + if (*newname == '\0') // For detecting name change strcpy (newname, defname); - if (_stricmp(newname, defname) == 0 || *newname == '\0') - p = NULL; - else - p = newname; + p = (*newname && _stricmp(newname, defname)) ? newname : NULL; b = WritePrivateProfileString(INI_FILES, INI_KRB_CCACHE, p, KERBEROS_INI); assert(b); diff --git a/src/windows/cns/cns.rc b/src/windows/cns/cns.rc index 0c3fc3290..262122734 100644 --- a/src/windows/cns/cns.rc +++ b/src/windows/cns/cns.rc @@ -141,25 +141,22 @@ END #endif /* KRB4 */ #ifdef KRB5 - ID_OPTS DIALOG 97, 52, 158, 124 + ID_OPTS DIALOG 97, 52, 168, 107 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Kerberos Options" FONT 8, "Arial" BEGIN - CONTROL "&Conf file:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 9, 40, 8 - CONTROL "", IDD_CONF, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 6, 82, 12 - CONTROL "&Realms file:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 26, 40, 8 - CONTROL "", IDD_REALMS, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 23, 82, 12 - CONTROL "Cre&dential cache:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 43, 58, 8 - CONTROL "", IDD_CCACHE, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 40, 82, 12 - CONTROL "&Ticket lifetime:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 60, 53, 8 - CONTROL "", IDD_LIFETIME, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 57, 20, 12 - CONTROL "minutes", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 95, 60, 46, 8 - CONTROL "Action when login expires", 209, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 73, 148, 23 - CONTROL "&Alert ", IDD_ALERT, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 36, 82, 28, 12 - CONTROL "&Beep", IDD_BEEP, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 85, 82, 39, 12 - CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 22, 104, 52, 14 - CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 104, 52, 14 + CONTROL "&Config file:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 9, 40, 8 + CONTROL "", IDD_CONF, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 6, 92, 12 + CONTROL "Cre&dential cache:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 26, 58, 8 + CONTROL "", IDD_CCACHE, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 23, 92, 12 + CONTROL "&Ticket lifetime:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 43, 53, 8 + CONTROL "", IDD_LIFETIME, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 70, 40, 20, 12 + CONTROL "minutes", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 95, 43, 46, 8 + CONTROL "Action when login expires", 209, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP, 5, 56, 158, 23 + CONTROL "&Alert ", IDD_ALERT, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 41, 65, 28, 12 + CONTROL "&Beep", IDD_BEEP, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 95, 65, 39, 12 + CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 22, 87, 52, 14 + CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 95, 87, 52, 14 END #endif /* KRB5 */ - diff --git a/src/windows/cns/krbini.h b/src/windows/cns/krbini.h index 4b09b046a..0264c2016 100644 --- a/src/windows/cns/krbini.h +++ b/src/windows/cns/krbini.h @@ -15,8 +15,15 @@ #define INI_ALERT "Alert" #define INI_BEEP "Beep" #define INI_FILES "Files" -#define INI_KRB_CONF "krb.conf" /* Location of krb.conf file */ -#define DEF_KRB_CONF "krb.con" /* Default name for krb.conf file */ +#ifdef KRB4 + #define INI_KRB_CONF "krb.conf" /* Location of krb.conf file */ + #define DEF_KRB_CONF "krb.con" /* Default name for krb.conf file */ +#endif /* KRB4 */ +#ifdef KRB5 + #define INI_KRB5_CONF "krb5.ini" /* From k5-config.h */ + #define INI_KRB_CONF INI_KRB5_CONF /* Location of krb.conf file */ + #define DEF_KRB_CONF INI_KRB5_CONF /* Default name for krb.conf file */ +#endif /* KRB5 */ #define INI_KRB_REALMS "krb.realms" /* Location of krb.realms file */ #define DEF_KRB_REALMS "krb.rea" /* Default name for krb.realms file */ #define INI_RECENT_LOGINS "Recent Logins"