aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Horowitz <marc@mit.edu>1998-10-21 02:40:32 +0000
committerMarc Horowitz <marc@mit.edu>1998-10-21 02:40:32 +0000
commit4869b33f0b5472fcde76f8443942a7edfed411b3 (patch)
tree43e2ccba45981523750a34668a4245d1a10b07c1
parent600ee1c4197e7121384a5b2882bccb3a6be1b5e4 (diff)
downloadkrb5-4869b33f0b5472fcde76f8443942a7edfed411b3.zip
krb5-4869b33f0b5472fcde76f8443942a7edfed411b3.tar.gz
krb5-4869b33f0b5472fcde76f8443942a7edfed411b3.tar.bz2
fix the code for pointing at the master kdc addresses. purify found
some UMR's. git-svn-id: svn://anonsvn.mit.edu/krb5/branches/marc-3des@10975 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/lib/krb5/os/locate_kdc.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c
index e17d7c1..d8187ac 100644
--- a/src/lib/krb5/os/locate_kdc.c
+++ b/src/lib/krb5/os/locate_kdc.c
@@ -46,7 +46,7 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs, master_index, nmasters)
const char *realm_kdc_names[4];
char **masterlist, **hostlist, *host, *port, *cp;
krb5_error_code code;
- int i, j, out, count;
+ int i, j, out, count, ismaster;
struct sockaddr *addr_p;
struct sockaddr_in *sin_p;
struct hostent *hp;
@@ -103,6 +103,9 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs, master_index, nmasters)
}
if (master_index) {
+ *master_index = 0;
+ *nmasters = 0;
+
realm_kdc_names[0] = "realms";
realm_kdc_names[1] = host;
realm_kdc_names[2] = "admin_server";
@@ -113,10 +116,7 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs, master_index, nmasters)
krb5_xfree(host);
- if (code) {
- *master_index = 0;
- *nmasters = 0;
- } else {
+ if (code == 0) {
for (i=0; masterlist[i]; i++) {
host = masterlist[i];
@@ -138,11 +138,10 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs, master_index, nmasters)
krb5_xfree(host);
}
- /* at this point, is master is non-NULL, then either the master kdc
+ /* at this point, if master is non-NULL, then either the master kdc
is required, and there is one, or the master kdc is not required,
and there may or may not be one. */
-
#ifdef HAVE_NETINET_IN_H
if (sec_udpport)
count = count * 2;
@@ -175,10 +174,15 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs, master_index, nmasters)
continue;
}
- if (masterlist)
- for (j=0; masterlist[j]; j++)
- if (strcasecmp(hostlist[i], masterlist[j]) == 0)
+ ismaster = 0;
+ if (masterlist) {
+ for (j=0; masterlist[j]; j++) {
+ if (strcasecmp(hostlist[i], masterlist[j]) == 0) {
*master_index = out;
+ ismaster = 1;
+ }
+ }
+ }
switch (hp->h_addrtype) {
@@ -211,7 +215,7 @@ krb5_locate_kdc(context, realm, addr_pp, naddrs, master_index, nmasters)
default:
break;
}
- if (masterlist)
+ if (ismaster)
*nmasters = out - *master_index;
/* Free the hostlist entry we are looping over. */