From kenh@cmf.nrl.navy.mil Fri Oct 24 17:19:41 1997
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id RAA23525 for <bugs@RT-11.MIT.EDU>; Fri, 24 Oct 1997 17:19:40 -0400
Received: from ginger.cmf.nrl.navy.mil by MIT.EDU with SMTP
id AA04730; Fri, 24 Oct 97 17:19:36 EDT
Received: from elvis.cmf.nrl.navy.mil (kenh@elvis.cmf.nrl.navy.mil [134.207.10.38])
by ginger.cmf.nrl.navy.mil (8.8.5/8.8.5) with ESMTP id RAA25774
for <krb5-bugs@mit.edu>; Fri, 24 Oct 1997 17:19:02 -0400 (EDT)
Received: (from kenh@localhost)
by elvis.cmf.nrl.navy.mil (8.8.5/8.8.5) id RAA01026;
Fri, 24 Oct 1997 17:18:48 -0400 (EDT)
Message-Id: <199710242118.RAA01026@elvis.cmf.nrl.navy.mil>
Date: Fri, 24 Oct 1997 17:18:48 -0400 (EDT)
From: Ken Hornstein <kenh@cmf.nrl.navy.mil>
Reply-To: kenh@cmf.nrl.navy.mil
To: krb5-bugs@MIT.EDU
Subject: The Win32 code doesn't work if your local machine is multihomed
X-Send-Pr-Version: 3.99
System: Windows 95
Architecture: win32
The calls to krb5_crypto_os_localaddr() that do the magic for Win32 machines
don't handle multihomed machines. So, depending on the address list you get
back, you might not be able to use Kerberos.
Try Kerberos on a multihomed NT box.
--- lib/crypto/os/c_localaddr.c.orig Fri Oct 24 14:34:02 1997
+++ lib/crypto/os/c_localaddr.c Fri Oct 24 16:45:02 1997
@@ -294,11 +294,7 @@
krb5_crypto_os_localaddr (krb5_address ***addr) {
char host[64]; /* Name of local machine */
struct hostent *hostrec;
- int err;
-
- *addr = calloc (2, sizeof (krb5_address *));
- if (*addr == NULL)
- return ENOMEM;
+ int err, i;
#ifdef HAVE_MACSOCK_H
hostrec = getmyipaddr();
@@ -323,26 +319,45 @@
}
#endif /* HAVE_MACSOCK_H */
- (*addr)[0] = calloc (1, sizeof(krb5_address));
- if ((*addr)[0] == NULL) {
- free (*addr);
- return ENOMEM;
- }
- (*addr)[0]->magic = KV5M_ADDRESS;
- (*addr)[0]->addrtype = hostrec->h_addrtype;
- (*addr)[0]->length = hostrec->h_length;
- (*addr)[0]->contents = (unsigned char *)malloc((*addr)[0]->length);
- if (!(*addr)[0]->contents) {
- free((*addr)[0]);
- free(*addr);
+ /*
+ * Count the elements in the host address list
+ */
+
+ for (i = 0; hostrec->h_addr_list[i]; i++);
+
+ *addr = calloc ((i+1), sizeof (krb5_address *));
+ if (*addr == NULL)
return ENOMEM;
- } else {
- memcpy ((*addr)[0]->contents,
- hostrec->h_addr,
- (*addr)[0]->length);
+
+ for (i = 0; hostrec->h_addr_list[i]; i++) {
+ (*addr)[i] = calloc (1, sizeof(krb5_address));
+
+ if ((*addr)[i] == NULL)
+ goto nomem;
+
+ (*addr)[i]->magic = KV5M_ADDRESS;
+ (*addr)[i]->addrtype = hostrec->h_addrtype;
+ (*addr)[i]->length = hostrec->h_length;
+ (*addr)[i]->contents = (unsigned char *)malloc((*addr)[i]->length);
+
+ if (!(*addr)[i]->contents) {
+ goto nomem;
+ } else {
+ memcpy ((*addr)[i]->contents, hostrec->h_addr_list[i],
+ (*addr)[i]->length);
+ }
}
- /* FIXME, deal with the case where gethostent returns multiple addrs */
return(0);
+
+nomem:
+
+ for (i = 0; (*addr)[i]; i++) {
+ if ((*addr)[i]->contents)
+ free((*addr)[i]->contents);
+ free((*addr)[i]);
+ }
+ free(*addr);
+ return ENOMEM;
}
#endif
Received: from MIT.EDU (PACIFIC-CARRIER-ANNEX.MIT.EDU [18.69.0.28]) by rt-11.MIT.EDU (8.7.5/8.7.3) with SMTP id RAA23525 for <bugs@RT-11.MIT.EDU>; Fri, 24 Oct 1997 17:19:40 -0400
Received: from ginger.cmf.nrl.navy.mil by MIT.EDU with SMTP
id AA04730; Fri, 24 Oct 97 17:19:36 EDT
Received: from elvis.cmf.nrl.navy.mil (kenh@elvis.cmf.nrl.navy.mil [134.207.10.38])
by ginger.cmf.nrl.navy.mil (8.8.5/8.8.5) with ESMTP id RAA25774
for <krb5-bugs@mit.edu>; Fri, 24 Oct 1997 17:19:02 -0400 (EDT)
Received: (from kenh@localhost)
by elvis.cmf.nrl.navy.mil (8.8.5/8.8.5) id RAA01026;
Fri, 24 Oct 1997 17:18:48 -0400 (EDT)
Message-Id: <199710242118.RAA01026@elvis.cmf.nrl.navy.mil>
Date: Fri, 24 Oct 1997 17:18:48 -0400 (EDT)
From: Ken Hornstein <kenh@cmf.nrl.navy.mil>
Reply-To: kenh@cmf.nrl.navy.mil
To: krb5-bugs@MIT.EDU
Subject: The Win32 code doesn't work if your local machine is multihomed
X-Send-Pr-Version: 3.99
Show quoted text
>Number: 484
>Category: krb5-libs
>Synopsis: krb5_crypto_os_localaddr() doesn't support multihomed Win32 machines
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Fri Oct 24 17:20:00 EDT 1997
>Last-Modified:
>Originator: Ken Hornstein
>Organization:
Navel Research Lab>Category: krb5-libs
>Synopsis: krb5_crypto_os_localaddr() doesn't support multihomed Win32 machines
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: krb5-unassigned
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Fri Oct 24 17:20:00 EDT 1997
>Last-Modified:
>Originator: Ken Hornstein
>Organization:
Show quoted text
>Release: krb5-current
>Environment:
>Environment:
System: Windows 95
Architecture: win32
Show quoted text
>Description:
The calls to krb5_crypto_os_localaddr() that do the magic for Win32 machines
don't handle multihomed machines. So, depending on the address list you get
back, you might not be able to use Kerberos.
Show quoted text
>How-To-Repeat:
Try Kerberos on a multihomed NT box.
Show quoted text
>Fix:
--- lib/crypto/os/c_localaddr.c.orig Fri Oct 24 14:34:02 1997
+++ lib/crypto/os/c_localaddr.c Fri Oct 24 16:45:02 1997
@@ -294,11 +294,7 @@
krb5_crypto_os_localaddr (krb5_address ***addr) {
char host[64]; /* Name of local machine */
struct hostent *hostrec;
- int err;
-
- *addr = calloc (2, sizeof (krb5_address *));
- if (*addr == NULL)
- return ENOMEM;
+ int err, i;
#ifdef HAVE_MACSOCK_H
hostrec = getmyipaddr();
@@ -323,26 +319,45 @@
}
#endif /* HAVE_MACSOCK_H */
- (*addr)[0] = calloc (1, sizeof(krb5_address));
- if ((*addr)[0] == NULL) {
- free (*addr);
- return ENOMEM;
- }
- (*addr)[0]->magic = KV5M_ADDRESS;
- (*addr)[0]->addrtype = hostrec->h_addrtype;
- (*addr)[0]->length = hostrec->h_length;
- (*addr)[0]->contents = (unsigned char *)malloc((*addr)[0]->length);
- if (!(*addr)[0]->contents) {
- free((*addr)[0]);
- free(*addr);
+ /*
+ * Count the elements in the host address list
+ */
+
+ for (i = 0; hostrec->h_addr_list[i]; i++);
+
+ *addr = calloc ((i+1), sizeof (krb5_address *));
+ if (*addr == NULL)
return ENOMEM;
- } else {
- memcpy ((*addr)[0]->contents,
- hostrec->h_addr,
- (*addr)[0]->length);
+
+ for (i = 0; hostrec->h_addr_list[i]; i++) {
+ (*addr)[i] = calloc (1, sizeof(krb5_address));
+
+ if ((*addr)[i] == NULL)
+ goto nomem;
+
+ (*addr)[i]->magic = KV5M_ADDRESS;
+ (*addr)[i]->addrtype = hostrec->h_addrtype;
+ (*addr)[i]->length = hostrec->h_length;
+ (*addr)[i]->contents = (unsigned char *)malloc((*addr)[i]->length);
+
+ if (!(*addr)[i]->contents) {
+ goto nomem;
+ } else {
+ memcpy ((*addr)[i]->contents, hostrec->h_addr_list[i],
+ (*addr)[i]->length);
+ }
}
- /* FIXME, deal with the case where gethostent returns multiple addrs */
return(0);
+
+nomem:
+
+ for (i = 0; (*addr)[i]; i++) {
+ if ((*addr)[i]->contents)
+ free((*addr)[i]->contents);
+ free((*addr)[i]);
+ }
+ free(*addr);
+ return ENOMEM;
}
#endif
Show quoted text
>Audit-Trail:
>Unformatted:
>Unformatted: