aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/os/get_krbhst.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1995-04-22 00:59:31 +0000
committerTheodore Tso <tytso@mit.edu>1995-04-22 00:59:31 +0000
commit37990cb9a9149cbee5851125793deddc3745be30 (patch)
tree463f29066f0215925b2532d06186189d19761bf5 /src/lib/krb5/os/get_krbhst.c
parent189ad2bf4dcc2e4b87c669f7d71f5c34488d4669 (diff)
downloadkrb5-37990cb9a9149cbee5851125793deddc3745be30.zip
krb5-37990cb9a9149cbee5851125793deddc3745be30.tar.gz
krb5-37990cb9a9149cbee5851125793deddc3745be30.tar.bz2
def_realm.c (krb5_get_default_realm): Use the profile code to
get the default realm from [libdefaults]/default_realm. get_krbhst.c (krb5_get_krbhst): Use the profile code to get the list of Kerberos servers for a particualar realm from [realms]/<realm>/kdc realm_dom.c (krb5_get_realm_domain): Use the profile code to get the default domain postfix for a realm (used only to convert V4 -> V5 principals) from [realms]/<realm>/default_domain hst_realm.c (krb5_get_host_realm): Use the profile code to get the default realm given a particular host from [domain_realm]/<host|domain> init_os_ctx.c (krb5_os_init_context): When the OS context is initialized, also initialize the profile file. This loads in the /etc/krb5.conf file. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5438 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/os/get_krbhst.c')
-rw-r--r--src/lib/krb5/os/get_krbhst.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/lib/krb5/os/get_krbhst.c b/src/lib/krb5/os/get_krbhst.c
index 093af11..8318d78 100644
--- a/src/lib/krb5/os/get_krbhst.c
+++ b/src/lib/krb5/os/get_krbhst.c
@@ -54,6 +54,8 @@
* hostname added to the list returned.
*/
+#ifdef OLD_CONFIG_FILES
+
extern char *krb5_config_file; /* extern so can be set at
load/runtime */
@@ -155,3 +157,50 @@ krb5_get_krbhst(context, realm, hostlist)
return retval;
}
+#else
+krb5_error_code
+krb5_get_krbhst(context, realm, hostlist)
+ krb5_context context;
+ const krb5_data *realm;
+ char ***hostlist;
+{
+ char **values, **cpp, *cp;
+ const char *realm_kdc_names[4];
+ krb5_error_code retval;
+
+ realm_kdc_names[0] = "realms";
+ realm_kdc_names[1] = realm->data;
+ realm_kdc_names[2] = "kdc";
+ realm_kdc_names[3] = 0;
+
+ if (context->profile == 0)
+ return KRB5_CONFIG_CANTOPEN;
+
+ retval = profile_get_values(context->profile, realm_kdc_names, &values);
+ if (retval == PROF_NO_SECTION)
+ return KRB5_REALM_UNKNOWN;
+ if (retval == PROF_NO_RELATION)
+ return KRB5_CONFIG_BADFORMAT;
+ if (retval)
+ return retval;
+
+ /*
+ * Do cleanup over the list. We allow for some extra field to be
+ * added to the kdc line later (maybe the port number)
+ */
+ for (cpp = values; *cpp; cpp++) {
+ cp = strchr(*cpp, ' ');
+ if (cp)
+ *cp = 0;
+ cp = strchr(*cpp, '\t');
+ if (cp)
+ *cp = 0;
+ cp = strchr(*cpp, ',');
+ if (cp)
+ *cp = 0;
+ }
+
+ *hostlist = values;
+ return 0;
+}
+#endif