WPARAM wparam,
LPARAM lparam)
{
+ char wdir[FILENAME_MAX];
char defname[FILENAME_MAX];
char newname[FILENAME_MAX];
UINT rc;
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);
WPARAM wparam,
LPARAM lparam)
{
+ char wdir[FILENAME_MAX];
char defname[FILENAME_MAX];
char newname[FILENAME_MAX];
char *p;
switch (wparam) {
case IDOK:
+ rc = GetWindowsDirectory(wdir, sizeof(wdir));
+ assert(rc > 0);
+ strcat(wdir, "\\");
+
/* Ticket duration */
lifetime = GetDlgItemInt(hwnd, IDD_LIFETIME, &b, FALSE);
/* 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);
#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 */
-