/*
* Copyright 2001 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Misc routines that are used by tcpd and by tcpdchk.
*
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
*/
#ifndef lint
#endif
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <netdb.h>
#include "tcpd.h"
extern char *fgets();
#ifndef INADDR_NONE
#endif
/* xgets - fgets() with backslash-newline stripping */
char *ptr;
int len;
{
int got;
tcpd_context.line++;
got -= 2;
} else {
return (start);
}
}
ptr[0] = 0;
}
}
/* split_at - break string at delimiter or return NULL */
char *string;
int delimiter;
{
char *cp;
*cp++ = 0;
return (cp);
}
/* dot_quad_addr - convert dotted quad to internal form */
char *str;
{
int in_run = 0;
int runs = 0;
/* Count the number of runs of non-dot characters. */
while (*cp) {
if (*cp == '.') {
in_run = 0;
} else if (in_run == 0) {
in_run = 1;
runs++;
}
cp++;
}
}
/* numeric_addr - convert textual IP address to binary form */
char *str;
int *af;
int *len;
{
union gen_addr t;
addr = &t;
#ifdef HAVE_IPV6
return 0;
return -1;
}
#endif
}
/* For none RFC 2553 compliant systems */
#ifdef USE_GETHOSTBYNAME2
#define freehostent(x) x = 0
#endif
/* tcpd_gethostbyname - an IP family neutral gethostbyname */
char *host;
int af;
{
#ifdef HAVE_IPV6
int err;
if (hs)
}
return hp;
} else { /* Try INET6 */
if (hs)
}
#else
return gethostbyname(host);
#endif
}
#ifdef HAVE_IPV6
/*
* When using IPv6 addresses, we'll be seeing lots of ":"s;
* we require the addresses to be specified as [address].
* An IPv6 address can be specified in 3 ways:
*
* x:x:x:x:x:x:x:x (fully specified)
* x::x:x:x:x (zeroes squashed)
* ::FFFF:1.2.3.4 (IPv4 mapped)
*
* These need to be skipped to get at the ":" delimeters.
*
* We also allow a '/prefix' specifier.
*/
char *str;
{
char *p = str;
char *q;
while (1) {
return p;
return p;
return p;
/*
* Quick and dirty parse, cheaper than inet_pton
* Could count colons and dots (must be 0 or 3 dots, no
* colons after dots seens, only one double :, etc, etc)
*/
return p;
}
p = cbr + 1;
}
}
#endif /* HAVE_IPV6 */