Changes in the CNS program for the new config file
authorKeith Vetter <keithv@fusion.com>
Thu, 27 Apr 1995 21:00:34 +0000 (21:00 +0000)
committerKeith Vetter <keithv@fusion.com>
Thu, 27 Apr 1995 21:00:34 +0000 (21:00 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5579 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/cns/changelo
src/windows/cns/cns.c
src/windows/cns/cns.rc
src/windows/cns/krbini.h

index 59f8c88dad2346ece325ff3996b399ca1ec1438d..9e70e5f50a794d2a87ab554371b707c39f06912b 100644 (file)
@@ -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
index a93113de78c678eea54535fc696ffcc8db6e0141..844777b3bca7f8f6f4f610abe04d52fde0292dfc 100644 (file)
@@ -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);
 
index 0c3fc3290e8a9ea9586ec704f3b383db7cb53a3b..2621227344555820f5e51a96184bd04438bfa542 100644 (file)
@@ -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 */
-
index 4b09b046a0478f27e50046f6fbf1243f394d03a5..0264c2016b4eb894c015c768618d559c913337bd 100644 (file)
 #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"