summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/krb5/krbhst.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/krb5/krbhst.c')
-rw-r--r--crypto/heimdal/lib/krb5/krbhst.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/crypto/heimdal/lib/krb5/krbhst.c b/crypto/heimdal/lib/krb5/krbhst.c
index 8d5c4e4..b257e8b 100644
--- a/crypto/heimdal/lib/krb5/krbhst.c
+++ b/crypto/heimdal/lib/krb5/krbhst.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -34,7 +34,7 @@
#include "krb5_locl.h"
#include <resolve.h>
-RCSID("$Id: krbhst.c,v 1.23 1999/12/11 23:14:25 assar Exp $");
+RCSID("$Id: krbhst.c,v 1.25 2001/01/19 04:30:54 assar Exp $");
/*
* assuming that `*res' contains `*count' strings, add a copy of `string'.
@@ -58,6 +58,11 @@ add_string(char ***res, int *count, const char *string)
return 0;
}
+/*
+ * do a SRV lookup for `realm, proto, service' returning the result
+ * in `res, count'
+ */
+
static krb5_error_code
srv_find_realm(krb5_context context, char ***res, int *count,
const char *realm, const char *proto, const char *service)
@@ -131,7 +136,7 @@ get_krbhst (krb5_context context,
"realms", *realm, conf_string, NULL);
for(r = res, count = 0; r && *r; r++, count++);
- if(context->srv_lookup) {
+ if(count == 0 && context->srv_lookup) {
char *s[] = { "udp", "tcp", "http" }, **q;
for(q = s; q < s + sizeof(s) / sizeof(s[0]); q++) {
ret = srv_find_realm(context, &res, &count, *realm, *q,
@@ -157,6 +162,10 @@ get_krbhst (krb5_context context,
return 0;
}
+/*
+ * set `hostlist' to a malloced list of kadmin servers.
+ */
+
krb5_error_code
krb5_get_krb_admin_hst (krb5_context context,
const krb5_realm *realm,
@@ -166,15 +175,30 @@ krb5_get_krb_admin_hst (krb5_context context,
hostlist);
}
+/*
+ * set `hostlist' to a malloced list of changepw servers.
+ */
+
krb5_error_code
krb5_get_krb_changepw_hst (krb5_context context,
const krb5_realm *realm,
char ***hostlist)
{
- return get_krbhst (context, realm, "admin_server", "kpasswd",
- hostlist);
+ krb5_error_code ret;
+
+ ret = get_krbhst (context, realm, "kpasswd_server", "kpasswd",
+ hostlist);
+ if (ret)
+ return ret;
+ ret = get_krbhst (context, realm, "admin_server", "kpasswd",
+ hostlist);
+ return ret;
}
+/*
+ * set `hostlist' to a malloced list of kerberos servers.
+ */
+
krb5_error_code
krb5_get_krbhst (krb5_context context,
const krb5_realm *realm,
@@ -183,6 +207,10 @@ krb5_get_krbhst (krb5_context context,
return get_krbhst (context, realm, "kdc", "kerberos", hostlist);
}
+/*
+ * free all memory associated with `hostlist'
+ */
+
krb5_error_code
krb5_free_krbhst (krb5_context context,
char **hostlist)
OpenPOWER on IntegriCloud