localaddr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* lib/krb5/os/localaddr.c
*
* Copyright 1990,1991,2000,2001,2002 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*
*
* Return the protocol addresses supported by this host.
*
* XNS support is untested, but "Should just work". (Hah!)
*/
#define NEED_SOCKETS
#include <k5-int.h>
/* needed for solaris, harmless elsewhere... */
#define BSD_COMP
#include <errno.h>
#include <stddef.h>
#include <ctype.h>
static krb5_error_code
struct localaddr_data {
};
static int
/*@*/
{
switch (a->sa_family) {
case AF_INET:
#ifdef KRB5_USE_INET6
case AF_INET6:
#endif
#ifdef KRB5_USE_NS
case AF_XNS:
#endif
break;
default:
break;
}
return 0;
}
static int
{
int i;
void *n;
if (n == 0) {
return 1;
}
return 0;
}
static krb5_address *
{
krb5_address *a;
void *data;
return NULL;
a = malloc (sizeof (krb5_address));
if (a == NULL) {
return NULL;
}
a->magic = KV5M_ADDRESS;
return a;
}
static int
/*@modifies *P_data@*/
{
krb5_address *address = 0;
#ifdef KRB5_DEBUG
char buf[256];
#endif
switch (a->sa_family) {
#ifdef HAVE_NETINET_IN_H
case AF_INET:
/*LINTED*/
&((const struct sockaddr_in *) a)->sin_addr);
#ifdef KRB5_DEBUG
#endif
break;
#ifdef KRB5_USE_INET6
case AF_INET6:
{
/*LINTED*/
#ifdef KRB5_DEBUG
#endif
break;
}
break;
}
#endif /* KRB5_USE_INET6 */
#ifdef KRB5_USE_NS
case AF_XNS:
&((const struct sockaddr_ns *)a)->sns_addr);
#ifdef KRB5_DEBUG
#endif
break;
#endif
#ifdef AF_LINK
/* Some BSD-based systems (e.g. NetBSD 1.5) and AIX will
include the ethernet address, but we don't want that, at
least for now. */
case AF_LINK:
break;
#endif
/*
* Add more address families here..
*/
default:
break;
}
#ifdef __LCLINT__
/* Redundant but unconditional store un-confuses lclint. */
#endif
if (address) {
}
}
static krb5_error_code
{
static const char *profile_name[] = {
"libdefaults", "extra_addresses", 0
};
char **values;
char **iter;
/* Ignore all errors for now? */
if (err)
return 0;
int i, count;
cp++;
if (*cp == 0)
break;
/* Start of an address. */
cp++;
if (*cp != 0) {
*cp = 0;
} else
/* Got a single address, process it. */
newaddrs = 0;
if (err)
continue;
for (i = 0; newaddrs[i]; i++) {
}
count = i;
if (bigger) {
}
}
for (i = 0; i < count; i++) {
else
}
}
}
return 0;
}
{
}
{
}
static krb5_error_code
{
struct localaddr_data data = { 0 };
int r;
/* krb5_error_code err; */
if (use_profile) {
/* err = krb5_os_localaddr_profile (context, &data); */
/* ignore err for now */
}
if (r != 0) {
int i;
}
return ENOMEM;
else
return r;
}
return ENOMEM;
else {
/* This can easily happen if we have IPv6 link-local
addresses. Just shorten the array. */
(sizeof (krb5_address *)
if (*addr == 0)
/* Okay, shortening failed, but the original should still
be intact. */
}
return 0;
}