+Tue Mar 28 19:22:28 1995 Keith Vetter (keithv@fusion.com)
+
+ For Windows, added calls to get the default config, realms and
+ ccache files out of a windows ini file.
+ * ccdefname.c: does this for the credential cache.
+ * osconfig.c: does this for the config and realms files.
+ * get_krbh.c, realm_do.c, hst_real.c, def_real.c: added calls to
+ set the default values.
+
Tue Mar 28 18:35:20 1995 John Gilmore (gnu at toad.com)
* DNR.c: Add Apple MacTCP source file for domain name resolution.
* Return default cred. cache name.
*/
+#define NEED_WINDOWS
#include "k5-int.h"
#include <stdio.h>
if (name == 0) {
if (name_buf == 0)
- name_buf = malloc (35);
+ name_buf = malloc (160);
-#ifdef MSDOS_FILESYSTEM
- strcpy (name_buf, "FILE:\\krb5cc");
+#ifdef _WINDOWS
+ {
+ char defname[160]; /* Default value */
+
+ strcpy (defname, "FILE:");
+ GetWindowsDirectory (defname+5, 160-5-7);
+ strcat (defname, "\\krb5cc");
+ GetPrivateProfileString(INI_FILES, INI_KRB_CCACHE, defname,
+ name_buf, 160, KERBEROS_INI);
+ }
#else
sprintf(name_buf, "FILE:/tmp/krb5cc_%d", getuid());
#endif
else if (saved_realm)
realm = saved_realm;
else {
+ krb5_find_config_files();
if (!(config_file = fopen(krb5_config_file, "r")))
/* can't open */
return KRB5_CONFIG_CANTOPEN;
* case.
*/
+ krb5_find_config_files();
if (!(config_file = fopen(krb5_config_file, "r")))
/* can't open */
return KRB5_CONFIG_CANTOPEN;
}
}
+ krb5_find_config_files();
if ((trans_file = fopen(krb5_trans_file, "r")) == (FILE *) 0) {
krb5_xfree(retrealms[0]);
krb5_xfree(retrealms);
(void) sprintf(scanstring, "%%%ds %%%ds",
sizeof(trans_host)-1,sizeof(trans_realm)-1);
while (1) {
-#ifdef _WINDOWS
+ #ifdef _WINDOWS
scanval = read_2str (trans_file, trans_host, sizeof(trans_host)-1,
trans_realm, sizeof(trans_realm)-1);
-#else
+ #else
scanval = fscanf(trans_file, scanstring, trans_host, trans_realm);
-#endif
+ #endif
if (scanval != 2) {
if (scanval == EOF) {
fclose(trans_file);
*realmsp = retrealms;
return 0;
}
+
+
+
* Definition of default configuration parameters.
*/
+#define NEED_WINDOWS
#include "k5-int.h"
char *krb5_config_file = DEFAULT_CONFIG_FILENAME;
char *krb5_default_pwd_prompt1 = DEFAULT_PWD_STRING1;
char *krb5_default_pwd_prompt2 = DEFAULT_PWD_STRING2;
+
+/*
+ * On Windows, we want to let the user specify in the kerberos.ini file
+ * where the config and realms files, krb.con and krb.rea, reside. If they
+ * aren't specified then we fall back to having them in the windows
+ * directory. We use the same format as the K4 version for compatability.
+ *
+ * Note: these values can change asynchronously so we can't cache the values.
+ */
+krb5_error_code
+krb5_find_config_files ()
+{
+#ifdef _WINDOWS
+ static char cnfname[160]; /* For krb.con */
+ static char realmsname[160]; /* For krb.rea */
+ char defname[160]; /* Default value */
+
+ /* First locate krb.con file */
+ GetWindowsDirectory(defname, sizeof(defname));
+ strcat (defname, "\\");
+ strcat (defname, DEFAULT_CONFIG_FILENAME);
+ GetPrivateProfileString(INI_FILES, INI_KRB_CONF, defname,
+ cnfname, sizeof(cnfname), KERBEROS_INI);
+
+ /* Now locate krb.rea file */
+ GetWindowsDirectory(defname, sizeof(defname));
+ strcat (defname, "\\");
+ strcat (defname, DEFAULT_TRANS_FILENAME);
+ GetPrivateProfileString(INI_FILES, INI_KRB_REALMS, defname,
+ realmsname, sizeof(realmsname), KERBEROS_INI);
+
+ krb5_config_file = cnfname;
+ krb5_trans_file = realmsname;
+
+#endif /* _WINDOWS */
+
+ return 0;
+}
return retval;
realm = realmlist[0];
}
+ krb5_find_config_files();
if ((trans_file = fopen(krb5_trans_file, "r")) == (FILE *) 0) {
if (realmlist != NULL) {
krb5_xfree(realmlist[0]);
(void) sprintf(scanstring, "%%%ds %%%ds",
sizeof(trans_host)-1,sizeof(trans_realm)-1);
while (1) {
-#ifdef _WINDOWS
+ #ifdef _WINDOWS
scanval = read_2str (trans_file, trans_host, sizeof(trans_host)-1,
trans_realm, sizeof(trans_realm)-1);
-#else
+ #else
scanval = fscanf(trans_file, scanstring, trans_host, trans_realm);
-#endif
+ #endif
if (scanval != 2) {
if (scanval == EOF) {
fclose(trans_file);