OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/newlib-1.18.0/newlib-1.18.0-or32-1.0rc2/newlib/libc/sys/linux/net
    from Rev 207 to Rev 520
    Reverse comparison

Rev 207 → Rev 520

/res_debug.c
0,0 → 1,1058
/*
* Copyright (c) 1985
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
 
/*
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
 
/*
* Portions Copyright (c) 1995 by International Business Machines, Inc.
*
* International Business Machines, Inc. (hereinafter called IBM) grants
* permission under its copyrights to use, copy, modify, and distribute this
* Software with or without fee, provided that the above copyright notice and
* all paragraphs of this notice appear in all copies, and that the name of IBM
* not be used in connection with the marketing of any product incorporating
* the Software or modifications thereof, without specific, written prior
* permission.
*
* To the extent it has a right to do so, IBM grants an immunity from suit
* under its patents, if any, for the use, sale or manufacture of products to
* the extent that such products are used for performing Domain Name System
* dynamic updates in TCP/IP networks by means of the Software. No immunity is
* granted for any product per se or for any other function of any product.
*
* THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
* DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
 
/*
* Portions Copyright (c) 1996-1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
 
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$BINDId: res_debug.c,v 8.34 2000/02/29 05:30:55 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
 
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
 
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
 
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <netdb.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "local.h"
 
#ifdef SPRINTF_CHAR
# define SPRINTF(x) strlen(sprintf/**/x)
#else
# define SPRINTF(x) sprintf x
#endif
 
extern const char *_res_sectioncodes[] attribute_hidden;
 
/*
* Print the current options.
*/
void
fp_resstat(const res_state statp, FILE *file) {
u_long mask;
 
fprintf(file, ";; res options:");
for (mask = 1; mask != 0; mask <<= 1)
if (statp->options & mask)
fprintf(file, " %s", p_option(mask));
putc('\n', file);
}
 
static void
do_section(const res_state statp,
ns_msg *handle, ns_sect section,
int pflag, FILE *file)
{
int n, sflag, rrnum;
static int buflen = 2048;
char *buf;
ns_opcode opcode;
ns_rr rr;
 
/*
* Print answer records.
*/
sflag = (statp->pfcode & pflag);
if (statp->pfcode && !sflag)
return;
 
buf = malloc(buflen);
if (buf == NULL) {
fprintf(file, ";; memory allocation failure\n");
return;
}
 
opcode = (ns_opcode) ns_msg_getflag(*handle, ns_f_opcode);
rrnum = 0;
for (;;) {
if (ns_parserr(handle, section, rrnum, &rr)) {
if (errno != ENODEV)
fprintf(file, ";; ns_parserr: %s\n",
strerror(errno));
else if (rrnum > 0 && sflag != 0 &&
(statp->pfcode & RES_PRF_HEAD1))
putc('\n', file);
goto cleanup;
}
if (rrnum == 0 && sflag != 0 && (statp->pfcode & RES_PRF_HEAD1))
fprintf(file, ";; %s SECTION:\n",
p_section(section, opcode));
if (section == ns_s_qd)
fprintf(file, ";;\t%s, type = %s, class = %s\n",
ns_rr_name(rr),
p_type(ns_rr_type(rr)),
p_class(ns_rr_class(rr)));
else {
n = ns_sprintrr(handle, &rr, NULL, NULL,
buf, buflen);
if (n < 0) {
if (errno == ENOSPC) {
free(buf);
buf = NULL;
if (buflen < 131072)
buf = malloc(buflen += 1024);
if (buf == NULL) {
fprintf(file,
";; memory allocation failure\n");
return;
}
continue;
}
fprintf(file, ";; ns_sprintrr: %s\n",
strerror(errno));
goto cleanup;
}
fputs(buf, file);
fputc('\n', file);
}
rrnum++;
}
cleanup:
if (buf != NULL)
free(buf);
}
 
/*
* Print the contents of a query.
* This is intended to be primarily a debugging routine.
*/
void
res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
ns_msg handle;
int qdcount, ancount, nscount, arcount;
u_int opcode, rcode, id;
 
if (ns_initparse(msg, len, &handle) < 0) {
fprintf(file, ";; ns_initparse: %s\n", strerror(errno));
return;
}
opcode = ns_msg_getflag(handle, ns_f_opcode);
rcode = ns_msg_getflag(handle, ns_f_rcode);
id = ns_msg_id(handle);
qdcount = ns_msg_count(handle, ns_s_qd);
ancount = ns_msg_count(handle, ns_s_an);
nscount = ns_msg_count(handle, ns_s_ns);
arcount = ns_msg_count(handle, ns_s_ar);
 
/*
* Print header fields.
*/
if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX) || rcode)
fprintf(file,
";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
_res_opcodes[opcode], p_rcode(rcode), id);
if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX))
putc(';', file);
if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD2)) {
fprintf(file, "; flags:");
if (ns_msg_getflag(handle, ns_f_qr))
fprintf(file, " qr");
if (ns_msg_getflag(handle, ns_f_aa))
fprintf(file, " aa");
if (ns_msg_getflag(handle, ns_f_tc))
fprintf(file, " tc");
if (ns_msg_getflag(handle, ns_f_rd))
fprintf(file, " rd");
if (ns_msg_getflag(handle, ns_f_ra))
fprintf(file, " ra");
if (ns_msg_getflag(handle, ns_f_z))
fprintf(file, " ??");
if (ns_msg_getflag(handle, ns_f_ad))
fprintf(file, " ad");
if (ns_msg_getflag(handle, ns_f_cd))
fprintf(file, " cd");
}
if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD1)) {
fprintf(file, "; %s: %d",
p_section(ns_s_qd, opcode), qdcount);
fprintf(file, ", %s: %d",
p_section(ns_s_an, opcode), ancount);
fprintf(file, ", %s: %d",
p_section(ns_s_ns, opcode), nscount);
fprintf(file, ", %s: %d",
p_section(ns_s_ar, opcode), arcount);
}
if ((!statp->pfcode) || (statp->pfcode &
(RES_PRF_HEADX | RES_PRF_HEAD2 | RES_PRF_HEAD1))) {
putc('\n',file);
}
/*
* Print the various sections.
*/
do_section(statp, &handle, ns_s_qd, RES_PRF_QUES, file);
do_section(statp, &handle, ns_s_an, RES_PRF_ANS, file);
do_section(statp, &handle, ns_s_ns, RES_PRF_AUTH, file);
do_section(statp, &handle, ns_s_ar, RES_PRF_ADD, file);
if (qdcount == 0 && ancount == 0 &&
nscount == 0 && arcount == 0)
putc('\n', file);
}
 
const u_char *
p_cdnname(const u_char *cp, const u_char *msg, int len, FILE *file) {
char name[MAXDNAME];
int n;
 
if ((n = dn_expand(msg, msg + len, cp, name, sizeof name)) < 0)
return (NULL);
if (name[0] == '\0')
putc('.', file);
else
fputs(name, file);
return (cp + n);
}
libresolv_hidden_def (p_cdnname)
 
const u_char *
p_cdname(const u_char *cp, const u_char *msg, FILE *file) {
return (p_cdnname(cp, msg, PACKETSZ, file));
}
 
/* Return a fully-qualified domain name from a compressed name (with
length supplied). */
 
const u_char *
p_fqnname(cp, msg, msglen, name, namelen)
const u_char *cp, *msg;
int msglen;
char *name;
int namelen;
{
int n, newlen;
 
if ((n = dn_expand(msg, cp + msglen, cp, name, namelen)) < 0)
return (NULL);
newlen = strlen(name);
if (newlen == 0 || name[newlen - 1] != '.') {
if (newlen + 1 >= namelen) /* Lack space for final dot */
return (NULL);
else
strcpy(name + newlen, ".");
}
return (cp + n);
}
libresolv_hidden_def (p_fqnname)
 
/* XXX: the rest of these functions need to become length-limited, too. */
 
const u_char *
p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
char name[MAXDNAME];
const u_char *n;
 
n = p_fqnname(cp, msg, MAXCDNAME, name, sizeof name);
if (n == NULL)
return (NULL);
fputs(name, file);
return (n);
}
 
/*
* Names of RR classes and qclasses. Classes and qclasses are the same, except
* that C_ANY is a qclass but not a class. (You can ask for records of class
* C_ANY, but you can't have any records of that class in the database.)
*/
extern const struct res_sym __p_class_syms[];
libresolv_hidden_proto (__p_class_syms)
const struct res_sym __p_class_syms[] = {
{C_IN, "IN"},
{C_CHAOS, "CHAOS"},
{C_HS, "HS"},
{C_HS, "HESIOD"},
{C_ANY, "ANY"},
{C_NONE, "NONE"},
{C_IN, (char *)0}
};
libresolv_hidden_data_def (__p_class_syms)
 
/*
* Names of message sections.
*/
const struct res_sym __p_default_section_syms[] attribute_hidden = {
{ns_s_qd, "QUERY"},
{ns_s_an, "ANSWER"},
{ns_s_ns, "AUTHORITY"},
{ns_s_ar, "ADDITIONAL"},
{0, (char *)0}
};
 
const struct res_sym __p_update_section_syms[] attribute_hidden = {
{S_ZONE, "ZONE"},
{S_PREREQ, "PREREQUISITE"},
{S_UPDATE, "UPDATE"},
{S_ADDT, "ADDITIONAL"},
{0, (char *)0}
};
 
const struct res_sym __p_key_syms[] attribute_hidden = {
{NS_ALG_MD5RSA, "RSA", "RSA KEY with MD5 hash"},
{NS_ALG_DH, "DH", "Diffie Hellman"},
{NS_ALG_DSA, "DSA", "Digital Signature Algorithm"},
{NS_ALG_EXPIRE_ONLY, "EXPIREONLY", "No algorithm"},
{NS_ALG_PRIVATE_OID, "PRIVATE", "Algorithm obtained from OID"},
{0, NULL, NULL}
};
 
const struct res_sym __p_cert_syms[] attribute_hidden = {
{cert_t_pkix, "PKIX", "PKIX (X.509v3) Certificate"},
{cert_t_spki, "SPKI", "SPKI certificate"},
{cert_t_pgp, "PGP", "PGP certificate"},
{cert_t_url, "URL", "URL Private"},
{cert_t_oid, "OID", "OID Private"},
{0, NULL, NULL}
};
 
/*
* Names of RR types and qtypes. Types and qtypes are the same, except
* that T_ANY is a qtype but not a type. (You can ask for records of type
* T_ANY, but you can't have any records of that type in the database.)
*/
extern const struct res_sym __p_type_syms[];
libresolv_hidden_proto (__p_type_syms)
const struct res_sym __p_type_syms[] = {
{ns_t_a, "A", "address"},
{ns_t_ns, "NS", "name server"},
{ns_t_md, "MD", "mail destination (deprecated)"},
{ns_t_mf, "MF", "mail forwarder (deprecated)"},
{ns_t_cname, "CNAME", "canonical name"},
{ns_t_soa, "SOA", "start of authority"},
{ns_t_mb, "MB", "mailbox"},
{ns_t_mg, "MG", "mail group member"},
{ns_t_mr, "MR", "mail rename"},
{ns_t_null, "NULL", "null"},
{ns_t_wks, "WKS", "well-known service (deprecated)"},
{ns_t_ptr, "PTR", "domain name pointer"},
{ns_t_hinfo, "HINFO", "host information"},
{ns_t_minfo, "MINFO", "mailbox information"},
{ns_t_mx, "MX", "mail exchanger"},
{ns_t_txt, "TXT", "text"},
{ns_t_rp, "RP", "responsible person"},
{ns_t_afsdb, "AFSDB", "DCE or AFS server"},
{ns_t_x25, "X25", "X25 address"},
{ns_t_isdn, "ISDN", "ISDN address"},
{ns_t_rt, "RT", "router"},
{ns_t_nsap, "NSAP", "nsap address"},
{ns_t_nsap_ptr, "NSAP_PTR", "domain name pointer"},
{ns_t_sig, "SIG", "signature"},
{ns_t_key, "KEY", "key"},
{ns_t_px, "PX", "mapping information"},
{ns_t_gpos, "GPOS", "geographical position (withdrawn)"},
{ns_t_aaaa, "AAAA", "IPv6 address"},
{ns_t_loc, "LOC", "location"},
{ns_t_nxt, "NXT", "next valid name (unimplemented)"},
{ns_t_eid, "EID", "endpoint identifier (unimplemented)"},
{ns_t_nimloc, "NIMLOC", "NIMROD locator (unimplemented)"},
{ns_t_srv, "SRV", "server selection"},
{ns_t_atma, "ATMA", "ATM address (unimplemented)"},
{ns_t_tsig, "TSIG", "transaction signature"},
{ns_t_ixfr, "IXFR", "incremental zone transfer"},
{ns_t_axfr, "AXFR", "zone transfer"},
{ns_t_zxfr, "ZXFR", "compressed zone transfer"},
{ns_t_mailb, "MAILB", "mailbox-related data (deprecated)"},
{ns_t_maila, "MAILA", "mail agent (deprecated)"},
{ns_t_naptr, "NAPTR", "URN Naming Authority"},
{ns_t_kx, "KX", "Key Exchange"},
{ns_t_cert, "CERT", "Certificate"},
{ns_t_any, "ANY", "\"any\""},
{0, NULL, NULL}
};
libresolv_hidden_data_def (__p_type_syms)
 
/*
* Names of DNS rcodes.
*/
const struct res_sym __p_rcode_syms[] attribute_hidden = {
{ns_r_noerror, "NOERROR", "no error"},
{ns_r_formerr, "FORMERR", "format error"},
{ns_r_servfail, "SERVFAIL", "server failed"},
{ns_r_nxdomain, "NXDOMAIN", "no such domain name"},
{ns_r_notimpl, "NOTIMP", "not implemented"},
{ns_r_refused, "REFUSED", "refused"},
{ns_r_yxdomain, "YXDOMAIN", "domain name exists"},
{ns_r_yxrrset, "YXRRSET", "rrset exists"},
{ns_r_nxrrset, "NXRRSET", "rrset doesn't exist"},
{ns_r_notauth, "NOTAUTH", "not authoritative"},
{ns_r_notzone, "NOTZONE", "Not in zone"},
{ns_r_max, "", ""},
{ns_r_badsig, "BADSIG", "bad signature"},
{ns_r_badkey, "BADKEY", "bad key"},
{ns_r_badtime, "BADTIME", "bad time"},
{0, NULL, NULL}
};
 
int
sym_ston(const struct res_sym *syms, const char *name, int *success) {
for ((void)NULL; syms->name != 0; syms++) {
if (strcasecmp (name, syms->name) == 0) {
if (success)
*success = 1;
return (syms->number);
}
}
if (success)
*success = 0;
return (syms->number); /* The default value. */
}
 
const char *
sym_ntos(const struct res_sym *syms, int number, int *success) {
static char unname[20];
 
for ((void)NULL; syms->name != 0; syms++) {
if (number == syms->number) {
if (success)
*success = 1;
return (syms->name);
}
}
 
sprintf(unname, "%d", number); /* XXX nonreentrant */
if (success)
*success = 0;
return (unname);
}
libresolv_hidden_def (sym_ntos)
 
const char *
sym_ntop(const struct res_sym *syms, int number, int *success) {
static char unname[20];
 
for ((void)NULL; syms->name != 0; syms++) {
if (number == syms->number) {
if (success)
*success = 1;
return (syms->humanname);
}
}
sprintf(unname, "%d", number); /* XXX nonreentrant */
if (success)
*success = 0;
return (unname);
}
 
/*
* Return a string for the type.
*/
const char *
p_type(int type) {
return (sym_ntos(__p_type_syms, type, (int *)0));
}
libresolv_hidden_def (p_type)
 
/*
* Return a string for the type.
*/
const char *
p_section(int section, int opcode) {
const struct res_sym *symbols;
 
switch (opcode) {
case ns_o_update:
symbols = __p_update_section_syms;
break;
default:
symbols = __p_default_section_syms;
break;
}
return (sym_ntos(symbols, section, (int *)0));
}
 
/*
* Return a mnemonic for class.
*/
const char *
p_class(int class) {
return (sym_ntos(__p_class_syms, class, (int *)0));
}
libresolv_hidden_def (p_class)
 
/*
* Return a mnemonic for an option
*/
const char *
p_option(u_long option) {
static char nbuf[40];
 
switch (option) {
case RES_INIT: return "init";
case RES_DEBUG: return "debug";
case RES_AAONLY: return "aaonly(unimpl)";
case RES_USEVC: return "usevc";
case RES_PRIMARY: return "primry(unimpl)";
case RES_IGNTC: return "igntc";
case RES_RECURSE: return "recurs";
case RES_DEFNAMES: return "defnam";
case RES_STAYOPEN: return "styopn";
case RES_DNSRCH: return "dnsrch";
case RES_INSECURE1: return "insecure1";
case RES_INSECURE2: return "insecure2";
case RES_USE_INET6: return "inet6";
case RES_ROTATE: return "rotate";
case RES_NOCHECKNAME: return "no-check-names";
case RES_USEBSTRING: return "ip6-bytstring";
/* XXX nonreentrant */
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
return (nbuf);
}
}
libresolv_hidden_def (p_option)
 
/*
* Return a mnemonic for a time to live.
*/
const char *
p_time(u_int32_t value) {
static char nbuf[40]; /* XXX nonreentrant */
 
if (ns_format_ttl(value, nbuf, sizeof nbuf) < 0)
sprintf(nbuf, "%u", value);
return (nbuf);
}
 
/*
* Return a string for the rcode.
*/
const char *
p_rcode(int rcode) {
return (sym_ntos(__p_rcode_syms, rcode, (int *)0));
}
libresolv_hidden_def (p_rcode)
 
/*
* routines to convert between on-the-wire RR format and zone file format.
* Does not contain conversion to/from decimal degrees; divide or multiply
* by 60*60*1000 for that.
*/
 
static const unsigned int poweroften[10]=
{ 1, 10, 100, 1000, 10000, 100000,
1000000,10000000,100000000,1000000000};
 
/* takes an XeY precision/size value, returns a string representation. */
static const char *
precsize_ntoa(prec)
u_int8_t prec;
{
static char retbuf[sizeof "90000000.00"]; /* XXX nonreentrant */
unsigned long val;
int mantissa, exponent;
 
mantissa = (int)((prec >> 4) & 0x0f) % 10;
exponent = (int)((prec >> 0) & 0x0f) % 10;
 
val = mantissa * poweroften[exponent];
 
(void) sprintf(retbuf, "%ld.%.2ld", val/100, val%100);
return (retbuf);
}
 
/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
static u_int8_t
precsize_aton(strptr)
const char **strptr;
{
unsigned int mval = 0, cmval = 0;
u_int8_t retval = 0;
const char *cp;
int exponent;
int mantissa;
 
cp = *strptr;
 
while (isdigit(*cp))
mval = mval * 10 + (*cp++ - '0');
 
if (*cp == '.') { /* centimeters */
cp++;
if (isdigit(*cp)) {
cmval = (*cp++ - '0') * 10;
if (isdigit(*cp)) {
cmval += (*cp++ - '0');
}
}
}
cmval = (mval * 100) + cmval;
 
for (exponent = 0; exponent < 9; exponent++)
if (cmval < poweroften[exponent+1])
break;
 
mantissa = cmval / poweroften[exponent];
if (mantissa > 9)
mantissa = 9;
 
retval = (mantissa << 4) | exponent;
 
*strptr = cp;
 
return (retval);
}
 
/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
static u_int32_t
latlon2ul(latlonstrptr,which)
const char **latlonstrptr;
int *which;
{
const char *cp;
u_int32_t retval;
int deg = 0, min = 0, secs = 0, secsfrac = 0;
 
cp = *latlonstrptr;
 
while (isdigit(*cp))
deg = deg * 10 + (*cp++ - '0');
 
while (isspace(*cp))
cp++;
 
if (!(isdigit(*cp)))
goto fndhemi;
 
while (isdigit(*cp))
min = min * 10 + (*cp++ - '0');
 
while (isspace(*cp))
cp++;
 
if (!(isdigit(*cp)))
goto fndhemi;
 
while (isdigit(*cp))
secs = secs * 10 + (*cp++ - '0');
 
if (*cp == '.') { /* decimal seconds */
cp++;
if (isdigit(*cp)) {
secsfrac = (*cp++ - '0') * 100;
if (isdigit(*cp)) {
secsfrac += (*cp++ - '0') * 10;
if (isdigit(*cp)) {
secsfrac += (*cp++ - '0');
}
}
}
}
 
while (!isspace(*cp)) /* if any trailing garbage */
cp++;
 
while (isspace(*cp))
cp++;
 
fndhemi:
switch (*cp) {
case 'N': case 'n':
case 'E': case 'e':
retval = ((unsigned)1<<31)
+ (((((deg * 60) + min) * 60) + secs) * 1000)
+ secsfrac;
break;
case 'S': case 's':
case 'W': case 'w':
retval = ((unsigned)1<<31)
- (((((deg * 60) + min) * 60) + secs) * 1000)
- secsfrac;
break;
default:
retval = 0; /* invalid value -- indicates error */
break;
}
 
switch (*cp) {
case 'N': case 'n':
case 'S': case 's':
*which = 1; /* latitude */
break;
case 'E': case 'e':
case 'W': case 'w':
*which = 2; /* longitude */
break;
default:
*which = 0; /* error */
break;
}
 
cp++; /* skip the hemisphere */
 
while (!isspace(*cp)) /* if any trailing garbage */
cp++;
 
while (isspace(*cp)) /* move to next field */
cp++;
 
*latlonstrptr = cp;
 
return (retval);
}
 
/* converts a zone file representation in a string to an RDATA on-the-wire
* representation. */
int
loc_aton(ascii, binary)
const char *ascii;
u_char *binary;
{
const char *cp, *maxcp;
u_char *bcp;
 
u_int32_t latit = 0, longit = 0, alt = 0;
u_int32_t lltemp1 = 0, lltemp2 = 0;
int altmeters = 0, altfrac = 0, altsign = 1;
u_int8_t hp = 0x16; /* default = 1e6 cm = 10000.00m = 10km */
u_int8_t vp = 0x13; /* default = 1e3 cm = 10.00m */
u_int8_t siz = 0x12; /* default = 1e2 cm = 1.00m */
int which1 = 0, which2 = 0;
 
cp = ascii;
maxcp = cp + strlen(ascii);
 
lltemp1 = latlon2ul(&cp, &which1);
 
lltemp2 = latlon2ul(&cp, &which2);
 
switch (which1 + which2) {
case 3: /* 1 + 2, the only valid combination */
if ((which1 == 1) && (which2 == 2)) { /* normal case */
latit = lltemp1;
longit = lltemp2;
} else if ((which1 == 2) && (which2 == 1)) { /* reversed */
longit = lltemp1;
latit = lltemp2;
} else { /* some kind of brokenness */
return (0);
}
break;
default: /* we didn't get one of each */
return (0);
}
 
/* altitude */
if (*cp == '-') {
altsign = -1;
cp++;
}
 
if (*cp == '+')
cp++;
 
while (isdigit(*cp))
altmeters = altmeters * 10 + (*cp++ - '0');
 
if (*cp == '.') { /* decimal meters */
cp++;
if (isdigit(*cp)) {
altfrac = (*cp++ - '0') * 10;
if (isdigit(*cp)) {
altfrac += (*cp++ - '0');
}
}
}
 
alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
 
while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
 
while (isspace(*cp) && (cp < maxcp))
cp++;
 
if (cp >= maxcp)
goto defaults;
 
siz = precsize_aton(&cp);
 
while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
 
while (isspace(*cp) && (cp < maxcp))
cp++;
 
if (cp >= maxcp)
goto defaults;
 
hp = precsize_aton(&cp);
 
while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
 
while (isspace(*cp) && (cp < maxcp))
cp++;
 
if (cp >= maxcp)
goto defaults;
 
vp = precsize_aton(&cp);
 
defaults:
 
bcp = binary;
*bcp++ = (u_int8_t) 0; /* version byte */
*bcp++ = siz;
*bcp++ = hp;
*bcp++ = vp;
PUTLONG(latit,bcp);
PUTLONG(longit,bcp);
PUTLONG(alt,bcp);
 
return (16); /* size of RR in octets */
}
 
/* takes an on-the-wire LOC RR and formats it in a human readable format. */
const char *
loc_ntoa(binary, ascii)
const u_char *binary;
char *ascii;
{
static char *error = "?";
static char tmpbuf[sizeof
"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"];
const u_char *cp = binary;
 
int latdeg, latmin, latsec, latsecfrac;
int longdeg, longmin, longsec, longsecfrac;
char northsouth, eastwest;
int altmeters, altfrac, altsign;
 
const u_int32_t referencealt = 100000 * 100;
 
int32_t latval, longval, altval;
u_int32_t templ;
u_int8_t sizeval, hpval, vpval, versionval;
 
char *sizestr, *hpstr, *vpstr;
 
versionval = *cp++;
 
if (ascii == NULL)
ascii = tmpbuf;
 
if (versionval) {
(void) sprintf(ascii, "; error: unknown LOC RR version");
return (ascii);
}
 
sizeval = *cp++;
 
hpval = *cp++;
vpval = *cp++;
 
GETLONG(templ, cp);
latval = (templ - ((unsigned)1<<31));
 
GETLONG(templ, cp);
longval = (templ - ((unsigned)1<<31));
 
GETLONG(templ, cp);
if (templ < referencealt) { /* below WGS 84 spheroid */
altval = referencealt - templ;
altsign = -1;
} else {
altval = templ - referencealt;
altsign = 1;
}
 
if (latval < 0) {
northsouth = 'S';
latval = -latval;
} else
northsouth = 'N';
 
latsecfrac = latval % 1000;
latval = latval / 1000;
latsec = latval % 60;
latval = latval / 60;
latmin = latval % 60;
latval = latval / 60;
latdeg = latval;
 
if (longval < 0) {
eastwest = 'W';
longval = -longval;
} else
eastwest = 'E';
 
longsecfrac = longval % 1000;
longval = longval / 1000;
longsec = longval % 60;
longval = longval / 60;
longmin = longval % 60;
longval = longval / 60;
longdeg = longval;
 
altfrac = altval % 100;
altmeters = (altval / 100) * altsign;
 
if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL)
sizestr = error;
if ((hpstr = strdup(precsize_ntoa(hpval))) == NULL)
hpstr = error;
if ((vpstr = strdup(precsize_ntoa(vpval))) == NULL)
vpstr = error;
 
sprintf(ascii,
"%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm",
latdeg, latmin, latsec, latsecfrac, northsouth,
longdeg, longmin, longsec, longsecfrac, eastwest,
altmeters, altfrac, sizestr, hpstr, vpstr);
 
if (sizestr != error)
free(sizestr);
if (hpstr != error)
free(hpstr);
if (vpstr != error)
free(vpstr);
 
return (ascii);
}
libresolv_hidden_def (loc_ntoa)
 
 
/* Return the number of DNS hierarchy levels in the name. */
int
dn_count_labels(const char *name) {
int i, len, count;
 
len = strlen(name);
for (i = 0, count = 0; i < len; i++) {
/* XXX need to check for \. or use named's nlabels(). */
if (name[i] == '.')
count++;
}
 
/* don't count initial wildcard */
if (name[0] == '*')
if (count)
count--;
 
/* don't count the null label for root. */
/* if terminating '.' not found, must adjust */
/* count to include last label */
if (len > 0 && name[len-1] != '.')
count++;
return (count);
}
 
 
/*
* Make dates expressed in seconds-since-Jan-1-1970 easy to read.
* SIG records are required to be printed like this, by the Secure DNS RFC.
*/
char *
p_secstodate (u_long secs) {
/* XXX nonreentrant */
static char output[15]; /* YYYYMMDDHHMMSS and null */
time_t clock = secs;
struct tm *time;
 
#ifdef HAVE_TIME_R
struct tm timebuf;
 
time = gmtime_r(&clock, &timebuf);
#else
time = gmtime(&clock);
#endif
time->tm_year += 1900;
time->tm_mon += 1;
sprintf(output, "%04d%02d%02d%02d%02d%02d",
time->tm_year, time->tm_mon, time->tm_mday,
time->tm_hour, time->tm_min, time->tm_sec);
return (output);
}
res_debug.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_pton.c =================================================================== --- inet_pton.c (nonexistent) +++ inet_pton.c (revision 520) @@ -0,0 +1,222 @@ +/* $KAME: inet_pton.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ + +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4(const char *src, u_char *dst); +static int inet_pton6(const char *src, u_char *dst); + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton(af, src, dst) + int af; + const char *src; + void *dst; +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: + return (inet_pton6(src, dst)); + default: + errno = EAFNOSUPPORT; + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(src, dst) + const char *src; + u_char *dst; +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + u_char tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + u_int new = *tp * 10 + (pch - digits); + + if (new > 255) + return (0); + *tp = new; + if (! saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} + +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(src, dst) + const char *src; + u_char *dst; +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + u_char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + u_int val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) + return (0); + saw_xdigit = 1; + continue; + } + if (ch == ':') { + curtok = src; + if (!saw_xdigit) { + if (colonp) + return (0); + colonp = tp; + continue; + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (saw_xdigit) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (u_char) (val >> 8) & 0xff; + *tp++ = (u_char) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_pton +__weak_reference(__inet_pton, inet_pton);
inet_pton.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: grp-lookup.c =================================================================== --- grp-lookup.c (nonexistent) +++ grp-lookup.c (revision 520) @@ -0,0 +1,23 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME group +#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" + +#include "XXX-lookup.c"
grp-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_debug.h =================================================================== --- res_debug.h (nonexistent) +++ res_debug.h (revision 520) @@ -0,0 +1,34 @@ +/* + * Copyright (c) 1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef _RES_DEBUG_H_ +#define _RES_DEBUG_H_ + +#ifndef DEBUG +# define Dprint(cond, args) /*empty*/ +# define DprintQ(cond, args, query, size) /*empty*/ +# define Aerror(statp, file, string, error, address) /*empty*/ +# define Perror(statp, file, string, error) /*empty*/ +#else +# define Dprint(cond, args) if (cond) {fprintf args;} else {} +# define DprintQ(cond, args, query, size) if (cond) {\ + fprintf args;\ + res_pquery(statp, query, size, stdout);\ + } else {} +#endif + +#endif /* _RES_DEBUG_H_ */
res_debug.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstbynm_r.c =================================================================== --- gethstbynm_r.c (nonexistent) +++ gethstbynm_r.c (revision 520) @@ -0,0 +1,45 @@ +/* Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +#define LOOKUP_TYPE struct hostent +#define FUNCTION_NAME gethostbyname +#define DATABASE_NAME hosts +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define NEED_H_ERRNO 1 +#define NEED__RES_HCONF 1 +#define POSTPROCESS \ + if (status == NSS_STATUS_SUCCESS) \ + _res_hconf_reorder_addrs (resbuf); + +#define HANDLE_DIGITS_DOTS 1 +#define HAVE_LOOKUP_BUFFER 1 + +/* Special name for the lookup function. */ +#define DB_LOOKUP_FCT __nss_hosts_lookup + +#include "getXXbyYY_r.c"
gethstbynm_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstent.c =================================================================== --- gethstent.c (nonexistent) +++ gethstent.c (revision 520) @@ -0,0 +1,27 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct hostent +#define GETFUNC_NAME gethostent +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#include "getXXent.c"
gethstent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nscd/nscd_proto.h =================================================================== --- nscd/nscd_proto.h (nonexistent) +++ nscd/nscd_proto.h (revision 520) @@ -0,0 +1,67 @@ +/* Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Thorsten Kukuk , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NSCD_PROTO_H +#define _NSCD_PROTO_H 1 + +#include +#include +#include + +/* Interval in which we transfer retry to contact the NSCD. */ +#define NSS_NSCD_RETRY 100 + +/* Type needed in the interfaces. */ +struct nscd_ai_result; + + +/* Variables for communication between NSCD handler functions and NSS. */ +extern int __nss_not_use_nscd_passwd attribute_hidden; +extern int __nss_not_use_nscd_group attribute_hidden; +extern int __nss_not_use_nscd_hosts attribute_hidden; + +extern int __nscd_getpwnam_r (const char *name, struct passwd *resultbuf, + char *buffer, size_t buflen, + struct passwd **result); +extern int __nscd_getpwuid_r (uid_t uid, struct passwd *resultbuf, + char *buffer, size_t buflen, + struct passwd **result); +extern int __nscd_getgrnam_r (const char *name, struct group *resultbuf, + char *buffer, size_t buflen, + struct group **result); +extern int __nscd_getgrgid_r (gid_t gid, struct group *resultbuf, + char *buffer, size_t buflen, + struct group **result); +extern int __nscd_gethostbyname_r (const char *name, + struct hostent *resultbuf, + char *buffer, size_t buflen, + struct hostent **result, int *h_errnop); +extern int __nscd_gethostbyname2_r (const char *name, int af, + struct hostent *resultbuf, + char *buffer, size_t buflen, + struct hostent **result, int *h_errnop); +extern int __nscd_gethostbyaddr_r (const void *addr, socklen_t len, int type, + struct hostent *resultbuf, + char *buffer, size_t buflen, + struct hostent **result, int *h_errnop); +extern int __nscd_getai (const char *key, struct nscd_ai_result **result, + int *h_errnop); +extern int __nscd_getgrouplist (const char *user, gid_t group, long int *size, + gid_t **groupsp, long int limit); +#endif /* _NSCD_PROTO_H */
nscd/nscd_proto.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nscd/nscd-client.h =================================================================== --- nscd/nscd-client.h (nonexistent) +++ nscd/nscd-client.h (revision 520) @@ -0,0 +1,312 @@ +/* Copyright (c) 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Thorsten Kukuk , 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file defines everything that client code should need to + know to talk to the nscd daemon. */ + +#ifndef _NSCD_CLIENT_H +#define _NSCD_CLIENT_H 1 + +#include +#include +#include +#include +#include + + +/* Version number of the daemon interface */ +#define NSCD_VERSION 2 + +/* Path of the file where the PID of the running system is stored. */ +#define _PATH_NSCDPID "/var/run/nscd/nscd.pid" + +/* Path for the Unix domain socket. */ +#define _PATH_NSCDSOCKET "/var/run/nscd/socket" + +/* Path for the configuration file. */ +#define _PATH_NSCDCONF "/etc/nscd.conf" + + +/* Available services. */ +typedef enum +{ + GETPWBYNAME, + GETPWBYUID, + GETGRBYNAME, + GETGRBYGID, + GETHOSTBYNAME, + GETHOSTBYNAMEv6, + GETHOSTBYADDR, + GETHOSTBYADDRv6, + LASTDBREQ = GETHOSTBYADDRv6, + SHUTDOWN, /* Shut the server down. */ + GETSTAT, /* Get the server statistic. */ + INVALIDATE, /* Invalidate one special cache. */ + GETFDPW, + GETFDGR, + GETFDHST, + GETAI, + INITGROUPS, + LASTREQ +} request_type; + + +/* Header common to all requests */ +typedef struct +{ + int32_t version; /* Version number of the daemon interface. */ + request_type type; /* Service requested. */ + int32_t key_len; /* Key length. */ +} request_header; + + +/* Structure sent in reply to password query. Note that this struct is + sent also if the service is disabled or there is no record found. */ +typedef struct +{ + int32_t version; + int32_t found; + nscd_ssize_t pw_name_len; + nscd_ssize_t pw_passwd_len; + uid_t pw_uid; + gid_t pw_gid; + nscd_ssize_t pw_gecos_len; + nscd_ssize_t pw_dir_len; + nscd_ssize_t pw_shell_len; +} pw_response_header; + + +/* Structure sent in reply to group query. Note that this struct is + sent also if the service is disabled or there is no record found. */ +typedef struct +{ + int32_t version; + int32_t found; + nscd_ssize_t gr_name_len; + nscd_ssize_t gr_passwd_len; + gid_t gr_gid; + nscd_ssize_t gr_mem_cnt; +} gr_response_header; + + +/* Structure sent in reply to host query. Note that this struct is + sent also if the service is disabled or there is no record found. */ +typedef struct +{ + int32_t version; + int32_t found; + nscd_ssize_t h_name_len; + nscd_ssize_t h_aliases_cnt; + int32_t h_addrtype; + int32_t h_length; + nscd_ssize_t h_addr_list_cnt; + int32_t error; +} hst_response_header; + + +/* Structure sent in reply to addrinfo query. Note that this struct is + sent also if the service is disabled or there is no record found. */ +typedef struct +{ + int32_t version; + int32_t found; + nscd_ssize_t naddrs; + nscd_ssize_t addrslen; + nscd_ssize_t canonlen; + int32_t error; +} ai_response_header; + +/* Structure filled in by __nscd_getai. */ +struct nscd_ai_result +{ + int naddrs; + char *canon; + uint8_t *family; + char *addrs; +}; + +/* Structure sent in reply to initgroups query. Note that this struct is + sent also if the service is disabled or there is no record found. */ +typedef struct +{ + int32_t version; + int32_t found; + nscd_ssize_t ngrps; +} initgr_response_header; + + +/* Type for offsets in data part of database. */ +typedef uint32_t ref_t; +/* Value for invalid/no reference. */ +#define ENDREF UINT32_MAX + +/* Timestamp type. */ +typedef uint64_t nscd_time_t; + +/* Alignment requirement of the beginning of the data region. */ +#define ALIGN 16 + + +/* Head of record in data part of database. */ +struct datahead +{ + nscd_ssize_t allocsize; /* Allocated Bytes. */ + nscd_ssize_t recsize; /* Size of the record. */ + nscd_time_t timeout; /* Time when this entry becomes invalid. */ + uint8_t notfound; /* Nonzero if data has not been found. */ + uint8_t nreloads; /* Reloads without use. */ + uint8_t usable; /* False if the entry must be ignored. */ + uint64_t :40; /* Alignment. */ + + /* We need to have the following element aligned for the response + header data types and their use in the 'struct dataset' types + defined in the XXXcache.c files. */ + union + { + pw_response_header pwdata; + gr_response_header grdata; + hst_response_header hstdata; + ai_response_header aidata; + initgr_response_header initgrdata; + nscd_ssize_t align1; + nscd_time_t align2; + } data[0]; +}; + + +/* Structure for one hash table entry. */ +struct hashentry +{ + request_type type:8; /* Which type of dataset. */ + bool first; /* True if this was the original key. */ + nscd_ssize_t len; /* Length of key. */ + ref_t key; /* Pointer to key. */ + int32_t owner; /* If secure table, this is the owner. */ + ref_t next; /* Next entry in this hash bucket list. */ + ref_t packet; /* Records for the result. */ + union + { + struct hashentry *dellist; /* Next record to be deleted. This can be a + pointer since only nscd uses this field. */ + ref_t *prevp; /* Pointer to field containing forward + reference. */ + }; +}; + + +/* Current persistent database version. */ +#define DB_VERSION 1 + +/* Maximum time allowed between updates of the timestamp. */ +#define MAPPING_TIMEOUT (5 * 60) + + +/* Header of persistent database file. */ +struct database_pers_head +{ + int32_t version; + int32_t header_size; + volatile int32_t gc_cycle; + volatile int32_t nscd_certainly_running; + volatile nscd_time_t timestamp; + + nscd_ssize_t module; + nscd_ssize_t data_size; + + nscd_ssize_t first_free; /* Offset of first free byte in data area. */ + + nscd_ssize_t nentries; + nscd_ssize_t maxnentries; + nscd_ssize_t maxnsearched; + + uint64_t poshit; + uint64_t neghit; + uint64_t posmiss; + uint64_t negmiss; + + uint64_t rdlockdelayed; + uint64_t wrlockdelayed; + + uint64_t addfailed; + + ref_t array[0]; +}; + + +/* Mapped database record. */ +struct mapped_database +{ + const struct database_pers_head *head; + const char *data; + size_t mapsize; + int counter; /* > 0 indicates it is usable. */ +}; +#define NO_MAPPING ((struct mapped_database *) -1l) + +struct locked_map_ptr +{ + int lock; + struct mapped_database *mapped; +}; +#define libc_locked_map_ptr(class, name) class struct locked_map_ptr name + + +/* Open socket connection to nscd server. */ +extern int __nscd_open_socket (const char *key, size_t keylen, + request_type type, void *response, + size_t responselen) attribute_hidden; + +/* Get reference of mapping. */ +extern struct mapped_database *__nscd_get_map_ref (request_type type, + const char *name, + struct locked_map_ptr *mapptr, + int *gc_cyclep); + +/* Unmap database. */ +extern void __nscd_unmap (struct mapped_database *mapped); + +/* Drop reference of mapping. */ +static inline int __nscd_drop_map_ref (struct mapped_database *map, + int *gc_cycle) +{ + if (map != NO_MAPPING) + { + int now_cycle = map->head->gc_cycle; + if (__builtin_expect (now_cycle != *gc_cycle, 0)) + { + /* We might have read inconsistent data. */ + *gc_cycle = now_cycle; + return -1; + } + + if (atomic_decrement_and_test (&map->counter) == 0) + __nscd_unmap (map); + } + + return 0; +} + + +/* Search the mapped database. */ +extern const struct datahead *__nscd_cache_search (request_type type, + const char *key, + size_t keylen, + const struct mapped_database *mapped); + +#endif /* nscd.h */
nscd/nscd-client.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifreq.c =================================================================== --- ifreq.c (nonexistent) +++ ifreq.c (revision 520) @@ -0,0 +1,100 @@ +/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "ifreq.h" + +/* Variable to signal whether SIOCGIFCONF is not available. */ +#if __ASSUME_SIOCGIFNAME == 0 || 1 +static int old_siocgifconf; +#else +# define old_siocgifconf 0 +#endif + + +void +__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd) +{ + int fd = sockfd; + struct ifconf ifc; + int rq_len; + int nifs; +# define RQ_IFS 4 + + if (fd < 0) + fd = __opensock (); + if (fd < 0) + { + *num_ifs = 0; + *ifreqs = NULL; + return; + } + + ifc.ifc_buf = NULL; + + /* We may be able to get the needed buffer size directly, rather than + guessing. */ + if (! old_siocgifconf) + { + ifc.ifc_buf = NULL; + ifc.ifc_len = 0; + if (ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0) + { +# if __ASSUME_SIOCGIFNAME == 0 + old_siocgifconf = 1; +# endif + rq_len = RQ_IFS * sizeof (struct ifreq); + } + else + rq_len = ifc.ifc_len; + } + else + rq_len = RQ_IFS * sizeof (struct ifreq); + + /* Read all the interfaces out of the kernel. */ + while (1) + { + ifc.ifc_len = rq_len; + void *newp = realloc (ifc.ifc_buf, ifc.ifc_len); + if (newp == NULL + || (ifc.ifc_buf = newp, ioctl (fd, SIOCGIFCONF, &ifc)) < 0) + { + free (ifc.ifc_buf); + + if (fd != sockfd) + close (fd); + + *num_ifs = 0; + *ifreqs = NULL; + return; + } + + if (!old_siocgifconf || ifc.ifc_len < rq_len) + break; + + rq_len *= 2; + } + + nifs = ifc.ifc_len / sizeof (struct ifreq); + + if (fd != sockfd) + close (fd); + + *num_ifs = nifs; + *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq)); +}
ifreq.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getprtname.c =================================================================== --- getprtname.c (nonexistent) +++ getprtname.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct protoent +#define FUNCTION_NAME getprotobyname +#define DATABASE_NAME protocols +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getprtname.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_comp.c =================================================================== --- res_comp.c (nonexistent) +++ res_comp.c (revision 520) @@ -0,0 +1,262 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; +static const char rcsid[] = "$BINDId: res_comp.c,v 8.15 1999/10/13 16:39:39 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +/* + * Expand compressed domain name 'comp_dn' to full domain name. + * 'msg' is a pointer to the begining of the message, + * 'eomorig' points to the first location after the message, + * 'exp_dn' is a pointer to a buffer of size 'length' for the result. + * Return size of compressed name or -1 if there was an error. + */ +int +dn_expand(const u_char *msg, const u_char *eom, const u_char *src, + char *dst, int dstsiz) +{ + int n = ns_name_uncompress(msg, eom, src, dst, (size_t)dstsiz); + + if (n > 0 && dst[0] == '.') + dst[0] = '\0'; + return (n); +} +libresolv_hidden_def (dn_expand) + +/* + * Pack domain name 'exp_dn' in presentation form into 'comp_dn'. + * Return the size of the compressed name or -1. + * 'length' is the size of the array pointed to by 'comp_dn'. + */ +int +dn_comp(const char *src, u_char *dst, int dstsiz, + u_char **dnptrs, u_char **lastdnptr) +{ + return (ns_name_compress(src, dst, (size_t)dstsiz, + (const u_char **)dnptrs, + (const u_char **)lastdnptr)); +} +libresolv_hidden_def (dn_comp) + +/* + * Skip over a compressed domain name. Return the size or -1. + */ +int +dn_skipname(const u_char *ptr, const u_char *eom) { + const u_char *saveptr = ptr; + + if (ns_name_skip(&ptr, eom) == -1) + return (-1); + return (ptr - saveptr); +} +libresolv_hidden_def (dn_skipname) + +/* + * Verify that a domain name uses an acceptable character set. + */ + +/* + * Note the conspicuous absence of ctype macros in these definitions. On + * non-ASCII hosts, we can't depend on string literals or ctype macros to + * tell us anything about network-format data. The rest of the BIND system + * is not careful about this, but for some reason, we're doing it right here. + */ +#define PERIOD 0x2e +#define hyphenchar(c) ((c) == 0x2d) +#define underscorechar(c) ((c) == 0x5f) +#define bslashchar(c) ((c) == 0x5c) +#define periodchar(c) ((c) == PERIOD) +#define asterchar(c) ((c) == 0x2a) +#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \ + || ((c) >= 0x61 && (c) <= 0x7a)) +#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39) + +#define borderchar(c) (alphachar(c) || digitchar(c)) +#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c)) +#define domainchar(c) ((c) > 0x20 && (c) < 0x7f) + +int +res_hnok(const char *dn) { + int ppch = '\0', pch = PERIOD, ch = *dn++; + + while (ch != '\0') { + int nch = *dn++; + + if (periodchar(ch)) { + (void)NULL; + } else if (periodchar(pch)) { + if (!borderchar(ch)) + return (0); + } else if (periodchar(nch) || nch == '\0') { + if (!borderchar(ch)) + return (0); + } else { + if (!middlechar(ch)) + return (0); + } + ppch = pch, pch = ch, ch = nch; + } + return (1); +} +libresolv_hidden_def (res_hnok) + +/* + * hostname-like (A, MX, WKS) owners can have "*" as their first label + * but must otherwise be as a host name. + */ +int +res_ownok(const char *dn) { + if (asterchar(dn[0])) { + if (periodchar(dn[1])) + return (res_hnok(dn+2)); + if (dn[1] == '\0') + return (1); + } + return (res_hnok(dn)); +} + +/* + * SOA RNAMEs and RP RNAMEs can have any printable character in their first + * label, but the rest of the name has to look like a host name. + */ +int +res_mailok(const char *dn) { + int ch, escaped = 0; + + /* "." is a valid missing representation */ + if (*dn == '\0') + return (1); + + /* otherwise
res_comp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetbyad_r.c =================================================================== --- getnetbyad_r.c (nonexistent) +++ getnetbyad_r.c (revision 520) @@ -0,0 +1,32 @@ +/* Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +#define LOOKUP_TYPE struct netent +#define FUNCTION_NAME getnetbyaddr +#define DATABASE_NAME networks +#define ADD_PARAMS uint32_t net, int type +#define ADD_VARIABLES net, type +#define NEED__RES 1 +#define NEED_H_ERRNO 1 + +#include "getXXbyYY_r.c"
getnetbyad_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getservent_r.c =================================================================== --- getservent_r.c (nonexistent) +++ getservent_r.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct servent +#define SETFUNC_NAME setservent +#define GETFUNC_NAME getservent +#define ENDFUNC_NAME endservent +#define DATABASE_NAME services +#define STAYOPEN int stayopen +#define STAYOPEN_VAR stayopen + +#include "getXXent_r.c"
getservent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getsrvbypt.c =================================================================== --- getsrvbypt.c (nonexistent) +++ getsrvbypt.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct servent +#define FUNCTION_NAME getservbyport +#define DATABASE_NAME services +#define ADD_PARAMS int port, const char *proto +#define ADD_VARIABLES port, proto +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getsrvbypt.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifreq.h =================================================================== --- ifreq.h (nonexistent) +++ ifreq.h (revision 520) @@ -0,0 +1,40 @@ +/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Andreas Jaeger . + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd); + +static inline struct ifreq * +__if_nextreq (struct ifreq *ifr) +{ + return ifr + 1; +} + +static inline void +__if_freereq (struct ifreq *ifreqs, int num_ifs) +{ + free (ifreqs); +}
ifreq.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rcmdsh.c =================================================================== --- rcmdsh.c (nonexistent) +++ rcmdsh.c (revision 520) @@ -0,0 +1,169 @@ +/* $OpenBSD: rcmdsh.c,v 1.5 1998/04/25 16:23:58 millert Exp $ */ + +/* + * Copyright (c) 2001, MagniComp + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * 3. Neither the name of the MagniComp nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE + * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * This is an rcmd() replacement originally by + * Chris Siebenmann . + */ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifndef _PATH_RSH +#define _PATH_RSH "/usr/bin/rsh" +#endif + +/* + * This is a replacement rcmd() function that uses the rsh(1) + * program in place of a direct rcmd(3) function call so as to + * avoid having to be root. Note that rport is ignored. + */ +int +rcmdsh(ahost, rport, locuser, remuser, cmd, rshprog) + char **ahost; + int rport; + const char *locuser, *remuser, *cmd, *rshprog; +{ + struct addrinfo hints, *res; + int cpid, sp[2], error; + char *p; + struct passwd *pw; + char num[8]; + static char hbuf[NI_MAXHOST]; + + /* What rsh/shell to use. */ + if (rshprog == NULL) + rshprog = _PATH_RSH; + + /* locuser must exist on this host. */ + if ((pw = getpwnam(locuser)) == NULL) { + (void)fprintf(stderr, "rcmdsh: unknown user: %s\n", locuser); + return (-1); + } + + /* Validate remote hostname. */ + if (strcmp(*ahost, "localhost") != 0) { + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + (void)snprintf(num, sizeof(num), "%d", ntohs(rport)); + error = getaddrinfo(*ahost, num, &hints, &res); + if (error) { + fprintf(stderr, "rcmdsh: getaddrinfo: %s\n", + gai_strerror(error)); + return (-1); + } + if (res->ai_canonname) { + strncpy(hbuf, res->ai_canonname, sizeof(hbuf) - 1); + hbuf[sizeof(hbuf) - 1] = '\0'; + *ahost = hbuf; + } + freeaddrinfo(res); + } + + /* Get a socketpair we'll use for stdin and stdout. */ + if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sp) == -1) { + perror("rcmdsh: socketpair"); + return (-1); + } + + cpid = fork(); + if (cpid == -1) { + perror("rcmdsh: fork failed"); + return (-1); + } else if (cpid == 0) { + /* + * Child. We use sp[1] to be stdin/stdout, and close sp[0]. + */ + (void)close(sp[0]); + if (dup2(sp[1], 0) == -1 || dup2(0, 1) == -1) { + perror("rcmdsh: dup2 failed"); + _exit(255); + } + /* Fork again to lose parent. */ + cpid = fork(); + if (cpid == -1) { + perror("rcmdsh: fork to lose parent failed"); + _exit(255); + } + if (cpid > 0) + _exit(0); + + /* In grandchild here. Become local user for rshprog. */ + if (setuid(pw->pw_uid) == -1) { + (void)fprintf(stderr, "rcmdsh: setuid(%u): %s\n", + pw->pw_uid, strerror(errno)); + _exit(255); + } + + /* + * If remote host is "localhost" and local and remote users + * are the same, avoid running remote shell for efficiency. + */ + if (strcmp(*ahost, "localhost") == 0 && + strcmp(locuser, remuser) == 0) { + if (pw->pw_shell[0] == '\0') + rshprog = _PATH_BSHELL; + else + rshprog = pw->pw_shell; + p = strrchr(rshprog, '/'); + execlp(rshprog, p ? p + 1 : rshprog, "-c", cmd, + (char *)NULL); + } else { + p = strrchr(rshprog, '/'); + execlp(rshprog, p ? p + 1 : rshprog, *ahost, "-l", + remuser, cmd, (char *)NULL); + } + (void)fprintf(stderr, "rcmdsh: execlp %s failed: %s\n", + rshprog, strerror(errno)); + _exit(255); + } else { + /* Parent. close sp[1], return sp[0]. */ + (void)close(sp[1]); + /* Reap child. */ + (void)wait(NULL); + return (sp[0]); + } + /* NOTREACHED */ +}
rcmdsh.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getrpcbyname.c =================================================================== --- getrpcbyname.c (nonexistent) +++ getrpcbyname.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct rpcent +#define FUNCTION_NAME getrpcbyname +#define DATABASE_NAME rpc +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getrpcbyname.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: etherent.h =================================================================== --- etherent.h (nonexistent) +++ etherent.h (revision 520) @@ -0,0 +1,9 @@ +/* Because the `ethers' lookup does not fit so well in the scheme we + define a dummy struct here which helps us to use the available + functions. */ +struct etherent +{ + const char *e_name; + struct ether_addr e_addr; +}; +
etherent.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: spwd-lookup.c =================================================================== --- spwd-lookup.c (nonexistent) +++ spwd-lookup.c (revision 520) @@ -0,0 +1,24 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME shadow +#define ALTERNATE_NAME passwd +#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" + +#include "XXX-lookup.c"
spwd-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getproto_r.c =================================================================== --- getproto_r.c (nonexistent) +++ getproto_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct protoent +#define FUNCTION_NAME getprotobynumber +#define DATABASE_NAME protocols +#define ADD_PARAMS int proto +#define ADD_VARIABLES proto + +#include "getXXbyYY_r.c"
getproto_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getrpcbynumber.c =================================================================== --- getrpcbynumber.c (nonexistent) +++ getrpcbynumber.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct rpcent +#define FUNCTION_NAME getrpcbynumber +#define DATABASE_NAME rpc +#define ADD_PARAMS int number +#define ADD_VARIABLES number +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getrpcbynumber.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_aton.c =================================================================== --- ether_aton.c (nonexistent) +++ ether_aton.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +struct ether_addr * +ether_aton (const char *asc) +{ + static struct ether_addr result; + + return ether_aton_r (asc, &result); +}
ether_aton.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: network-lookup.c =================================================================== --- network-lookup.c (nonexistent) +++ network-lookup.c (revision 520) @@ -0,0 +1,23 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME networks +#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files" + +#include "XXX-lookup.c"
network-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ethers-lookup.c =================================================================== --- ethers-lookup.c (nonexistent) +++ ethers-lookup.c (revision 520) @@ -0,0 +1,22 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME ethers + +#include "XXX-lookup.c"
ethers-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pwd-lookup.c =================================================================== --- pwd-lookup.c (nonexistent) +++ pwd-lookup.c (revision 520) @@ -0,0 +1,23 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME passwd +#define DEFAULT_CONFIG "compat [NOTFOUND=return] files" + +#include "XXX-lookup.c"
pwd-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nsswitch.c =================================================================== --- nsswitch.c (nonexistent) +++ nsswitch.c (revision 520) @@ -0,0 +1,772 @@ +/* Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "local.h" + +#if !defined DO_STATIC_NSS || defined SHARED +# include +#endif + +#include "nsswitch.h" +#include "nscd/nscd_proto.h" + +/* Prototypes for the local functions. */ +static name_database *nss_parse_file (const char *fname) internal_function; +static name_database_entry *nss_getline (char *line) internal_function; +static service_user *nss_parse_service_list (const char *line) + internal_function; +static service_library *nss_new_service (name_database *database, + const char *name) internal_function; + + +/* Declare external database variables. */ +#define DEFINE_DATABASE(name) \ + extern service_user *__nss_##name##_database attribute_hidden; \ + weak_extern (__nss_##name##_database) +#include "databases.def" +#undef DEFINE_DATABASE + +/* Structure to map database name to variable. */ +static struct +{ + const char *name; + service_user **dbp; +} databases[] = +{ +#define DEFINE_DATABASE(name) \ + { #name, &__nss_##name##_database }, +#include "databases.def" +#undef DEFINE_DATABASE +}; + + +__libc_lock_define_initialized (static, lock) + +#if !defined DO_STATIC_NSS || defined SHARED +/* String with revision number of the shared object files. */ +static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15; +#endif + +/* The root of the whole data base. */ +static name_database *service_table; + + +/* -1 == database not found + 0 == database entry pointer stored */ +int +__nss_database_lookup (const char *database, const char *alternate_name, + const char *defconfig, service_user **ni) +{ + /* Prevent multiple threads to change the service table. */ + __libc_lock_lock (lock); + + /* Reconsider database variable in case some other thread called + `__nss_configure_lookup' while we waited for the lock. */ + if (*ni != NULL) + { + __libc_lock_unlock (lock); + return 0; + } + + /* Are we initialized yet? */ + if (service_table == NULL) + /* Read config file. */ + service_table = nss_parse_file (_PATH_NSSWITCH_CONF); + + /* Test whether configuration data is available. */ + if (service_table != NULL) + { + /* Return first `service_user' entry for DATABASE. */ + name_database_entry *entry; + + /* XXX Could use some faster mechanism here. But each database is + only requested once and so this might not be critical. */ + for (entry = service_table->entry; entry != NULL; entry = entry->next) + if (strcmp (database, entry->name) == 0) + *ni = entry->service; + + if (*ni == NULL && alternate_name != NULL) + /* We haven't found an entry so far. Try to find it with the + alternative name. */ + for (entry = service_table->entry; entry != NULL; entry = entry->next) + if (strcmp (alternate_name, entry->name) == 0) + *ni = entry->service; + } + + /* No configuration data is available, either because nsswitch.conf + doesn't exist or because it doesn't has a line for this database. + + DEFCONFIG specifies the default service list for this database, + or null to use the most common default. */ + if (*ni == NULL) + *ni = nss_parse_service_list (defconfig + ?: "nis [NOTFOUND=return] files"); + + __libc_lock_unlock (lock); + + return 0; +} +libc_hidden_def (__nss_database_lookup) + + +/* -1 == not found + 0 == function found + 1 == finished */ +int +__nss_lookup (service_user **ni, const char *fct_name, void **fctp) +{ + *fctp = __nss_lookup_function (*ni, fct_name); + + while (*fctp == NULL + && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE + && (*ni)->next != NULL) + { + *ni = (*ni)->next; + + *fctp = __nss_lookup_function (*ni, fct_name); + } + + return *fctp != NULL ? 0 : (*ni)->next == NULL ? 1 : -1; +} + + +/* -1 == not found + 0 == adjusted for next function + 1 == finished */ +int +__nss_next (service_user **ni, const char *fct_name, void **fctp, int status, + int all_values) +{ + if (all_values) + { + if (nss_next_action (*ni, NSS_STATUS_TRYAGAIN) == NSS_ACTION_RETURN + && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_RETURN + && nss_next_action (*ni, NSS_STATUS_NOTFOUND) == NSS_ACTION_RETURN + && nss_next_action (*ni, NSS_STATUS_SUCCESS) == NSS_ACTION_RETURN) + return 1; + } + else + { + /* This is really only for debugging. */ + if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN) + { + fprintf (stderr, "illegal status in __nss_next"); + abort(); + } + + if (nss_next_action (*ni, status) == NSS_ACTION_RETURN) + return 1; + } + + if ((*ni)->next == NULL) + return -1; + + do + { + *ni = (*ni)->next; + + *fctp = __nss_lookup_function (*ni, fct_name); + } + while (*fctp == NULL + && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE + && (*ni)->next != NULL); + + return *fctp != NULL ? 0 : -1; +} +libc_hidden_def (__nss_next) + + +int +__nss_configure_lookup (const char *dbname, const char *service_line) +{ + service_user *new_db; + size_t cnt; + + for (cnt = 0; cnt < sizeof databases; ++cnt) + { + int cmp = strcmp (dbname, databases[cnt].name); + if (cmp == 0) + break; + if (cmp < 0) + { + __set_errno (EINVAL); + return -1; + } + } + + if (cnt == sizeof databases) + { + __set_errno (EINVAL); + return -1; + } + + /* Test whether it is really used. */ + if (databases[cnt].dbp == NULL) + /* Nothing to do, but we could do. */ + return 0; + + /* Try to generate new data. */ + new_db = nss_parse_service_list (service_line); + if (new_db == NULL) + { + /* Illegal service specification. */ + __set_errno (EINVAL); + return -1; + } + + /* Prevent multiple threads to change the service table. */ + __libc_lock_lock (lock); + + /* Install new rules. */ + *databases[cnt].dbp = new_db; + + __libc_lock_unlock (lock); + + return 0; +} + + +/* Comparison function for searching NI->known tree. */ +static int +known_compare (const void *p1, const void *p2) +{ + return p1 == p2 ? 0 : strcmp (*(const char *const *) p1, + *(const char *const *) p2); +} + + +void * +__nss_lookup_function (service_user *ni, const char *fct_name) +{ + void **found, *result; + + /* We now modify global data. Protect it. */ + __libc_lock_lock (lock); + + /* Search the tree of functions previously requested. Data in the + tree are `known_function' structures, whose first member is a + `const char *', the lookup key. The search returns a pointer to + the tree node structure; the first member of the is a pointer to + our structure (i.e. what will be a `known_function'); since the + first member of that is the lookup key string, &FCT_NAME is close + enough to a pointer to our structure to use as a lookup key that + will be passed to `known_compare' (above). */ + + found = tsearch (&fct_name, (void **) &ni->known, &known_compare); + if (*found != &fct_name) + /* The search found an existing structure in the tree. */ + result = ((known_function *) *found)->fct_ptr; + else + { + /* This name was not known before. Now we have a node in the tree + (in the proper sorted position for FCT_NAME) that points to + &FCT_NAME instead of any real `known_function' structure. + Allocate a new structure and fill it in. */ + + known_function *known = malloc (sizeof *known); + if (! known) + { + remove_from_tree: + /* Oops. We can't instantiate this node properly. + Remove it from the tree. */ + tdelete (&fct_name, (void **) &ni->known, &known_compare); + result = NULL; + } + else + { + /* Point the tree node at this new structure. */ + *found = known; + known->fct_name = fct_name; + + if (ni->library == NULL) + { + /* This service has not yet been used. Fetch the service + library for it, creating a new one if need be. If there + is no service table from the file, this static variable + holds the head of the service_library list made from the + default configuration. */ + static name_database default_table; + ni->library = nss_new_service (service_table ?: &default_table, + ni->name); + if (ni->library == NULL) + { + /* This only happens when out of memory. */ + free (known); + goto remove_from_tree; + } + } + +#if !defined DO_STATIC_NSS || defined SHARED + if (ni->library->lib_handle == NULL) + { + /* Load the shared library. */ + size_t shlen = (7 + strlen (ni->library->name) + 3 + + strlen (__nss_shlib_revision) + 1); + int saved_errno = errno; + char shlib_name[shlen]; + + /* Construct shared object name. */ + stpcpy (stpcpy (stpcpy (stpcpy (shlib_name, + "libnss_"), + ni->library->name), + ".so"), + __nss_shlib_revision); + + ni->library->lib_handle = __libc_dlopen (shlib_name); + if (ni->library->lib_handle == NULL) + { + /* Failed to load the library. */ + ni->library->lib_handle = (void *) -1l; + __set_errno (saved_errno); + } + } + + if (ni->library->lib_handle == (void *) -1l) + /* Library not found => function not found. */ + result = NULL; + else + { + /* Get the desired function. */ + size_t namlen = (5 + strlen (ni->library->name) + 1 + + strlen (fct_name) + 1); + char name[namlen]; + + /* Construct the function name. */ + stpcpy (stpcpy (stpcpy (stpcpy (name, "_nss_"), + ni->library->name), + "_"), + fct_name); + + /* Look up the symbol. */ + result = __libc_dlsym (ni->library->lib_handle, name); + } +#else + /* We can't get function address dynamically in static linking. */ + { +# define DEFINE_ENT(h,nm) \ + { #h"_get"#nm"ent_r", _nss_##h##_get##nm##ent_r }, \ + { #h"_end"#nm"ent", _nss_##h##_end##nm##ent }, \ + { #h"_set"#nm"ent", _nss_##h##_set##nm##ent }, +# define DEFINE_GET(h,nm) \ + { #h"_get"#nm"_r", _nss_##h##_get##nm##_r }, +# define DEFINE_GETBY(h,nm,ky) \ + { #h"_get"#nm"by"#ky"_r", _nss_##h##_get##nm##by##ky##_r }, + static struct fct_tbl { const char *fname; void *fp; } *tp, tbl[] = + { +# include "function.def" + { NULL, NULL } + }; + size_t namlen = (5 + strlen (ni->library->name) + 1 + + strlen (fct_name) + 1); + char name[namlen]; + + /* Construct the function name. */ + stpcpy (stpcpy (stpcpy (name, ni->library->name), + "_"), + fct_name); + + result = NULL; + for (tp = &tbl[0]; tp->fname; tp++) + if (strcmp (tp->fname, name) == 0) + { + result = tp->fp; + break; + } + } +#endif + + /* Remember function pointer for later calls. Even if null, we + record it so a second try needn't search the library again. */ + known->fct_ptr = result; + } + } + + /* Remove the lock. */ + __libc_lock_unlock (lock); + + return result; +} +libc_hidden_def (__nss_lookup_function) + + +static name_database * +internal_function +nss_parse_file (const char *fname) +{ + FILE *fp; + name_database *result; + name_database_entry *last; + char *line; + size_t len; + + /* Open the configuration file. */ + fp = fopen (fname, "rc"); + if (fp == NULL) + return NULL; + + /* No threads use this stream. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); + + result = (name_database *) malloc (sizeof (name_database)); + if (result == NULL) + return NULL; + + result->entry = NULL; + result->library = NULL; + last = NULL; + line = NULL; + len = 0; + do + { + name_database_entry *this; + ssize_t n; + char *tmp; + + n = __getline (&line, &len, fp); + if (n < 0) + break; + if (line[n - 1] == '\n') + line[n - 1] = '\0'; + + /* Because the file format does not know any form of quoting we + can search forward for the next '#' character and if found + make it terminating the line. */ + tmp = strchr (line, '#'); + if (tmp == NULL) + tmp = line + strlen (line); + *tmp = '\0'; + + /* If the line is blank it is ignored. */ + if (line[0] == '\0') + continue; + + /* Each line completely specifies the actions for a database. */ + this = nss_getline (line); + if (this != NULL) + { + if (last != NULL) + last->next = this; + else + result->entry = this; + + last = this; + } + } + while (!feof (fp)); + + /* Free the buffer. */ + free (line); + /* Close configuration file. */ + fclose (fp); + + return result; +} + + +/* Read the source names: + `( ( "[" "!"? ( "=" )+ "]" )? )*' + */ +static service_user * +internal_function +nss_parse_service_list (const char *line) +{ + service_user *result = NULL, **nextp = &result; + + while (1) + { + service_user *new_service; + const char *name; + + while (isspace (line[0])) + ++line; + if (line[0] == '\0') + /* No source specified. */ + return result; + + /* Read identifier. */ + name = line; + while (line[0] != '\0' && !isspace (line[0]) && line[0] != '[') + ++line; + if (name == line) + return result; + + + new_service = (service_user *) malloc (sizeof (service_user) + + (line - name + 1)); + if (new_service == NULL) + return result; + + *((char *) mempcpy (new_service->name, name, line - name)) = '\0'; + + /* Set default actions. */ + new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE; + new_service->actions[2 + NSS_STATUS_UNAVAIL] = NSS_ACTION_CONTINUE; + new_service->actions[2 + NSS_STATUS_NOTFOUND] = NSS_ACTION_CONTINUE; + new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN; + new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN; + new_service->library = NULL; + new_service->known = NULL; + new_service->next = NULL; + + while (isspace (line[0])) + ++line; + + if (line[0] == '[') + { + /* Read criterions. */ + do + ++line; + while (line[0] != '\0' && isspace (line[0])); + + do + { + int not; + enum nss_status status; + lookup_actions action; + + /* Grok ! before name to mean all statii but that one. */ + not = line[0] == '!'; + if (not) + ++line; + + /* Read status name. */ + name = line; + while (line[0] != '\0' && !isspace (line[0]) && line[0] != '=' + && line[0] != ']') + ++line; + + /* Compare with known statii. */ + if (line - name == 7) + { + if (strncasecmp (name, "SUCCESS", 7) == 0) + status = NSS_STATUS_SUCCESS; + else if (strncasecmp (name, "UNAVAIL", 7) == 0) + status = NSS_STATUS_UNAVAIL; + else + return result; + } + else if (line - name == 8) + { + if (strncasecmp (name, "NOTFOUND", 8) == 0) + status = NSS_STATUS_NOTFOUND; + else if (strncasecmp (name, "TRYAGAIN", 8) == 0) + status = NSS_STATUS_TRYAGAIN; + else + return result; + } + else + return result; + + while (isspace (line[0])) + ++line; + if (line[0] != '=') + return result; + do + ++line; + while (isspace (line[0])); + + name = line; + while (line[0] != '\0' && !isspace (line[0]) && line[0] != '=' + && line[0] != ']') + ++line; + + if (line - name == 6 && strncasecmp (name, "RETURN", 6) == 0) + action = NSS_ACTION_RETURN; + else if (line - name == 8 + && strncasecmp (name, "CONTINUE", 8) == 0) + action = NSS_ACTION_CONTINUE; + else + return result; + + if (not) + { + /* Save the current action setting for this status, + set them all to the given action, and reset this one. */ + const lookup_actions save = new_service->actions[2 + status]; + new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action; + new_service->actions[2 + NSS_STATUS_UNAVAIL] = action; + new_service->actions[2 + NSS_STATUS_NOTFOUND] = action; + new_service->actions[2 + NSS_STATUS_SUCCESS] = action; + new_service->actions[2 + status] = save; + } + else + new_service->actions[2 + status] = action; + + /* Skip white spaces. */ + while (isspace (line[0])) + ++line; + } + while (line[0] != ']'); + + /* Skip the ']'. */ + ++line; + } + + *nextp = new_service; + nextp = &new_service->next; + } +} + +static name_database_entry * +internal_function +nss_getline (char *line) +{ + const char *name; + name_database_entry *result; + size_t len; + + /* Ignore leading white spaces. ATTENTION: this is different from + what is implemented in Solaris. The Solaris man page says a line + beginning with a white space character is ignored. We regard + this as just another misfeature in Solaris. */ + while (isspace (line[0])) + ++line; + + /* Recognize ` ":"'. */ + name = line; + while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':') + ++line; + if (line[0] == '\0' || name == line) + /* Syntax error. */ + return NULL; + *line++ = '\0'; + + len = strlen (name) + 1; + + result = (name_database_entry *) malloc (sizeof (name_database_entry) + len); + if (result == NULL) + return NULL; + + /* Save the database name. */ + memcpy (result->name, name, len); + + /* Parse the list of services. */ + result->service = nss_parse_service_list (line); + + result->next = NULL; + return result; +} + + +static service_library * +internal_function +nss_new_service (name_database *database, const char *name) +{ + service_library **currentp = &database->library; + + while (*currentp != NULL) + { + if (strcmp ((*currentp)->name, name) == 0) + return *currentp; + currentp = &(*currentp)->next; + } + + /* We have to add the new service. */ + *currentp = (service_library *) malloc (sizeof (service_library)); + if (*currentp == NULL) + return NULL; + + (*currentp)->name = name; + (*currentp)->lib_handle = NULL; + (*currentp)->next = NULL; + + return *currentp; +} + + +#ifdef USE_NSCD +/* Called by nscd and nscd alone. */ +void +__nss_disable_nscd (void) +{ + /* Disable all uses of NSCD. */ + __nss_not_use_nscd_passwd = -1; + __nss_not_use_nscd_group = -1; + __nss_not_use_nscd_hosts = -1; +} +#endif + + +/* Free all resources if necessary. */ +libc_freeres_fn (free_mem) +{ + name_database *top = service_table; + name_database_entry *entry; + service_library *library; + + if (top == NULL) + /* Maybe we have not read the nsswitch.conf file. */ + return; + + /* Don't disturb ongoing other threads (if there are any). */ + service_table = NULL; + + entry = top->entry; + while (entry != NULL) + { + name_database_entry *olde = entry; + service_user *service = entry->service; + + while (service != NULL) + { + service_user *olds = service; + + if (service->known != NULL) + tdestroy (service->known, free); + + service = service->next; + free (olds); + } + + entry = entry->next; + free (olde); + } + + library = top->library; + while (library != NULL) + { + service_library *oldl = library; + + if (library->lib_handle && library->lib_handle != (void *) -1l) + __libc_dlclose (library->lib_handle); + + library = library->next; + free (oldl); + } + + free (top); +}
nsswitch.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getproto.c =================================================================== --- getproto.c (nonexistent) +++ getproto.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct protoent +#define FUNCTION_NAME getprotobynumber +#define DATABASE_NAME protocols +#define ADD_PARAMS int proto +#define ADD_VARIABLES proto +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getproto.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: databases.def =================================================================== --- databases.def (nonexistent) +++ databases.def (revision 520) @@ -0,0 +1,40 @@ +/* List of all databases defined for the NSS in GNU C Library. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This list must be kept sorted!!! */ + +DEFINE_DATABASE (aliases) +DEFINE_DATABASE (ethers) +DEFINE_DATABASE (group) +DEFINE_DATABASE (hosts) +DEFINE_DATABASE (netgroup) +DEFINE_DATABASE (networks) +DEFINE_DATABASE (passwd) +DEFINE_DATABASE (protocols) +DEFINE_DATABASE (publickey) +DEFINE_DATABASE (rpc) +DEFINE_DATABASE (services) +DEFINE_DATABASE (shadow) + +/* + Local Variables: + mode:C + End: + */ Index: gethstbynm2.c =================================================================== --- gethstbynm2.c (nonexistent) +++ gethstbynm2.c (revision 520) @@ -0,0 +1,39 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +#define LOOKUP_TYPE struct hostent +#define FUNCTION_NAME gethostbyname2 +#define DATABASE_NAME hosts +#define ADD_PARAMS const char *name, int af +#define ADD_VARIABLES name, af +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#define HANDLE_DIGITS_DOTS 1 +#define HAVE_AF 1 + +#include "getXXbyYY.c"
gethstbynm2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nsswitch.h =================================================================== --- nsswitch.h (nonexistent) +++ nsswitch.h (revision 520) @@ -0,0 +1,180 @@ +/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NSSWITCH_H +#define _NSSWITCH_H 1 + +/* This is an *internal* header. */ + +#include +#include +#include +#include +#include +#include +#include + +/* Actions performed after lookup finished. */ +typedef enum +{ + NSS_ACTION_CONTINUE, + NSS_ACTION_RETURN +} lookup_actions; + + +typedef struct service_library +{ + /* Name of service (`files', `dns', `nis', ...). */ + const char *name; + /* Pointer to the loaded shared library. */ + void *lib_handle; + /* And the link to the next entry. */ + struct service_library *next; +} service_library; + + +/* For mapping a function name to a function pointer. It is known in + nsswitch.c:nss_lookup_function that a string pointer for the lookup key + is the first member. */ +typedef struct +{ + const char *fct_name; + void *fct_ptr; +} known_function; + + +typedef struct service_user +{ + /* And the link to the next entry. */ + struct service_user *next; + /* Action according to result. */ + lookup_actions actions[5]; + /* Link to the underlying library object. */ + service_library *library; + /* Collection of known functions. */ + struct entry *known; + /* Name of the service (`files', `dns', `nis', ...). */ + char name[0]; +} service_user; + +/* To access the action based on the status value use this macro. */ +#define nss_next_action(ni, status) ((ni)->actions[2 + status]) + + +typedef struct name_database_entry +{ + /* And the link to the next entry. */ + struct name_database_entry *next; + /* List of service to be used. */ + service_user *service; + /* Name of the database. */ + char name[0]; +} name_database_entry; + + +typedef struct name_database +{ + /* List of all known databases. */ + name_database_entry *entry; + /* List of libraries with service implementation. */ + service_library *library; +} name_database; + + +/* Interface functions for NSS. */ + +/* Get the data structure representing the specified database. + If there is no configuration for this database in the file, + parse a service list from DEFCONFIG and use that. More + than one function can use the database. */ +extern int __nss_database_lookup (const char *database, + const char *alternative_name, + const char *defconfig, service_user **ni); +libc_hidden_proto (__nss_database_lookup) + +/* Put first function with name FCT_NAME for SERVICE in FCTP. The + position is remembered in NI. The function returns a value < 0 if + an error occurred or no such function exists. */ +extern int __nss_lookup (service_user **ni, const char *fct_name, void **fctp); + +/* Determine the next step in the lookup process according to the + result STATUS of the call to the last function returned by + `__nss_lookup' or `__nss_next'. NI specifies the last function + examined. The function return a value > 0 if the process should + stop with the last result of the last function call to be the + result of the entire lookup. The returned value is 0 if there is + another function to use and < 0 if an error occurred. + + If ALL_VALUES is nonzero, the return value will not be > 0 as long as + there is a possibility the lookup process can ever use following + services. In other words, only if all four lookup results have + the action RETURN associated the lookup process stops before the + natural end. */ +extern int __nss_next (service_user **ni, const char *fct_name, void **fctp, + int status, int all_values); +libc_hidden_proto (__nss_next) + +/* Search for the service described in NI for a function named FCT_NAME + and return a pointer to this function if successful. */ +extern void *__nss_lookup_function (service_user *ni, const char *fct_name); +libc_hidden_proto (__nss_lookup_function) + + +/* Called by NSCD to disable recursive calls. */ +extern void __nss_disable_nscd (void); + + +typedef int (*db_lookup_function) (service_user **, const char *, void **) + internal_function; +typedef enum nss_status (*setent_function) (int); +typedef enum nss_status (*endent_function) (void); +typedef enum nss_status (*getent_function) (void *, char *, size_t, + int *, int *); +typedef int (*getent_r_function) (void *, char *, size_t, + void **result, int *); + +extern void __nss_setent (const char *func_name, + db_lookup_function lookup_fct, + service_user **nip, service_user **startp, + service_user **last_nip, int stayon, + int *stayon_tmp, int res); +extern void __nss_endent (const char *func_name, + db_lookup_function lookup_fct, + service_user **nip, service_user **startp, + service_user **last_nip, int res); +extern int __nss_getent_r (const char *getent_func_name, + const char *setent_func_name, + db_lookup_function lookup_fct, + service_user **nip, service_user **startp, + service_user **last_nip, int *stayon_tmp, + int res, + void *resbuf, char *buffer, size_t buflen, + void **result, int *h_errnop); +extern void *__nss_getent (getent_r_function func, + void **resbuf, char **buffer, size_t buflen, + size_t *buffer_size, int *h_errnop); +struct hostent; +extern int __nss_hostname_digits_dots (const char *name, + struct hostent *resbuf, char **buffer, + size_t *buffer_size, size_t buflen, + struct hostent **result, + enum nss_status *status, int af, + int *h_errnop); +libc_hidden_proto (__nss_hostname_digits_dots) + +#endif /* nsswitch.h */
nsswitch.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_ntoa_r.c =================================================================== --- ether_ntoa_r.c (nonexistent) +++ ether_ntoa_r.c (revision 520) @@ -0,0 +1,34 @@ +/* Copyright (C) 1996,97,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + + +char * +ether_ntoa_r (const struct ether_addr *addr, char *buf) +{ + sprintf (buf, "%x:%x:%x:%x:%x:%x", + addr->ether_addr_octet[0], addr->ether_addr_octet[1], + addr->ether_addr_octet[2], addr->ether_addr_octet[3], + addr->ether_addr_octet[4], addr->ether_addr_octet[5]); + return buf; +} +libc_hidden_def (ether_ntoa_r)
ether_ntoa_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_mkadr.c =================================================================== --- inet_mkadr.c (nonexistent) +++ inet_mkadr.c (revision 520) @@ -0,0 +1,60 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include "libc-symbols.h" + +/* + * Formulate an Internet address from network + host. Used in + * building addresses stored in the ifnet structure. + */ +struct in_addr +inet_makeaddr(net, host) + in_addr_t net, host; +{ + struct in_addr in; + + if (net < 128) + in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); + else if (net < 65536) + in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); + else if (net < 16777216L) + in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); + else + in.s_addr = net | host; + in.s_addr = htonl(in.s_addr); + return in; +} +libc_hidden_def (inet_makeaddr)
inet_mkadr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetent_r.c =================================================================== --- getnetent_r.c (nonexistent) +++ getnetent_r.c (revision 520) @@ -0,0 +1,32 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct netent +#define SETFUNC_NAME setnetent +#define GETFUNC_NAME getnetent +#define ENDFUNC_NAME endnetent +#define DATABASE_NAME networks +#define STAYOPEN int stayopen +#define STAYOPEN_VAR stayopen +#define NEED__RES 1 +#define NEED_H_ERRNO 1 + +#include "getXXent_r.c"
getnetent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifaddrs.h =================================================================== --- ifaddrs.h (nonexistent) +++ ifaddrs.h (revision 520) @@ -0,0 +1,74 @@ +/* ifaddrs.h -- declarations for getting network interface addresses + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _IFADDRS_H +#define _IFADDRS_H 1 + +#include +#include + +__BEGIN_DECLS + +/* The `getifaddrs' function generates a linked list of these structures. + Each element of the list describes one network interface. */ +struct ifaddrs +{ + struct ifaddrs *ifa_next; /* Pointer to the next structure. */ + + char *ifa_name; /* Name of this network interface. */ + unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */ + + struct sockaddr *ifa_addr; /* Network address of this interface. */ + struct sockaddr *ifa_netmask; /* Netmask of this interface. */ + union + { + /* At most one of the following two is valid. If the IFF_BROADCAST + bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the + IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid. + It is never the case that both these bits are set at once. */ + struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */ + struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */ + } ifa_ifu; + /* These very same macros are defined by for `struct ifaddr'. + So if they are defined already, the existing definitions will be fine. */ +# ifndef ifa_broadaddr +# define ifa_broadaddr ifa_ifu.ifu_broadaddr +# endif +# ifndef ifa_dstaddr +# define ifa_dstaddr ifa_ifu.ifu_dstaddr +# endif + + void *ifa_data; /* Address-specific data (may be unused). */ +}; + + +/* Create a linked list of `struct ifaddrs' structures, one for each + network interface on the host machine. If successful, store the + list in *IFAP and return 0. On errors, return -1 and set `errno'. + + The storage returned in *IFAP is allocated dynamically and can + only be properly freed by passing it to `freeifaddrs'. */ +extern int getifaddrs (struct ifaddrs **__ifap) __THROW; + +/* Reclaim the storage allocated by a previous `getifaddrs' call. */ +extern void freeifaddrs (struct ifaddrs *__ifa) __THROW; + +__END_DECLS + +#endif /* ifaddrs.h */
ifaddrs.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: un-namespace.h =================================================================== --- un-namespace.h (nonexistent) +++ un-namespace.h (revision 520) @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2001 Daniel Eischen . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/include/un-namespace.h,v 1.7 2002/03/29 22:43:42 markm Exp $ + */ + +#ifndef _UN_NAMESPACE_H_ +#define _UN_NAMESPACE_H_ + +#undef accept +#undef __acl_aclcheck_fd +#undef __acl_delete_fd +#undef __acl_get_fd +#undef __acl_set_fd +#undef bind +#undef __cap_get_fd +#undef __cap_set_fd +#undef close +#undef connect +#undef dup +#undef dup2 +#undef execve +#undef fcntl +#undef flock +#undef fstat +#undef fstatfs +#undef fsync +#undef getdirentries +#undef getlogin +#undef getpeername +#undef getprogname +#undef getsockname +#undef getsockopt +#undef ioctl +#undef listen +#undef nanosleep +#undef open +#undef pthread_getspecific +#undef pthread_key_create +#undef pthread_key_delete +#undef pthread_mutex_destroy +#undef pthread_mutex_init +#undef pthread_mutex_lock +#undef pthread_mutex_trylock +#undef pthread_mutex_unlock +#undef pthread_mutexattr_init +#undef pthread_mutexattr_destroy +#undef pthread_mutexattr_settype +#undef pthread_once +#undef pthread_self +#undef pthread_setspecific +#undef read +#undef readv +#undef recvfrom +#undef recvmsg +#undef select +#undef sendmsg +#undef sendto +#undef setsockopt +#undef sigaction +#undef sigprocmask +#undef sigsuspend +#undef socket +#undef socketpair +#undef wait4 +#undef write +#undef writev + +#if 0 +#undef creat +#undef fchflags +#undef fchmod +#undef fpathconf +#undef msync +#undef nfssvc +#undef pause +#undef poll +#undef pthread_rwlock_destroy +#undef pthread_rwlock_init +#undef pthread_rwlock_rdlock +#undef pthread_rwlock_tryrdlock +#undef pthread_rwlock_trywrlock +#undef pthread_rwlock_unlock +#undef pthread_rwlock_wrlock +#undef pthread_rwlockattr_init +#undef pthread_rwlockattr_destroy +#undef sched_yield +#undef sendfile +#undef shutdown +#undef sigaltstack +#undef sigpending +#undef sigreturn +#undef sigsetmask +#undef sleep +#undef system +#undef tcdrain +#undef wait +#undef waitpid +#endif /* 0 */ + +#ifdef _SIGNAL_H_ +int _sigaction(int, const struct sigaction *, struct sigaction *); +#endif + +#ifdef _SYS_FCNTL_H_ +int _flock(int, int); +#endif + +#undef err +#undef warn + +#endif /* _UN_NAMESPACE_H_ */
un-namespace.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_libc.c =================================================================== --- res_libc.c (nonexistent) +++ res_libc.c (revision 520) @@ -0,0 +1,166 @@ +/* + * Copyright (c) 1995-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libc-symbols.h" + + +/* The following bit is copied from res_data.c (where it is #ifdef'ed + out) since res_init() should go into libc.so but the rest of that + file should not. */ + +extern unsigned long long int __res_initstamp attribute_hidden; +/* We have atomic increment operations on 64-bit platforms. */ +#if __WORDSIZE == 64 +# define atomicinclock(lock) (void) 0 +# define atomicincunlock(lock) (void) 0 +# define atomicinc(var) atomic_increment (&(var)) +#else +__libc_lock_define_initialized (static, lock); +# define atomicinclock(lock) __libc_lock_lock (lock) +# define atomicincunlock(lock) __libc_lock_unlock (lock) +# define atomicinc(var) ++var +#endif + +int +res_init(void) { + extern int __res_vinit(res_state, int); + + /* + * These three fields used to be statically initialized. This made + * it hard to use this code in a shared library. It is necessary, + * now that we're doing dynamic initialization here, that we preserve + * the old semantics: if an application modifies one of these three + * fields of _res before res_init() is called, res_init() will not + * alter them. Of course, if an application is setting them to + * _zero_ before calling res_init(), hoping to override what used + * to be the static default, we can't detect it and unexpected results + * will follow. Zero for any of these fields would make no sense, + * so one can safely assume that the applications were already getting + * unexpected results. + * + * _res.options is tricky since some apps were known to diddle the bits + * before res_init() was first called. We can't replicate that semantic + * with dynamic initialization (they may have turned bits off that are + * set in RES_DEFAULT). Our solution is to declare such applications + * "broken". They could fool us by setting RES_INIT but none do (yet). + */ + if (!_res.retrans) + _res.retrans = RES_TIMEOUT; + if (!_res.retry) + _res.retry = 4; + if (!(_res.options & RES_INIT)) + _res.options = RES_DEFAULT; + else if (_res.nscount > 0) { + __res_nclose (&_res); /* Close any VC sockets. */ + int ns; + for (ns = 0; ns < MAXNS; ns++) { + free (_res._u._ext.nsaddrs[ns]); + _res._u._ext.nsaddrs[ns] = NULL; + } + } + + /* + * This one used to initialize implicitly to zero, so unless the app + * has set it to something in particular, we can randomize it now. + */ + if (!_res.id) + _res.id = res_randomid(); + + atomicinclock (lock); + /* Request all threads to re-initialize their resolver states, + resolv.conf might have changed. */ + atomicinc (__res_initstamp); + atomicincunlock (lock); + + return (__res_vinit(&_res, 1)); +} + +/* Initialize resp if RES_INIT is not yet set or if res_init in some other + thread requested re-initializing. */ +int +__res_maybe_init (res_state resp, int preinit) +{ + if (resp->options & RES_INIT) { + if (__res_initstamp != resp->_u._ext.initstamp) { + if (resp->nscount > 0) { + __res_nclose (resp); + int ns; + for (ns = 0; ns < MAXNS; ns++) { + free (resp->_u._ext.nsaddrs[ns]); + resp->_u._ext.nsaddrs[ns] = NULL; + } + return __res_vinit (resp, 1); + } + } + return 0; + } else if (preinit) { + if (!resp->retrans) + resp->retrans = RES_TIMEOUT; + if (!resp->retry) + resp->retry = 4; + resp->options = RES_DEFAULT; + if (!resp->id) + resp->id = res_randomid (); + return __res_vinit (resp, 1); + } else + return __res_ninit (resp); +} +libc_hidden_def (__res_maybe_init) + +/* This needs to be after the use of _res in res_init, above. */ +#undef _res + +/* The resolver state for use by single-threaded programs. + This differs from plain `struct __res_state _res;' in that it doesn't + create a common definition, but a plain symbol that resides in .bss, + which can have an alias. */ +struct __res_state _res __attribute__((section (".bss"))); + +#define USE___THREAD 1 + +#if USE___THREAD +#undef __resp +__thread struct __res_state *__resp = &_res; +extern __thread struct __res_state *__libc_resp + __attribute__ ((alias ("__resp"))) attribute_hidden; +#endif + +/* We declare this with compat_symbol so that it's not + visible at link time. Programs must use the accessor functions. */ +#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING +# include +compat_symbol (libc, _res, _res, GLIBC_2_0); +#endif + +#include + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2) +# undef res_init +extern int __res_init_weak (void); +weak_extern (__res_init_weak); +strong_alias (__res_init, __res_init_weak); +compat_symbol (libc, __res_init_weak, res_init, GLIBC_2_0); +#endif
res_libc.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: aliases.h =================================================================== --- aliases.h (nonexistent) +++ aliases.h (revision 520) @@ -0,0 +1,64 @@ +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _ALIASES_H +#define _ALIASES_H 1 + +#include + +#include + + +__BEGIN_DECLS + +/* Structure to represent one entry of the alias data base. */ +struct aliasent + { + char *alias_name; + size_t alias_members_len; + char **alias_members; + int alias_local; + }; + + +/* Open alias data base files. */ +extern void setaliasent (void) __THROW; + +/* Close alias data base files. */ +extern void endaliasent (void) __THROW; + +/* Get the next entry from the alias data base. */ +extern struct aliasent *getaliasent (void) __THROW; + +/* Get the next entry from the alias data base and put it in RESULT_BUF. */ +extern int getaliasent_r (struct aliasent *__restrict __result_buf, + char *__restrict __buffer, size_t __buflen, + struct aliasent **__restrict __result) __THROW; + +/* Get alias entry corresponding to NAME. */ +extern struct aliasent *getaliasbyname (__const char *__name) __THROW; + +/* Get alias entry corresponding to NAME and put it in RESULT_BUF. */ +extern int getaliasbyname_r (__const char *__restrict __name, + struct aliasent *__restrict __result_buf, + char *__restrict __buffer, size_t __buflen, + struct aliasent **__restrict __result) __THROW; + +__END_DECLS + +#endif /* aliases.h */
aliases.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: not-cancel.h =================================================================== --- not-cancel.h (nonexistent) +++ not-cancel.h (revision 520) @@ -0,0 +1,53 @@ +/* Uncancelable versions of cancelable interfaces. Linux version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include + +/* Uncancelable open. */ +#define open_not_cancel(name, flags, mode) open((name), (flags), (mode)) +#define open_not_cancel_2(name, flags) open((name), (flags)) + +/* Uncancelable close. */ +#define close_not_cancel(fd) close((fd)) +#define close_not_cancel_no_status(fd) (void)close((fd)) + +/* Uncancelable read. */ +#define read_not_cancel(fd, buf, n) read((fd), (buf), (n)) + +/* Uncancelable write. */ +#define write_not_cancel(fd, buf, n) write((fd), (buf), (n)) + +/* Uncancelable writev. */ +#define writev_not_cancel_no_status(fd, iov, n) \ + (void) writev((fd), (iov), (n)) + +/* Uncancelable fcntl. */ +#define fcntl_not_cancel(fd, cmd, val) fcntl((fd), (cmd), (val)) + +/* Uncancelable waitpid. */ +#ifdef __NR_waitpid +# define waitpid_not_cancel(pid, stat_loc, options) \ + waitpid((pid), (stat_loc), (options)) +#else +# define waitpid_not_cancel(pid, stat_loc, options) \ + wait4((pid), (stat_loc), (options), NULL) +#endif
not-cancel.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_ntop.c =================================================================== --- inet_ntop.c (nonexistent) +++ inet_ntop.c (revision 520) @@ -0,0 +1,200 @@ +/* Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char rcsid[] = "$Id$"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SPRINTF(x) ((socklen_t)sprintf x) + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size); +static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +const char * +inet_ntop(af, src, dst, size) + int af; + const void *src; + char *dst; + socklen_t size; +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: + errno = EAFNOSUPPORT; + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address, more or less like inet_ntoa() + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(src, dst, size) + const u_char *src; + char *dst; + socklen_t size; +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + + if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(src, dst, size) + const u_char *src; + char *dst; + socklen_t size; +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp; + struct { int base, len; } best, cur; + u_int words[NS_IN6ADDRSZ / NS_INT16SZ]; + int i; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < NS_IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + cur.base = -1; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) + *tp++ = ':'; + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *tp++ = ':'; + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) + return (NULL); + tp += strlen(tp); + break; + } + tp += SPRINTF((tp, "%x", words[i])); + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == + (NS_IN6ADDRSZ / NS_INT16SZ)) + *tp++ = ':'; + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((socklen_t)(tp - tmp) > size) { + errno = ENOSPC; + return (NULL); + } + strcpy(dst, tmp); + return (dst); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_ntop +__weak_reference(__inet_ntop, inet_ntop);
inet_ntop.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: alias-lookup.c =================================================================== --- alias-lookup.c (nonexistent) +++ alias-lookup.c (revision 520) @@ -0,0 +1,22 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME aliases + +#include "XXX-lookup.c"
alias-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns_netint.c =================================================================== --- ns_netint.c (nonexistent) +++ ns_netint.c (revision 520) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_netint.c,v 8.4 1999/10/13 16:39:35 vixie Exp $"; +#endif + +/* Import. */ + +#include +#include +#include "libc-symbols.h" + +/* Public. */ + +u_int +ns_get16(const u_char *src) { + u_int dst; + + NS_GET16(dst, src); + return (dst); +} +libresolv_hidden_def (ns_get16) + +u_long +ns_get32(const u_char *src) { + u_long dst; + + NS_GET32(dst, src); + return (dst); +} +libresolv_hidden_def (ns_get32) + +void +ns_put16(u_int src, u_char *dst) { + NS_PUT16(src, dst); +} + +void +ns_put32(u_long src, u_char *dst) { + NS_PUT32(src, dst); +}
ns_netint.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getrpcbyname_r.c =================================================================== --- getrpcbyname_r.c (nonexistent) +++ getrpcbyname_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct rpcent +#define FUNCTION_NAME getrpcbyname +#define DATABASE_NAME rpc +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name + +#include "getXXbyYY_r.c"
getrpcbyname_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns_ttl.c =================================================================== --- ns_ttl.c (nonexistent) +++ ns_ttl.c (revision 520) @@ -0,0 +1,161 @@ +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_ttl.c,v 8.8 1999/10/13 16:39:36 vixie Exp $"; +#endif + +/* Import. */ + +#include + +#include +#include +#include +#include + +#include "libc-symbols.h" + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +/* Forward. */ + +static int fmt1(int t, char s, char **buf, size_t *buflen); + +/* Macros. */ + +#define T(x) if ((x) < 0) return (-1); else (void)NULL + +/* Public. */ + +int +ns_format_ttl(u_long src, char *dst, size_t dstlen) { + char *odst = dst; + int secs, mins, hours, days, weeks, x; + char *p; + + secs = src % 60; src /= 60; + mins = src % 60; src /= 60; + hours = src % 24; src /= 24; + days = src % 7; src /= 7; + weeks = src; src = 0; + + x = 0; + if (weeks) { + T(fmt1(weeks, 'W', &dst, &dstlen)); + x++; + } + if (days) { + T(fmt1(days, 'D', &dst, &dstlen)); + x++; + } + if (hours) { + T(fmt1(hours, 'H', &dst, &dstlen)); + x++; + } + if (mins) { + T(fmt1(mins, 'M', &dst, &dstlen)); + x++; + } + if (secs || !(weeks || days || hours || mins)) { + T(fmt1(secs, 'S', &dst, &dstlen)); + x++; + } + + if (x > 1) { + int ch; + + for (p = odst; (ch = *p) != '\0'; p++) + if (isascii(ch) && isupper(ch)) + *p = tolower(ch); + } + + return (dst - odst); +} + +#ifndef SHARED +// Seems not to be needed. It's not exported from the DSO. Some libresolv.a +// might depend on it so we let it in. +int +ns_parse_ttl(const char *src, u_long *dst) { + u_long ttl, tmp; + int ch, digits, dirty; + + ttl = 0; + tmp = 0; + digits = 0; + dirty = 0; + while ((ch = *src++) != '\0') { + if (!isascii(ch) || !isprint(ch)) + goto einval; + if (isdigit(ch)) { + tmp *= 10; + tmp += (ch - '0'); + digits++; + continue; + } + if (digits == 0) + goto einval; + if (islower(ch)) + ch = toupper(ch); + switch (ch) { + case 'W': tmp *= 7; + case 'D': tmp *= 24; + case 'H': tmp *= 60; + case 'M': tmp *= 60; + case 'S': break; + default: goto einval; + } + ttl += tmp; + tmp = 0; + digits = 0; + dirty = 1; + } + if (digits > 0) { + if (dirty) + goto einval; + else + ttl += tmp; + } + *dst = ttl; + return (0); + + einval: + __set_errno (EINVAL); + return (-1); +} +#endif + +/* Private. */ + +static int +fmt1(int t, char s, char **buf, size_t *buflen) { + char tmp[50]; + size_t len; + + len = SPRINTF((tmp, "%d%c", t, s)); + if (len + 1 > *buflen) + return (-1); + strcpy(*buf, tmp); + *buf += len; + *buflen -= len; + return (0); +}
ns_ttl.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_aton_r.c =================================================================== --- ether_aton_r.c (nonexistent) +++ ether_aton_r.c (revision 520) @@ -0,0 +1,64 @@ +/* Copyright (C) 1996,97,98,99,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + + +struct ether_addr * +ether_aton_r (const char *asc, struct ether_addr *addr) +{ + size_t cnt; + + for (cnt = 0; cnt < 6; ++cnt) + { + unsigned int number; + char ch; + + ch = _tolower (*asc++); + if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f')) + return NULL; + number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10); + + ch = _tolower (*asc); + if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch))) + { + ++asc; + if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f')) + return NULL; + number <<= 4; + number += isdigit (ch) ? (ch - '0') : (ch - 'a' + 10); + + ch = *asc; + if (cnt < 5 && ch != ':') + return NULL; + } + + /* Store result. */ + addr->ether_addr_octet[cnt] = (unsigned char) number; + + /* Skip ':'. */ + ++asc; + } + + return addr; +} +libc_hidden_def (ether_aton_r)
ether_aton_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getrpcbynumber_r.c =================================================================== --- getrpcbynumber_r.c (nonexistent) +++ getrpcbynumber_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct rpcent +#define FUNCTION_NAME getrpcbynumber +#define DATABASE_NAME rpc +#define ADD_PARAMS int number +#define ADD_VARIABLES number + +#include "getXXbyYY_r.c"
getrpcbynumber_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: proto-lookup.c =================================================================== --- proto-lookup.c (nonexistent) +++ proto-lookup.c (revision 520) @@ -0,0 +1,22 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME protocols + +#include "XXX-lookup.c"
proto-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: digits_dots.c =================================================================== --- digits_dots.c (nonexistent) +++ digits_dots.c (revision 520) @@ -0,0 +1,317 @@ +/* Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by H.J. Lu , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nsswitch.h" + +#ifdef USE_NSCD +# define inet_aton __inet_aton +# include +#endif + +int +__nss_hostname_digits_dots (const char *name, struct hostent *resbuf, + char **buffer, size_t *buffer_size, + size_t buflen, struct hostent **result, + enum nss_status *status, int af, int *h_errnop) +{ + int save; + + /* We have to test for the use of IPv6 which can only be done by + examining `_res'. */ + if (__res_maybe_init (&_res, 0) == -1) + { + if (h_errnop) + *h_errnop = NETDB_INTERNAL; + *result = NULL; + return -1; + } + + /* + * disallow names consisting only of digits/dots, unless + * they end in a dot. + */ + if (isdigit (name[0]) || isxdigit (name[0]) || name[0] == ':') + { + const char *cp; + char *hostname; + typedef unsigned char host_addr_t[16]; + host_addr_t *host_addr; + typedef char *host_addr_list_t[2]; + host_addr_list_t *h_addr_ptrs; + char **h_alias_ptr; + size_t size_needed; + int addr_size; + + switch (af) + { + case AF_INET: + addr_size = INADDRSZ; + break; + + case AF_INET6: + addr_size = IN6ADDRSZ; + break; + + default: + af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET; + addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ; + break; + } + + size_needed = (sizeof (*host_addr) + + sizeof (*h_addr_ptrs) + strlen (name) + 1); + + if (buffer_size == NULL) + { + if (buflen < size_needed) + { + if (h_errnop != NULL) + *h_errnop = TRY_AGAIN; + __set_errno (ERANGE); + goto done; + } + } + else if (buffer_size != NULL && *buffer_size < size_needed) + { + char *new_buf; + *buffer_size = size_needed; + new_buf = (char *) realloc (*buffer, *buffer_size); + + if (new_buf == NULL) + { + save = errno; + free (*buffer); + *buffer = NULL; + *buffer_size = 0; + __set_errno (save); + if (h_errnop != NULL) + *h_errnop = TRY_AGAIN; + *result = NULL; + goto done; + } + *buffer = new_buf; + } + + memset (*buffer, '\0', size_needed); + + host_addr = (host_addr_t *) *buffer; + h_addr_ptrs = (host_addr_list_t *) + ((char *) host_addr + sizeof (*host_addr)); + h_alias_ptr = (char **) ((char *) h_addr_ptrs + sizeof (*h_addr_ptrs)); + hostname = (char *) h_alias_ptr + sizeof (*h_alias_ptr); + + if (isdigit (name[0])) + { + for (cp = name;; ++cp) + { + if (*cp == '\0') + { + int ok; + + if (*--cp == '.') + break; + + /* All-numeric, no dot at the end. Fake up a hostent as if + we'd actually done a lookup. What if someone types + 255.255.255.255? The test below will succeed + spuriously... ??? */ + if (af == AF_INET) + ok = __inet_aton (name, (struct in_addr *) host_addr); + else + { + assert (af == AF_INET6); + ok = inet_pton (af, name, host_addr) > 0; + } + if (! ok) + { + *h_errnop = HOST_NOT_FOUND; + if (buffer_size) + *result = NULL; + goto done; + } + + resbuf->h_name = strcpy (hostname, name); + h_alias_ptr[0] = NULL; + resbuf->h_aliases = h_alias_ptr; + (*h_addr_ptrs)[0] = (char *) host_addr; + (*h_addr_ptrs)[1] = NULL; + resbuf->h_addr_list = *h_addr_ptrs; + if (af == AF_INET && (_res.options & RES_USE_INET6)) + { + /* We need to change the IP v4 address into the + IP v6 address. */ + char tmp[INADDRSZ]; + char *p = (char *) host_addr; + int i; + + /* Save a copy of the IP v4 address. */ + memcpy (tmp, host_addr, INADDRSZ); + /* Mark this ipv6 addr as a mapped ipv4. */ + for (i = 0; i < 10; i++) + *p++ = 0x00; + *p++ = 0xff; + *p++ = 0xff; + /* Copy the IP v4 address. */ + memcpy (p, tmp, INADDRSZ); + resbuf->h_addrtype = AF_INET6; + resbuf->h_length = IN6ADDRSZ; + } + else + { + resbuf->h_addrtype = af; + resbuf->h_length = addr_size; + } + if (h_errnop != NULL) + *h_errnop = NETDB_SUCCESS; + if (buffer_size == NULL) + *status = NSS_STATUS_SUCCESS; + else + *result = resbuf; + goto done; + } + + if (!isdigit (*cp) && *cp != '.') + break; + } + } + + if ((isxdigit (name[0]) && strchr (name, ':') != NULL) || name[0] == ':') + { + const char *cp; + char *hostname; + typedef unsigned char host_addr_t[16]; + host_addr_t *host_addr; + typedef char *host_addr_list_t[2]; + host_addr_list_t *h_addr_ptrs; + size_t size_needed; + int addr_size; + + switch (af) + { + default: + af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET; + if (af == AF_INET6) + { + addr_size = IN6ADDRSZ; + break; + } + /* FALLTHROUGH */ + + case AF_INET: + /* This is not possible. We cannot represent an IPv6 address + in an `struct in_addr' variable. */ + *h_errnop = HOST_NOT_FOUND; + *result = NULL; + goto done; + + case AF_INET6: + addr_size = IN6ADDRSZ; + break; + } + + size_needed = (sizeof (*host_addr) + + sizeof (*h_addr_ptrs) + strlen (name) + 1); + + if (buffer_size == NULL && buflen < size_needed) + { + if (h_errnop != NULL) + *h_errnop = TRY_AGAIN; + __set_errno (ERANGE); + goto done; + } + else if (buffer_size != NULL && *buffer_size < size_needed) + { + char *new_buf; + *buffer_size = size_needed; + new_buf = realloc (*buffer, *buffer_size); + + if (new_buf == NULL) + { + save = errno; + free (*buffer); + __set_errno (save); + *buffer = NULL; + *buffer_size = 0; + *result = NULL; + goto done; + } + *buffer = new_buf; + } + + memset (*buffer, '\0', size_needed); + + host_addr = (host_addr_t *) *buffer; + h_addr_ptrs = (host_addr_list_t *) + ((char *) host_addr + sizeof (*host_addr)); + hostname = (char *) h_addr_ptrs + sizeof (*h_addr_ptrs); + + for (cp = name;; ++cp) + { + if (!*cp) + { + if (*--cp == '.') + break; + + /* All-IPv6-legal, no dot at the end. Fake up a + hostent as if we'd actually done a lookup. */ + if (inet_pton (AF_INET6, name, host_addr) <= 0) + { + *h_errnop = HOST_NOT_FOUND; + if (buffer_size) + *result = NULL; + goto done; + } + + resbuf->h_name = strcpy (hostname, name); + h_alias_ptr[0] = NULL; + resbuf->h_aliases = h_alias_ptr; + (*h_addr_ptrs)[0] = (char *) host_addr; + (*h_addr_ptrs)[1] = (char *) 0; + resbuf->h_addr_list = *h_addr_ptrs; + resbuf->h_addrtype = AF_INET6; + resbuf->h_length = addr_size; + *h_errnop = NETDB_SUCCESS; + if (buffer_size == NULL) + *status = NSS_STATUS_SUCCESS; + else + *result = resbuf; + goto done; + } + + if (!isxdigit (*cp) && *cp != ':' && *cp != '.') + break; + } + } + } + + return 0; + +done: + return 1; +} +libc_hidden_def (__nss_hostname_digits_dots)
digits_dots.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getprtent.c =================================================================== --- getprtent.c (nonexistent) +++ getprtent.c (revision 520) @@ -0,0 +1,26 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct protoent +#define GETFUNC_NAME getprotoent +#define BUFLEN 1024 + +#include "getXXent.c"
getprtent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstbyad_r.c =================================================================== --- gethstbyad_r.c (nonexistent) +++ gethstbyad_r.c (revision 520) @@ -0,0 +1,53 @@ +/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +#define LOOKUP_TYPE struct hostent +#define FUNCTION_NAME gethostbyaddr +#define DATABASE_NAME hosts +#define ADD_PARAMS const void *addr, socklen_t len, int type +#define ADD_VARIABLES addr, len, type +#define NEED_H_ERRNO 1 +#define NEED__RES 1 +#define NEED__RES_HCONF 1 +/* If the addr parameter is the IPv6 unspecified address no query must + be performed. */ +#define PREPROCESS \ + if (len == sizeof (struct in6_addr) \ + && __builtin_expect (memcmp (&in6addr_any, addr, \ + sizeof (struct in6_addr)), 1) == 0) \ + { \ + *h_errnop = HOST_NOT_FOUND; \ + *result = NULL; \ + return ENOENT; \ + } +#define POSTPROCESS \ + if (status == NSS_STATUS_SUCCESS) \ + { \ + _res_hconf_reorder_addrs (resbuf); \ + _res_hconf_trim_domains (resbuf); \ + } + +/* Special name for the lookup function. */ +#define DB_LOOKUP_FCT __nss_hosts_lookup + +#include "getXXbyYY_r.c"
gethstbyad_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetbyad.c =================================================================== --- getnetbyad.c (nonexistent) +++ getnetbyad.c (revision 520) @@ -0,0 +1,32 @@ +/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +#define LOOKUP_TYPE struct netent +#define FUNCTION_NAME getnetbyaddr +#define DATABASE_NAME networks +#define ADD_PARAMS uint32_t net, int type +#define ADD_VARIABLES net, type +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#include "getXXbyYY.c"
getnetbyad.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getservent.c =================================================================== --- getservent.c (nonexistent) +++ getservent.c (revision 520) @@ -0,0 +1,26 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct servent +#define GETFUNC_NAME getservent +#define BUFLEN 1024 + +#include "getXXent.c"
getservent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getXXent_r.c =================================================================== --- getXXent_r.c (nonexistent) +++ getXXent_r.c (revision 520) @@ -0,0 +1,209 @@ +/* Copyright (C) 1996,97,98,99,2000,2002,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#define _IO_MTSAFE_IO +#include + +#include "nsswitch.h" + +/*******************************************************************\ +|* Here we assume several symbols to be defined: *| +|* *| +|* LOOKUP_TYPE - the return type of the function *| +|* *| +|* SETFUNC_NAME - name of the non-reentrant setXXXent function *| +|* *| +|* GETFUNC_NAME - name of the non-reentrant getXXXent function *| +|* *| +|* ENDFUNC_NAME - name of the non-reentrant endXXXent function *| +|* *| +|* DATABASE_NAME - name of the database the function accesses *| +|* (e.g., host, services, ...) *| +|* *| +|* Optionally the following vars can be defined: *| +|* *| +|* STAYOPEN - variable declaration for setXXXent function *| +|* *| +|* STAYOPEN_VAR - variable name for setXXXent function *| +|* *| +|* NEED_H_ERRNO - an extra parameter will be passed to point to *| +|* the global `h_errno' variable. *| +|* *| +\*******************************************************************/ + +/* To make the real sources a bit prettier. */ +#define REENTRANT_GETNAME APPEND_R (GETFUNC_NAME) +#define APPEND_R(Name) CONCAT2_2 (Name, _r) +#define INTERNAL(Name) CONCAT2_2 (__, Name) +#define CONCAT2_1(Pre, Post) CONCAT2_2 (Pre, Post) +#define CONCAT2_2(Pre, Post) Pre##Post +#define NEW(name) NEW1 (name) +#define NEW1(name) __new_##name + +#define SETFUNC_NAME_STRING STRINGIZE (SETFUNC_NAME) +#define GETFUNC_NAME_STRING STRINGIZE (REENTRANT_GETNAME) +#define ENDFUNC_NAME_STRING STRINGIZE (ENDFUNC_NAME) +#define DATABASE_NAME_STRING STRINGIZE (DATABASE_NAME) +#define STRINGIZE(Name) STRINGIZE1 (Name) +#define STRINGIZE1(Name) #Name + +#ifndef DB_LOOKUP_FCT +# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup) +# define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post) +# define CONCAT3_2(Pre, Name, Post) Pre##Name##Post +#endif + +/* Sometimes we need to store error codes in the `h_errno' variable. */ +#ifdef NEED_H_ERRNO +# define H_ERRNO_PARM , int *h_errnop +# define H_ERRNO_VAR , &h_errno +# define H_ERRNO_VAR_P &h_errno +#else +# define H_ERRNO_PARM +# define H_ERRNO_VAR +# define H_ERRNO_VAR_P NULL +#endif + +/* Some databases take the `stayopen' flag. */ +#ifdef STAYOPEN +# define STAYOPEN_TMP CONCAT2_1 (STAYOPEN, _tmp) +# define STAYOPEN_TMPVAR &CONCAT2_1 (STAYOPEN_VAR, _tmp) +#else +# define STAYOPEN void +# define STAYOPEN_VAR 0 +# define STAYOPEN_TMPVAR NULL +#endif + +#ifndef NEED__RES +# define NEED__RES 0 +#endif + +/* This handle for the NSS data base is shared between all + set/get/endXXXent functions. */ +static service_user *nip; +/* Remember the last service used since the last call to `endXXent'. */ +static service_user *last_nip; +/* Remember the first service_entry, it's always the same. */ +static service_user *startp; + +#ifdef STAYOPEN_TMP +/* We need to remember the last `stayopen' flag given by the user + since the `setent' function is only called for the first available + service. */ +static STAYOPEN_TMP; +#endif + +/* Protect above variable against multiple uses at the same time. */ +__libc_lock_define_initialized (static, lock) + +/* The lookup function for the first entry of this service. */ +extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp) + internal_function; +libc_hidden_proto (DB_LOOKUP_FCT) + +void +SETFUNC_NAME (STAYOPEN) +{ + int save; + + __libc_lock_lock (lock); + __nss_setent (SETFUNC_NAME_STRING, DB_LOOKUP_FCT, &nip, &startp, + &last_nip, STAYOPEN_VAR, STAYOPEN_TMPVAR, NEED__RES); + + save = errno; + __libc_lock_unlock (lock); + __set_errno (save); +} + + +void +ENDFUNC_NAME (void) +{ + int save; + + /* If the service has not been used before do not do anything. */ + if (startp != NULL) + { + __libc_lock_lock (lock); + __nss_endent (ENDFUNC_NAME_STRING, DB_LOOKUP_FCT, &nip, &startp, + &last_nip, NEED__RES); + save = errno; + __libc_lock_unlock (lock); + __set_errno (save); + } +} + + +int +INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen, + LOOKUP_TYPE **result H_ERRNO_PARM) +{ + int status; + int save; + + __libc_lock_lock (lock); + status = __nss_getent_r (GETFUNC_NAME_STRING, SETFUNC_NAME_STRING, + DB_LOOKUP_FCT, &nip, &startp, &last_nip, + STAYOPEN_TMPVAR, NEED__RES, resbuf, buffer, + buflen, (void **) result, H_ERRNO_VAR_P); + save = errno; + __libc_lock_unlock (lock); + __set_errno (save); + return status; +} + + +#include +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2) +#define OLD(name) OLD1 (name) +#define OLD1(name) __old_##name + +int +attribute_compat_text_section +OLD (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen, + LOOKUP_TYPE **result H_ERRNO_PARM) +{ + int ret = INTERNAL (REENTRANT_GETNAME) (resbuf, buffer, buflen, + result H_ERRNO_VAR); + + if (ret != 0) + ret = -1; + + return ret; +} + +#define do_symbol_version(real, name, version) \ + compat_symbol (libc, real, name, version) +do_symbol_version (OLD (REENTRANT_GETNAME), REENTRANT_GETNAME, GLIBC_2_0); +#endif + +/* As INTERNAL (REENTRANT_GETNAME) may be hidden, we need an alias + in between so that the REENTRANT_GETNAME@@GLIBC_2.1.2 is not + hidden too. */ +strong_alias (INTERNAL (REENTRANT_GETNAME), NEW (REENTRANT_GETNAME)); + +#define do_default_symbol_version(real, name, version) \ + versioned_symbol (libc, real, name, version) +do_default_symbol_version (NEW (REENTRANT_GETNAME), + REENTRANT_GETNAME, GLIBC_2_1_2); + +static_link_warning (SETFUNC_NAME) +static_link_warning (ENDFUNC_NAME) +static_link_warning (REENTRANT_GETNAME)
getXXent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_addr.c =================================================================== --- inet_addr.c (nonexistent) +++ inet_addr.c (revision 520) @@ -0,0 +1,201 @@ +/* $KAME: inet_addr.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ + +/* + * ++Copyright++ 1983, 1990, 1993 + * - + * Copyright (c) 1983, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +/* + * ASCII internet address interpretation routine. + * The value returned is in network order. + */ +in_addr_t /* XXX should be struct in_addr :( */ +inet_addr(cp) + const char *cp; +{ + struct in_addr val; + + if (inet_aton(cp, &val)) + return (val.s_addr); + return (INADDR_NONE); +} + +/* + * Check whether "cp" is a valid ASCII representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ +int +inet_aton(cp, addr) + const char *cp; + struct in_addr *addr; +{ + u_long parts[4]; + in_addr_t val; + char *c; + char *endptr; + int gotend, n; + + c = (char *)cp; + n = 0; + /* + * Run through the string, grabbing numbers until + * the end of the string, or some error + */ + gotend = 0; + while (!gotend) { + errno = 0; + val = strtoul(c, &endptr, 0); + + if (errno == ERANGE) /* Fail completely if it overflowed. */ + return (0); + + /* + * If the whole string is invalid, endptr will equal + * c.. this way we can make sure someone hasn't + * gone '.12' or something which would get past + * the next check. + */ + if (endptr == c) + return (0); + parts[n] = val; + c = endptr; + + /* Check the next character past the previous number's end */ + switch (*c) { + case '.' : + /* Make sure we only do 3 dots .. */ + if (n == 3) /* Whoops. Quit. */ + return (0); + n++; + c++; + break; + + case '\0': + gotend = 1; + break; + + default: + if (isspace((unsigned char)*c)) { + gotend = 1; + break; + } else + return (0); /* Invalid character, so fail */ + } + + } + + /* + * Concoct the address according to + * the number of parts specified. + */ + + switch (n) { + case 0: /* a -- 32 bits */ + /* + * Nothing is necessary here. Overflow checking was + * already done in strtoul(). + */ + break; + case 1: /* a.b -- 8.24 bits */ + if (val > 0xffffff || parts[0] > 0xff) + return (0); + val |= parts[0] << 24; + break; + + case 2: /* a.b.c -- 8.8.16 bits */ + if (val > 0xffff || parts[0] > 0xff || parts[1] > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 3: /* a.b.c.d -- 8.8.8.8 bits */ + if (val > 0xff || parts[0] > 0xff || parts[1] > 0xff || + parts[2] > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } + + if (addr != NULL) + addr->s_addr = htonl(val); + return (1); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_addr +__weak_reference(__inet_addr, inet_addr); +#undef inet_aton +__weak_reference(__inet_aton, inet_aton);
inet_addr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnssent_r.c =================================================================== --- getnssent_r.c (nonexistent) +++ getnssent_r.c (revision 520) @@ -0,0 +1,218 @@ +/* Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include "nsswitch.h" + +/* Set up NIP to run through the services. If ALL is zero, use NIP's + current location if it's not nil. Return nonzero if there are no + services (left). */ +static int +setup (const char *func_name, db_lookup_function lookup_fct, + void **fctp, service_user **nip, service_user **startp, int all) +{ + int no_more; + if (*startp == NULL) + { + no_more = lookup_fct (nip, func_name, fctp); + *startp = no_more ? (service_user *) -1l : *nip; + } + else if (*startp == (service_user *) -1l) + /* No services at all. */ + return 1; + else + { + if (all || !*nip) + /* Reset to the beginning of the service list. */ + *nip = *startp; + /* Look up the first function. */ + no_more = __nss_lookup (nip, func_name, fctp); + } + return no_more; +} + +void +__nss_setent (const char *func_name, db_lookup_function lookup_fct, + service_user **nip, service_user **startp, + service_user **last_nip, int stayopen, int *stayopen_tmp, + int res) +{ + union + { + setent_function f; + void *ptr; + } fct; + int no_more; + + if (res && __res_maybe_init (&_res, 0) == -1) + { + h_errno = (NETDB_INTERNAL); + return; + } + + /* Cycle through the services and run their `setXXent' functions until + we find an available service. */ + no_more = setup (func_name, lookup_fct, &fct.ptr, nip, + startp, 1); + while (! no_more) + { + int is_last_nip = *nip == *last_nip; + enum nss_status status; + + if (stayopen_tmp) + status = DL_CALL_FCT (fct.f, (*stayopen_tmp)); + else + status = DL_CALL_FCT (fct.f, (0)); + + no_more = __nss_next (nip, func_name, &fct.ptr, + status, 0); + if (is_last_nip) + *last_nip = *nip; + } + + if (stayopen_tmp) + *stayopen_tmp = stayopen; +} + + +void +__nss_endent (const char *func_name, db_lookup_function lookup_fct, + service_user **nip, service_user **startp, + service_user **last_nip, int res) +{ + union + { + endent_function f; + void *ptr; + } fct; + int no_more; + + if (res && __res_maybe_init (&_res, 0) == -1) + { + h_errno = (NETDB_INTERNAL); + return; + } + + /* Cycle through all the services and run their endXXent functions. */ + no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1); + while (! no_more) + { + /* Ignore status, we force check in __NSS_NEXT. */ + DL_CALL_FCT (fct.f, ()); + + if (*nip == *last_nip) + /* We have processed all services which were used. */ + break; + + no_more = __nss_next (nip, func_name, &fct.ptr, 0, 1); + } + *last_nip = *nip = NULL; +} + + +int +__nss_getent_r (const char *getent_func_name, + const char *setent_func_name, + db_lookup_function lookup_fct, + service_user **nip, service_user **startp, + service_user **last_nip, int *stayopen_tmp, int res, + void *resbuf, char *buffer, size_t buflen, + void **result, int *h_errnop) +{ + union + { + getent_function f; + void *ptr; + } fct; + int no_more; + enum nss_status status; + + if (res && __res_maybe_init (&_res, 0) == -1) + { + *h_errnop = NETDB_INTERNAL; + *result = NULL; + return errno; + } + + /* Initialize status to return if no more functions are found. */ + status = NSS_STATUS_NOTFOUND; + + /* Run through available functions, starting with the same function last + run. We will repeat each function as long as it succeeds, and then go + on to the next service action. */ + no_more = setup (getent_func_name, lookup_fct, &fct.ptr, nip, + startp, 0); + while (! no_more) + { + int is_last_nip = *nip == *last_nip; + + status = DL_CALL_FCT (fct.f, + (resbuf, buffer, buflen, &errno, &h_errno)); + + /* The the status is NSS_STATUS_TRYAGAIN and errno is ERANGE the + provided buffer is too small. In this case we should give + the user the possibility to enlarge the buffer and we should + not simply go on with the next service (even if the TRYAGAIN + action tells us so). */ + if (status == NSS_STATUS_TRYAGAIN + && (h_errnop == NULL || *h_errnop == NETDB_INTERNAL) + && errno == ERANGE) + break; + + do + { + no_more = __nss_next (nip, getent_func_name, &fct.ptr, + status, 0); + + if (is_last_nip) + *last_nip = *nip; + + if (! no_more) + { + /* Call the `setXXent' function. This wasn't done before. */ + union + { + setent_function f; + void *ptr; + } sfct; + + no_more = __nss_lookup (nip, setent_func_name, + &sfct.ptr); + + if (! no_more) + { + if (stayopen_tmp) + status = DL_CALL_FCT (sfct.f, (*stayopen_tmp)); + else + status = DL_CALL_FCT (sfct.f, (0)); + } + else + status = NSS_STATUS_NOTFOUND; + } + } + while (! no_more && status != NSS_STATUS_SUCCESS); + } + + *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL; + return (status == NSS_STATUS_SUCCESS ? 0 + : status != NSS_STATUS_TRYAGAIN ? ENOENT + /* h_errno functions only set errno if h_errno is NETDB_INTERNAL. */ + : (h_errnop == NULL || *h_errnop == NETDB_INTERNAL) ? errno + : EAGAIN); +}
getnssent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nscd-types.h =================================================================== --- nscd-types.h (nonexistent) +++ nscd-types.h (revision 520) @@ -0,0 +1,22 @@ +/* Types for the NSCD implementation. Generic version. + Copyright (c) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +typedef int32_t nscd_ssize_t;
nscd-types.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: recv.c =================================================================== --- recv.c (nonexistent) +++ recv.c (revision 520) @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)recv.c 8.2 (Berkeley) 2/21/94"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include "namespace.h" +#include +#include + +#include +#include "un-namespace.h" + +ssize_t +recv(s, buf, len, flags) + int s, flags; + size_t len; + void *buf; +{ + return (recvfrom(s, buf, len, flags, NULL, 0)); +}
recv.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: key-lookup.c =================================================================== --- key-lookup.c (nonexistent) +++ key-lookup.c (revision 520) @@ -0,0 +1,23 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME publickey +#define DEFAULT_CONFIG "nis nisplus" + +#include "XXX-lookup.c"
key-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_send.c =================================================================== --- res_send.c (nonexistent) +++ res_send.c (revision 520) @@ -0,0 +1,1116 @@ +/* + * Copyright (c) 1985, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; +static const char rcsid[] = "$BINDId: res_send.c,v 8.38 2000/03/30 20:16:51 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#define s6_addr32 __u6_addr.__u6_addr32 +/* + * Send query to name server and wait for reply. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +#if PACKETSZ > 65536 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 65536 +#endif + + +/* From ev_streams.c. */ + +static inline void +__attribute ((always_inline)) +evConsIovec(void *buf, size_t cnt, struct iovec *vec) { + memset(vec, 0xf5, sizeof (*vec)); + vec->iov_base = buf; + vec->iov_len = cnt; +} + +/* From ev_timers.c. */ + +#define BILLION 1000000000 + +static inline void +evConsTime(struct timespec *res, time_t sec, long nsec) { + res->tv_sec = sec; + res->tv_nsec = nsec; +} + +static inline void +evAddTime(struct timespec *res, const struct timespec *addend1, + const struct timespec *addend2) { + res->tv_sec = addend1->tv_sec + addend2->tv_sec; + res->tv_nsec = addend1->tv_nsec + addend2->tv_nsec; + if (res->tv_nsec >= BILLION) { + res->tv_sec++; + res->tv_nsec -= BILLION; + } +} + +static inline void +evSubTime(struct timespec *res, const struct timespec *minuend, + const struct timespec *subtrahend) { + res->tv_sec = minuend->tv_sec - subtrahend->tv_sec; + if (minuend->tv_nsec >= subtrahend->tv_nsec) + res->tv_nsec = minuend->tv_nsec - subtrahend->tv_nsec; + else { + res->tv_nsec = (BILLION + - subtrahend->tv_nsec + minuend->tv_nsec); + res->tv_sec--; + } +} + +static inline int +evCmpTime(struct timespec a, struct timespec b) { + long x = a.tv_sec - b.tv_sec; + + if (x == 0L) + x = a.tv_nsec - b.tv_nsec; + return (x < 0L ? (-1) : x > 0L ? (1) : (0)); +} + +static inline void +evNowTime(struct timespec *res) { + struct timeval now; + + if (gettimeofday(&now, NULL) < 0) + evConsTime(res, 0, 0); + else + TIMEVAL_TO_TIMESPEC (&now, res); +} + + +/* Options. Leave them on. */ +/* #undef DEBUG */ +#include "res_debug.h" + +#define EXT(res) ((res)->_u._ext) + +/* Forward. */ + +static int send_vc(res_state, const u_char *, int, + u_char **, int *, int *, int, u_char **); +static int send_dg(res_state, const u_char *, int, + u_char **, int *, int *, int, + int *, int *, u_char **); +#ifdef DEBUG +static void Aerror(const res_state, FILE *, const char *, int, + const struct sockaddr *); +static void Perror(const res_state, FILE *, const char *, int); +#endif +static int sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *); + +/* Reachover. */ + +static void convaddr4to6(struct sockaddr_in6 *sa); +void res_pquery(const res_state, const u_char *, int, FILE *); + +/* Public. */ + +/* int + * res_isourserver(ina) + * looks up "ina" in _res.ns_addr_list[] + * returns: + * 0 : not found + * >0 : found + * author: + * paul vixie, 29may94 + */ +int +res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp) +{ + int ns; + + if (inp->sin6_family == AF_INET) { + struct sockaddr_in *in4p = (struct sockaddr_in *) inp; + in_port_t port = in4p->sin_port; + in_addr_t addr = in4p->sin_addr.s_addr; + + for (ns = 0; ns < MAXNS; ns++) { + const struct sockaddr_in *srv = + (struct sockaddr_in *)EXT(statp).nsaddrs[ns]; + + if ((srv != NULL) && (srv->sin_family == AF_INET) && + (srv->sin_port == port) && + (srv->sin_addr.s_addr == INADDR_ANY || + srv->sin_addr.s_addr == addr)) + return (1); + } + } else if (inp->sin6_family == AF_INET6) { + for (ns = 0; ns < MAXNS; ns++) { + const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns]; + if ((srv != NULL) && (srv->sin6_family == AF_INET6) && + (srv->sin6_port == inp->sin6_port) && + !(memcmp(&srv->sin6_addr, &in6addr_any, + sizeof (struct in6_addr)) && + memcmp(&srv->sin6_addr, &inp->sin6_addr, + sizeof (struct in6_addr)))) + return (1); + } + } + return (0); +} + +/* int + * res_nameinquery(name, type, class, buf, eom) + * look for (name,type,class) in the query section of packet (buf,eom) + * requires: + * buf + HFIXEDSZ <= eom + * returns: + * -1 : format error + * 0 : not found + * >0 : found + * author: + * paul vixie, 29may94 + */ +int +res_nameinquery(const char *name, int type, int class, + const u_char *buf, const u_char *eom) +{ + const u_char *cp = buf + HFIXEDSZ; + int qdcount = ntohs(((HEADER*)buf)->qdcount); + + while (qdcount-- > 0) { + char tname[MAXDNAME+1]; + int n, ttype, tclass; + + n = dn_expand(buf, eom, cp, tname, sizeof tname); + if (n < 0) + return (-1); + cp += n; + if (cp + 2 * INT16SZ > eom) + return (-1); + ttype = ns_get16(cp); cp += INT16SZ; + tclass = ns_get16(cp); cp += INT16SZ; + if (ttype == type && tclass == class && + ns_samename(tname, name) == 1) + return (1); + } + return (0); +} +libresolv_hidden_def (res_nameinquery) + +/* int + * res_queriesmatch(buf1, eom1, buf2, eom2) + * is there a 1:1 mapping of (name,type,class) + * in (buf1,eom1) and (buf2,eom2)? + * returns: + * -1 : format error + * 0 : not a 1:1 mapping + * >0 : is a 1:1 mapping + * author: + * paul vixie, 29may94 + */ +int +res_queriesmatch(const u_char *buf1, const u_char *eom1, + const u_char *buf2, const u_char *eom2) +{ + const u_char *cp = buf1 + HFIXEDSZ; + int qdcount = ntohs(((HEADER*)buf1)->qdcount); + + if (buf1 + HFIXEDSZ > eom1 || buf2 + HFIXEDSZ > eom2) + return (-1); + + /* + * Only header section present in replies to + * dynamic update packets. + */ + if ((((HEADER *)buf1)->opcode == ns_o_update) && + (((HEADER *)buf2)->opcode == ns_o_update)) + return (1); + + if (qdcount != ntohs(((HEADER*)buf2)->qdcount)) + return (0); + while (qdcount-- > 0) { + char tname[MAXDNAME+1]; + int n, ttype, tclass; + + n = dn_expand(buf1, eom1, cp, tname, sizeof tname); + if (n < 0) + return (-1); + cp += n; + if (cp + 2 * INT16SZ > eom1) + return (-1); + ttype = ns_get16(cp); cp += INT16SZ; + tclass = ns_get16(cp); cp += INT16SZ; + if (!res_nameinquery(tname, ttype, tclass, buf2, eom2)) + return (0); + } + return (1); +} +libresolv_hidden_def (res_queriesmatch) + +int +__libc_res_nsend(res_state statp, const u_char *buf, int buflen, + u_char *ans, int anssiz, u_char **ansp) +{ + int gotsomewhere, terrno, try, v_circuit, resplen, ns, n; + + if (statp->nscount == 0) { + __set_errno (ESRCH); + return (-1); + } + + if (anssiz < HFIXEDSZ) { + __set_errno (EINVAL); + return (-1); + } + + if ((statp->qhook || statp->rhook) && anssiz < MAXPACKET && ansp) { + u_char *buf = malloc (MAXPACKET); + if (buf == NULL) + return (-1); + memcpy (buf, ans, HFIXEDSZ); + *ansp = buf; + ans = buf; + anssiz = MAXPACKET; + } + + DprintQ((statp->options & RES_DEBUG) || (statp->pfcode & RES_PRF_QUERY), + (stdout, ";; res_send()\n"), buf, buflen); + v_circuit = (statp->options & RES_USEVC) || buflen > PACKETSZ; + gotsomewhere = 0; + terrno = ETIMEDOUT; + + /* + * If the ns_addr_list in the resolver context has changed, then + * invalidate our cached copy and the associated timing data. + */ + if (EXT(statp).nsinit) { + int needclose = 0; + + if (EXT(statp).nscount != statp->nscount) + needclose++; + else + for (ns = 0; ns < MAXNS; ns++) { + unsigned int map = EXT(statp).nsmap[ns]; + if (map < MAXNS + && !sock_eq((struct sockaddr_in6 *) + &statp->nsaddr_list[map], + EXT(statp).nsaddrs[ns])) + { + needclose++; + break; + } + } + if (needclose) + res_nclose(statp); + } + + /* + * Maybe initialize our private copy of the ns_addr_list. + */ + if (EXT(statp).nsinit == 0) { + unsigned char map[MAXNS]; + + memset (map, MAXNS, sizeof (map)); + for (n = 0; n < MAXNS; n++) { + ns = EXT(statp).nsmap[n]; + if (ns < statp->nscount) + map[ns] = n; + else if (ns < MAXNS) { + free(EXT(statp).nsaddrs[n]); + EXT(statp).nsaddrs[n] = NULL; + EXT(statp).nsmap[n] = MAXNS; + } + } + n = statp->nscount; + if (statp->nscount > EXT(statp).nscount) + for (n = EXT(statp).nscount, ns = 0; + n < statp->nscount; n++) { + while (ns < MAXNS + && EXT(statp).nsmap[ns] != MAXNS) + ns++; + if (ns == MAXNS) + break; + EXT(statp).nsmap[ns] = n; + map[n] = ns++; + } + EXT(statp).nscount = n; + for (ns = 0; ns < EXT(statp).nscount; ns++) { + n = map[ns]; + if (EXT(statp).nsaddrs[n] == NULL) + EXT(statp).nsaddrs[n] = + malloc(sizeof (struct sockaddr_in6)); + if (EXT(statp).nsaddrs[n] != NULL) { + memcpy(EXT(statp).nsaddrs[n], + &statp->nsaddr_list[ns], + sizeof (struct sockaddr_in)); + EXT(statp).nssocks[n] = -1; + n++; + } + } + EXT(statp).nsinit = 1; + } + + /* + * Some resolvers want to even out the load on their nameservers. + * Note that RES_BLAST overrides RES_ROTATE. + */ + if ((statp->options & RES_ROTATE) != 0 && + (statp->options & RES_BLAST) == 0) { + struct sockaddr_in6 *ina; + unsigned int map; + + n = 0; + while (n < MAXNS && EXT(statp).nsmap[n] == MAXNS) + n++; + if (n < MAXNS) { + ina = EXT(statp).nsaddrs[n]; + map = EXT(statp).nsmap[n]; + for (;;) { + ns = n + 1; + while (ns < MAXNS + && EXT(statp).nsmap[ns] == MAXNS) + ns++; + if (ns == MAXNS) + break; + EXT(statp).nsaddrs[n] = EXT(statp).nsaddrs[ns]; + EXT(statp).nsmap[n] = EXT(statp).nsmap[ns]; + n = ns; + } + EXT(statp).nsaddrs[n] = ina; + EXT(statp).nsmap[n] = map; + } + } + + /* + * Send request, RETRY times, or until successful. + */ + for (try = 0; try < statp->retry; try++) { + for (ns = 0; ns < MAXNS; ns++) + { + struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; + + if (nsap == NULL) + goto next_ns; + same_ns: + if (statp->qhook) { + int done = 0, loops = 0; + + do { + res_sendhookact act; + + struct sockaddr_in *nsap4; + nsap4 = (struct sockaddr_in *) nsap; + act = (*statp->qhook)(&nsap4, &buf, &buflen, + ans, anssiz, &resplen); + nsap = (struct sockaddr_in6 *) nsap4; + switch (act) { + case res_goahead: + done = 1; + break; + case res_nextns: + res_nclose(statp); + goto next_ns; + case res_done: + return (resplen); + case res_modified: + /* give the hook another try */ + if (++loops < 42) /*doug adams*/ + break; + /*FALLTHROUGH*/ + case res_error: + /*FALLTHROUGH*/ + default: + return (-1); + } + } while (!done); + } + +#ifdef DEBUG + char tmpbuf[40]; +#endif + Dprint(statp->options & RES_DEBUG, + (stdout, ";; Querying server (# %d) address = %s\n", + ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr, + tmpbuf, sizeof (tmpbuf)))); + + if (v_circuit) { + /* Use VC; at most one attempt per server. */ + try = statp->retry; + n = send_vc(statp, buf, buflen, &ans, &anssiz, &terrno, + ns, ansp); + if (n < 0) + return (-1); + if (n == 0) + goto next_ns; + resplen = n; + } else { + /* Use datagrams. */ + n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno, + ns, &v_circuit, &gotsomewhere, ansp); + if (n < 0) + return (-1); + if (n == 0) + goto next_ns; + if (v_circuit) + goto same_ns; + resplen = n; + } + + Dprint((statp->options & RES_DEBUG) || + ((statp->pfcode & RES_PRF_REPLY) && + (statp->pfcode & RES_PRF_HEAD1)), + (stdout, ";; got answer:\n")); + + DprintQ((statp->options & RES_DEBUG) || + (statp->pfcode & RES_PRF_REPLY), + (stdout, "%s", ""), + ans, (resplen > anssiz) ? anssiz : resplen); + + /* + * If we have temporarily opened a virtual circuit, + * or if we haven't been asked to keep a socket open, + * close the socket. + */ + if ((v_circuit && (statp->options & RES_USEVC) == 0) || + (statp->options & RES_STAYOPEN) == 0) { + res_nclose(statp); + } + if (statp->rhook) { + int done = 0, loops = 0; + + do { + res_sendhookact act; + + act = (*statp->rhook)((struct sockaddr_in *) + nsap, buf, buflen, + ans, anssiz, &resplen); + switch (act) { + case res_goahead: + case res_done: + done = 1; + break; + case res_nextns: + res_nclose(statp); + goto next_ns; + case res_modified: + /* give the hook another try */ + if (++loops < 42) /*doug adams*/ + break; + /*FALLTHROUGH*/ + case res_error: + /*FALLTHROUGH*/ + default: + return (-1); + } + } while (!done); + + } + return (resplen); + next_ns: ; + } /*foreach ns*/ + } /*foreach retry*/ + res_nclose(statp); + if (!v_circuit) { + if (!gotsomewhere) + __set_errno (ECONNREFUSED); /* no nameservers found */ + else + __set_errno (ETIMEDOUT); /* no answer obtained */ + } else + __set_errno (terrno); + return (-1); +} + +int +res_nsend(res_state statp, + const u_char *buf, int buflen, u_char *ans, int anssiz) +{ + return __libc_res_nsend(statp, buf, buflen, ans, anssiz, NULL); +} +libresolv_hidden_def (res_nsend) + +/* Private */ + +static int +send_vc(res_state statp, + const u_char *buf, int buflen, u_char **ansp, int *anssizp, + int *terrno, int ns, u_char **anscp) +{ + const HEADER *hp = (HEADER *) buf; + u_char *ans = *ansp; + int anssiz = *anssizp; + HEADER *anhp = (HEADER *) ans; + struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; + int truncating, connreset, resplen, n; + struct iovec iov[2]; + u_short len; + u_char *cp; + + connreset = 0; + same_ns: + truncating = 0; + + /* Are we still talking to whom we want to talk to? */ + if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) { + struct sockaddr_in6 peer; + int size = sizeof peer; + + if (getpeername(statp->_vcsock, + (struct sockaddr *)&peer, &size) < 0 || + !sock_eq(&peer, nsap)) { + res_nclose(statp); + statp->_flags &= ~RES_F_VC; + } + } + + if (statp->_vcsock < 0 || (statp->_flags & RES_F_VC) == 0) { + if (statp->_vcsock >= 0) + res_nclose(statp); + + statp->_vcsock = socket(nsap->sin6_family, SOCK_STREAM, 0); + if (statp->_vcsock < 0) { + *terrno = errno; + Perror(statp, stderr, "socket(vc)", errno); + return (-1); + } + __set_errno (0); + if (connect(statp->_vcsock, (struct sockaddr *)nsap, + sizeof *nsap) < 0) { + *terrno = errno; + Aerror(statp, stderr, "connect/vc", errno, + (struct sockaddr *) nsap); + res_nclose(statp); + return (0); + } + statp->_flags |= RES_F_VC; + } + + /* + * Send length & message + */ + putshort((u_short)buflen, (u_char*)&len); + evConsIovec(&len, INT16SZ, &iov[0]); + evConsIovec((void*)buf, buflen, &iov[1]); + if (TEMP_FAILURE_RETRY (writev(statp->_vcsock, iov, 2)) + != (INT16SZ + buflen)) { + *terrno = errno; + Perror(statp, stderr, "write failed", errno); + res_nclose(statp); + return (0); + } + /* + * Receive length & response + */ + read_len: + cp = ans; + len = INT16SZ; + while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, (char *)cp, + (int)len))) > 0) { + cp += n; + if ((len -= n) <= 0) + break; + } + if (n <= 0) { + *terrno = errno; + Perror(statp, stderr, "read failed", errno); + res_nclose(statp); + /* + * A long running process might get its TCP + * connection reset if the remote server was + * restarted. Requery the server instead of + * trying a new one. When there is only one + * server, this means that a query might work + * instead of failing. We only allow one reset + * per query to prevent looping. + */ + if (*terrno == ECONNRESET && !connreset) { + connreset = 1; + res_nclose(statp); + goto same_ns; + } + res_nclose(statp); + return (0); + } + resplen = ns_get16(ans); + if (resplen > anssiz) { + if (anscp) { + ans = malloc (MAXPACKET); + if (ans == NULL) { + *terrno = ENOMEM; + res_nclose(statp); + return (0); + } + anssiz = MAXPACKET; + *anssizp = MAXPACKET; + *ansp = ans; + *anscp = ans; + anhp = (HEADER *) ans; + len = resplen; + } else { + Dprint(statp->options & RES_DEBUG, + (stdout, ";; response truncated\n") + ); + truncating = 1; + len = anssiz; + } + } else + len = resplen; + if (len < HFIXEDSZ) { + /* + * Undersized message. + */ + Dprint(statp->options & RES_DEBUG, + (stdout, ";; undersized: %d\n", len)); + *terrno = EMSGSIZE; + res_nclose(statp); + return (0); + } + cp = ans; + while (len != 0 && (n = read(statp->_vcsock, (char *)cp, (int)len)) > 0){ + cp += n; + len -= n; + } + if (n <= 0) { + *terrno = errno; + Perror(statp, stderr, "read(vc)", errno); + res_nclose(statp); + return (0); + } + if (truncating) { + /* + * Flush rest of answer so connection stays in synch. + */ + anhp->tc = 1; + len = resplen - anssiz; + while (len != 0) { + char junk[PACKETSZ]; + + n = read(statp->_vcsock, junk, + (len > sizeof junk) ? sizeof junk : len); + if (n > 0) + len -= n; + else + break; + } + } + /* + * If the calling applicating has bailed out of + * a previous call and failed to arrange to have + * the circuit closed or the server has got + * itself confused, then drop the packet and + * wait for the correct one. + */ + if (hp->id != anhp->id) { + DprintQ((statp->options & RES_DEBUG) || + (statp->pfcode & RES_PRF_REPLY), + (stdout, ";; old answer (unexpected):\n"), + ans, (resplen > anssiz) ? anssiz: resplen); + goto read_len; + } + + /* + * All is well, or the error is fatal. Signal that the + * next nameserver ought not be tried. + */ + return (resplen); +} + +static int +send_dg(res_state statp, + const u_char *buf, int buflen, u_char **ansp, int *anssizp, + int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp) +{ + const HEADER *hp = (HEADER *) buf; + u_char *ans = *ansp; + int anssiz = *anssizp; + HEADER *anhp = (HEADER *) ans; + struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns]; + struct timespec now, timeout, finish; + struct pollfd pfd[1]; + int ptimeout; + struct sockaddr_in6 from; + static int socket_pf = 0; + int fromlen, resplen, seconds, n; + + if (EXT(statp).nssocks[ns] == -1) { + /* only try IPv6 if IPv6 NS and if not failed before */ + if ((EXT(statp).nscount6 > 0) && (socket_pf != PF_INET)) { + EXT(statp).nssocks[ns] = + socket(PF_INET6, SOCK_DGRAM, 0); + socket_pf = EXT(statp).nssocks[ns] < 0 ? PF_INET + : PF_INET6; + } + if (EXT(statp).nssocks[ns] < 0) + EXT(statp).nssocks[ns] = socket(PF_INET, SOCK_DGRAM, 0); + if (EXT(statp).nssocks[ns] < 0) { + *terrno = errno; + Perror(statp, stderr, "socket(dg)", errno); + return (-1); + } + /* If IPv6 socket and nsap is IPv4, make it IPv4-mapped */ + if ((socket_pf == PF_INET6) && (nsap->sin6_family == AF_INET)) + convaddr4to6(nsap); + /* + * On a 4.3BSD+ machine (client and server, + * actually), sending to a nameserver datagram + * port with no nameserver will cause an + * ICMP port unreachable message to be returned. + * If our datagram socket is "connected" to the + * server, we get an ECONNREFUSED error on the next + * socket operation, and select returns if the + * error message is received. We can thus detect + * the absence of a nameserver without timing out. + */ + if (connect(EXT(statp).nssocks[ns], (struct sockaddr *)nsap, + sizeof *nsap) < 0) { + Aerror(statp, stderr, "connect(dg)", errno, + (struct sockaddr *) nsap); + res_nclose(statp); + return (0); + } + /* Make socket non-blocking. */ + int fl = fcntl (EXT(statp).nssocks[ns], F_GETFL); + if (fl != -1) + fcntl (EXT(statp).nssocks[ns], F_SETFL, + fl | O_NONBLOCK); + Dprint(statp->options & RES_DEBUG, + (stdout, ";; new DG socket\n")) + } + + /* + * Compute time for the total operation. + */ + seconds = (statp->retrans << ns); + if (ns > 0) + seconds /= statp->nscount; + if (seconds <= 0) + seconds = 1; + evNowTime(&now); + evConsTime(&timeout, seconds, 0); + evAddTime(&finish, &now, &timeout); + int need_recompute = 0; + int nwritten = 0; + pfd[0].fd = EXT(statp).nssocks[ns]; + pfd[0].events = POLLOUT; + wait: + if (need_recompute) { + evNowTime(&now); + if (evCmpTime(finish, now) <= 0) { + Perror(statp, stderr, "select", errno); + res_nclose(statp); + return (0); + } + evSubTime(&timeout, &finish, &now); + } + /* Convert struct timespec in milliseconds. */ + ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000; + + n = 0; + if (nwritten == 0) + n = poll (pfd, 1, 0); + if (__builtin_expect (n == 0, 0)) { + n = poll (pfd, 1, ptimeout); + need_recompute = 1; + } + if (n == 0) { + Dprint(statp->options & RES_DEBUG, (stdout, + ";; timeout sending\n")); + *gotsomewhere = 1; + return (0); + } + if (n < 0) { + if (errno == EINTR) { + recompute_resend: + evNowTime(&now); + if (evCmpTime(finish, now) > 0) { + evSubTime(&timeout, &finish, &now); + goto wait; + } + } + Perror(statp, stderr, "poll", errno); + res_nclose(statp); + return (0); + } + __set_errno (0); + if (pfd[0].revents & POLLOUT) { + if (send(pfd[0].fd, (char*)buf, buflen, 0) != buflen) { + if (errno == EINTR || errno == EAGAIN) + goto recompute_resend; + Perror(statp, stderr, "send", errno); + res_nclose(statp); + return (0); + } + pfd[0].events = POLLIN; + ++nwritten; + goto wait; + } else if (pfd[0].revents & POLLIN) { + fromlen = sizeof(struct sockaddr_in6); + if (anssiz < MAXPACKET + && anscp + && (ioctl (pfd[0].fd, FIONREAD, &resplen) < 0 + || anssiz < resplen)) { + ans = malloc (MAXPACKET); + if (ans == NULL) + ans = *ansp; + else { + anssiz = MAXPACKET; + *anssizp = MAXPACKET; + *ansp = ans; + *anscp = ans; + anhp = (HEADER *) ans; + } + } + resplen = recvfrom(pfd[0].fd, (char*)ans, anssiz,0, + (struct sockaddr *)&from, &fromlen); + if (resplen <= 0) { + if (errno == EINTR || errno == EAGAIN) { + need_recompute = 1; + goto wait; + } + Perror(statp, stderr, "recvfrom", errno); + res_nclose(statp); + return (0); + } + *gotsomewhere = 1; + if (resplen < HFIXEDSZ) { + /* + * Undersized message. + */ + Dprint(statp->options & RES_DEBUG, + (stdout, ";; undersized: %d\n", + resplen)); + *terrno = EMSGSIZE; + res_nclose(statp); + return (0); + } + if (hp->id != anhp->id) { + /* + * response from old query, ignore it. + * XXX - potential security hazard could + * be detected here. + */ + DprintQ((statp->options & RES_DEBUG) || + (statp->pfcode & RES_PRF_REPLY), + (stdout, ";; old answer:\n"), + ans, (resplen > anssiz) ? anssiz : resplen); + goto wait; + } + if (!(statp->options & RES_INSECURE1) && + !res_ourserver_p(statp, &from)) { + /* + * response from wrong server? ignore it. + * XXX - potential security hazard could + * be detected here. + */ + DprintQ((statp->options & RES_DEBUG) || + (statp->pfcode & RES_PRF_REPLY), + (stdout, ";; not our server:\n"), + ans, (resplen > anssiz) ? anssiz : resplen); + goto wait; + } + if (!(statp->options & RES_INSECURE2) && + !res_queriesmatch(buf, buf + buflen, + ans, ans + anssiz)) { + /* + * response contains wrong query? ignore it. + * XXX - potential security hazard could + * be detected here. + */ + DprintQ((statp->options & RES_DEBUG) || + (statp->pfcode & RES_PRF_REPLY), + (stdout, ";; wrong query name:\n"), + ans, (resplen > anssiz) ? anssiz : resplen); + goto wait; + } + if (anhp->rcode == SERVFAIL || + anhp->rcode == NOTIMP || + anhp->rcode == REFUSED) { + DprintQ(statp->options & RES_DEBUG, + (stdout, "server rejected query:\n"), + ans, (resplen > anssiz) ? anssiz : resplen); + res_nclose(statp); + /* don't retry if called from dig */ + if (!statp->pfcode) + return (0); + } + if (!(statp->options & RES_IGNTC) && anhp->tc) { + /* + * To get the rest of answer, + * use TCP with same server. + */ + Dprint(statp->options & RES_DEBUG, + (stdout, ";; truncated answer\n")); + *v_circuit = 1; + res_nclose(statp); + return (1); + } + /* + * All is well, or the error is fatal. Signal that the + * next nameserver ought not be tried. + */ + return (resplen); + } else if (pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) { + /* Something went wrong. We can stop trying. */ + res_nclose(statp); + return (0); + } +} + +#ifdef DEBUG +static void +Aerror(const res_state statp, FILE *file, const char *string, int error, + const struct sockaddr *address) +{ + int save = errno; + + if ((statp->options & RES_DEBUG) != 0) { + char tmp[sizeof "xxxx.xxxx.xxxx.255.255.255.255"]; + + fprintf(file, "res_send: %s ([%s].%u): %s\n", + string, + inet_ntop(address->sa_family, address->sa_data, + tmp, sizeof tmp), + (address->sa_family == AF_INET + ? ntohs(((struct sockaddr_in *) address)->sin_port) + : address->sa_family == AF_INET6 + ? ntohs(((struct sockaddr_in6 *) address)->sin6_port) + : 0), + strerror(error)); + } + __set_errno (save); +} + +static void +Perror(const res_state statp, FILE *file, const char *string, int error) { + int save = errno; + + if ((statp->options & RES_DEBUG) != 0) + fprintf(file, "res_send: %s: %s\n", + string, strerror(error)); + __set_errno (save); +} +#endif + +static int +sock_eq(struct sockaddr_in6 *a1, struct sockaddr_in6 *a2) { + if (a1->sin6_family == a2->sin6_family) { + if (a1->sin6_family == AF_INET) + return ((((struct sockaddr_in *)a1)->sin_port == + ((struct sockaddr_in *)a2)->sin_port) && + (((struct sockaddr_in *)a1)->sin_addr.s_addr == + ((struct sockaddr_in *)a2)->sin_addr.s_addr)); + else + return ((a1->sin6_port == a2->sin6_port) && + !memcmp(&a1->sin6_addr, &a2->sin6_addr, + sizeof (struct in6_addr))); + } + if (a1->sin6_family == AF_INET) { + struct sockaddr_in6 *sap = a1; + a1 = a2; + a2 = sap; + } /* assumes that AF_INET and AF_INET6 are the only possibilities */ + return ((a1->sin6_port == ((struct sockaddr_in *)a2)->sin_port) && + IN6_IS_ADDR_V4MAPPED(&a1->sin6_addr) && + (a1->sin6_addr.s6_addr32[3] == + ((struct sockaddr_in *)a2)->sin_addr.s_addr)); +} + +/* + * Converts IPv4 family, address and port to + * IPv6 family, IPv4-mapped IPv6 address and port. + */ +static void +convaddr4to6(struct sockaddr_in6 *sa) +{ + struct sockaddr_in *sa4p = (struct sockaddr_in *) sa; + in_port_t port = sa4p->sin_port; + in_addr_t addr = sa4p->sin_addr.s_addr; + + sa->sin6_family = AF_INET6; + sa->sin6_port = port; + sa->sin6_addr.s6_addr32[0] = 0; + sa->sin6_addr.s6_addr32[1] = 0; + sa->sin6_addr.s6_addr32[2] = htonl(0xFFFF); + sa->sin6_addr.s6_addr32[3] = addr; +}
res_send.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: check_pf.c =================================================================== --- check_pf.c (nonexistent) +++ check_pf.c (revision 520) @@ -0,0 +1,199 @@ +/* Determine protocol families for which interfaces exist. Linux version. + Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "config.h" +#include "local.h" + +#define __ASSUME_NETLINK_SUPPORT 1 + +static int +make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6) +{ + struct + { + struct nlmsghdr nlh; + struct rtgenmsg g; + } req; + struct sockaddr_nl nladdr; + + req.nlh.nlmsg_len = sizeof (req); + req.nlh.nlmsg_type = RTM_GETADDR; + req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST; + req.nlh.nlmsg_pid = 0; + req.nlh.nlmsg_seq = time (NULL); + req.g.rtgen_family = AF_UNSPEC; + + memset (&nladdr, '\0', sizeof (nladdr)); + nladdr.nl_family = AF_NETLINK; + + if (TEMP_FAILURE_RETRY (sendto (fd, (void *) &req, sizeof (req), 0, + (struct sockaddr *) &nladdr, + sizeof (nladdr))) < 0) + return -1; + + *seen_ipv4 = false; + *seen_ipv6 = false; + + bool done = false; + char buf[4096]; + struct iovec iov = { buf, sizeof (buf) }; + + do + { + struct msghdr msg = + { + (void *) &nladdr, sizeof (nladdr), + &iov, 1, + NULL, 0, + 0 + }; + + ssize_t read_len = TEMP_FAILURE_RETRY (recvmsg (fd, &msg, 0)); + if (read_len < 0) + return -1; + + if (msg.msg_flags & MSG_TRUNC) + return -1; + + struct nlmsghdr *nlmh; + for (nlmh = (struct nlmsghdr *) buf; + NLMSG_OK (nlmh, (size_t) read_len); + nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len)) + { + if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != pid + || nlmh->nlmsg_seq != req.nlh.nlmsg_seq) + continue; + + if (nlmh->nlmsg_type == RTM_NEWADDR) + { + struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlmh); + + switch (ifam->ifa_family) + { + case AF_INET: + *seen_ipv4 = true; + break; + case AF_INET6: + *seen_ipv6 = true; + break; + default: + /* Ignore. */ + break; + } + } + else if (nlmh->nlmsg_type == NLMSG_DONE) + /* We found the end, leave the loop. */ + done = true; + else ; + } + } + while (! done); + + close (fd); + + return 0; +} + + +/* We don't know if we have NETLINK support compiled in in our + Kernel. */ +#if __ASSUME_NETLINK_SUPPORT == 0 +/* Define in ifaddrs.h. */ +extern int __no_netlink_support attribute_hidden; +#else +# define __no_netlink_support 0 +#endif + + +void +attribute_hidden +__check_pf (bool *seen_ipv4, bool *seen_ipv6) +{ + if (! __no_netlink_support) + { + int fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE); + + struct sockaddr_nl nladdr; + memset (&nladdr, '\0', sizeof (nladdr)); + nladdr.nl_family = AF_NETLINK; + + socklen_t addr_len = sizeof (nladdr); + + if (fd >= 0 + && bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0 + && getsockname (fd, (struct sockaddr *) &nladdr, &addr_len) == 0 + && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6) == 0) + /* It worked. */ + return; + + if (fd >= 0) + close (fd); + +#if __ASSUME_NETLINK_SUPPORT == 0 + /* Remember that there is no netlink support. */ + __no_netlink_support = 1; +#else + /* We cannot determine what interfaces are available. Be + pessimistic. */ + *seen_ipv4 = true; + *seen_ipv6 = true; +#endif + } + +#if __ASSUME_NETLINK_SUPPORT == 0 + /* No netlink. Get the interface list via getifaddrs. */ + struct ifaddrs *ifa = NULL; + if (getifaddrs (&ifa) != 0) + { + /* We cannot determine what interfaces are available. Be + pessimistic. */ + *seen_ipv4 = true; + *seen_ipv6 = true; + return; + } + + *seen_ipv4 = false; + *seen_ipv6 = false; + + struct ifaddrs *runp; + for (runp = ifa; runp != NULL; runp = runp->ifa_next) + if (runp->ifa_addr->sa_family == PF_INET) + *seen_ipv4 = true; + else if (runp->ifa_addr->sa_family == PF_INET6) + *seen_ipv6 = true; + + (void) freeifaddrs (ifa); +#endif +}
check_pf.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_net.c =================================================================== --- inet_net.c (nonexistent) +++ inet_net.c (revision 520) @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include + +/* + * Internet network address interpretation routine. + * The library routines call this routine to interpret + * network numbers. + */ +u_int32_t +inet_network(cp) + register const char *cp; +{ + register u_int32_t val, base, n, i; + register char c; + u_int32_t parts[4], *pp = parts; + int digit; + +again: + val = 0; base = 10; digit = 0; + if (*cp == '0') + digit = 1, base = 8, cp++; + if (*cp == 'x' || *cp == 'X') + base = 16, cp++; + while ((c = *cp) != 0) { + if (isdigit(c)) { + if (base == 8 && (c == '8' || c == '9')) + return (INADDR_NONE); + val = (val * base) + (c - '0'); + cp++; + digit = 1; + continue; + } + if (base == 16 && isxdigit(c)) { + val = (val << 4) + (tolower (c) + 10 - 'a'); + cp++; + digit = 1; + continue; + } + break; + } + if (!digit) + return (INADDR_NONE); + if (pp >= parts + 4 || val > 0xff) + return (INADDR_NONE); + if (*cp == '.') { + *pp++ = val, cp++; + goto again; + } + if (*cp && !isspace(*cp)) + return (INADDR_NONE); + if (pp >= parts + 4 || val > 0xff) + return (INADDR_NONE); + *pp++ = val; + n = pp - parts; + for (val = 0, i = 0; i < n; i++) { + val <<= 8; + val |= parts[i] & 0xff; + } + return (val); +}
inet_net.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_hconf.c =================================================================== --- res_hconf.c (nonexistent) +++ res_hconf.c (revision 520) @@ -0,0 +1,676 @@ +/* Copyright (C) 1993, 1995-2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger (davidm@azstarnet.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This file provides a Linux /etc/host.conf compatible front end to + the various name resolvers (/etc/hosts, named, NIS server, etc.). + Though mostly compatibly, the following differences exist compared + to the original implementation: + + - new command "spoof" takes an arguments like RESOLV_SPOOF_CHECK + environment variable (i.e., `off', `nowarn', or `warn'). + + - line comments can appear anywhere (not just at the beginning of + a line) +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define _IO_MTSAFE_IO +#include +#include "ifreq.h" +#include "res_hconf.h" +#include "local.h" +#ifdef USE_IN_LIBIO +# include +#endif + +#define _PATH_HOSTCONF "/etc/host.conf" + +/* Environment vars that all user to override default behavior: */ +#define ENV_HOSTCONF "RESOLV_HOST_CONF" +#define ENV_SERVORDER "RESOLV_SERV_ORDER" +#define ENV_SPOOF "RESOLV_SPOOF_CHECK" +#define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS" +#define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS" +#define ENV_MULTI "RESOLV_MULTI" +#define ENV_REORDER "RESOLV_REORDER" + +static const char *arg_service_list (const char *, int, const char *, + unsigned int); +static const char *arg_trimdomain_list (const char *, int, const char *, + unsigned int); +static const char *arg_spoof (const char *, int, const char *, unsigned int); +static const char *arg_bool (const char *, int, const char *, unsigned int); + +static struct cmd +{ + const char *name; + const char *(*parse_args) (const char * filename, int line_num, + const char * args, unsigned int arg); + unsigned int arg; +} cmd[] = +{ + {"order", arg_service_list, 0}, + {"trim", arg_trimdomain_list, 0}, + {"spoof", arg_spoof, 0}, + {"multi", arg_bool, HCONF_FLAG_MULTI}, + {"nospoof", arg_bool, HCONF_FLAG_SPOOF}, + {"spoofalert", arg_bool, HCONF_FLAG_SPOOFALERT}, + {"reorder", arg_bool, HCONF_FLAG_REORDER} +}; + +/* Structure containing the state. */ +struct hconf _res_hconf; + +/* Skip white space. */ +static const char * +skip_ws (const char *str) +{ + while (isspace (*str)) ++str; + return str; +} + + +/* Skip until whitespace, comma, end of line, or comment character. */ +static const char * +skip_string (const char *str) +{ + while (*str && !isspace (*str) && *str != '#' && *str != ',') + ++str; + return str; +} + + +static const char * +arg_service_list (const char *fname, int line_num, const char *args, + unsigned int arg) +{ + enum Name_Service service; + const char *start; + size_t len; + size_t i; + static struct + { + const char * name; + enum Name_Service service; + } svcs[] = + { + {"bind", SERVICE_BIND}, + {"hosts", SERVICE_HOSTS}, + {"nis", SERVICE_NIS}, + }; + + do + { + start = args; + args = skip_string (args); + len = args - start; + + service = SERVICE_NONE; + for (i = 0; i < sizeof (svcs) / sizeof (svcs[0]); ++i) + { + if (strncasecmp (start, svcs[i].name, len) == 0 + && len == strlen (svcs[i].name)) + { + service = svcs[i].service; + break; + } + } + if (service == SERVICE_NONE) + { + char *buf; + + if (asprintf (&buf, + _("%s: line %d: expected service, found `%s'\n"), + fname, line_num, start) < 0) + return 0; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return 0; + } + if (_res_hconf.num_services >= SERVICE_MAX) + { + char *buf; + + if (asprintf (&buf, _("\ +%s: line %d: cannot specify more than %d services"), + fname, line_num, SERVICE_MAX) < 0) + return 0; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return 0; + } + _res_hconf.service[_res_hconf.num_services++] = service; + + args = skip_ws (args); + switch (*args) + { + case ',': + case ';': + case ':': + args = skip_ws (++args); + if (!*args || *args == '#') + { + char *buf; + + if (asprintf (&buf, _("\ +%s: line %d: list delimiter not followed by keyword"), + fname, line_num) < 0) + return 0; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return 0; + } + default: + break; + } + } + while (*args && *args != '#'); + return args; +} + + +static const char * +arg_trimdomain_list (const char *fname, int line_num, const char *args, + unsigned int flag) +{ + const char * start; + size_t len; + + do + { + start = args; + args = skip_string (args); + len = args - start; + + if (_res_hconf.num_trimdomains >= TRIMDOMAINS_MAX) + { + char *buf; + + if (asprintf (&buf, _("\ +%s: line %d: cannot specify more than %d trim domains"), + fname, line_num, TRIMDOMAINS_MAX) < 0) + return 0; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return 0; + } + _res_hconf.trimdomain[_res_hconf.num_trimdomains++] = + strndup (start, len); + args = skip_ws (args); + switch (*args) + { + case ',': case ';': case ':': + args = skip_ws (++args); + if (!*args || *args == '#') + { + char *buf; + + if (asprintf (&buf, _("\ +%s: line %d: list delimiter not followed by domain"), + fname, line_num) < 0) + return 0; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return 0; + } + default: + break; + } + } + while (*args && *args != '#'); + return args; +} + + +static const char * +arg_spoof (const char *fname, int line_num, const char *args, unsigned flag) +{ + const char *start = args; + size_t len; + + args = skip_string (args); + len = args - start; + + if (len == 3 && strncasecmp (start, "off", len) == 0) + _res_hconf.flags &= ~(HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT); + else + { + _res_hconf.flags |= (HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT); + if ((len == 6 && strncasecmp (start, "nowarn", len) == 0) + || !(len == 4 && strncasecmp (start, "warn", len) == 0)) + _res_hconf.flags &= ~HCONF_FLAG_SPOOFALERT; + } + return args; +} + + +static const char * +arg_bool (const char *fname, int line_num, const char *args, unsigned flag) +{ + if (strncasecmp (args, "on", 2) == 0) + { + args += 2; + _res_hconf.flags |= flag; + } + else if (strncasecmp (args, "off", 3) == 0) + { + args += 3; + _res_hconf.flags &= ~flag; + } + else + { + char *buf; + + if (asprintf (&buf, + _("%s: line %d: expected `on' or `off', found `%s'\n"), + fname, line_num, args) < 0) + return 0; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return 0; + } + return args; +} + + +static void +parse_line (const char *fname, int line_num, const char *str) +{ + const char *start; + struct cmd *c = 0; + size_t len; + size_t i; + + str = skip_ws (str); + + /* skip line comment and empty lines: */ + if (*str == '\0' || *str == '#') return; + + start = str; + str = skip_string (str); + len = str - start; + + for (i = 0; i < sizeof (cmd) / sizeof (cmd[0]); ++i) + { + if (strncasecmp (start, cmd[i].name, len) == 0 + && strlen (cmd[i].name) == len) + { + c = &cmd[i]; + break; + } + } + if (c == NULL) + { + char *buf; + + if (asprintf (&buf, _("%s: line %d: bad command `%s'\n"), + fname, line_num, start) < 0) + return; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + return; + } + + /* process args: */ + str = skip_ws (str); + str = (*c->parse_args) (fname, line_num, str, c->arg); + if (!str) + return; + + /* rest of line must contain white space or comment only: */ + while (*str) + { + if (!isspace (*str)) { + if (*str != '#') + { + char *buf; + + if (asprintf (&buf, + _("%s: line %d: ignoring trailing garbage `%s'\n"), + fname, line_num, str) < 0) + break; + +#ifdef USE_IN_LIBIO + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else +#endif + fputs (buf, stderr); + + free (buf); + } + break; + } + ++str; + } +} + + +static void +do_init (void) +{ + const char *hconf_name; + int line_num = 0; + char buf[256], *envval; + FILE *fp; + + memset (&_res_hconf, '\0', sizeof (_res_hconf)); + + hconf_name = getenv (ENV_HOSTCONF); + if (hconf_name == NULL) + hconf_name = _PATH_HOSTCONF; + + fp = fopen (hconf_name, "rc"); + if (!fp) + /* make up something reasonable: */ + _res_hconf.service[_res_hconf.num_services++] = SERVICE_BIND; + else + { + /* No threads using this stream. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); + + while (fgets (buf, sizeof (buf), fp)) + { + char *tmp; + ++line_num; + tmp = strchr (buf, '\n'); + if (tmp != NULL) + *tmp = '\0'; + parse_line (hconf_name, line_num, buf); + } + fclose (fp); + } + + envval = getenv (ENV_SERVORDER); + if (envval) + { + _res_hconf.num_services = 0; + arg_service_list (ENV_SERVORDER, 1, envval, 0); + } + + envval = getenv (ENV_SPOOF); + if (envval) + arg_spoof (ENV_SPOOF, 1, envval, 0); + + envval = getenv (ENV_MULTI); + if (envval) + arg_bool (ENV_MULTI, 1, envval, HCONF_FLAG_MULTI); + + envval = getenv (ENV_REORDER); + if (envval) + arg_bool (ENV_REORDER, 1, envval, HCONF_FLAG_REORDER); + + envval = getenv (ENV_TRIM_ADD); + if (envval) + arg_trimdomain_list (ENV_TRIM_ADD, 1, envval, 0); + + envval = getenv (ENV_TRIM_OVERR); + if (envval) + { + _res_hconf.num_trimdomains = 0; + arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval, 0); + } + + _res_hconf.initialized = 1; +} + + +/* Initialize hconf datastructure by reading host.conf file and + environment variables. */ +void +_res_hconf_init (void) +{ + __libc_once_define (static, once); + + __libc_once (once, do_init); +} + + +/* List of known interfaces. */ +libc_freeres_ptr ( +static struct netaddr +{ + int addrtype; + union + { + struct + { + u_int32_t addr; + u_int32_t mask; + } ipv4; + } u; +} *ifaddrs); + +/* We need to protect the dynamic buffer handling. */ +__libc_lock_define_initialized (static, lock); + +/* Reorder addresses returned in a hostent such that the first address + is an address on the local subnet, if there is such an address. + Otherwise, nothing is changed. + + Note that this function currently only handles IPv4 addresses. */ + +void +_res_hconf_reorder_addrs (struct hostent *hp) +{ +#if defined SIOCGIFCONF && defined SIOCGIFNETMASK + int i, j; + /* Number of interfaces. */ + static int num_ifs = -1; + + /* Only reorder if we're supposed to. */ + if ((_res_hconf.flags & HCONF_FLAG_REORDER) == 0) + return; + + /* Can't deal with anything but IPv4 for now... */ + if (hp->h_addrtype != AF_INET) + return; + + if (num_ifs <= 0) + { + struct ifreq *ifr, *cur_ifr; + int sd, num, i; + /* Save errno. */ + int save = errno; + + /* Initialize interface table. */ + + num_ifs = 0; + + /* The SIOCGIFNETMASK ioctl will only work on an AF_INET socket. */ + sd = socket (AF_INET, SOCK_DGRAM, 0); + if (sd < 0) + return; + + /* Get lock. */ + __libc_lock_lock (lock); + + /* Get a list of interfaces. */ + __ifreq (&ifr, &num, sd); + if (!ifr) + goto cleanup; + + ifaddrs = malloc (num * sizeof (ifaddrs[0])); + if (!ifaddrs) + goto cleanup1; + + /* Copy usable interfaces in ifaddrs structure. */ + for (cur_ifr = ifr, i = 0; i < num; cur_ifr = __if_nextreq (cur_ifr), ++i) + { + if (cur_ifr->ifr_addr.sa_family != AF_INET) + continue; + + ifaddrs[num_ifs].addrtype = AF_INET; + ifaddrs[num_ifs].u.ipv4.addr = + ((struct sockaddr_in *) &cur_ifr->ifr_addr)->sin_addr.s_addr; + + if (ioctl (sd, SIOCGIFNETMASK, cur_ifr) < 0) + continue; + + ifaddrs[num_ifs].u.ipv4.mask = + ((struct sockaddr_in *) &cur_ifr->ifr_netmask)->sin_addr.s_addr; + + /* Now we're committed to this entry. */ + ++num_ifs; + } + /* Just keep enough memory to hold all the interfaces we want. */ + ifaddrs = realloc (ifaddrs, num_ifs * sizeof (ifaddrs[0])); + assert (ifaddrs != NULL); + + cleanup1: + __if_freereq (ifr, num); + + cleanup: + /* Release lock, preserve error value, and close socket. */ + save = errno; + __libc_lock_unlock (lock); + close (sd); + } + + if (num_ifs == 0) + return; + + /* Find an address for which we have a direct connection. */ + for (i = 0; hp->h_addr_list[i]; ++i) + { + struct in_addr *haddr = (struct in_addr *) hp->h_addr_list[i]; + + for (j = 0; j < num_ifs; ++j) + { + u_int32_t if_addr = ifaddrs[j].u.ipv4.addr; + u_int32_t if_netmask = ifaddrs[j].u.ipv4.mask; + + if (((haddr->s_addr ^ if_addr) & if_netmask) == 0) + { + void *tmp; + + tmp = hp->h_addr_list[i]; + hp->h_addr_list[i] = hp->h_addr_list[0]; + hp->h_addr_list[0] = tmp; + return; + } + } + } +#endif /* defined(SIOCGIFCONF) && ... */ +} + + +/* If HOSTNAME has a postfix matching any of the trimdomains, trim away + that postfix. Notice that HOSTNAME is modified inplace. Also, the + original code applied all trimdomains in order, meaning that the + same domainname could be trimmed multiple times. I believe this + was unintentional. */ +void +_res_hconf_trim_domain (char *hostname) +{ + size_t hostname_len, trim_len; + int i; + + hostname_len = strlen (hostname); + + for (i = 0; i < _res_hconf.num_trimdomains; ++i) + { + const char *trim = _res_hconf.trimdomain[i]; + + trim_len = strlen (trim); + if (hostname_len > trim_len + && strcasecmp (&hostname[hostname_len - trim_len], trim) == 0) + { + hostname[hostname_len - trim_len] = '\0'; + break; + } + } +} + + +/* Trim all hostnames/aliases in HP according to the trimdomain list. + Notice that HP is modified inplace! */ +void +_res_hconf_trim_domains (struct hostent *hp) +{ + int i; + + if (_res_hconf.num_trimdomains == 0) + return; + + _res_hconf_trim_domain (hp->h_name); + for (i = 0; hp->h_aliases[i]; ++i) + _res_hconf_trim_domain (hp->h_aliases[i]); +}
res_hconf.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_hconf.h =================================================================== --- res_hconf.h (nonexistent) +++ res_hconf.h (revision 520) @@ -0,0 +1,55 @@ +/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by David Mosberger (davidm@azstarnet.com). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _RES_HCONF_H_ +#define _RES_HCONF_H_ + +#include + +#define TRIMDOMAINS_MAX 4 + +enum Name_Service +{ + SERVICE_NONE = 0, + SERVICE_BIND, SERVICE_HOSTS, SERVICE_NIS, + SERVICE_MAX +}; + +struct hconf +{ + int initialized; + int num_services; + enum Name_Service service[SERVICE_MAX]; + int num_trimdomains; + const char *trimdomain[TRIMDOMAINS_MAX]; + unsigned int flags; +# define HCONF_FLAG_INITED (1 << 0) /* initialized? */ +# define HCONF_FLAG_SPOOF (1 << 1) /* refuse spoofed addresses */ +# define HCONF_FLAG_SPOOFALERT (1 << 2) /* syslog warning of spoofed */ +# define HCONF_FLAG_REORDER (1 << 3) /* list best address first */ +# define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */ +}; +extern struct hconf _res_hconf; + +extern void _res_hconf_init (void); +extern void _res_hconf_trim_domain (char *domain); +extern void _res_hconf_trim_domains (struct hostent *hp); +extern void _res_hconf_reorder_addrs (struct hostent *hp); + +#endif /* _RES_HCONF_H_ */
res_hconf.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_lnaof.c =================================================================== --- inet_lnaof.c (nonexistent) +++ inet_lnaof.c (revision 520) @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include + +/* + * Return the local network address portion of an + * internet address; handles class a/b/c network + * number formats. + */ +in_addr_t +inet_lnaof(in) + struct in_addr in; +{ + register u_int32_t i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return ((i)&IN_CLASSA_HOST); + else if (IN_CLASSB(i)) + return ((i)&IN_CLASSB_HOST); + else + return ((i)&IN_CLASSC_HOST); +}
inet_lnaof.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns_name.c =================================================================== --- ns_name.c (nonexistent) +++ ns_name.c (revision 520) @@ -0,0 +1,748 @@ +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_name.c,v 8.15 2000/03/30 22:53:46 vixie Exp $"; +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +/* Data. */ + +static const char digits[] = "0123456789"; + +/* Forward. */ + +static int special(int); +static int printable(int); +static int dn_find(const u_char *, const u_char *, + const u_char * const *, + const u_char * const *); + +/* Public. */ + +/* + * ns_name_ntop(src, dst, dstsiz) + * Convert an encoded domain name to printable ascii as per RFC1035. + * return: + * Number of bytes written to buffer, or -1 (with errno set) + * notes: + * The root is returned as "." + * All other domains are returned in non absolute form + */ +int +ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) { + const u_char *cp; + char *dn, *eom; + u_char c; + u_int n; + + cp = src; + dn = dst; + eom = dst + dstsiz; + + while ((n = *cp++) != 0) { + if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) { + /* Some kind of compression pointer. */ + __set_errno (EMSGSIZE); + return (-1); + } + if (dn != dst) { + if (dn >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = '.'; + } + + if (n == 0x41) { + n = *cp++ / 8; + if (dn + n * 2 + 4 >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = '\\'; + *dn++ = '['; + *dn++ = 'x'; + + while (n-- > 0) { + c = *cp++; + unsigned u = c >> 4; + *dn++ = u > 9 ? 'a' + u - 10 : '0' + u; + u = c & 0xf; + *dn++ = u > 9 ? 'a' + u - 10 : '0' + u; + } + + *dn++ = ']'; + continue; + } + + if (dn + n >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + for ((void)NULL; n > 0; n--) { + c = *cp++; + if (special(c)) { + if (dn + 1 >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = '\\'; + *dn++ = (char)c; + } else if (!printable(c)) { + if (dn + 3 >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = '\\'; + *dn++ = digits[c / 100]; + *dn++ = digits[(c % 100) / 10]; + *dn++ = digits[c % 10]; + } else { + if (dn >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = (char)c; + } + } + } + if (dn == dst) { + if (dn >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = '.'; + } + if (dn >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = '\0'; + return (dn - dst); +} +libresolv_hidden_def (ns_name_ntop) + +/* + * ns_name_pton(src, dst, dstsiz) + * Convert a ascii string into an encoded domain name as per RFC1035. + * return: + * -1 if it fails + * 1 if string was fully qualified + * 0 is string was not fully qualified + * notes: + * Enforces label and domain length limits. + */ + +int +ns_name_pton(const char *src, u_char *dst, size_t dstsiz) { + u_char *label, *bp, *eom; + int c, n, escaped; + char *cp; + + escaped = 0; + bp = dst; + eom = dst + dstsiz; + label = bp++; + + while ((c = *src++) != 0) { + if (escaped) { + if ((cp = strchr(digits, c)) != NULL) { + n = (cp - digits) * 100; + if ((c = *src++) == 0 || + (cp = strchr(digits, c)) == NULL) { + __set_errno (EMSGSIZE); + return (-1); + } + n += (cp - digits) * 10; + if ((c = *src++) == 0 || + (cp = strchr(digits, c)) == NULL) { + __set_errno (EMSGSIZE); + return (-1); + } + n += (cp - digits); + if (n > 255) { + __set_errno (EMSGSIZE); + return (-1); + } + c = n; + } else if (c == '[' && label == bp - 1 && *src == 'x') { + /* Theoretically we would have to handle \[o + as well but we do not since we do not need + it internally. */ + *label = 0x41; + label = bp++; + ++src; + while (isxdigit (*src)) { + n = *src > '9' ? *src - 'a' + 10 : *src - '0'; + ++src; + if (! isxdigit(*src)) { + __set_errno (EMSGSIZE); + return (-1); + } + n <<= 4; + n += *src > '9' ? *src - 'a' + 10 : *src - '0'; + if (bp + 1 >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *bp++ = n; + ++src; + } + *label = (bp - label - 1) * 8; + if (*src++ != ']' || *src++ != '.') { + __set_errno (EMSGSIZE); + return (-1); + } + escaped = 0; + label = bp++; + if (bp >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + continue; + } + escaped = 0; + } else if (c == '\\') { + escaped = 1; + continue; + } else if (c == '.') { + c = (bp - label - 1); + if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ + __set_errno (EMSGSIZE); + return (-1); + } + if (label >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *label = c; + /* Fully qualified ? */ + if (*src == '\0') { + if (c != 0) { + if (bp >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *bp++ = '\0'; + } + if ((bp - dst) > MAXCDNAME) { + __set_errno (EMSGSIZE); + return (-1); + } + return (1); + } + if (c == 0 || *src == '.') { + __set_errno (EMSGSIZE); + return (-1); + } + label = bp++; + continue; + } + if (bp >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *bp++ = (u_char)c; + } + c = (bp - label - 1); + if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */ + __set_errno (EMSGSIZE); + return (-1); + } + if (label >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *label = c; + if (c != 0) { + if (bp >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *bp++ = 0; + } + if ((bp - dst) > MAXCDNAME) { /* src too big */ + __set_errno (EMSGSIZE); + return (-1); + } + return (0); +} + +/* + * ns_name_ntol(src, dst, dstsiz) + * Convert a network strings labels into all lowercase. + * return: + * Number of bytes written to buffer, or -1 (with errno set) + * notes: + * Enforces label and domain length limits. + */ + +int +ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) { + const u_char *cp; + u_char *dn, *eom; + u_char c; + u_int n; + + cp = src; + dn = dst; + eom = dst + dstsiz; + + while ((n = *cp++) != 0) { + if ((n & NS_CMPRSFLGS) != 0) { + /* Some kind of compression pointer. */ + __set_errno (EMSGSIZE); + return (-1); + } + *dn++ = n; + if (dn + n >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + for ((void)NULL; n > 0; n--) { + c = *cp++; + if (isupper(c)) + *dn++ = tolower(c); + else + *dn++ = c; + } + } + *dn++ = '\0'; + return (dn - dst); +} + +/* + * ns_name_unpack(msg, eom, src, dst, dstsiz) + * Unpack a domain name from a message, source may be compressed. + * return: + * -1 if it fails, or consumed octets if it succeeds. + */ +int +ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src, + u_char *dst, size_t dstsiz) +{ + const u_char *srcp, *dstlim; + u_char *dstp; + int n, len, checked; + + len = -1; + checked = 0; + dstp = dst; + srcp = src; + dstlim = dst + dstsiz; + if (srcp < msg || srcp >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + /* Fetch next label in domain name. */ + while ((n = *srcp++) != 0) { + /* Check for indirection. */ + switch (n & NS_CMPRSFLGS) { + case 0x40: + if (n == 0x41) { + if (dstp + 1 >= dstlim) { + __set_errno (EMSGSIZE); + return (-1); + } + *dstp++ = 0x41; + n = *srcp++ / 8; + ++checked; + } else { + __set_errno (EMSGSIZE); + return (-1); /* flag error */ + } + /* FALLTHROUGH */ + case 0: + /* Limit checks. */ + if (dstp + n + 1 >= dstlim || srcp + n >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + checked += n + 1; + dstp = mempcpy(dstp, srcp - 1, n + 1); + srcp += n; + break; + + case NS_CMPRSFLGS: + if (srcp >= eom) { + __set_errno (EMSGSIZE); + return (-1); + } + if (len < 0) + len = srcp - src + 1; + srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff)); + if (srcp < msg || srcp >= eom) { /* Out of range. */ + __set_errno (EMSGSIZE); + return (-1); + } + checked += 2; + /* + * Check for loops in the compressed name; + * if we've looked at the whole message, + * there must be a loop. + */ + if (checked >= eom - msg) { + __set_errno (EMSGSIZE); + return (-1); + } + break; + + default: + __set_errno (EMSGSIZE); + return (-1); /* flag error */ + } + } + *dstp = '\0'; + if (len < 0) + len = srcp - src; + return (len); +} +libresolv_hidden_def (ns_name_unpack) + +/* + * ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr) + * Pack domain name 'domain' into 'comp_dn'. + * return: + * Size of the compressed name, or -1. + * notes: + * 'dnptrs' is an array of pointers to previous compressed names. + * dnptrs[0] is a pointer to the beginning of the message. The array + * ends with NULL. + * 'lastdnptr' is a pointer to the end of the array pointed to + * by 'dnptrs'. + * Side effects: + * The list of pointers in dnptrs is updated for labels inserted into + * the message as we compress the name. If 'dnptr' is NULL, we don't + * try to compress names. If 'lastdnptr' is NULL, we don't update the + * list. + */ +int +ns_name_pack(const u_char *src, u_char *dst, int dstsiz, + const u_char **dnptrs, const u_char **lastdnptr) +{ + u_char *dstp; + const u_char **cpp, **lpp, *eob, *msg; + const u_char *srcp; + int n, l, first = 1; + + srcp = src; + dstp = dst; + eob = dstp + dstsiz; + lpp = cpp = NULL; + if (dnptrs != NULL) { + if ((msg = *dnptrs++) != NULL) { + for (cpp = dnptrs; *cpp != NULL; cpp++) + (void)NULL; + lpp = cpp; /* end of list to search */ + } + } else + msg = NULL; + + /* make sure the domain we are about to add is legal */ + l = 0; + do { + n = *srcp; + if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) { + __set_errno (EMSGSIZE); + return (-1); + } + if (n == 0x41) + n = *++srcp / 8; + l += n + 1; + if (l > MAXCDNAME) { + __set_errno (EMSGSIZE); + return (-1); + } + srcp += n + 1; + } while (n != 0); + + /* from here on we need to reset compression pointer array on error */ + srcp = src; + do { + /* Look to see if we can use pointers. */ + n = *srcp; + if (n != 0 && n != 0x41 && msg != NULL) { + l = dn_find(srcp, msg, (const u_char * const *)dnptrs, + (const u_char * const *)lpp); + if (l >= 0) { + if (dstp + 1 >= eob) { + goto cleanup; + } + *dstp++ = (l >> 8) | NS_CMPRSFLGS; + *dstp++ = l % 256; + return (dstp - dst); + } + /* Not found, save it. */ + if (lastdnptr != NULL && cpp < lastdnptr - 1 && + (dstp - msg) < 0x4000 && first) { + *cpp++ = dstp; + *cpp = NULL; + first = 0; + } + } + /* copy label to buffer */ + if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) { /* Should not happen. */ + goto cleanup; + } + if (n == 0x41) { + n = *++srcp / 8; + if (dstp + 1 >= eob) + goto cleanup; + *dstp++ = 0x41; + } + if (dstp + 1 + n >= eob) { + goto cleanup; + } + memcpy(dstp, srcp, n + 1); + srcp += n + 1; + dstp += n + 1; + } while (n != 0); + + if (dstp > eob) { +cleanup: + if (msg != NULL) + *lpp = NULL; + __set_errno (EMSGSIZE); + return (-1); + } + return (dstp - dst); +} + +/* + * ns_name_uncompress(msg, eom, src, dst, dstsiz) + * Expand compressed domain name to presentation format. + * return: + * Number of bytes read out of `src', or -1 (with errno set). + * note: + * Root domain returns as "." not "". + */ +int +ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src, + char *dst, size_t dstsiz) +{ + u_char tmp[NS_MAXCDNAME]; + int n; + + if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1) + return (-1); + if (ns_name_ntop(tmp, dst, dstsiz) == -1) + return (-1); + return (n); +} + +/* + * ns_name_compress(src, dst, dstsiz, dnptrs, lastdnptr) + * Compress a domain name into wire format, using compression pointers. + * return: + * Number of bytes consumed in `dst' or -1 (with errno set). + * notes: + * 'dnptrs' is an array of pointers to previous compressed names. + * dnptrs[0] is a pointer to the beginning of the message. + * The list ends with NULL. 'lastdnptr' is a pointer to the end of the + * array pointed to by 'dnptrs'. Side effect is to update the list of + * pointers for labels inserted into the message as we compress the name. + * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr' + * is NULL, we don't update the list. + */ +int +ns_name_compress(const char *src, u_char *dst, size_t dstsiz, + const u_char **dnptrs, const u_char **lastdnptr) +{ + u_char tmp[NS_MAXCDNAME]; + + if (ns_name_pton(src, tmp, sizeof tmp) == -1) + return (-1); + return (ns_name_pack(tmp, dst, dstsiz, dnptrs, lastdnptr)); +} + +/* + * Reset dnptrs so that there are no active references to pointers at or + * after src. + */ +void +ns_name_rollback(const u_char *src, const u_char **dnptrs, + const u_char **lastdnptr) +{ + while (dnptrs < lastdnptr && *dnptrs != NULL) { + if (*dnptrs >= src) { + *dnptrs = NULL; + break; + } + dnptrs++; + } +} + +/* + * ns_name_skip(ptrptr, eom) + * Advance *ptrptr to skip over the compressed name it points at. + * return: + * 0 on success, -1 (with errno set) on failure. + */ +int +ns_name_skip(const u_char **ptrptr, const u_char *eom) { + const u_char *cp; + u_int n; + + cp = *ptrptr; + while (cp < eom && (n = *cp++) != 0) { + /* Check for indirection. */ + switch (n & NS_CMPRSFLGS) { + case 0: /* normal case, n == len */ + cp += n; + continue; + case NS_CMPRSFLGS: /* indirection */ + cp++; + break; + default: /* illegal type */ + __set_errno (EMSGSIZE); + return (-1); + } + break; + } + if (cp > eom) { + __set_errno (EMSGSIZE); + return (-1); + } + *ptrptr = cp; + return (0); +} + +/* Private. */ + +/* + * special(ch) + * Thinking in noninternationalized USASCII (per the DNS spec), + * is this characted special ("in need of quoting") ? + * return: + * boolean. + */ +static int +special(int ch) { + switch (ch) { + case 0x22: /* '"' */ + case 0x2E: /* '.' */ + case 0x3B: /* ';' */ + case 0x5C: /* '\\' */ + /* Special modifiers in zone files. */ + case 0x40: /* '@' */ + case 0x24: /* '$' */ + return (1); + default: + return (0); + } +} + +/* + * printable(ch) + * Thinking in noninternationalized USASCII (per the DNS spec), + * is this character visible and not a space when printed ? + * return: + * boolean. + */ +static int +printable(int ch) { + return (ch > 0x20 && ch < 0x7f); +} + +/* + * Thinking in noninternationalized USASCII (per the DNS spec), + * convert this character to lower case if it's upper case. + */ +static int +mklower(int ch) { + if (ch >= 0x41 && ch <= 0x5A) + return (ch + 0x20); + return (ch); +} + +/* + * dn_find(domain, msg, dnptrs, lastdnptr) + * Search for the counted-label name in an array of compressed names. + * return: + * offset from msg if found, or -1. + * notes: + * dnptrs is the pointer to the first name on the list, + * not the pointer to the start of the message. + */ +static int +dn_find(const u_char *domain, const u_char *msg, + const u_char * const *dnptrs, + const u_char * const *lastdnptr) +{ + const u_char *dn, *cp, *sp; + const u_char * const *cpp; + u_int n; + + for (cpp = dnptrs; cpp < lastdnptr; cpp++) { + sp = *cpp; + /* + * terminate search on: + * root label + * compression pointer + * unusable offset + */ + while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 && + (sp - msg) < 0x4000) { + dn = domain; + cp = sp; + while ((n = *cp++) != 0) { + /* + * check for indirection + */ + switch (n & NS_CMPRSFLGS) { + case 0: /* normal case, n == len */ + if (n != *dn++) + goto next; + for ((void)NULL; n > 0; n--) + if (mklower(*dn++) != + mklower(*cp++)) + goto next; + /* Is next root for both ? */ + if (*dn == '\0' && *cp == '\0') + return (sp - msg); + if (*dn) + continue; + goto next; + + case NS_CMPRSFLGS: /* indirection */ + cp = msg + (((n & 0x3f) << 8) | *cp); + break; + + default: /* illegal type */ + __set_errno (EMSGSIZE); + return (-1); + } + } + next: + sp += *sp + 1; + } + } + __set_errno (ENOENT); + return (-1); +}
ns_name.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_ntoa.c =================================================================== --- inet_ntoa.c (nonexistent) +++ inet_ntoa.c (revision 520) @@ -0,0 +1,98 @@ +/* Convert Inet number to ASCII representation. + Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include + +/* The interface of this function is completely stupid, it requires a + static buffer. We relax this a bit in that we allow at least one + buffer for each thread. */ + +/* This is the key for the thread specific memory. */ +static __libc_key_t key; + +/* If nonzero the key allocation failed and we should better use a + static buffer than fail. */ +static char local_buf[18]; +static char *static_buf; + +/* Destructor for the thread-specific data. */ +static void init (void); +static void free_key_mem (void *mem); + + +char * +inet_ntoa (struct in_addr in) +{ + __libc_once_define (static, once); + char *buffer; + unsigned char *bytes; + + /* If we have not yet initialized the buffer do it now. */ + __libc_once (once, init); + + if (static_buf != NULL) + buffer = static_buf; + else + { + /* We don't use the static buffer and so we have a key. Use it + to get the thread-specific buffer. */ + buffer = __libc_getspecific (key); + if (buffer == NULL) + { + /* No buffer allocated so far. */ + buffer = malloc (18); + if (buffer == NULL) + /* No more memory available. We use the static buffer. */ + buffer = local_buf; + else + __libc_setspecific (key, buffer); + } + } + + bytes = (unsigned char *) ∈ + snprintf (buffer, 18, "%d.%d.%d.%d", + bytes[0], bytes[1], bytes[2], bytes[3]); + + return buffer; +} + + +/* Initialize buffer. */ +static void +init (void) +{ + if (__libc_key_create (&key, free_key_mem)) + /* Creating the key failed. This means something really went + wrong. In any case use a static buffer which is better than + nothing. */ + static_buf = local_buf; +} + + +/* Free the thread specific data, this is done if a thread terminates. */ +static void +free_key_mem (void *mem) +{ + free (mem); + __libc_setspecific (key, NULL); +}
inet_ntoa.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_data.c =================================================================== --- res_data.c (nonexistent) +++ res_data.c (revision 520) @@ -0,0 +1,335 @@ +/* + * Copyright (c) 1995-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = "$BINDId: res_data.c,v 8.17 1999/10/13 17:11:31 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#ifdef BIND_UPDATE +#include +#endif +#include +#include +#include +#include +#include "libc-symbols.h" + +const char *_res_opcodes[] = { + "QUERY", + "IQUERY", + "CQUERYM", + "CQUERYU", /* experimental */ + "NOTIFY", /* experimental */ + "UPDATE", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "ZONEINIT", + "ZONEREF", +}; +libresolv_hidden_data_def (_res_opcodes) + +#ifdef BIND_UPDATE +const char *_res_sectioncodes[] attribute_hidden = { + "ZONE", + "PREREQUISITES", + "UPDATE", + "ADDITIONAL", +}; +#endif + +#ifndef __BIND_NOSTATIC +#ifdef _LIBC +/* The definition has been moved to res_libc.c. */ +#else +#undef _res +struct __res_state _res +# if defined(__BIND_RES_TEXT) + = { RES_TIMEOUT, } /* Motorola, et al. */ +# endif + ; +#endif + +/* Proto. */ +#ifndef _LIBC +int res_ourserver_p(const res_state, const struct sockaddr_in *); +void res_pquery(const res_state, const u_char *, int, FILE *); +#endif + +#ifndef _LIBC +/* Moved to res_libc.c since res_init() should go into libc.so but the + rest of this file not. */ +int +res_init(void) { + extern int __res_vinit(res_state, int); + + /* + * These three fields used to be statically initialized. This made + * it hard to use this code in a shared library. It is necessary, + * now that we're doing dynamic initialization here, that we preserve + * the old semantics: if an application modifies one of these three + * fields of _res before res_init() is called, res_init() will not + * alter them. Of course, if an application is setting them to + * _zero_ before calling res_init(), hoping to override what used + * to be the static default, we can't detect it and unexpected results + * will follow. Zero for any of these fields would make no sense, + * so one can safely assume that the applications were already getting + * unexpected results. + * + * _res.options is tricky since some apps were known to diddle the bits + * before res_init() was first called. We can't replicate that semantic + * with dynamic initialization (they may have turned bits off that are + * set in RES_DEFAULT). Our solution is to declare such applications + * "broken". They could fool us by setting RES_INIT but none do (yet). + */ + if (!_res.retrans) + _res.retrans = RES_TIMEOUT; + if (!_res.retry) + _res.retry = 4; + if (!(_res.options & RES_INIT)) + _res.options = RES_DEFAULT; + + /* + * This one used to initialize implicitly to zero, so unless the app + * has set it to something in particular, we can randomize it now. + */ + if (!_res.id) + _res.id = res_randomid(); + + return (__res_vinit(&_res, 1)); +} +#endif + +void +p_query(const u_char *msg) { + fp_query(msg, stdout); +} + +void +fp_query(const u_char *msg, FILE *file) { + fp_nquery(msg, PACKETSZ, file); +} +libresolv_hidden_def (fp_query) + +void +fp_nquery(const u_char *msg, int len, FILE *file) { + if (__res_maybe_init (&_res, 0) == -1) + return; + + res_pquery(&_res, msg, len, file); +} +libresolv_hidden_def (fp_nquery) + +int +res_mkquery(int op, /* opcode of query */ + const char *dname, /* domain name */ + int class, int type, /* class and type of query */ + const u_char *data, /* resource record data */ + int datalen, /* length of data */ + const u_char *newrr_in, /* new rr for modify or append */ + u_char *buf, /* buffer to put query */ + int buflen) /* size of buffer */ +{ + if (__res_maybe_init (&_res, 1) == -1) { + RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); + return (-1); + } + return (res_nmkquery(&_res, op, dname, class, type, + data, datalen, + newrr_in, buf, buflen)); +} + +#ifdef BIND_UPDATE +int +res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) { + if (__res_maybe_init (&_res, 1) == -1) { + RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); + return (-1); + } + + return (res_nmkupdate(&_res, rrecp_in, buf, buflen)); +} +#endif + +int +res_query(const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer buffer */ +{ + if (__res_maybe_init (&_res, 1) == -1) { + RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); + return (-1); + } + return (res_nquery(&_res, name, class, type, answer, anslen)); +} + +void +res_send_setqhook(res_send_qhook hook) { + _res.qhook = hook; +} + +void +res_send_setrhook(res_send_rhook hook) { + _res.rhook = hook; +} + +int +res_isourserver(const struct sockaddr_in *inp) { + return (res_ourserver_p(&_res, (const struct sockaddr_in6 *) inp)); +} + +int +res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) { + if (__res_maybe_init (&_res, 1) == -1) { + /* errno should have been set by res_init() in this case. */ + return (-1); + } + + return (res_nsend(&_res, buf, buflen, ans, anssiz)); +} + +#ifndef _LIBC +int +res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key, + u_char *ans, int anssiz) +{ + if (__res_maybe_init (&_res, 1) == -1) { + /* errno should have been set by res_init() in this case. */ + return (-1); + } + + return (res_nsendsigned(&_res, buf, buflen, key, ans, anssiz)); +} +#endif + +void +res_close(void) { +#ifdef _LIBC + /* + * Some stupid programs out there call res_close() before res_init(). + * Since _res._vcsock isn't explicitly initialized, these means that + * we could do a close(0), which might lead to some security problems. + * Therefore we check if res_init() was called before by looking at + * the RES_INIT bit in _res.options. If it hasn't been set we bail out + * early. */ + if ((_res.options & RES_INIT) == 0) + return; +#endif + res_nclose(&_res); +} + +#ifdef BIND_UPDATE +int +res_update(ns_updrec *rrecp_in) { + if (__res_maybe_init (&_res, 1) == -1) { + RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); + return (-1); + } + + return (res_nupdate(&_res, rrecp_in, NULL)); +} +#endif + +int +res_search(const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer */ +{ + if (__res_maybe_init (&_res, 1) == -1) { + RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); + return (-1); + } + + return (res_nsearch(&_res, name, class, type, answer, anslen)); +} + +int +res_querydomain(const char *name, + const char *domain, + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer */ +{ + if (__res_maybe_init (&_res, 1) == -1) { + RES_SET_H_ERRNO(&_res, NETDB_INTERNAL); + return (-1); + } + + return (res_nquerydomain(&_res, name, domain, + class, type, + answer, anslen)); +} + +const char * +hostalias(const char *name) { + static char abuf[MAXDNAME]; + + return (res_hostalias(&_res, name, abuf, sizeof abuf)); +} +libresolv_hidden_def (hostalias) + +#ifdef ultrix +int +local_hostname_length(const char *hostname) { + int len_host, len_domain; + + if (!*_res.defdname) + res_init(); + len_host = strlen(hostname); + len_domain = strlen(_res.defdname); + if (len_host > len_domain && + !strcasecmp(hostname + len_host - len_domain, _res.defdname) && + hostname[len_host - len_domain - 1] == '.') + return (len_host - len_domain - 1); + return (0); +} +#endif /*ultrix*/ + +#endif + + +#include + +#if SHLIB_COMPAT(libresolv, GLIBC_2_0, GLIBC_2_2) +# undef res_mkquery +# undef res_query +# undef res_querydomain +# undef res_search +weak_alias (__res_mkquery, res_mkquery); +weak_alias (__res_query, res_query); +weak_alias (__res_querydomain, res_querydomain); +weak_alias (__res_search, res_search); +#endif
res_data.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: base64.c =================================================================== --- base64.c (nonexistent) +++ base64.c (revision 520) @@ -0,0 +1,319 @@ +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ + +#if !defined(LINT) && !defined(CODECENTER) +static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $"; +#endif /* not lint */ + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "libc-symbols.h" + +#define Assert(Cond) if (!(Cond)) abort() + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly edited form for + convenience. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8-bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a quantity. When fewer than 24 input + bits are available in an input group, zero bits are added (on the + right) to form an integral number of 6-bit groups. Padding at the + end of the data is performed using the '=' character. + + Since all base64 input is an integral number of octets, only the + ------------------------------------------------- + following cases can arise: + + (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded + output will be an integral multiple of 4 characters + with no "=" padding, + (2) the final quantum of encoding input is exactly 8 bits; + here, the final unit of encoded output will be two + characters followed by two "=" padding characters, or + (3) the final quantum of encoding input is exactly 16 bits; + here, the final unit of encoded output will be three + characters followed by one "=" padding character. + */ + +int +b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) { + size_t datalength = 0; + u_char input[3]; + u_char output[4]; + size_t i; + + while (2 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + srclength -= 3; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + output[3] = input[2] & 0x3f; + Assert(output[0] < 64); + Assert(output[1] < 64); + Assert(output[2] < 64); + Assert(output[3] < 64); + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + target[datalength++] = Base64[output[2]]; + target[datalength++] = Base64[output[3]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = '\0'; + for (i = 0; i < srclength; i++) + input[i] = *src++; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + Assert(output[0] < 64); + Assert(output[1] < 64); + Assert(output[2] < 64); + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + if (srclength == 1) + target[datalength++] = Pad64; + else + target[datalength++] = Base64[output[2]]; + target[datalength++] = Pad64; + } + if (datalength >= targsize) + return (-1); + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (datalength); +} +libresolv_hidden_def (b64_ntop) + +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 64 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +int +b64_pton(src, target, targsize) + char const *src; + u_char *target; + size_t targsize; +{ + int tarindex, state, ch; + char *pos; + + state = 0; + tarindex = 0; + + while ((ch = *src++) != '\0') { + if (isspace(ch)) /* Skip whitespace anywhere. */ + continue; + + if (ch == Pad64) + break; + + pos = strchr(Base64, ch); + if (pos == 0) /* A non-base64 character. */ + return (-1); + + switch (state) { + case 0: + if (target) { + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] = (pos - Base64) << 2; + } + state = 1; + break; + case 1: + if (target) { + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 4; + target[tarindex+1] = ((pos - Base64) & 0x0f) + << 4 ; + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 2; + target[tarindex+1] = ((pos - Base64) & 0x03) + << 6; + } + tarindex++; + state = 3; + break; + case 3: + if (target) { + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64); + } + tarindex++; + state = 0; + break; + default: + abort(); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace(ch)) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace(ch)) + return (-1); + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target && target[tarindex] != 0) + return (-1); + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +}
base64.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstent_r.c =================================================================== --- gethstent_r.c (nonexistent) +++ gethstent_r.c (revision 520) @@ -0,0 +1,35 @@ +/* Copyright (C) 1996, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct hostent +#define SETFUNC_NAME sethostent +#define GETFUNC_NAME gethostent +#define ENDFUNC_NAME endhostent +#define DATABASE_NAME hosts +#define STAYOPEN int stayopen +#define STAYOPEN_VAR stayopen +#define NEED_H_ERRNO 1 +#define NEED__RES 1 + +/* Special name for the lookup function. */ +#define DB_LOOKUP_FCT __nss_hosts_lookup + +#include "getXXent_r.c"
gethstent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Makefile.am =================================================================== --- Makefile.am (nonexistent) +++ Makefile.am (revision 520) @@ -0,0 +1,94 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = -I$(srcdir)/../include -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +GENERAL_SOURCES = addr2ascii.c ascii2addr.c alias-lookup.c \ + base64.c check_pf.c digits_dots.c \ + ether_aton.c ether_aton_r.c ether_hton.c \ + ether_line.c ether_ntoa.c ether_ntoa_r.c ether_ntoh.c \ + ethers-lookup.c getaddrinfo.c getaliasent.c \ + getaliasent_r.c getaliasname.c getaliasname_r.c gethstbyad.c \ + gethstbyad_r.c gethstbynm2.c gethstbynm2_r.c gethstbynm.c \ + gethstbynm_r.c gethstent.c gethstent_r.c getnameinfo.c getnetbyad.c \ + getnetbyad_r.c getnetbynm.c getnetbynm_r.c getnetent.c getnetent_r.c \ + getnetgrent.c getnetgrent_r.c getnssent.c getnssent_r.c getproto.c \ + getproto_r.c getprtent.c \ + getprtent_r.c getprtname.c getprtname_r.c getrpcbyname.c \ + getrpcbyname_r.c getrpcbynumber.c getrpcbynumber_r.c getrpcent.c \ + getrpcent_r.c getservent.c getservent_r.c getsrvbynm.c getsrvbynm_r.c \ + getsrvbypt.c getsrvbypt_r.c grp-lookup.c \ + herrno.c hosts-lookup.c ifreq.c \ + in6_addr.c inet6_option.c inet_addr.c \ + inet_lnaof.c inet_mkadr.c inet_net.c inet_neta.c inet_netof.c \ + inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c \ + inet_pton.c issetugid-stub.c key-lookup.c netgrp-lookup.c \ + network-lookup.c nsswitch.c \ + ns_name.c ns_netint.c ns_parse.c ns_print.c ns_samedomain.c \ + ns_ttl.c nsap_addr.c proto-lookup.c opensock.c pwd-lookup.c recv.c \ + res_comp.c res_data.c res_debug.c res_hconf.c res_init.c \ + res_libc.c res_mkquery.c \ + res_query.c res_send.c \ + rexec.c rpc-lookup.c ruserpass.c send.c service-lookup.c spwd-lookup.c + +ELIX_4_SOURCES = \ + ifname.c \ + rcmd.$(oext) \ + rcmdsh.$(oext) + +if ELIX_LEVEL_1 +ELIX_SOURCES = +else +if ELIX_LEVEL_2 +ELIX_SOURCES = +else +if ELIX_LEVEL_3 +ELIX_SOURCES = +else +ELIX_SOURCES = $(ELIX_4_SOURCES) +endif +endif +endif + +libnet_la_LDFLAGS = -Xcompiler -nostdlib +libnet_la_CFLAGS = -DINET6 + +if USE_LIBTOOL +noinst_LTLIBRARIES = libnet.la +libnet_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) +lib_a_CFLAGS = $(AM_CFLAGS) +noinst_DATA = +endif # USE_LIBTOOL + +include $(srcdir)/../../../../Makefile.shared + +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \ + for i in $(srcdir)/../include/arpa/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \ + for i in $(srcdir)/../include/net/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \ + for i in $(srcdir)/../include/netinet/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \ + for i in $(srcdir)/../include/netinet6/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netns; \ + for i in $(srcdir)/../include/netns/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netns/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \ + for i in $(srcdir)/../include/rpc/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \ + done;
Makefile.am Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getsrvbypt_r.c =================================================================== --- getsrvbypt_r.c (nonexistent) +++ getsrvbypt_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct servent +#define FUNCTION_NAME getservbyport +#define DATABASE_NAME services +#define ADD_PARAMS int port, const char *proto +#define ADD_VARIABLES port, proto + +#include "getXXbyYY_r.c"
getsrvbypt_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getprtent_r.c =================================================================== --- getprtent_r.c (nonexistent) +++ getprtent_r.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct protoent +#define SETFUNC_NAME setprotoent +#define GETFUNC_NAME getprotoent +#define ENDFUNC_NAME endprotoent +#define DATABASE_NAME protocols +#define STAYOPEN int stayopen +#define STAYOPEN_VAR stayopen + +#include "getXXent_r.c"
getprtent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_hton.c =================================================================== --- ether_hton.c (nonexistent) +++ ether_hton.c (revision 520) @@ -0,0 +1,83 @@ +/* Copyright (C) 1996, 1999, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include "etherent.h" + +#include "nsswitch.h" + +/* Type of the lookup function we need here. */ +typedef int (*lookup_function) (const char *, struct etherent *, char *, int, + int *); + +/* The lookup function for the first entry of this service. */ +extern int __nss_ethers_lookup (service_user **nip, const char *name, + void **fctp) internal_function; + + +int +ether_hostton (const char *hostname, struct ether_addr *addr) +{ + static service_user *startp; + static lookup_function start_fct; + service_user *nip; + union + { + lookup_function f; + void *ptr; + } fct; + int no_more; + enum nss_status status = NSS_STATUS_UNAVAIL; + struct etherent etherent; + + if (startp == NULL) + { + no_more = __nss_ethers_lookup (&nip, "gethostton_r", &fct.ptr); + if (no_more) + startp = (service_user *) -1; + else + { + startp = nip; + start_fct = fct.f; + } + } + else + { + fct.f = start_fct; + no_more = (nip = startp) == (service_user *) -1; + } + + while (no_more == 0) + { + char buffer[1024]; + + status = (*fct.f) (hostname, ðerent, buffer, sizeof buffer, &errno); + + no_more = __nss_next (&nip, "gethostton_r", &fct.ptr, status, 0); + } + + if (status == NSS_STATUS_SUCCESS) + memcpy (addr, etherent.e_addr.ether_addr_octet, + sizeof (struct ether_addr)); + + return status == NSS_STATUS_SUCCESS ? 0 : -1; +}
ether_hton.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ifname.c =================================================================== --- ifname.c (nonexistent) +++ ifname.c (revision 520) @@ -0,0 +1,227 @@ +/* $KAME: ifname.c,v 1.4 2001/08/20 02:32:40 itojun Exp $ */ + +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include + +/* + * TODO: + * - prototype defs into arpa/inet.h, not net/if.h (bsd-api-new-02) + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define ROUNDUP(a) \ + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) +#define ADVANCE(x, n) + +static unsigned int +if_onametoindex(ifname) + const char *ifname; +{ + struct if_nameindex *iff = if_nameindex(), *ifx; + int ret; + + if (iff == NULL) return 0; + ifx = iff; + while (ifx->if_name != NULL) { + if (strcmp(ifx->if_name, ifname) == 0) { + ret = ifx->if_index; + if_freenameindex(iff); + return ret; + } + ifx++; + } + if_freenameindex(iff); + errno = ENXIO; + return 0; +} + +unsigned int +if_nametoindex(ifname) + const char *ifname; +{ + int s; + struct ifreq ifr; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s == -1) + return (0); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); + if (ioctl(s, SIOCGIFINDEX, &ifr) == -1) { + close (s); + return (if_onametoindex(ifname)); + } + close(s); + return (ifr.ifr_index); +} + +char * +if_indextoname(ifindex, ifname) + unsigned int ifindex; + char *ifname; /* at least IF_NAMESIZE */ +{ + struct if_nameindex *iff = if_nameindex(), *ifx; + char *cp, *dp; + + if (iff == NULL) return NULL; + ifx = iff; + while (ifx->if_index != 0) { + if (ifx->if_index == ifindex) { + cp = ifname; + dp = ifx->if_name; + while ((*cp++ = *dp++)) ; + if_freenameindex(iff); + return (ifname); + } + ifx++; + } + if_freenameindex(iff); + errno = ENXIO; + return NULL; +} + +struct if_nameindex * +if_nameindex() +{ + size_t needed; + int mib[6], i, ifn = 0, off = 0, hlen; + char *buf = NULL, *lim, *next, *cp, *ifbuf = NULL; + struct rt_msghdr *rtm; + struct if_msghdr *ifm; + struct sockaddr *sa; + struct if_nameindex *ret = NULL; + static int ifxs = 64; /* initial upper limit */ + struct _ifx { + int if_index; + int if_off; + } *ifx = NULL; + + mib[0] = CTL_NET; + mib[1] = PF_ROUTE; + mib[2] = 0; /* protocol */ + mib[3] = 0; /* wildcard address family */ + mib[4] = 0; + mib[5] = 0; /* no flags */ + if (__sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + return NULL; + if ((buf = malloc(needed)) == NULL) { + errno = ENOMEM; + goto end; + } + /* XXX: we may have allocated too much than necessary */ + if ((ifbuf = malloc(needed)) == NULL) { + errno = ENOMEM; + goto end; + } + if ((ifx = (struct _ifx *)malloc(sizeof(*ifx) * ifxs)) == NULL) { + errno = ENOMEM; + goto end; + } + if (__sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { + /* sysctl has set errno */ + goto end; + } + lim = buf + needed; + for (next = buf; next < lim; next += rtm->rtm_msglen) { + rtm = (struct rt_msghdr *)next; + if (rtm->rtm_version != RTM_VERSION) { + errno = EPROTONOSUPPORT; + goto end; + } + switch (rtm->rtm_type) { + case RTM_IFINFO: + ifm = (struct if_msghdr *)rtm; + ifx[ifn].if_index = ifm->ifm_index; + ifx[ifn].if_off = off; + cp = (char *)(ifm + 1); + for (i = 1; i; i <<= 1) { + if (i & ifm->ifm_addrs) { + sa = (struct sockaddr *)cp; + ADVANCE(cp, sa); + } + } + if (++ifn == ifxs) { + /* we need more memory */ + struct _ifx *newifx; + + ifxs *= 2; + if ((newifx = (struct _ifx *)malloc(sizeof(*newifx) * ifxs)) == NULL) { + errno = ENOMEM; + goto end; + } + + /* copy and free old data */ + memcpy(newifx, ifx, (sizeof(*ifx) * ifxs) / 2); + free(ifx); + ifx = newifx; + } + } + } + hlen = sizeof(struct if_nameindex) * (ifn + 1); + if ((cp = (char *)malloc(hlen + off)) == NULL) { + errno = ENOMEM; + goto end; + } + bcopy(ifbuf, cp + hlen, off); + ret = (struct if_nameindex *)cp; + for (i = 0; i < ifn; i++) { + ret[i].if_index = ifx[i].if_index; + ret[i].if_name = cp + hlen + ifx[i].if_off; + } + ret[ifn].if_index = 0; + ret[ifn].if_name = NULL; + + end: + if (buf) free(buf); + if (ifbuf) free(ifbuf); + if (ifx) free(ifx); + + return ret; +} + +void if_freenameindex(ptr) + struct if_nameindex *ptr; +{ + free(ptr); +}
ifname.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getsrvbynm.c =================================================================== --- getsrvbynm.c (nonexistent) +++ getsrvbynm.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct servent +#define FUNCTION_NAME getservbyname +#define DATABASE_NAME services +#define ADD_PARAMS const char *name, const char *proto +#define ADD_VARIABLES name, proto +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getsrvbynm.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: Makefile.in =================================================================== --- Makefile.in (nonexistent) +++ Makefile.in (revision 520) @@ -0,0 +1,1576 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/../../../../Makefile.shared \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am +subdir = net +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../../../libtool.m4 \ + $(top_srcdir)/../../../../ltoptions.m4 \ + $(top_srcdir)/../../../../ltsugar.m4 \ + $(top_srcdir)/../../../../ltversion.m4 \ + $(top_srcdir)/../../../../lt~obsolete.m4 \ + $(top_srcdir)/../../../acinclude.m4 \ + $(top_srcdir)/../../../confsubdir.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +lib_a_AR = $(AR) $(ARFLAGS) +lib_a_LIBADD = +am__objects_1 = lib_a-addr2ascii.$(OBJEXT) lib_a-ascii2addr.$(OBJEXT) \ + lib_a-alias-lookup.$(OBJEXT) lib_a-base64.$(OBJEXT) \ + lib_a-check_pf.$(OBJEXT) lib_a-digits_dots.$(OBJEXT) \ + lib_a-ether_aton.$(OBJEXT) lib_a-ether_aton_r.$(OBJEXT) \ + lib_a-ether_hton.$(OBJEXT) lib_a-ether_line.$(OBJEXT) \ + lib_a-ether_ntoa.$(OBJEXT) lib_a-ether_ntoa_r.$(OBJEXT) \ + lib_a-ether_ntoh.$(OBJEXT) lib_a-ethers-lookup.$(OBJEXT) \ + lib_a-getaddrinfo.$(OBJEXT) lib_a-getaliasent.$(OBJEXT) \ + lib_a-getaliasent_r.$(OBJEXT) lib_a-getaliasname.$(OBJEXT) \ + lib_a-getaliasname_r.$(OBJEXT) lib_a-gethstbyad.$(OBJEXT) \ + lib_a-gethstbyad_r.$(OBJEXT) lib_a-gethstbynm2.$(OBJEXT) \ + lib_a-gethstbynm2_r.$(OBJEXT) lib_a-gethstbynm.$(OBJEXT) \ + lib_a-gethstbynm_r.$(OBJEXT) lib_a-gethstent.$(OBJEXT) \ + lib_a-gethstent_r.$(OBJEXT) lib_a-getnameinfo.$(OBJEXT) \ + lib_a-getnetbyad.$(OBJEXT) lib_a-getnetbyad_r.$(OBJEXT) \ + lib_a-getnetbynm.$(OBJEXT) lib_a-getnetbynm_r.$(OBJEXT) \ + lib_a-getnetent.$(OBJEXT) lib_a-getnetent_r.$(OBJEXT) \ + lib_a-getnetgrent.$(OBJEXT) lib_a-getnetgrent_r.$(OBJEXT) \ + lib_a-getnssent.$(OBJEXT) lib_a-getnssent_r.$(OBJEXT) \ + lib_a-getproto.$(OBJEXT) lib_a-getproto_r.$(OBJEXT) \ + lib_a-getprtent.$(OBJEXT) lib_a-getprtent_r.$(OBJEXT) \ + lib_a-getprtname.$(OBJEXT) lib_a-getprtname_r.$(OBJEXT) \ + lib_a-getrpcbyname.$(OBJEXT) lib_a-getrpcbyname_r.$(OBJEXT) \ + lib_a-getrpcbynumber.$(OBJEXT) \ + lib_a-getrpcbynumber_r.$(OBJEXT) lib_a-getrpcent.$(OBJEXT) \ + lib_a-getrpcent_r.$(OBJEXT) lib_a-getservent.$(OBJEXT) \ + lib_a-getservent_r.$(OBJEXT) lib_a-getsrvbynm.$(OBJEXT) \ + lib_a-getsrvbynm_r.$(OBJEXT) lib_a-getsrvbypt.$(OBJEXT) \ + lib_a-getsrvbypt_r.$(OBJEXT) lib_a-grp-lookup.$(OBJEXT) \ + lib_a-herrno.$(OBJEXT) lib_a-hosts-lookup.$(OBJEXT) \ + lib_a-ifreq.$(OBJEXT) lib_a-in6_addr.$(OBJEXT) \ + lib_a-inet6_option.$(OBJEXT) lib_a-inet_addr.$(OBJEXT) \ + lib_a-inet_lnaof.$(OBJEXT) lib_a-inet_mkadr.$(OBJEXT) \ + lib_a-inet_net.$(OBJEXT) lib_a-inet_neta.$(OBJEXT) \ + lib_a-inet_netof.$(OBJEXT) lib_a-inet_net_ntop.$(OBJEXT) \ + lib_a-inet_net_pton.$(OBJEXT) lib_a-inet_ntoa.$(OBJEXT) \ + lib_a-inet_ntop.$(OBJEXT) lib_a-inet_pton.$(OBJEXT) \ + lib_a-issetugid-stub.$(OBJEXT) lib_a-key-lookup.$(OBJEXT) \ + lib_a-netgrp-lookup.$(OBJEXT) lib_a-network-lookup.$(OBJEXT) \ + lib_a-nsswitch.$(OBJEXT) lib_a-ns_name.$(OBJEXT) \ + lib_a-ns_netint.$(OBJEXT) lib_a-ns_parse.$(OBJEXT) \ + lib_a-ns_print.$(OBJEXT) lib_a-ns_samedomain.$(OBJEXT) \ + lib_a-ns_ttl.$(OBJEXT) lib_a-nsap_addr.$(OBJEXT) \ + lib_a-proto-lookup.$(OBJEXT) lib_a-opensock.$(OBJEXT) \ + lib_a-pwd-lookup.$(OBJEXT) lib_a-recv.$(OBJEXT) \ + lib_a-res_comp.$(OBJEXT) lib_a-res_data.$(OBJEXT) \ + lib_a-res_debug.$(OBJEXT) lib_a-res_hconf.$(OBJEXT) \ + lib_a-res_init.$(OBJEXT) lib_a-res_libc.$(OBJEXT) \ + lib_a-res_mkquery.$(OBJEXT) lib_a-res_query.$(OBJEXT) \ + lib_a-res_send.$(OBJEXT) lib_a-rexec.$(OBJEXT) \ + lib_a-rpc-lookup.$(OBJEXT) lib_a-ruserpass.$(OBJEXT) \ + lib_a-send.$(OBJEXT) lib_a-service-lookup.$(OBJEXT) \ + lib_a-spwd-lookup.$(OBJEXT) +am__objects_2 = lib_a-ifname.$(OBJEXT) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_3 = $(am__objects_2) +@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \ +@USE_LIBTOOL_FALSE@ $(am__objects_3) +lib_a_OBJECTS = $(am_lib_a_OBJECTS) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libnet_la_LIBADD = +am__objects_4 = libnet_la-addr2ascii.lo libnet_la-ascii2addr.lo \ + libnet_la-alias-lookup.lo libnet_la-base64.lo \ + libnet_la-check_pf.lo libnet_la-digits_dots.lo \ + libnet_la-ether_aton.lo libnet_la-ether_aton_r.lo \ + libnet_la-ether_hton.lo libnet_la-ether_line.lo \ + libnet_la-ether_ntoa.lo libnet_la-ether_ntoa_r.lo \ + libnet_la-ether_ntoh.lo libnet_la-ethers-lookup.lo \ + libnet_la-getaddrinfo.lo libnet_la-getaliasent.lo \ + libnet_la-getaliasent_r.lo libnet_la-getaliasname.lo \ + libnet_la-getaliasname_r.lo libnet_la-gethstbyad.lo \ + libnet_la-gethstbyad_r.lo libnet_la-gethstbynm2.lo \ + libnet_la-gethstbynm2_r.lo libnet_la-gethstbynm.lo \ + libnet_la-gethstbynm_r.lo libnet_la-gethstent.lo \ + libnet_la-gethstent_r.lo libnet_la-getnameinfo.lo \ + libnet_la-getnetbyad.lo libnet_la-getnetbyad_r.lo \ + libnet_la-getnetbynm.lo libnet_la-getnetbynm_r.lo \ + libnet_la-getnetent.lo libnet_la-getnetent_r.lo \ + libnet_la-getnetgrent.lo libnet_la-getnetgrent_r.lo \ + libnet_la-getnssent.lo libnet_la-getnssent_r.lo \ + libnet_la-getproto.lo libnet_la-getproto_r.lo \ + libnet_la-getprtent.lo libnet_la-getprtent_r.lo \ + libnet_la-getprtname.lo libnet_la-getprtname_r.lo \ + libnet_la-getrpcbyname.lo libnet_la-getrpcbyname_r.lo \ + libnet_la-getrpcbynumber.lo libnet_la-getrpcbynumber_r.lo \ + libnet_la-getrpcent.lo libnet_la-getrpcent_r.lo \ + libnet_la-getservent.lo libnet_la-getservent_r.lo \ + libnet_la-getsrvbynm.lo libnet_la-getsrvbynm_r.lo \ + libnet_la-getsrvbypt.lo libnet_la-getsrvbypt_r.lo \ + libnet_la-grp-lookup.lo libnet_la-herrno.lo \ + libnet_la-hosts-lookup.lo libnet_la-ifreq.lo \ + libnet_la-in6_addr.lo libnet_la-inet6_option.lo \ + libnet_la-inet_addr.lo libnet_la-inet_lnaof.lo \ + libnet_la-inet_mkadr.lo libnet_la-inet_net.lo \ + libnet_la-inet_neta.lo libnet_la-inet_netof.lo \ + libnet_la-inet_net_ntop.lo libnet_la-inet_net_pton.lo \ + libnet_la-inet_ntoa.lo libnet_la-inet_ntop.lo \ + libnet_la-inet_pton.lo libnet_la-issetugid-stub.lo \ + libnet_la-key-lookup.lo libnet_la-netgrp-lookup.lo \ + libnet_la-network-lookup.lo libnet_la-nsswitch.lo \ + libnet_la-ns_name.lo libnet_la-ns_netint.lo \ + libnet_la-ns_parse.lo libnet_la-ns_print.lo \ + libnet_la-ns_samedomain.lo libnet_la-ns_ttl.lo \ + libnet_la-nsap_addr.lo libnet_la-proto-lookup.lo \ + libnet_la-opensock.lo libnet_la-pwd-lookup.lo \ + libnet_la-recv.lo libnet_la-res_comp.lo libnet_la-res_data.lo \ + libnet_la-res_debug.lo libnet_la-res_hconf.lo \ + libnet_la-res_init.lo libnet_la-res_libc.lo \ + libnet_la-res_mkquery.lo libnet_la-res_query.lo \ + libnet_la-res_send.lo libnet_la-rexec.lo \ + libnet_la-rpc-lookup.lo libnet_la-ruserpass.lo \ + libnet_la-send.lo libnet_la-service-lookup.lo \ + libnet_la-spwd-lookup.lo +am__objects_5 = libnet_la-ifname.lo +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_6 = $(am__objects_5) +@USE_LIBTOOL_TRUE@am_libnet_la_OBJECTS = $(am__objects_4) \ +@USE_LIBTOOL_TRUE@ $(am__objects_6) +libnet_la_OBJECTS = $(am_libnet_la_OBJECTS) +@USE_LIBTOOL_TRUE@am_libnet_la_rpath = +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(lib_a_SOURCES) $(libnet_la_SOURCES) +DATA = $(noinst_DATA) +ETAGS = etags +CTAGS = ctags +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ELIX_LEVEL_0_FALSE = @ELIX_LEVEL_0_FALSE@ +ELIX_LEVEL_0_TRUE = @ELIX_LEVEL_0_TRUE@ +ELIX_LEVEL_1_FALSE = @ELIX_LEVEL_1_FALSE@ +ELIX_LEVEL_1_TRUE = @ELIX_LEVEL_1_TRUE@ +ELIX_LEVEL_2_FALSE = @ELIX_LEVEL_2_FALSE@ +ELIX_LEVEL_2_TRUE = @ELIX_LEVEL_2_TRUE@ +ELIX_LEVEL_3_FALSE = @ELIX_LEVEL_3_FALSE@ +ELIX_LEVEL_3_TRUE = @ELIX_LEVEL_3_TRUE@ +ELIX_LEVEL_4_FALSE = @ELIX_LEVEL_4_FALSE@ +ELIX_LEVEL_4_TRUE = @ELIX_LEVEL_4_TRUE@ +EXEEXT = @EXEEXT@ +EXTRA_SUBDIRS = @EXTRA_SUBDIRS@ +EXTRA_SUBLIBS = @EXTRA_SUBLIBS@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LINUX_MACH_LIB = @LINUX_MACH_LIB@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MAY_SUPPLY_SYSCALLS_FALSE = @MAY_SUPPLY_SYSCALLS_FALSE@ +MAY_SUPPLY_SYSCALLS_TRUE = @MAY_SUPPLY_SYSCALLS_TRUE@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +READELF = @READELF@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_LIBTOOL_FALSE = @USE_LIBTOOL_FALSE@ +USE_LIBTOOL_TRUE = @USE_LIBTOOL_TRUE@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_AS = @ac_ct_AS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DLLTOOL = @ac_ct_DLLTOOL@ +ac_ct_DSYMUTIL = @ac_ct_DSYMUTIL@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_LIPO = @ac_ct_LIPO@ +ac_ct_NMEDIT = @ac_ct_NMEDIT@ +ac_ct_OBJDUMP = @ac_ct_OBJDUMP@ +ac_ct_OTOOL = @ac_ct_OTOOL@ +ac_ct_OTOOL64 = @ac_ct_OTOOL64@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_READELF = @ac_ct_READELF@ +ac_ct_STRIP = @ac_ct_STRIP@ +aext = @aext@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libm_machine_dir = @libm_machine_dir@ +localstatedir = @localstatedir@ +lpfx = @lpfx@ +lt_ECHO = @lt_ECHO@ +machine_dir = @machine_dir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sys_dir = @sys_dir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AUTOMAKE_OPTIONS = cygnus +INCLUDES = -I$(srcdir)/../include -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) +GENERAL_SOURCES = addr2ascii.c ascii2addr.c alias-lookup.c \ + base64.c check_pf.c digits_dots.c \ + ether_aton.c ether_aton_r.c ether_hton.c \ + ether_line.c ether_ntoa.c ether_ntoa_r.c ether_ntoh.c \ + ethers-lookup.c getaddrinfo.c getaliasent.c \ + getaliasent_r.c getaliasname.c getaliasname_r.c gethstbyad.c \ + gethstbyad_r.c gethstbynm2.c gethstbynm2_r.c gethstbynm.c \ + gethstbynm_r.c gethstent.c gethstent_r.c getnameinfo.c getnetbyad.c \ + getnetbyad_r.c getnetbynm.c getnetbynm_r.c getnetent.c getnetent_r.c \ + getnetgrent.c getnetgrent_r.c getnssent.c getnssent_r.c getproto.c \ + getproto_r.c getprtent.c \ + getprtent_r.c getprtname.c getprtname_r.c getrpcbyname.c \ + getrpcbyname_r.c getrpcbynumber.c getrpcbynumber_r.c getrpcent.c \ + getrpcent_r.c getservent.c getservent_r.c getsrvbynm.c getsrvbynm_r.c \ + getsrvbypt.c getsrvbypt_r.c grp-lookup.c \ + herrno.c hosts-lookup.c ifreq.c \ + in6_addr.c inet6_option.c inet_addr.c \ + inet_lnaof.c inet_mkadr.c inet_net.c inet_neta.c inet_netof.c \ + inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c \ + inet_pton.c issetugid-stub.c key-lookup.c netgrp-lookup.c \ + network-lookup.c nsswitch.c \ + ns_name.c ns_netint.c ns_parse.c ns_print.c ns_samedomain.c \ + ns_ttl.c nsap_addr.c proto-lookup.c opensock.c pwd-lookup.c recv.c \ + res_comp.c res_data.c res_debug.c res_hconf.c res_init.c \ + res_libc.c res_mkquery.c \ + res_query.c res_send.c \ + rexec.c rpc-lookup.c ruserpass.c send.c service-lookup.c spwd-lookup.c + +ELIX_4_SOURCES = \ + ifname.c \ + rcmd.$(oext) \ + rcmdsh.$(oext) + +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ELIX_SOURCES = $(ELIX_4_SOURCES) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_SOURCES = +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_SOURCES = +@ELIX_LEVEL_1_TRUE@ELIX_SOURCES = +libnet_la_LDFLAGS = -Xcompiler -nostdlib +libnet_la_CFLAGS = -DINET6 +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libnet.la +@USE_LIBTOOL_TRUE@libnet_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES) +@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus net/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --cygnus net/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) + -rm -f lib.a + $(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libnet.la: $(libnet_la_OBJECTS) $(libnet_la_DEPENDENCIES) + $(LINK) $(am_libnet_la_rpath) $(libnet_la_LDFLAGS) $(libnet_la_OBJECTS) $(libnet_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -c -o $@ $< + +lib_a-addr2ascii.o: addr2ascii.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-addr2ascii.o `test -f 'addr2ascii.c' || echo '$(srcdir)/'`addr2ascii.c + +lib_a-addr2ascii.obj: addr2ascii.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-addr2ascii.obj `if test -f 'addr2ascii.c'; then $(CYGPATH_W) 'addr2ascii.c'; else $(CYGPATH_W) '$(srcdir)/addr2ascii.c'; fi` + +lib_a-ascii2addr.o: ascii2addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ascii2addr.o `test -f 'ascii2addr.c' || echo '$(srcdir)/'`ascii2addr.c + +lib_a-ascii2addr.obj: ascii2addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ascii2addr.obj `if test -f 'ascii2addr.c'; then $(CYGPATH_W) 'ascii2addr.c'; else $(CYGPATH_W) '$(srcdir)/ascii2addr.c'; fi` + +lib_a-alias-lookup.o: alias-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-alias-lookup.o `test -f 'alias-lookup.c' || echo '$(srcdir)/'`alias-lookup.c + +lib_a-alias-lookup.obj: alias-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-alias-lookup.obj `if test -f 'alias-lookup.c'; then $(CYGPATH_W) 'alias-lookup.c'; else $(CYGPATH_W) '$(srcdir)/alias-lookup.c'; fi` + +lib_a-base64.o: base64.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-base64.o `test -f 'base64.c' || echo '$(srcdir)/'`base64.c + +lib_a-base64.obj: base64.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-base64.obj `if test -f 'base64.c'; then $(CYGPATH_W) 'base64.c'; else $(CYGPATH_W) '$(srcdir)/base64.c'; fi` + +lib_a-check_pf.o: check_pf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-check_pf.o `test -f 'check_pf.c' || echo '$(srcdir)/'`check_pf.c + +lib_a-check_pf.obj: check_pf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-check_pf.obj `if test -f 'check_pf.c'; then $(CYGPATH_W) 'check_pf.c'; else $(CYGPATH_W) '$(srcdir)/check_pf.c'; fi` + +lib_a-digits_dots.o: digits_dots.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-digits_dots.o `test -f 'digits_dots.c' || echo '$(srcdir)/'`digits_dots.c + +lib_a-digits_dots.obj: digits_dots.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-digits_dots.obj `if test -f 'digits_dots.c'; then $(CYGPATH_W) 'digits_dots.c'; else $(CYGPATH_W) '$(srcdir)/digits_dots.c'; fi` + +lib_a-ether_aton.o: ether_aton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton.o `test -f 'ether_aton.c' || echo '$(srcdir)/'`ether_aton.c + +lib_a-ether_aton.obj: ether_aton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton.obj `if test -f 'ether_aton.c'; then $(CYGPATH_W) 'ether_aton.c'; else $(CYGPATH_W) '$(srcdir)/ether_aton.c'; fi` + +lib_a-ether_aton_r.o: ether_aton_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton_r.o `test -f 'ether_aton_r.c' || echo '$(srcdir)/'`ether_aton_r.c + +lib_a-ether_aton_r.obj: ether_aton_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton_r.obj `if test -f 'ether_aton_r.c'; then $(CYGPATH_W) 'ether_aton_r.c'; else $(CYGPATH_W) '$(srcdir)/ether_aton_r.c'; fi` + +lib_a-ether_hton.o: ether_hton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_hton.o `test -f 'ether_hton.c' || echo '$(srcdir)/'`ether_hton.c + +lib_a-ether_hton.obj: ether_hton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_hton.obj `if test -f 'ether_hton.c'; then $(CYGPATH_W) 'ether_hton.c'; else $(CYGPATH_W) '$(srcdir)/ether_hton.c'; fi` + +lib_a-ether_line.o: ether_line.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_line.o `test -f 'ether_line.c' || echo '$(srcdir)/'`ether_line.c + +lib_a-ether_line.obj: ether_line.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_line.obj `if test -f 'ether_line.c'; then $(CYGPATH_W) 'ether_line.c'; else $(CYGPATH_W) '$(srcdir)/ether_line.c'; fi` + +lib_a-ether_ntoa.o: ether_ntoa.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa.o `test -f 'ether_ntoa.c' || echo '$(srcdir)/'`ether_ntoa.c + +lib_a-ether_ntoa.obj: ether_ntoa.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa.obj `if test -f 'ether_ntoa.c'; then $(CYGPATH_W) 'ether_ntoa.c'; else $(CYGPATH_W) '$(srcdir)/ether_ntoa.c'; fi` + +lib_a-ether_ntoa_r.o: ether_ntoa_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa_r.o `test -f 'ether_ntoa_r.c' || echo '$(srcdir)/'`ether_ntoa_r.c + +lib_a-ether_ntoa_r.obj: ether_ntoa_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa_r.obj `if test -f 'ether_ntoa_r.c'; then $(CYGPATH_W) 'ether_ntoa_r.c'; else $(CYGPATH_W) '$(srcdir)/ether_ntoa_r.c'; fi` + +lib_a-ether_ntoh.o: ether_ntoh.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoh.o `test -f 'ether_ntoh.c' || echo '$(srcdir)/'`ether_ntoh.c + +lib_a-ether_ntoh.obj: ether_ntoh.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoh.obj `if test -f 'ether_ntoh.c'; then $(CYGPATH_W) 'ether_ntoh.c'; else $(CYGPATH_W) '$(srcdir)/ether_ntoh.c'; fi` + +lib_a-ethers-lookup.o: ethers-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ethers-lookup.o `test -f 'ethers-lookup.c' || echo '$(srcdir)/'`ethers-lookup.c + +lib_a-ethers-lookup.obj: ethers-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ethers-lookup.obj `if test -f 'ethers-lookup.c'; then $(CYGPATH_W) 'ethers-lookup.c'; else $(CYGPATH_W) '$(srcdir)/ethers-lookup.c'; fi` + +lib_a-getaddrinfo.o: getaddrinfo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaddrinfo.o `test -f 'getaddrinfo.c' || echo '$(srcdir)/'`getaddrinfo.c + +lib_a-getaddrinfo.obj: getaddrinfo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaddrinfo.obj `if test -f 'getaddrinfo.c'; then $(CYGPATH_W) 'getaddrinfo.c'; else $(CYGPATH_W) '$(srcdir)/getaddrinfo.c'; fi` + +lib_a-getaliasent.o: getaliasent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent.o `test -f 'getaliasent.c' || echo '$(srcdir)/'`getaliasent.c + +lib_a-getaliasent.obj: getaliasent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent.obj `if test -f 'getaliasent.c'; then $(CYGPATH_W) 'getaliasent.c'; else $(CYGPATH_W) '$(srcdir)/getaliasent.c'; fi` + +lib_a-getaliasent_r.o: getaliasent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent_r.o `test -f 'getaliasent_r.c' || echo '$(srcdir)/'`getaliasent_r.c + +lib_a-getaliasent_r.obj: getaliasent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent_r.obj `if test -f 'getaliasent_r.c'; then $(CYGPATH_W) 'getaliasent_r.c'; else $(CYGPATH_W) '$(srcdir)/getaliasent_r.c'; fi` + +lib_a-getaliasname.o: getaliasname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname.o `test -f 'getaliasname.c' || echo '$(srcdir)/'`getaliasname.c + +lib_a-getaliasname.obj: getaliasname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname.obj `if test -f 'getaliasname.c'; then $(CYGPATH_W) 'getaliasname.c'; else $(CYGPATH_W) '$(srcdir)/getaliasname.c'; fi` + +lib_a-getaliasname_r.o: getaliasname_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname_r.o `test -f 'getaliasname_r.c' || echo '$(srcdir)/'`getaliasname_r.c + +lib_a-getaliasname_r.obj: getaliasname_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname_r.obj `if test -f 'getaliasname_r.c'; then $(CYGPATH_W) 'getaliasname_r.c'; else $(CYGPATH_W) '$(srcdir)/getaliasname_r.c'; fi` + +lib_a-gethstbyad.o: gethstbyad.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad.o `test -f 'gethstbyad.c' || echo '$(srcdir)/'`gethstbyad.c + +lib_a-gethstbyad.obj: gethstbyad.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad.obj `if test -f 'gethstbyad.c'; then $(CYGPATH_W) 'gethstbyad.c'; else $(CYGPATH_W) '$(srcdir)/gethstbyad.c'; fi` + +lib_a-gethstbyad_r.o: gethstbyad_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad_r.o `test -f 'gethstbyad_r.c' || echo '$(srcdir)/'`gethstbyad_r.c + +lib_a-gethstbyad_r.obj: gethstbyad_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad_r.obj `if test -f 'gethstbyad_r.c'; then $(CYGPATH_W) 'gethstbyad_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstbyad_r.c'; fi` + +lib_a-gethstbynm2.o: gethstbynm2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2.o `test -f 'gethstbynm2.c' || echo '$(srcdir)/'`gethstbynm2.c + +lib_a-gethstbynm2.obj: gethstbynm2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2.obj `if test -f 'gethstbynm2.c'; then $(CYGPATH_W) 'gethstbynm2.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm2.c'; fi` + +lib_a-gethstbynm2_r.o: gethstbynm2_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2_r.o `test -f 'gethstbynm2_r.c' || echo '$(srcdir)/'`gethstbynm2_r.c + +lib_a-gethstbynm2_r.obj: gethstbynm2_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2_r.obj `if test -f 'gethstbynm2_r.c'; then $(CYGPATH_W) 'gethstbynm2_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm2_r.c'; fi` + +lib_a-gethstbynm.o: gethstbynm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm.o `test -f 'gethstbynm.c' || echo '$(srcdir)/'`gethstbynm.c + +lib_a-gethstbynm.obj: gethstbynm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm.obj `if test -f 'gethstbynm.c'; then $(CYGPATH_W) 'gethstbynm.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm.c'; fi` + +lib_a-gethstbynm_r.o: gethstbynm_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm_r.o `test -f 'gethstbynm_r.c' || echo '$(srcdir)/'`gethstbynm_r.c + +lib_a-gethstbynm_r.obj: gethstbynm_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm_r.obj `if test -f 'gethstbynm_r.c'; then $(CYGPATH_W) 'gethstbynm_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm_r.c'; fi` + +lib_a-gethstent.o: gethstent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent.o `test -f 'gethstent.c' || echo '$(srcdir)/'`gethstent.c + +lib_a-gethstent.obj: gethstent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent.obj `if test -f 'gethstent.c'; then $(CYGPATH_W) 'gethstent.c'; else $(CYGPATH_W) '$(srcdir)/gethstent.c'; fi` + +lib_a-gethstent_r.o: gethstent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent_r.o `test -f 'gethstent_r.c' || echo '$(srcdir)/'`gethstent_r.c + +lib_a-gethstent_r.obj: gethstent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent_r.obj `if test -f 'gethstent_r.c'; then $(CYGPATH_W) 'gethstent_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstent_r.c'; fi` + +lib_a-getnameinfo.o: getnameinfo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnameinfo.o `test -f 'getnameinfo.c' || echo '$(srcdir)/'`getnameinfo.c + +lib_a-getnameinfo.obj: getnameinfo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnameinfo.obj `if test -f 'getnameinfo.c'; then $(CYGPATH_W) 'getnameinfo.c'; else $(CYGPATH_W) '$(srcdir)/getnameinfo.c'; fi` + +lib_a-getnetbyad.o: getnetbyad.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad.o `test -f 'getnetbyad.c' || echo '$(srcdir)/'`getnetbyad.c + +lib_a-getnetbyad.obj: getnetbyad.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad.obj `if test -f 'getnetbyad.c'; then $(CYGPATH_W) 'getnetbyad.c'; else $(CYGPATH_W) '$(srcdir)/getnetbyad.c'; fi` + +lib_a-getnetbyad_r.o: getnetbyad_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad_r.o `test -f 'getnetbyad_r.c' || echo '$(srcdir)/'`getnetbyad_r.c + +lib_a-getnetbyad_r.obj: getnetbyad_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad_r.obj `if test -f 'getnetbyad_r.c'; then $(CYGPATH_W) 'getnetbyad_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetbyad_r.c'; fi` + +lib_a-getnetbynm.o: getnetbynm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm.o `test -f 'getnetbynm.c' || echo '$(srcdir)/'`getnetbynm.c + +lib_a-getnetbynm.obj: getnetbynm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm.obj `if test -f 'getnetbynm.c'; then $(CYGPATH_W) 'getnetbynm.c'; else $(CYGPATH_W) '$(srcdir)/getnetbynm.c'; fi` + +lib_a-getnetbynm_r.o: getnetbynm_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm_r.o `test -f 'getnetbynm_r.c' || echo '$(srcdir)/'`getnetbynm_r.c + +lib_a-getnetbynm_r.obj: getnetbynm_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm_r.obj `if test -f 'getnetbynm_r.c'; then $(CYGPATH_W) 'getnetbynm_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetbynm_r.c'; fi` + +lib_a-getnetent.o: getnetent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent.o `test -f 'getnetent.c' || echo '$(srcdir)/'`getnetent.c + +lib_a-getnetent.obj: getnetent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent.obj `if test -f 'getnetent.c'; then $(CYGPATH_W) 'getnetent.c'; else $(CYGPATH_W) '$(srcdir)/getnetent.c'; fi` + +lib_a-getnetent_r.o: getnetent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent_r.o `test -f 'getnetent_r.c' || echo '$(srcdir)/'`getnetent_r.c + +lib_a-getnetent_r.obj: getnetent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent_r.obj `if test -f 'getnetent_r.c'; then $(CYGPATH_W) 'getnetent_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetent_r.c'; fi` + +lib_a-getnetgrent.o: getnetgrent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent.o `test -f 'getnetgrent.c' || echo '$(srcdir)/'`getnetgrent.c + +lib_a-getnetgrent.obj: getnetgrent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent.obj `if test -f 'getnetgrent.c'; then $(CYGPATH_W) 'getnetgrent.c'; else $(CYGPATH_W) '$(srcdir)/getnetgrent.c'; fi` + +lib_a-getnetgrent_r.o: getnetgrent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent_r.o `test -f 'getnetgrent_r.c' || echo '$(srcdir)/'`getnetgrent_r.c + +lib_a-getnetgrent_r.obj: getnetgrent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent_r.obj `if test -f 'getnetgrent_r.c'; then $(CYGPATH_W) 'getnetgrent_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetgrent_r.c'; fi` + +lib_a-getnssent.o: getnssent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent.o `test -f 'getnssent.c' || echo '$(srcdir)/'`getnssent.c + +lib_a-getnssent.obj: getnssent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent.obj `if test -f 'getnssent.c'; then $(CYGPATH_W) 'getnssent.c'; else $(CYGPATH_W) '$(srcdir)/getnssent.c'; fi` + +lib_a-getnssent_r.o: getnssent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent_r.o `test -f 'getnssent_r.c' || echo '$(srcdir)/'`getnssent_r.c + +lib_a-getnssent_r.obj: getnssent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent_r.obj `if test -f 'getnssent_r.c'; then $(CYGPATH_W) 'getnssent_r.c'; else $(CYGPATH_W) '$(srcdir)/getnssent_r.c'; fi` + +lib_a-getproto.o: getproto.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto.o `test -f 'getproto.c' || echo '$(srcdir)/'`getproto.c + +lib_a-getproto.obj: getproto.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto.obj `if test -f 'getproto.c'; then $(CYGPATH_W) 'getproto.c'; else $(CYGPATH_W) '$(srcdir)/getproto.c'; fi` + +lib_a-getproto_r.o: getproto_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto_r.o `test -f 'getproto_r.c' || echo '$(srcdir)/'`getproto_r.c + +lib_a-getproto_r.obj: getproto_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto_r.obj `if test -f 'getproto_r.c'; then $(CYGPATH_W) 'getproto_r.c'; else $(CYGPATH_W) '$(srcdir)/getproto_r.c'; fi` + +lib_a-getprtent.o: getprtent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent.o `test -f 'getprtent.c' || echo '$(srcdir)/'`getprtent.c + +lib_a-getprtent.obj: getprtent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent.obj `if test -f 'getprtent.c'; then $(CYGPATH_W) 'getprtent.c'; else $(CYGPATH_W) '$(srcdir)/getprtent.c'; fi` + +lib_a-getprtent_r.o: getprtent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent_r.o `test -f 'getprtent_r.c' || echo '$(srcdir)/'`getprtent_r.c + +lib_a-getprtent_r.obj: getprtent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent_r.obj `if test -f 'getprtent_r.c'; then $(CYGPATH_W) 'getprtent_r.c'; else $(CYGPATH_W) '$(srcdir)/getprtent_r.c'; fi` + +lib_a-getprtname.o: getprtname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname.o `test -f 'getprtname.c' || echo '$(srcdir)/'`getprtname.c + +lib_a-getprtname.obj: getprtname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname.obj `if test -f 'getprtname.c'; then $(CYGPATH_W) 'getprtname.c'; else $(CYGPATH_W) '$(srcdir)/getprtname.c'; fi` + +lib_a-getprtname_r.o: getprtname_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname_r.o `test -f 'getprtname_r.c' || echo '$(srcdir)/'`getprtname_r.c + +lib_a-getprtname_r.obj: getprtname_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname_r.obj `if test -f 'getprtname_r.c'; then $(CYGPATH_W) 'getprtname_r.c'; else $(CYGPATH_W) '$(srcdir)/getprtname_r.c'; fi` + +lib_a-getrpcbyname.o: getrpcbyname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname.o `test -f 'getrpcbyname.c' || echo '$(srcdir)/'`getrpcbyname.c + +lib_a-getrpcbyname.obj: getrpcbyname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname.obj `if test -f 'getrpcbyname.c'; then $(CYGPATH_W) 'getrpcbyname.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbyname.c'; fi` + +lib_a-getrpcbyname_r.o: getrpcbyname_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname_r.o `test -f 'getrpcbyname_r.c' || echo '$(srcdir)/'`getrpcbyname_r.c + +lib_a-getrpcbyname_r.obj: getrpcbyname_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname_r.obj `if test -f 'getrpcbyname_r.c'; then $(CYGPATH_W) 'getrpcbyname_r.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbyname_r.c'; fi` + +lib_a-getrpcbynumber.o: getrpcbynumber.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber.o `test -f 'getrpcbynumber.c' || echo '$(srcdir)/'`getrpcbynumber.c + +lib_a-getrpcbynumber.obj: getrpcbynumber.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber.obj `if test -f 'getrpcbynumber.c'; then $(CYGPATH_W) 'getrpcbynumber.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbynumber.c'; fi` + +lib_a-getrpcbynumber_r.o: getrpcbynumber_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber_r.o `test -f 'getrpcbynumber_r.c' || echo '$(srcdir)/'`getrpcbynumber_r.c + +lib_a-getrpcbynumber_r.obj: getrpcbynumber_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber_r.obj `if test -f 'getrpcbynumber_r.c'; then $(CYGPATH_W) 'getrpcbynumber_r.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbynumber_r.c'; fi` + +lib_a-getrpcent.o: getrpcent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent.o `test -f 'getrpcent.c' || echo '$(srcdir)/'`getrpcent.c + +lib_a-getrpcent.obj: getrpcent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent.obj `if test -f 'getrpcent.c'; then $(CYGPATH_W) 'getrpcent.c'; else $(CYGPATH_W) '$(srcdir)/getrpcent.c'; fi` + +lib_a-getrpcent_r.o: getrpcent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent_r.o `test -f 'getrpcent_r.c' || echo '$(srcdir)/'`getrpcent_r.c + +lib_a-getrpcent_r.obj: getrpcent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent_r.obj `if test -f 'getrpcent_r.c'; then $(CYGPATH_W) 'getrpcent_r.c'; else $(CYGPATH_W) '$(srcdir)/getrpcent_r.c'; fi` + +lib_a-getservent.o: getservent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent.o `test -f 'getservent.c' || echo '$(srcdir)/'`getservent.c + +lib_a-getservent.obj: getservent.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent.obj `if test -f 'getservent.c'; then $(CYGPATH_W) 'getservent.c'; else $(CYGPATH_W) '$(srcdir)/getservent.c'; fi` + +lib_a-getservent_r.o: getservent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent_r.o `test -f 'getservent_r.c' || echo '$(srcdir)/'`getservent_r.c + +lib_a-getservent_r.obj: getservent_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent_r.obj `if test -f 'getservent_r.c'; then $(CYGPATH_W) 'getservent_r.c'; else $(CYGPATH_W) '$(srcdir)/getservent_r.c'; fi` + +lib_a-getsrvbynm.o: getsrvbynm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm.o `test -f 'getsrvbynm.c' || echo '$(srcdir)/'`getsrvbynm.c + +lib_a-getsrvbynm.obj: getsrvbynm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm.obj `if test -f 'getsrvbynm.c'; then $(CYGPATH_W) 'getsrvbynm.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbynm.c'; fi` + +lib_a-getsrvbynm_r.o: getsrvbynm_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm_r.o `test -f 'getsrvbynm_r.c' || echo '$(srcdir)/'`getsrvbynm_r.c + +lib_a-getsrvbynm_r.obj: getsrvbynm_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm_r.obj `if test -f 'getsrvbynm_r.c'; then $(CYGPATH_W) 'getsrvbynm_r.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbynm_r.c'; fi` + +lib_a-getsrvbypt.o: getsrvbypt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt.o `test -f 'getsrvbypt.c' || echo '$(srcdir)/'`getsrvbypt.c + +lib_a-getsrvbypt.obj: getsrvbypt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt.obj `if test -f 'getsrvbypt.c'; then $(CYGPATH_W) 'getsrvbypt.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbypt.c'; fi` + +lib_a-getsrvbypt_r.o: getsrvbypt_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt_r.o `test -f 'getsrvbypt_r.c' || echo '$(srcdir)/'`getsrvbypt_r.c + +lib_a-getsrvbypt_r.obj: getsrvbypt_r.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt_r.obj `if test -f 'getsrvbypt_r.c'; then $(CYGPATH_W) 'getsrvbypt_r.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbypt_r.c'; fi` + +lib_a-grp-lookup.o: grp-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-grp-lookup.o `test -f 'grp-lookup.c' || echo '$(srcdir)/'`grp-lookup.c + +lib_a-grp-lookup.obj: grp-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-grp-lookup.obj `if test -f 'grp-lookup.c'; then $(CYGPATH_W) 'grp-lookup.c'; else $(CYGPATH_W) '$(srcdir)/grp-lookup.c'; fi` + +lib_a-herrno.o: herrno.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-herrno.o `test -f 'herrno.c' || echo '$(srcdir)/'`herrno.c + +lib_a-herrno.obj: herrno.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-herrno.obj `if test -f 'herrno.c'; then $(CYGPATH_W) 'herrno.c'; else $(CYGPATH_W) '$(srcdir)/herrno.c'; fi` + +lib_a-hosts-lookup.o: hosts-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-hosts-lookup.o `test -f 'hosts-lookup.c' || echo '$(srcdir)/'`hosts-lookup.c + +lib_a-hosts-lookup.obj: hosts-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-hosts-lookup.obj `if test -f 'hosts-lookup.c'; then $(CYGPATH_W) 'hosts-lookup.c'; else $(CYGPATH_W) '$(srcdir)/hosts-lookup.c'; fi` + +lib_a-ifreq.o: ifreq.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifreq.o `test -f 'ifreq.c' || echo '$(srcdir)/'`ifreq.c + +lib_a-ifreq.obj: ifreq.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifreq.obj `if test -f 'ifreq.c'; then $(CYGPATH_W) 'ifreq.c'; else $(CYGPATH_W) '$(srcdir)/ifreq.c'; fi` + +lib_a-in6_addr.o: in6_addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-in6_addr.o `test -f 'in6_addr.c' || echo '$(srcdir)/'`in6_addr.c + +lib_a-in6_addr.obj: in6_addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-in6_addr.obj `if test -f 'in6_addr.c'; then $(CYGPATH_W) 'in6_addr.c'; else $(CYGPATH_W) '$(srcdir)/in6_addr.c'; fi` + +lib_a-inet6_option.o: inet6_option.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet6_option.o `test -f 'inet6_option.c' || echo '$(srcdir)/'`inet6_option.c + +lib_a-inet6_option.obj: inet6_option.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet6_option.obj `if test -f 'inet6_option.c'; then $(CYGPATH_W) 'inet6_option.c'; else $(CYGPATH_W) '$(srcdir)/inet6_option.c'; fi` + +lib_a-inet_addr.o: inet_addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_addr.o `test -f 'inet_addr.c' || echo '$(srcdir)/'`inet_addr.c + +lib_a-inet_addr.obj: inet_addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_addr.obj `if test -f 'inet_addr.c'; then $(CYGPATH_W) 'inet_addr.c'; else $(CYGPATH_W) '$(srcdir)/inet_addr.c'; fi` + +lib_a-inet_lnaof.o: inet_lnaof.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_lnaof.o `test -f 'inet_lnaof.c' || echo '$(srcdir)/'`inet_lnaof.c + +lib_a-inet_lnaof.obj: inet_lnaof.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_lnaof.obj `if test -f 'inet_lnaof.c'; then $(CYGPATH_W) 'inet_lnaof.c'; else $(CYGPATH_W) '$(srcdir)/inet_lnaof.c'; fi` + +lib_a-inet_mkadr.o: inet_mkadr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_mkadr.o `test -f 'inet_mkadr.c' || echo '$(srcdir)/'`inet_mkadr.c + +lib_a-inet_mkadr.obj: inet_mkadr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_mkadr.obj `if test -f 'inet_mkadr.c'; then $(CYGPATH_W) 'inet_mkadr.c'; else $(CYGPATH_W) '$(srcdir)/inet_mkadr.c'; fi` + +lib_a-inet_net.o: inet_net.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net.o `test -f 'inet_net.c' || echo '$(srcdir)/'`inet_net.c + +lib_a-inet_net.obj: inet_net.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net.obj `if test -f 'inet_net.c'; then $(CYGPATH_W) 'inet_net.c'; else $(CYGPATH_W) '$(srcdir)/inet_net.c'; fi` + +lib_a-inet_neta.o: inet_neta.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_neta.o `test -f 'inet_neta.c' || echo '$(srcdir)/'`inet_neta.c + +lib_a-inet_neta.obj: inet_neta.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_neta.obj `if test -f 'inet_neta.c'; then $(CYGPATH_W) 'inet_neta.c'; else $(CYGPATH_W) '$(srcdir)/inet_neta.c'; fi` + +lib_a-inet_netof.o: inet_netof.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_netof.o `test -f 'inet_netof.c' || echo '$(srcdir)/'`inet_netof.c + +lib_a-inet_netof.obj: inet_netof.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_netof.obj `if test -f 'inet_netof.c'; then $(CYGPATH_W) 'inet_netof.c'; else $(CYGPATH_W) '$(srcdir)/inet_netof.c'; fi` + +lib_a-inet_net_ntop.o: inet_net_ntop.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_ntop.o `test -f 'inet_net_ntop.c' || echo '$(srcdir)/'`inet_net_ntop.c + +lib_a-inet_net_ntop.obj: inet_net_ntop.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_ntop.obj `if test -f 'inet_net_ntop.c'; then $(CYGPATH_W) 'inet_net_ntop.c'; else $(CYGPATH_W) '$(srcdir)/inet_net_ntop.c'; fi` + +lib_a-inet_net_pton.o: inet_net_pton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_pton.o `test -f 'inet_net_pton.c' || echo '$(srcdir)/'`inet_net_pton.c + +lib_a-inet_net_pton.obj: inet_net_pton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_pton.obj `if test -f 'inet_net_pton.c'; then $(CYGPATH_W) 'inet_net_pton.c'; else $(CYGPATH_W) '$(srcdir)/inet_net_pton.c'; fi` + +lib_a-inet_ntoa.o: inet_ntoa.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_ntoa.o `test -f 'inet_ntoa.c' || echo '$(srcdir)/'`inet_ntoa.c + +lib_a-inet_ntoa.obj: inet_ntoa.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_ntoa.obj `if test -f 'inet_ntoa.c'; then $(CYGPATH_W) 'inet_ntoa.c'; else $(CYGPATH_W) '$(srcdir)/inet_ntoa.c'; fi` + +lib_a-inet_ntop.o: inet_ntop.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_ntop.o `test -f 'inet_ntop.c' || echo '$(srcdir)/'`inet_ntop.c + +lib_a-inet_ntop.obj: inet_ntop.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_ntop.obj `if test -f 'inet_ntop.c'; then $(CYGPATH_W) 'inet_ntop.c'; else $(CYGPATH_W) '$(srcdir)/inet_ntop.c'; fi` + +lib_a-inet_pton.o: inet_pton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_pton.o `test -f 'inet_pton.c' || echo '$(srcdir)/'`inet_pton.c + +lib_a-inet_pton.obj: inet_pton.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_pton.obj `if test -f 'inet_pton.c'; then $(CYGPATH_W) 'inet_pton.c'; else $(CYGPATH_W) '$(srcdir)/inet_pton.c'; fi` + +lib_a-issetugid-stub.o: issetugid-stub.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-issetugid-stub.o `test -f 'issetugid-stub.c' || echo '$(srcdir)/'`issetugid-stub.c + +lib_a-issetugid-stub.obj: issetugid-stub.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-issetugid-stub.obj `if test -f 'issetugid-stub.c'; then $(CYGPATH_W) 'issetugid-stub.c'; else $(CYGPATH_W) '$(srcdir)/issetugid-stub.c'; fi` + +lib_a-key-lookup.o: key-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-key-lookup.o `test -f 'key-lookup.c' || echo '$(srcdir)/'`key-lookup.c + +lib_a-key-lookup.obj: key-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-key-lookup.obj `if test -f 'key-lookup.c'; then $(CYGPATH_W) 'key-lookup.c'; else $(CYGPATH_W) '$(srcdir)/key-lookup.c'; fi` + +lib_a-netgrp-lookup.o: netgrp-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-netgrp-lookup.o `test -f 'netgrp-lookup.c' || echo '$(srcdir)/'`netgrp-lookup.c + +lib_a-netgrp-lookup.obj: netgrp-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-netgrp-lookup.obj `if test -f 'netgrp-lookup.c'; then $(CYGPATH_W) 'netgrp-lookup.c'; else $(CYGPATH_W) '$(srcdir)/netgrp-lookup.c'; fi` + +lib_a-network-lookup.o: network-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-network-lookup.o `test -f 'network-lookup.c' || echo '$(srcdir)/'`network-lookup.c + +lib_a-network-lookup.obj: network-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-network-lookup.obj `if test -f 'network-lookup.c'; then $(CYGPATH_W) 'network-lookup.c'; else $(CYGPATH_W) '$(srcdir)/network-lookup.c'; fi` + +lib_a-nsswitch.o: nsswitch.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsswitch.o `test -f 'nsswitch.c' || echo '$(srcdir)/'`nsswitch.c + +lib_a-nsswitch.obj: nsswitch.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsswitch.obj `if test -f 'nsswitch.c'; then $(CYGPATH_W) 'nsswitch.c'; else $(CYGPATH_W) '$(srcdir)/nsswitch.c'; fi` + +lib_a-ns_name.o: ns_name.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_name.o `test -f 'ns_name.c' || echo '$(srcdir)/'`ns_name.c + +lib_a-ns_name.obj: ns_name.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_name.obj `if test -f 'ns_name.c'; then $(CYGPATH_W) 'ns_name.c'; else $(CYGPATH_W) '$(srcdir)/ns_name.c'; fi` + +lib_a-ns_netint.o: ns_netint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_netint.o `test -f 'ns_netint.c' || echo '$(srcdir)/'`ns_netint.c + +lib_a-ns_netint.obj: ns_netint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_netint.obj `if test -f 'ns_netint.c'; then $(CYGPATH_W) 'ns_netint.c'; else $(CYGPATH_W) '$(srcdir)/ns_netint.c'; fi` + +lib_a-ns_parse.o: ns_parse.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_parse.o `test -f 'ns_parse.c' || echo '$(srcdir)/'`ns_parse.c + +lib_a-ns_parse.obj: ns_parse.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_parse.obj `if test -f 'ns_parse.c'; then $(CYGPATH_W) 'ns_parse.c'; else $(CYGPATH_W) '$(srcdir)/ns_parse.c'; fi` + +lib_a-ns_print.o: ns_print.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_print.o `test -f 'ns_print.c' || echo '$(srcdir)/'`ns_print.c + +lib_a-ns_print.obj: ns_print.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_print.obj `if test -f 'ns_print.c'; then $(CYGPATH_W) 'ns_print.c'; else $(CYGPATH_W) '$(srcdir)/ns_print.c'; fi` + +lib_a-ns_samedomain.o: ns_samedomain.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_samedomain.o `test -f 'ns_samedomain.c' || echo '$(srcdir)/'`ns_samedomain.c + +lib_a-ns_samedomain.obj: ns_samedomain.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_samedomain.obj `if test -f 'ns_samedomain.c'; then $(CYGPATH_W) 'ns_samedomain.c'; else $(CYGPATH_W) '$(srcdir)/ns_samedomain.c'; fi` + +lib_a-ns_ttl.o: ns_ttl.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_ttl.o `test -f 'ns_ttl.c' || echo '$(srcdir)/'`ns_ttl.c + +lib_a-ns_ttl.obj: ns_ttl.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_ttl.obj `if test -f 'ns_ttl.c'; then $(CYGPATH_W) 'ns_ttl.c'; else $(CYGPATH_W) '$(srcdir)/ns_ttl.c'; fi` + +lib_a-nsap_addr.o: nsap_addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsap_addr.o `test -f 'nsap_addr.c' || echo '$(srcdir)/'`nsap_addr.c + +lib_a-nsap_addr.obj: nsap_addr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsap_addr.obj `if test -f 'nsap_addr.c'; then $(CYGPATH_W) 'nsap_addr.c'; else $(CYGPATH_W) '$(srcdir)/nsap_addr.c'; fi` + +lib_a-proto-lookup.o: proto-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-proto-lookup.o `test -f 'proto-lookup.c' || echo '$(srcdir)/'`proto-lookup.c + +lib_a-proto-lookup.obj: proto-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-proto-lookup.obj `if test -f 'proto-lookup.c'; then $(CYGPATH_W) 'proto-lookup.c'; else $(CYGPATH_W) '$(srcdir)/proto-lookup.c'; fi` + +lib_a-opensock.o: opensock.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-opensock.o `test -f 'opensock.c' || echo '$(srcdir)/'`opensock.c + +lib_a-opensock.obj: opensock.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-opensock.obj `if test -f 'opensock.c'; then $(CYGPATH_W) 'opensock.c'; else $(CYGPATH_W) '$(srcdir)/opensock.c'; fi` + +lib_a-pwd-lookup.o: pwd-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pwd-lookup.o `test -f 'pwd-lookup.c' || echo '$(srcdir)/'`pwd-lookup.c + +lib_a-pwd-lookup.obj: pwd-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pwd-lookup.obj `if test -f 'pwd-lookup.c'; then $(CYGPATH_W) 'pwd-lookup.c'; else $(CYGPATH_W) '$(srcdir)/pwd-lookup.c'; fi` + +lib_a-recv.o: recv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-recv.o `test -f 'recv.c' || echo '$(srcdir)/'`recv.c + +lib_a-recv.obj: recv.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-recv.obj `if test -f 'recv.c'; then $(CYGPATH_W) 'recv.c'; else $(CYGPATH_W) '$(srcdir)/recv.c'; fi` + +lib_a-res_comp.o: res_comp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_comp.o `test -f 'res_comp.c' || echo '$(srcdir)/'`res_comp.c + +lib_a-res_comp.obj: res_comp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_comp.obj `if test -f 'res_comp.c'; then $(CYGPATH_W) 'res_comp.c'; else $(CYGPATH_W) '$(srcdir)/res_comp.c'; fi` + +lib_a-res_data.o: res_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_data.o `test -f 'res_data.c' || echo '$(srcdir)/'`res_data.c + +lib_a-res_data.obj: res_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_data.obj `if test -f 'res_data.c'; then $(CYGPATH_W) 'res_data.c'; else $(CYGPATH_W) '$(srcdir)/res_data.c'; fi` + +lib_a-res_debug.o: res_debug.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_debug.o `test -f 'res_debug.c' || echo '$(srcdir)/'`res_debug.c + +lib_a-res_debug.obj: res_debug.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_debug.obj `if test -f 'res_debug.c'; then $(CYGPATH_W) 'res_debug.c'; else $(CYGPATH_W) '$(srcdir)/res_debug.c'; fi` + +lib_a-res_hconf.o: res_hconf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_hconf.o `test -f 'res_hconf.c' || echo '$(srcdir)/'`res_hconf.c + +lib_a-res_hconf.obj: res_hconf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_hconf.obj `if test -f 'res_hconf.c'; then $(CYGPATH_W) 'res_hconf.c'; else $(CYGPATH_W) '$(srcdir)/res_hconf.c'; fi` + +lib_a-res_init.o: res_init.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_init.o `test -f 'res_init.c' || echo '$(srcdir)/'`res_init.c + +lib_a-res_init.obj: res_init.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_init.obj `if test -f 'res_init.c'; then $(CYGPATH_W) 'res_init.c'; else $(CYGPATH_W) '$(srcdir)/res_init.c'; fi` + +lib_a-res_libc.o: res_libc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_libc.o `test -f 'res_libc.c' || echo '$(srcdir)/'`res_libc.c + +lib_a-res_libc.obj: res_libc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_libc.obj `if test -f 'res_libc.c'; then $(CYGPATH_W) 'res_libc.c'; else $(CYGPATH_W) '$(srcdir)/res_libc.c'; fi` + +lib_a-res_mkquery.o: res_mkquery.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_mkquery.o `test -f 'res_mkquery.c' || echo '$(srcdir)/'`res_mkquery.c + +lib_a-res_mkquery.obj: res_mkquery.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_mkquery.obj `if test -f 'res_mkquery.c'; then $(CYGPATH_W) 'res_mkquery.c'; else $(CYGPATH_W) '$(srcdir)/res_mkquery.c'; fi` + +lib_a-res_query.o: res_query.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_query.o `test -f 'res_query.c' || echo '$(srcdir)/'`res_query.c + +lib_a-res_query.obj: res_query.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_query.obj `if test -f 'res_query.c'; then $(CYGPATH_W) 'res_query.c'; else $(CYGPATH_W) '$(srcdir)/res_query.c'; fi` + +lib_a-res_send.o: res_send.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_send.o `test -f 'res_send.c' || echo '$(srcdir)/'`res_send.c + +lib_a-res_send.obj: res_send.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_send.obj `if test -f 'res_send.c'; then $(CYGPATH_W) 'res_send.c'; else $(CYGPATH_W) '$(srcdir)/res_send.c'; fi` + +lib_a-rexec.o: rexec.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rexec.o `test -f 'rexec.c' || echo '$(srcdir)/'`rexec.c + +lib_a-rexec.obj: rexec.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rexec.obj `if test -f 'rexec.c'; then $(CYGPATH_W) 'rexec.c'; else $(CYGPATH_W) '$(srcdir)/rexec.c'; fi` + +lib_a-rpc-lookup.o: rpc-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rpc-lookup.o `test -f 'rpc-lookup.c' || echo '$(srcdir)/'`rpc-lookup.c + +lib_a-rpc-lookup.obj: rpc-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rpc-lookup.obj `if test -f 'rpc-lookup.c'; then $(CYGPATH_W) 'rpc-lookup.c'; else $(CYGPATH_W) '$(srcdir)/rpc-lookup.c'; fi` + +lib_a-ruserpass.o: ruserpass.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ruserpass.o `test -f 'ruserpass.c' || echo '$(srcdir)/'`ruserpass.c + +lib_a-ruserpass.obj: ruserpass.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ruserpass.obj `if test -f 'ruserpass.c'; then $(CYGPATH_W) 'ruserpass.c'; else $(CYGPATH_W) '$(srcdir)/ruserpass.c'; fi` + +lib_a-send.o: send.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-send.o `test -f 'send.c' || echo '$(srcdir)/'`send.c + +lib_a-send.obj: send.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-send.obj `if test -f 'send.c'; then $(CYGPATH_W) 'send.c'; else $(CYGPATH_W) '$(srcdir)/send.c'; fi` + +lib_a-service-lookup.o: service-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-service-lookup.o `test -f 'service-lookup.c' || echo '$(srcdir)/'`service-lookup.c + +lib_a-service-lookup.obj: service-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-service-lookup.obj `if test -f 'service-lookup.c'; then $(CYGPATH_W) 'service-lookup.c'; else $(CYGPATH_W) '$(srcdir)/service-lookup.c'; fi` + +lib_a-spwd-lookup.o: spwd-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spwd-lookup.o `test -f 'spwd-lookup.c' || echo '$(srcdir)/'`spwd-lookup.c + +lib_a-spwd-lookup.obj: spwd-lookup.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spwd-lookup.obj `if test -f 'spwd-lookup.c'; then $(CYGPATH_W) 'spwd-lookup.c'; else $(CYGPATH_W) '$(srcdir)/spwd-lookup.c'; fi` + +lib_a-ifname.o: ifname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifname.o `test -f 'ifname.c' || echo '$(srcdir)/'`ifname.c + +lib_a-ifname.obj: ifname.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifname.obj `if test -f 'ifname.c'; then $(CYGPATH_W) 'ifname.c'; else $(CYGPATH_W) '$(srcdir)/ifname.c'; fi` + +libnet_la-addr2ascii.lo: addr2ascii.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-addr2ascii.lo `test -f 'addr2ascii.c' || echo '$(srcdir)/'`addr2ascii.c + +libnet_la-ascii2addr.lo: ascii2addr.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ascii2addr.lo `test -f 'ascii2addr.c' || echo '$(srcdir)/'`ascii2addr.c + +libnet_la-alias-lookup.lo: alias-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-alias-lookup.lo `test -f 'alias-lookup.c' || echo '$(srcdir)/'`alias-lookup.c + +libnet_la-base64.lo: base64.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-base64.lo `test -f 'base64.c' || echo '$(srcdir)/'`base64.c + +libnet_la-check_pf.lo: check_pf.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-check_pf.lo `test -f 'check_pf.c' || echo '$(srcdir)/'`check_pf.c + +libnet_la-digits_dots.lo: digits_dots.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-digits_dots.lo `test -f 'digits_dots.c' || echo '$(srcdir)/'`digits_dots.c + +libnet_la-ether_aton.lo: ether_aton.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_aton.lo `test -f 'ether_aton.c' || echo '$(srcdir)/'`ether_aton.c + +libnet_la-ether_aton_r.lo: ether_aton_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_aton_r.lo `test -f 'ether_aton_r.c' || echo '$(srcdir)/'`ether_aton_r.c + +libnet_la-ether_hton.lo: ether_hton.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_hton.lo `test -f 'ether_hton.c' || echo '$(srcdir)/'`ether_hton.c + +libnet_la-ether_line.lo: ether_line.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_line.lo `test -f 'ether_line.c' || echo '$(srcdir)/'`ether_line.c + +libnet_la-ether_ntoa.lo: ether_ntoa.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_ntoa.lo `test -f 'ether_ntoa.c' || echo '$(srcdir)/'`ether_ntoa.c + +libnet_la-ether_ntoa_r.lo: ether_ntoa_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_ntoa_r.lo `test -f 'ether_ntoa_r.c' || echo '$(srcdir)/'`ether_ntoa_r.c + +libnet_la-ether_ntoh.lo: ether_ntoh.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_ntoh.lo `test -f 'ether_ntoh.c' || echo '$(srcdir)/'`ether_ntoh.c + +libnet_la-ethers-lookup.lo: ethers-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ethers-lookup.lo `test -f 'ethers-lookup.c' || echo '$(srcdir)/'`ethers-lookup.c + +libnet_la-getaddrinfo.lo: getaddrinfo.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaddrinfo.lo `test -f 'getaddrinfo.c' || echo '$(srcdir)/'`getaddrinfo.c + +libnet_la-getaliasent.lo: getaliasent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasent.lo `test -f 'getaliasent.c' || echo '$(srcdir)/'`getaliasent.c + +libnet_la-getaliasent_r.lo: getaliasent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasent_r.lo `test -f 'getaliasent_r.c' || echo '$(srcdir)/'`getaliasent_r.c + +libnet_la-getaliasname.lo: getaliasname.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasname.lo `test -f 'getaliasname.c' || echo '$(srcdir)/'`getaliasname.c + +libnet_la-getaliasname_r.lo: getaliasname_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasname_r.lo `test -f 'getaliasname_r.c' || echo '$(srcdir)/'`getaliasname_r.c + +libnet_la-gethstbyad.lo: gethstbyad.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbyad.lo `test -f 'gethstbyad.c' || echo '$(srcdir)/'`gethstbyad.c + +libnet_la-gethstbyad_r.lo: gethstbyad_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbyad_r.lo `test -f 'gethstbyad_r.c' || echo '$(srcdir)/'`gethstbyad_r.c + +libnet_la-gethstbynm2.lo: gethstbynm2.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm2.lo `test -f 'gethstbynm2.c' || echo '$(srcdir)/'`gethstbynm2.c + +libnet_la-gethstbynm2_r.lo: gethstbynm2_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm2_r.lo `test -f 'gethstbynm2_r.c' || echo '$(srcdir)/'`gethstbynm2_r.c + +libnet_la-gethstbynm.lo: gethstbynm.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm.lo `test -f 'gethstbynm.c' || echo '$(srcdir)/'`gethstbynm.c + +libnet_la-gethstbynm_r.lo: gethstbynm_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm_r.lo `test -f 'gethstbynm_r.c' || echo '$(srcdir)/'`gethstbynm_r.c + +libnet_la-gethstent.lo: gethstent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstent.lo `test -f 'gethstent.c' || echo '$(srcdir)/'`gethstent.c + +libnet_la-gethstent_r.lo: gethstent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstent_r.lo `test -f 'gethstent_r.c' || echo '$(srcdir)/'`gethstent_r.c + +libnet_la-getnameinfo.lo: getnameinfo.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnameinfo.lo `test -f 'getnameinfo.c' || echo '$(srcdir)/'`getnameinfo.c + +libnet_la-getnetbyad.lo: getnetbyad.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbyad.lo `test -f 'getnetbyad.c' || echo '$(srcdir)/'`getnetbyad.c + +libnet_la-getnetbyad_r.lo: getnetbyad_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbyad_r.lo `test -f 'getnetbyad_r.c' || echo '$(srcdir)/'`getnetbyad_r.c + +libnet_la-getnetbynm.lo: getnetbynm.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbynm.lo `test -f 'getnetbynm.c' || echo '$(srcdir)/'`getnetbynm.c + +libnet_la-getnetbynm_r.lo: getnetbynm_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbynm_r.lo `test -f 'getnetbynm_r.c' || echo '$(srcdir)/'`getnetbynm_r.c + +libnet_la-getnetent.lo: getnetent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetent.lo `test -f 'getnetent.c' || echo '$(srcdir)/'`getnetent.c + +libnet_la-getnetent_r.lo: getnetent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetent_r.lo `test -f 'getnetent_r.c' || echo '$(srcdir)/'`getnetent_r.c + +libnet_la-getnetgrent.lo: getnetgrent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetgrent.lo `test -f 'getnetgrent.c' || echo '$(srcdir)/'`getnetgrent.c + +libnet_la-getnetgrent_r.lo: getnetgrent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetgrent_r.lo `test -f 'getnetgrent_r.c' || echo '$(srcdir)/'`getnetgrent_r.c + +libnet_la-getnssent.lo: getnssent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnssent.lo `test -f 'getnssent.c' || echo '$(srcdir)/'`getnssent.c + +libnet_la-getnssent_r.lo: getnssent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnssent_r.lo `test -f 'getnssent_r.c' || echo '$(srcdir)/'`getnssent_r.c + +libnet_la-getproto.lo: getproto.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getproto.lo `test -f 'getproto.c' || echo '$(srcdir)/'`getproto.c + +libnet_la-getproto_r.lo: getproto_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getproto_r.lo `test -f 'getproto_r.c' || echo '$(srcdir)/'`getproto_r.c + +libnet_la-getprtent.lo: getprtent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtent.lo `test -f 'getprtent.c' || echo '$(srcdir)/'`getprtent.c + +libnet_la-getprtent_r.lo: getprtent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtent_r.lo `test -f 'getprtent_r.c' || echo '$(srcdir)/'`getprtent_r.c + +libnet_la-getprtname.lo: getprtname.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtname.lo `test -f 'getprtname.c' || echo '$(srcdir)/'`getprtname.c + +libnet_la-getprtname_r.lo: getprtname_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtname_r.lo `test -f 'getprtname_r.c' || echo '$(srcdir)/'`getprtname_r.c + +libnet_la-getrpcbyname.lo: getrpcbyname.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbyname.lo `test -f 'getrpcbyname.c' || echo '$(srcdir)/'`getrpcbyname.c + +libnet_la-getrpcbyname_r.lo: getrpcbyname_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbyname_r.lo `test -f 'getrpcbyname_r.c' || echo '$(srcdir)/'`getrpcbyname_r.c + +libnet_la-getrpcbynumber.lo: getrpcbynumber.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbynumber.lo `test -f 'getrpcbynumber.c' || echo '$(srcdir)/'`getrpcbynumber.c + +libnet_la-getrpcbynumber_r.lo: getrpcbynumber_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbynumber_r.lo `test -f 'getrpcbynumber_r.c' || echo '$(srcdir)/'`getrpcbynumber_r.c + +libnet_la-getrpcent.lo: getrpcent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcent.lo `test -f 'getrpcent.c' || echo '$(srcdir)/'`getrpcent.c + +libnet_la-getrpcent_r.lo: getrpcent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcent_r.lo `test -f 'getrpcent_r.c' || echo '$(srcdir)/'`getrpcent_r.c + +libnet_la-getservent.lo: getservent.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getservent.lo `test -f 'getservent.c' || echo '$(srcdir)/'`getservent.c + +libnet_la-getservent_r.lo: getservent_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getservent_r.lo `test -f 'getservent_r.c' || echo '$(srcdir)/'`getservent_r.c + +libnet_la-getsrvbynm.lo: getsrvbynm.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbynm.lo `test -f 'getsrvbynm.c' || echo '$(srcdir)/'`getsrvbynm.c + +libnet_la-getsrvbynm_r.lo: getsrvbynm_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbynm_r.lo `test -f 'getsrvbynm_r.c' || echo '$(srcdir)/'`getsrvbynm_r.c + +libnet_la-getsrvbypt.lo: getsrvbypt.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbypt.lo `test -f 'getsrvbypt.c' || echo '$(srcdir)/'`getsrvbypt.c + +libnet_la-getsrvbypt_r.lo: getsrvbypt_r.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbypt_r.lo `test -f 'getsrvbypt_r.c' || echo '$(srcdir)/'`getsrvbypt_r.c + +libnet_la-grp-lookup.lo: grp-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-grp-lookup.lo `test -f 'grp-lookup.c' || echo '$(srcdir)/'`grp-lookup.c + +libnet_la-herrno.lo: herrno.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-herrno.lo `test -f 'herrno.c' || echo '$(srcdir)/'`herrno.c + +libnet_la-hosts-lookup.lo: hosts-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-hosts-lookup.lo `test -f 'hosts-lookup.c' || echo '$(srcdir)/'`hosts-lookup.c + +libnet_la-ifreq.lo: ifreq.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ifreq.lo `test -f 'ifreq.c' || echo '$(srcdir)/'`ifreq.c + +libnet_la-in6_addr.lo: in6_addr.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-in6_addr.lo `test -f 'in6_addr.c' || echo '$(srcdir)/'`in6_addr.c + +libnet_la-inet6_option.lo: inet6_option.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet6_option.lo `test -f 'inet6_option.c' || echo '$(srcdir)/'`inet6_option.c + +libnet_la-inet_addr.lo: inet_addr.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_addr.lo `test -f 'inet_addr.c' || echo '$(srcdir)/'`inet_addr.c + +libnet_la-inet_lnaof.lo: inet_lnaof.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_lnaof.lo `test -f 'inet_lnaof.c' || echo '$(srcdir)/'`inet_lnaof.c + +libnet_la-inet_mkadr.lo: inet_mkadr.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_mkadr.lo `test -f 'inet_mkadr.c' || echo '$(srcdir)/'`inet_mkadr.c + +libnet_la-inet_net.lo: inet_net.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net.lo `test -f 'inet_net.c' || echo '$(srcdir)/'`inet_net.c + +libnet_la-inet_neta.lo: inet_neta.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_neta.lo `test -f 'inet_neta.c' || echo '$(srcdir)/'`inet_neta.c + +libnet_la-inet_netof.lo: inet_netof.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_netof.lo `test -f 'inet_netof.c' || echo '$(srcdir)/'`inet_netof.c + +libnet_la-inet_net_ntop.lo: inet_net_ntop.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net_ntop.lo `test -f 'inet_net_ntop.c' || echo '$(srcdir)/'`inet_net_ntop.c + +libnet_la-inet_net_pton.lo: inet_net_pton.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net_pton.lo `test -f 'inet_net_pton.c' || echo '$(srcdir)/'`inet_net_pton.c + +libnet_la-inet_ntoa.lo: inet_ntoa.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_ntoa.lo `test -f 'inet_ntoa.c' || echo '$(srcdir)/'`inet_ntoa.c + +libnet_la-inet_ntop.lo: inet_ntop.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_ntop.lo `test -f 'inet_ntop.c' || echo '$(srcdir)/'`inet_ntop.c + +libnet_la-inet_pton.lo: inet_pton.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_pton.lo `test -f 'inet_pton.c' || echo '$(srcdir)/'`inet_pton.c + +libnet_la-issetugid-stub.lo: issetugid-stub.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-issetugid-stub.lo `test -f 'issetugid-stub.c' || echo '$(srcdir)/'`issetugid-stub.c + +libnet_la-key-lookup.lo: key-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-key-lookup.lo `test -f 'key-lookup.c' || echo '$(srcdir)/'`key-lookup.c + +libnet_la-netgrp-lookup.lo: netgrp-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-netgrp-lookup.lo `test -f 'netgrp-lookup.c' || echo '$(srcdir)/'`netgrp-lookup.c + +libnet_la-network-lookup.lo: network-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-network-lookup.lo `test -f 'network-lookup.c' || echo '$(srcdir)/'`network-lookup.c + +libnet_la-nsswitch.lo: nsswitch.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsswitch.lo `test -f 'nsswitch.c' || echo '$(srcdir)/'`nsswitch.c + +libnet_la-ns_name.lo: ns_name.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_name.lo `test -f 'ns_name.c' || echo '$(srcdir)/'`ns_name.c + +libnet_la-ns_netint.lo: ns_netint.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_netint.lo `test -f 'ns_netint.c' || echo '$(srcdir)/'`ns_netint.c + +libnet_la-ns_parse.lo: ns_parse.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_parse.lo `test -f 'ns_parse.c' || echo '$(srcdir)/'`ns_parse.c + +libnet_la-ns_print.lo: ns_print.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_print.lo `test -f 'ns_print.c' || echo '$(srcdir)/'`ns_print.c + +libnet_la-ns_samedomain.lo: ns_samedomain.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_samedomain.lo `test -f 'ns_samedomain.c' || echo '$(srcdir)/'`ns_samedomain.c + +libnet_la-ns_ttl.lo: ns_ttl.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_ttl.lo `test -f 'ns_ttl.c' || echo '$(srcdir)/'`ns_ttl.c + +libnet_la-nsap_addr.lo: nsap_addr.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsap_addr.lo `test -f 'nsap_addr.c' || echo '$(srcdir)/'`nsap_addr.c + +libnet_la-proto-lookup.lo: proto-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-proto-lookup.lo `test -f 'proto-lookup.c' || echo '$(srcdir)/'`proto-lookup.c + +libnet_la-opensock.lo: opensock.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-opensock.lo `test -f 'opensock.c' || echo '$(srcdir)/'`opensock.c + +libnet_la-pwd-lookup.lo: pwd-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-pwd-lookup.lo `test -f 'pwd-lookup.c' || echo '$(srcdir)/'`pwd-lookup.c + +libnet_la-recv.lo: recv.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-recv.lo `test -f 'recv.c' || echo '$(srcdir)/'`recv.c + +libnet_la-res_comp.lo: res_comp.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_comp.lo `test -f 'res_comp.c' || echo '$(srcdir)/'`res_comp.c + +libnet_la-res_data.lo: res_data.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_data.lo `test -f 'res_data.c' || echo '$(srcdir)/'`res_data.c + +libnet_la-res_debug.lo: res_debug.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_debug.lo `test -f 'res_debug.c' || echo '$(srcdir)/'`res_debug.c + +libnet_la-res_hconf.lo: res_hconf.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_hconf.lo `test -f 'res_hconf.c' || echo '$(srcdir)/'`res_hconf.c + +libnet_la-res_init.lo: res_init.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_init.lo `test -f 'res_init.c' || echo '$(srcdir)/'`res_init.c + +libnet_la-res_libc.lo: res_libc.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_libc.lo `test -f 'res_libc.c' || echo '$(srcdir)/'`res_libc.c + +libnet_la-res_mkquery.lo: res_mkquery.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_mkquery.lo `test -f 'res_mkquery.c' || echo '$(srcdir)/'`res_mkquery.c + +libnet_la-res_query.lo: res_query.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_query.lo `test -f 'res_query.c' || echo '$(srcdir)/'`res_query.c + +libnet_la-res_send.lo: res_send.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_send.lo `test -f 'res_send.c' || echo '$(srcdir)/'`res_send.c + +libnet_la-rexec.lo: rexec.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-rexec.lo `test -f 'rexec.c' || echo '$(srcdir)/'`rexec.c + +libnet_la-rpc-lookup.lo: rpc-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-rpc-lookup.lo `test -f 'rpc-lookup.c' || echo '$(srcdir)/'`rpc-lookup.c + +libnet_la-ruserpass.lo: ruserpass.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ruserpass.lo `test -f 'ruserpass.c' || echo '$(srcdir)/'`ruserpass.c + +libnet_la-send.lo: send.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-send.lo `test -f 'send.c' || echo '$(srcdir)/'`send.c + +libnet_la-service-lookup.lo: service-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-service-lookup.lo `test -f 'service-lookup.c' || echo '$(srcdir)/'`service-lookup.c + +libnet_la-spwd-lookup.lo: spwd-lookup.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-spwd-lookup.lo `test -f 'spwd-lookup.c' || echo '$(srcdir)/'`spwd-lookup.c + +libnet_la-ifname.lo: ifname.c + $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ifname.lo `test -f 'ifname.c' || echo '$(srcdir)/'`ifname.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: +check: check-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-data-local + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-data-local install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-info-am + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/arpa; \ + for i in $(srcdir)/../include/arpa/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/arpa/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/net; \ + for i in $(srcdir)/../include/net/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/net/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet; \ + for i in $(srcdir)/../include/netinet/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netinet6; \ + for i in $(srcdir)/../include/netinet6/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netinet6/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/netns; \ + for i in $(srcdir)/../include/netns/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/netns/`basename $$i`; \ + done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \ + for i in $(srcdir)/../include/rpc/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \ + done; +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: function.def =================================================================== --- function.def (nonexistent) +++ function.def (revision 520) @@ -0,0 +1,78 @@ +/* List of functions defined for static NSS in GNU C Library. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* + This is a minimal config. Only services `files' and `dns' are supported. +*/ + +/* aliases */ +DEFINE_ENT (files, alias) +DEFINE_GETBY (files, alias, name) + +/* ethers */ +DEFINE_ENT (files, ether) + +/* group */ +DEFINE_ENT (files, gr) +DEFINE_GET (files, grgid) +DEFINE_GET (files, grnam) + +/* hosts */ +DEFINE_ENT (files, host) +DEFINE_GETBY (files, host, addr) +DEFINE_GETBY (files, host, name) +DEFINE_GET (files, hostton) +DEFINE_GET (files, ntohost) +DEFINE_GETBY (dns, host, addr) +DEFINE_GETBY (dns, host, name) +DEFINE_GETBY (dns, host, name2) + +/* netgroup */ +DEFINE_ENT (files, netgr) + +/* networks */ +DEFINE_ENT (files, net) +DEFINE_GETBY (files, net, name) +DEFINE_GETBY (files, net, addr) +DEFINE_GETBY (dns, net, name) +DEFINE_GETBY (dns, net, addr) + +/* protocols */ +DEFINE_ENT (files, proto) +DEFINE_GETBY (files, proto, name) +DEFINE_GETBY (files, proto, number) + +/* passwd */ +DEFINE_ENT (files, pw) +DEFINE_GET (files, pwnam) +DEFINE_GET (files, pwuid) + +/* rpc */ +DEFINE_ENT (files, rpc) +DEFINE_GETBY (files, rpc, name) +DEFINE_GETBY (files, rpc, number) + +/* services */ +DEFINE_ENT (files, serv) +DEFINE_GETBY (files, serv, name) +DEFINE_GETBY (files, serv, port) + +/* shadow */ +DEFINE_ENT (files, sp) +DEFINE_GET (files, spnam) Index: addr2ascii.c =================================================================== --- addr2ascii.c (nonexistent) +++ addr2ascii.c (revision 520) @@ -0,0 +1,86 @@ +/* + * Copyright 1996 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * 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. 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. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $ANA: addr2ascii.c,v 1.1 1996/06/13 18:41:46 wollman Exp $ + */ + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +/*- + * Convert a network address from binary to printable numeric format. + * This API is copied from INRIA's IPv6 implementation, but it is a + * bit bogus in two ways: + * + * 1) There is no value in passing both an address family and + * an address length; either one should imply the other, + * or we should be passing sockaddrs instead. + * 2) There should by contrast be /added/ a length for the buffer + * that we pass in, so that programmers are spared the need to + * manually calculate (read: ``guess'') the maximum length. + * + * Flash: the API is also the same in the NRL implementation, and seems to + * be some sort of standard, so we appear to be stuck with both the bad + * naming and the poor choice of arguments. + */ +char * +addr2ascii(af, addrp, len, buf) + int af; + const void *addrp; + int len; /* should be size_t XXX */ + char *buf; /* XXX should pass length of buffer */ +{ + static char staticbuf[64]; /* 64 for AF_LINK > 16 for AF_INET */ + + if (!buf) + buf = staticbuf; + + switch(af) { + case AF_INET: + if (len != sizeof(struct in_addr)) { + errno = ENAMETOOLONG; + return 0; + } + strcpy(buf, inet_ntoa(*(const struct in_addr *)addrp)); + break; + + default: + errno = EPROTONOSUPPORT; + return 0; + } + return buf; +}
addr2ascii.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_mkquery.c =================================================================== --- res_mkquery.c (nonexistent) +++ res_mkquery.c (revision 520) @@ -0,0 +1,222 @@ +/* + * Copyright (c) 1985, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; +static const char rcsid[] = "$BINDId: res_mkquery.c,v 8.12 1999/10/13 16:39:40 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "local.h" + +/* Options. Leave them on. */ +/* #define DEBUG */ + +#ifdef _LIBC +# include +# if HP_TIMING_AVAIL +# define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; } +# endif +#endif + +/* + * Form all types of queries. + * Returns the size of the result or -1. + */ +int +res_nmkquery(res_state statp, + int op, /* opcode of query */ + const char *dname, /* domain name */ + int class, int type, /* class and type of query */ + const u_char *data, /* resource record data */ + int datalen, /* length of data */ + const u_char *newrr_in, /* new rr for modify or append */ + u_char *buf, /* buffer to put query */ + int buflen) /* size of buffer */ +{ + register HEADER *hp; + register u_char *cp; + register int n; + u_char *dnptrs[20], **dpp, **lastdnptr; + +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_nmkquery(%s, %s, %s, %s)\n", + _res_opcodes[op], dname, p_class(class), p_type(type)); +#endif + /* + * Initialize header fields. + */ + if ((buf == NULL) || (buflen < HFIXEDSZ)) + return (-1); + memset(buf, 0, HFIXEDSZ); + hp = (HEADER *) buf; + /* We randomize the IDs every time. The old code just + incremented by one after the initial randomization which + still predictable if the application does multiple + requests. */ +#if 0 + hp->id = htons(++statp->id); +#else + hp->id = htons(statp->id); + int randombits; + do + { +#ifdef RANDOM_BITS + RANDOM_BITS (randombits); +#else + struct timeval tv; + gettimeofday (&tv, NULL); + randombits = (tv.tv_sec << 8) ^ tv.tv_usec; +#endif + } + while ((randombits & 0xffff) == 0); + statp->id = (statp->id + randombits) & 0xffff; +#endif + hp->opcode = op; + hp->rd = (statp->options & RES_RECURSE) != 0; + hp->rcode = NOERROR; + cp = buf + HFIXEDSZ; + buflen -= HFIXEDSZ; + dpp = dnptrs; + *dpp++ = buf; + *dpp++ = NULL; + lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0]; + /* + * perform opcode specific processing + */ + switch (op) { + case QUERY: /*FALLTHROUGH*/ + case NS_NOTIFY_OP: + if ((buflen -= QFIXEDSZ) < 0) + return (-1); + if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0) + return (-1); + cp += n; + buflen -= n; + __putshort(type, cp); + cp += INT16SZ; + __putshort(class, cp); + cp += INT16SZ; + hp->qdcount = htons(1); + if (op == QUERY || data == NULL) + break; + /* + * Make an additional record for completion domain. + */ + buflen -= RRFIXEDSZ; + n = dn_comp((char *)data, cp, buflen, dnptrs, lastdnptr); + if (n < 0) + return (-1); + cp += n; + buflen -= n; + __putshort(T_NULL, cp); + cp += INT16SZ; + __putshort(class, cp); + cp += INT16SZ; + __putlong(0, cp); + cp += INT32SZ; + __putshort(0, cp); + cp += INT16SZ; + hp->arcount = htons(1); + break; + + case IQUERY: + /* + * Initialize answer section + */ + if (buflen < 1 + RRFIXEDSZ + datalen) + return (-1); + *cp++ = '\0'; /* no domain name */ + __putshort(type, cp); + cp += INT16SZ; + __putshort(class, cp); + cp += INT16SZ; + __putlong(0, cp); + cp += INT32SZ; + __putshort(datalen, cp); + cp += INT16SZ; + if (datalen) { + memcpy(cp, data, datalen); + cp += datalen; + } + hp->ancount = htons(1); + break; + + default: + return (-1); + } + return (cp - buf); +} +libresolv_hidden_def (res_nmkquery)
res_mkquery.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetgrent_r.c =================================================================== --- getnetgrent_r.c (nonexistent) +++ getnetgrent_r.c (revision 520) @@ -0,0 +1,446 @@ +/* Copyright (C) 1996,1997,1998,1999,2002,2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define _IO_MTSAFE_IO +#include +#include +#include +#include +#include +#include "netgroup.h" +#include "nsswitch.h" +#include "libc-symbols.h" + + +/* Protect above variable against multiple uses at the same time. */ +__libc_lock_define_initialized (static, lock) + +/* The whole information for the set/get/endnetgrent functions are + kept in this structure. */ +static struct __netgrent dataset; + +/* The lookup function for the first entry of this service. */ +extern int __nss_netgroup_lookup (service_user **nip, const char *name, + void **fctp) internal_function; + + +/* Set up NIP to run through the services. If ALL is zero, use NIP's + current location if it's not nil. Return nonzero if there are no + services (left). */ +static enum nss_status +setup (void **fctp, const char *func_name, int all, service_user **nipp) +{ + /* Remember the first service_entry, it's always the same. */ + static service_user *startp; + int no_more; + + if (startp == NULL) + { + /* Executing this more than once at the same time must yield the + same result every time. So we need no locking. */ + no_more = __nss_netgroup_lookup (nipp, func_name, fctp); + startp = no_more ? (service_user *) -1 : *nipp; + } + else if (startp == (service_user *) -1) + /* No services at all. */ + return 1; + else + { + if (all || *nipp == NULL) + /* Reset to the beginning of the service list. */ + *nipp = startp; + /* Look up the first function. */ + no_more = __nss_lookup (nipp, func_name, fctp); + } + return no_more; +} + +/* Free used memory. */ +static void +free_memory (struct __netgrent *data) +{ + while (data->known_groups != NULL) + { + struct name_list *tmp = data->known_groups; + data->known_groups = data->known_groups->next; + free (tmp); + } + + while (data->needed_groups != NULL) + { + struct name_list *tmp = data->needed_groups; + data->needed_groups = data->needed_groups->next; + free (tmp); + } +} + +static int +internal_function +__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap, + int *errnop) +{ + union + { + enum nss_status (*f) (const char *, struct __netgrent *); + void *ptr; + } fct; + enum nss_status status = NSS_STATUS_UNAVAIL; + struct name_list *new_elem; + + /* Cycle through all the services and run their setnetgrent functions. */ + int no_more = setup (&fct.ptr, "setnetgrent", 1, &datap->nip); + while (! no_more) + { + /* Ignore status, we force check in `__nss_next'. */ + status = (*fct.f) (group, datap); + + no_more = __nss_next (&datap->nip, "setnetgrent", &fct.ptr, status, 0); + } + + /* Add the current group to the list of known groups. */ + size_t group_len = strlen (group) + 1; + new_elem = (struct name_list *) malloc (sizeof (struct name_list) + + group_len); + if (new_elem == NULL) + { + *errnop = errno; + status = NSS_STATUS_TRYAGAIN; + } + else + { + new_elem->next = datap->known_groups; + memcpy (new_elem->name, group, group_len); + datap->known_groups = new_elem; + } + + return status == NSS_STATUS_SUCCESS; +} + +int internal_setnetgrent (const char *group, struct __netgrent *datap); +libc_hidden_proto (internal_setnetgrent) + +int +internal_setnetgrent (const char *group, struct __netgrent *datap) +{ + /* Free list of all netgroup names from last run. */ + free_memory (datap); + + return __internal_setnetgrent_reuse (group, datap, &errno); +} +libc_hidden_def (internal_setnetgrent) +strong_alias (internal_setnetgrent, __internal_setnetgrent) + +int +setnetgrent (const char *group) +{ + int result; + + __libc_lock_lock (lock); + + result = internal_setnetgrent (group, &dataset); + + __libc_lock_unlock (lock); + + return result; +} + + +void internal_endnetgrent (struct __netgrent *datap); +libc_hidden_proto (internal_endnetgrent) + +void +internal_endnetgrent (struct __netgrent *datap) +{ + service_user *old_nip; + union + { + enum nss_status (*f) (struct __netgrent *); + void *ptr; + } fct; + + /* Remember which was the last used service. */ + old_nip = datap->nip; + + /* Cycle through all the services and run their endnetgrent functions. */ + int no_more = setup (&fct.ptr, "endnetgrent", 1, &datap->nip); + while (! no_more) + { + /* Ignore status, we force check in `__nss_next'. */ + (void) (*fct.f) (datap); + + no_more = (datap->nip == old_nip + || __nss_next (&datap->nip, "endnetgrent", &fct.ptr, 0, 1)); + } + + /* Now free list of all netgroup names from last run. */ + free_memory (datap); +} +libc_hidden_def (internal_endnetgrent) +strong_alias (internal_endnetgrent, __internal_endnetgrent) + + +void +endnetgrent (void) +{ + __libc_lock_lock (lock); + + internal_endnetgrent (&dataset); + + __libc_lock_unlock (lock); +} + + +int internal_getnetgrent_r (char **hostp, char **userp, char **domainp, + struct __netgrent *datap, + char *buffer, size_t buflen, int *errnop); +libc_hidden_proto (internal_getnetgrent_r) + +int +internal_getnetgrent_r (char **hostp, char **userp, char **domainp, + struct __netgrent *datap, + char *buffer, size_t buflen, int *errnop) +{ + union + { + enum nss_status (*f) (struct __netgrent *, char *, size_t, int *); + void *ptr; + } fct; + + /* Initialize status to return if no more functions are found. */ + enum nss_status status = NSS_STATUS_NOTFOUND; + + /* Run through available functions, starting with the same function last + run. We will repeat each function as long as it succeeds, and then go + on to the next service action. */ + int no_more = setup (&fct.ptr, "getnetgrent_r", 0, &datap->nip); + while (! no_more) + { + status = (*fct.f) (datap, buffer, buflen, &errno); + + if (status == NSS_STATUS_RETURN) + { + /* This was the last one for this group. Look at next group + if available. */ + int found = 0; + while (datap->needed_groups != NULL && ! found) + { + struct name_list *tmp = datap->needed_groups; + datap->needed_groups = datap->needed_groups->next; + tmp->next = datap->known_groups; + datap->known_groups = tmp; + + found = __internal_setnetgrent_reuse (datap->known_groups->name, + datap, errnop); + } + + if (found) + continue; + } + else if (status == NSS_STATUS_SUCCESS && datap->type == group_val) + { + /* The last entry was a name of another netgroup. */ + struct name_list *namep; + + /* Ignore if we've seen the name before. */ + for (namep = datap->known_groups; namep != NULL; + namep = namep->next) + if (strcmp (datap->val.group, namep->name) == 0) + break; + if (namep != NULL) + /* Really ignore. */ + continue; + + size_t group_len = strlen (datap->val.group) + 1; + namep = (struct name_list *) malloc (sizeof (struct name_list) + + group_len); + if (namep == NULL) + /* We are out of memory. */ + status = NSS_STATUS_RETURN; + else + { + namep->next = datap->needed_groups; + memcpy (namep->name, datap->val.group, group_len); + datap->needed_groups = namep; + /* And get the next entry. */ + continue; + } + } + + no_more = __nss_next (&datap->nip, "getnetgrent_r", &fct.ptr, status, 0); + } + + if (status == NSS_STATUS_SUCCESS) + { + *hostp = (char *) datap->val.triple.host; + *userp = (char *) datap->val.triple.user; + *domainp = (char *) datap->val.triple.domain; + } + + return status == NSS_STATUS_SUCCESS ? 1 : 0; +} +libc_hidden_def (internal_getnetgrent_r) +strong_alias (internal_getnetgrent_r, __internal_getnetgrent_r) + +/* The real entry point. */ +int +__getnetgrent_r (char **hostp, char **userp, char **domainp, + char *buffer, size_t buflen) +{ + enum nss_status status; + + __libc_lock_lock (lock); + + status = internal_getnetgrent_r (hostp, userp, domainp, &dataset, + buffer, buflen, &errno); + + __libc_lock_unlock (lock); + + return status; +} +weak_alias (__getnetgrent_r, getnetgrent_r) + +/* Test whether given (host,user,domain) triple is in NETGROUP. */ +int +innetgr (const char *netgroup, const char *host, const char *user, + const char *domain) +{ + union + { + int (*f) (const char *, struct __netgrent *); + void *ptr; + } setfct; + union + { + void (*f) (struct __netgrent *); + void *ptr; + } endfct; + union + { + int (*f) (struct __netgrent *, char *, size_t, int *); + void *ptr; + } getfct; + struct __netgrent entry; + int result = 0; + const char *current_group = netgroup; + int real_entry = 0; + + memset (&entry, '\0', sizeof (entry)); + + /* Walk through the services until we found an answer or we shall + not work further. We can do some optimization here. Since all + services must provide the `setnetgrent' function we can do all + the work during one walk through the service list. */ + while (1) + { + int no_more = setup (&setfct.ptr, "setnetgrent", 1, &entry.nip); + while (! no_more) + { + /* Open netgroup. */ + enum nss_status status = (*setfct.f) (current_group, &entry); + + if (status == NSS_STATUS_SUCCESS + && __nss_lookup (&entry.nip, "getnetgrent_r", &getfct.ptr) == 0) + { + char buffer[1024]; + + while ((*getfct.f) (&entry, buffer, sizeof buffer, &errno) + == NSS_STATUS_SUCCESS) + { + if (entry.type == group_val) + { + /* Make sure we haven't seen the name before. */ + struct name_list *namep; + + for (namep = entry.known_groups; namep != NULL; + namep = namep->next) + if (strcmp (entry.val.group, namep->name) == 0) + break; + if (namep == NULL + && strcmp (netgroup, entry.val.group) != 0) + { + size_t group_len = strlen (entry.val.group) + 1; + namep = + (struct name_list *) malloc (sizeof (*namep) + + group_len); + if (namep == NULL) + { + /* Out of memory, simply return. */ + result = -1; + break; + } + + namep->next = entry.needed_groups; + memcpy (namep->name, entry.val.group, group_len); + entry.needed_groups = namep; + } + } + else + { + real_entry = 1; + + if ((entry.val.triple.host == NULL || host == NULL + || strcasecmp (entry.val.triple.host, host) == 0) + && (entry.val.triple.user == NULL || user == NULL + || strcmp (entry.val.triple.user, user) == 0) + && (entry.val.triple.domain == NULL || domain == NULL + || strcasecmp (entry.val.triple.domain, + domain) == 0)) + { + result = 1; + break; + } + } + } + + if (result != 0) + break; + + /* If we found one service which does know the given + netgroup we don't try further. */ + status = NSS_STATUS_RETURN; + } + + /* Free all resources of the service. */ + if (__nss_lookup (&entry.nip, "endnetgrent", &endfct.ptr) == 0) + (*endfct.f) (&entry); + + /* Look for the next service. */ + no_more = __nss_next (&entry.nip, "setnetgrent", + &setfct.ptr, status, 0); + } + + if (result == 0 && entry.needed_groups != NULL) + { + struct name_list *tmp = entry.needed_groups; + entry.needed_groups = tmp->next; + tmp->next = entry.known_groups; + entry.known_groups = tmp; + current_group = entry.known_groups->name; + continue; + } + + /* No way out. */ + break; + } + + /* Free the memory. */ + free_memory (&entry); + + return result; +} +libc_hidden_def (innetgr)
getnetgrent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nss.h =================================================================== --- nss.h (nonexistent) +++ nss.h (revision 520) @@ -0,0 +1,52 @@ +/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Define interface to NSS. This is meant for the interface functions + and for implementors of new services. */ + +#ifndef _NSS_H +#define _NSS_H 1 + +#include + + +__BEGIN_DECLS + +/* Possible results of lookup using a nss_* function. */ +enum nss_status +{ + NSS_STATUS_TRYAGAIN = -2, + NSS_STATUS_UNAVAIL, + NSS_STATUS_NOTFOUND, + NSS_STATUS_SUCCESS, + NSS_STATUS_RETURN +}; + + +/* Overwrite service selection for database DBNAME using specification + in STRING. + This function should only be used by system programs which have to + work around non-existing services (e.e., while booting). + Attention: Using this function repeatedly will slowly eat up the + whole memory since previous selection data cannot be freed. */ +extern int __nss_configure_lookup (__const char *__dbname, + __const char *__string) __THROW; + +__END_DECLS + +#endif /* nss.h */
nss.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns_parse.c =================================================================== --- ns_parse.c (nonexistent) +++ ns_parse.c (revision 520) @@ -0,0 +1,196 @@ +/* + * Copyright (c) 1996,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixie Exp $"; +#endif + +/* Import. */ + +#include + +#include +#include + +#include +#include +#include + +#include "libc-symbols.h" + +/* Forward. */ + +static void setsection(ns_msg *msg, ns_sect sect); + +/* Macros. */ + +#define RETERR(err) do { __set_errno (err); return (-1); } while (0) + +/* Public. */ + +/* These need to be in the same order as the nres.h:ns_flag enum. */ +struct _ns_flagdata _ns_flagdata[16] = { + { 0x8000, 15 }, /* qr. */ + { 0x7800, 11 }, /* opcode. */ + { 0x0400, 10 }, /* aa. */ + { 0x0200, 9 }, /* tc. */ + { 0x0100, 8 }, /* rd. */ + { 0x0080, 7 }, /* ra. */ + { 0x0040, 6 }, /* z. */ + { 0x0020, 5 }, /* ad. */ + { 0x0010, 4 }, /* cd. */ + { 0x000f, 0 }, /* rcode. */ + { 0x0000, 0 }, /* expansion (1/6). */ + { 0x0000, 0 }, /* expansion (2/6). */ + { 0x0000, 0 }, /* expansion (3/6). */ + { 0x0000, 0 }, /* expansion (4/6). */ + { 0x0000, 0 }, /* expansion (5/6). */ + { 0x0000, 0 }, /* expansion (6/6). */ +}; + +int +ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) { + const u_char *optr = ptr; + + for ((void)NULL; count > 0; count--) { + int b, rdlength; + + b = dn_skipname(ptr, eom); + if (b < 0) + RETERR(EMSGSIZE); + ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/; + if (section != ns_s_qd) { + if (ptr + NS_INT32SZ + NS_INT16SZ > eom) + RETERR(EMSGSIZE); + ptr += NS_INT32SZ/*TTL*/; + NS_GET16(rdlength, ptr); + ptr += rdlength/*RData*/; + } + } + if (ptr > eom) + RETERR(EMSGSIZE); + return (ptr - optr); +} + +int +ns_initparse(const u_char *msg, int msglen, ns_msg *handle) { + const u_char *eom = msg + msglen; + int i; + + memset(handle, 0x5e, sizeof *handle); + handle->_msg = msg; + handle->_eom = eom; + if (msg + NS_INT16SZ > eom) + RETERR(EMSGSIZE); + NS_GET16(handle->_id, msg); + if (msg + NS_INT16SZ > eom) + RETERR(EMSGSIZE); + NS_GET16(handle->_flags, msg); + for (i = 0; i < ns_s_max; i++) { + if (msg + NS_INT16SZ > eom) + RETERR(EMSGSIZE); + NS_GET16(handle->_counts[i], msg); + } + for (i = 0; i < ns_s_max; i++) + if (handle->_counts[i] == 0) + handle->_sections[i] = NULL; + else { + int b = ns_skiprr(msg, eom, (ns_sect)i, + handle->_counts[i]); + + if (b < 0) + return (-1); + handle->_sections[i] = msg; + msg += b; + } + if (msg != eom) + RETERR(EMSGSIZE); + setsection(handle, ns_s_max); + return (0); +} + +int +ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) { + int b; + + /* Make section right. */ + if (section < 0 || section >= ns_s_max) + RETERR(ENODEV); + if (section != handle->_sect) + setsection(handle, section); + + /* Make rrnum right. */ + if (rrnum == -1) + rrnum = handle->_rrnum; + if (rrnum < 0 || rrnum >= handle->_counts[(int)section]) + RETERR(ENODEV); + if (rrnum < handle->_rrnum) + setsection(handle, section); + if (rrnum > handle->_rrnum) { + b = ns_skiprr(handle->_ptr, handle->_eom, section, + rrnum - handle->_rrnum); + + if (b < 0) + return (-1); + handle->_ptr += b; + handle->_rrnum = rrnum; + } + + /* Do the parse. */ + b = dn_expand(handle->_msg, handle->_eom, + handle->_ptr, rr->name, NS_MAXDNAME); + if (b < 0) + return (-1); + handle->_ptr += b; + if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom) + RETERR(EMSGSIZE); + NS_GET16(rr->type, handle->_ptr); + NS_GET16(rr->rr_class, handle->_ptr); + if (section == ns_s_qd) { + rr->ttl = 0; + rr->rdlength = 0; + rr->rdata = NULL; + } else { + if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom) + RETERR(EMSGSIZE); + NS_GET32(rr->ttl, handle->_ptr); + NS_GET16(rr->rdlength, handle->_ptr); + if (handle->_ptr + rr->rdlength > handle->_eom) + RETERR(EMSGSIZE); + rr->rdata = handle->_ptr; + handle->_ptr += rr->rdlength; + } + if (++handle->_rrnum > handle->_counts[(int)section]) + setsection(handle, (ns_sect)((int)section + 1)); + + /* All done. */ + return (0); +} + +/* Private. */ + +static void +setsection(ns_msg *msg, ns_sect sect) { + msg->_sect = sect; + if (sect == ns_s_max) { + msg->_rrnum = -1; + msg->_ptr = NULL; + } else { + msg->_rrnum = 0; + msg->_ptr = msg->_sections[(int)sect]; + } +}
ns_parse.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getaliasname_r.c =================================================================== --- getaliasname_r.c (nonexistent) +++ getaliasname_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct aliasent +#define FUNCTION_NAME getaliasbyname +#define DATABASE_NAME aliases +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name + +#include "getXXbyYY_r.c"
getaliasname_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetbynm.c =================================================================== --- getnetbynm.c (nonexistent) +++ getnetbynm.c (revision 520) @@ -0,0 +1,31 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct netent +#define FUNCTION_NAME getnetbyname +#define DATABASE_NAME networks +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#include "getXXbyYY.c"
getnetbynm.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getXXbyYY.c =================================================================== --- getXXbyYY.c (nonexistent) +++ getXXbyYY.c (revision 520) @@ -0,0 +1,156 @@ +/* Copyright (C) 1996-2001,2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#define _IO_MTSAFE_IO +#include +#include +#include + +#include "nsswitch.h" + +/*******************************************************************\ +|* Here we assume several symbols to be defined: *| +|* *| +|* LOOKUP_TYPE - the return type of the function *| +|* *| +|* FUNCTION_NAME - name of the non-reentrant function *| +|* *| +|* DATABASE_NAME - name of the database the function accesses *| +|* (e.g., host, services, ...) *| +|* *| +|* ADD_PARAMS - additional parameter, can vary in number *| +|* *| +|* ADD_VARIABLES - names of additional parameter *| +|* *| +|* BUFLEN - length of buffer allocated for the non *| +|* reentrant version *| +|* *| +|* Optionally the following vars can be defined: *| +|* *| +|* NEED_H_ERRNO - an extra parameter will be passed to point to *| +|* the global `h_errno' variable. *| +|* *| +\*******************************************************************/ + +/* To make the real sources a bit prettier. */ +#define REENTRANT_NAME APPEND_R (FUNCTION_NAME) +#define APPEND_R(name) APPEND_R1 (name) +#define APPEND_R1(name) name##_r +#define INTERNAL(name) INTERNAL1 (name) +#define INTERNAL1(name) __##name + +/* Sometimes we need to store error codes in the `h_errno' variable. */ +#ifdef NEED_H_ERRNO +# define H_ERRNO_PARM , int *h_errnop +# define H_ERRNO_VAR , &h_errno_tmp +# define H_ERRNO_VAR_P &h_errno_tmp +#else +# define H_ERRNO_PARM +# define H_ERRNO_VAR +# define H_ERRNO_VAR_P NULL +#endif + +#ifdef HAVE_AF +# define AF_VAL af +#else +# define AF_VAL AF_INET +#endif + +/* Prototype for reentrant version we use here. */ +extern int INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, + char *buffer, size_t buflen, + LOOKUP_TYPE **result H_ERRNO_PARM); + +/* We need to protect the dynamic buffer handling. */ +__libc_lock_define_initialized (static, lock); + +/* This points to the static buffer used. */ +libc_freeres_ptr (static char *buffer); + + +LOOKUP_TYPE * +FUNCTION_NAME (ADD_PARAMS) +{ + static size_t buffer_size; + static LOOKUP_TYPE resbuf; + LOOKUP_TYPE *result; +#ifdef NEED_H_ERRNO + int h_errno_tmp = 0; +#endif + + /* Get lock. */ + __libc_lock_lock (lock); + + if (buffer == NULL) + { + buffer_size = BUFLEN; + buffer = (char *) malloc (buffer_size); + } + +#ifdef HANDLE_DIGITS_DOTS + if (buffer != NULL) + { + if (__nss_hostname_digits_dots (name, &resbuf, &buffer, + &buffer_size, 0, &result, NULL, AF_VAL, + H_ERRNO_VAR_P)) + goto done; + } +#endif + + while (buffer != NULL + && (INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer, + buffer_size, &result H_ERRNO_VAR) + == ERANGE) +#ifdef NEED_H_ERRNO + && h_errno_tmp == NETDB_INTERNAL +#endif + ) + { + char *new_buf; + buffer_size *= 2; + new_buf = (char *) realloc (buffer, buffer_size); + if (new_buf == NULL) + { + /* We are out of memory. Free the current buffer so that the + process gets a chance for a normal termination. */ + free (buffer); + errno = (ENOMEM); + } + buffer = new_buf; + } + + if (buffer == NULL) + result = NULL; + +#ifdef HANDLE_DIGITS_DOTS +done: +#endif + /* Release lock. */ + __libc_lock_unlock (lock); + +#ifdef NEED_H_ERRNO + if (h_errno_tmp != 0) + h_errno = (h_errno_tmp); +#endif + + return result; +} + +static_link_warning (FUNCTION_NAME)
getXXbyYY.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rcmd.c =================================================================== --- rcmd.c (nonexistent) +++ rcmd.c (revision 520) @@ -0,0 +1,885 @@ +/* + * Copyright (C) 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +/* + * Copyright (c) 1983, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "local.h" + + +int __ivaliduser (FILE *, u_int32_t, const char *, const char *); +static int __validuser2_sa (FILE *, struct sockaddr *, size_t, + const char *, const char *, const char *); +static int ruserok2_sa (struct sockaddr *ra, size_t ralen, + int superuser, const char *ruser, + const char *luser, const char *rhost); +static int ruserok_sa (struct sockaddr *ra, size_t ralen, + int superuser, const char *ruser, + const char *luser); +int iruserok_af (const void *raddr, int superuser, const char *ruser, + const char *luser, sa_family_t af); +int iruserok (u_int32_t raddr, int superuser, const char *ruser, + const char *luser); + +libc_hidden_proto (iruserok_af) + +libc_freeres_ptr(static char *ahostbuf); + +int +rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) + char **ahost; + u_short rport; + const char *locuser, *remuser, *cmd; + int *fd2p; + sa_family_t af; +{ + char paddr[INET6_ADDRSTRLEN]; + struct addrinfo hints, *res, *ai; + struct sockaddr_storage from; + struct pollfd pfd[2]; + int32_t oldmask; + pid_t pid; + int s, lport, timo, error; + char c; + int refused; + char num[8]; + ssize_t n; + + if (af != AF_INET && af != AF_INET6 && af != AF_UNSPEC) + { + __set_errno (EAFNOSUPPORT); + return -1; + } + + pid = __getpid(); + + memset(&hints, '\0', sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = af; + hints.ai_socktype = SOCK_STREAM; + (void)snprintf(num, sizeof(num), "%d", ntohs(rport)); + error = getaddrinfo(*ahost, num, &hints, &res); + if (error) { + if (error == EAI_NONAME && *ahost != NULL) { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s: Unknown host\n", + *ahost); + else + fprintf(stderr, "%s: Unknown host\n", *ahost); + } else { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"rcmd: getaddrinfo: %s\n", + gai_strerror(error)); + else + fprintf(stderr, "rcmd: getaddrinfo: %s\n", + gai_strerror(error)); + } + return (-1); + } + + pfd[0].events = POLLIN; + pfd[1].events = POLLIN; + + if (res->ai_canonname){ + free (ahostbuf); + ahostbuf = strdup (res->ai_canonname); + if (ahostbuf == NULL) { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s", + _("rcmd: Cannot allocate memory\n")); + else + fputs(_("rcmd: Cannot allocate memory\n"), + stderr); + return (-1); + } + *ahost = ahostbuf; + } else + *ahost = NULL; + ai = res; + refused = 0; + oldmask = __sigblock(sigmask(SIGURG)); + for (timo = 1, lport = IPPORT_RESERVED - 1;;) { + char errbuf[200]; + + s = rresvport_af(&lport, ai->ai_family); + if (s < 0) { + if (errno == EAGAIN) { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s", + _("rcmd: socket: All ports in use\n")); + else + fputs(_("rcmd: socket: All ports in use\n"), + stderr); + } else { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, + L"rcmd: socket: %m\n"); + else + fprintf(stderr, "rcmd: socket: %m\n"); + } + __sigsetmask(oldmask); + freeaddrinfo(res); + return -1; + } + __fcntl(s, F_SETOWN, pid); + if (__connect(s, ai->ai_addr, ai->ai_addrlen) >= 0) + break; + (void)__close(s); + if (errno == EADDRINUSE) { + lport--; + continue; + } + if (errno == ECONNREFUSED) + refused = 1; + if (ai->ai_next != NULL) { + int oerrno = errno; + char *buf = NULL; + + getnameinfo(ai->ai_addr, ai->ai_addrlen, + paddr, sizeof(paddr), + NULL, 0, + NI_NUMERICHOST); + + if (__asprintf (&buf, _("connect to address %s: "), + paddr) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s", buf); + else + fputs (buf, stderr); + free (buf); + } + __set_errno (oerrno); + perror(0); + ai = ai->ai_next; + getnameinfo(ai->ai_addr, ai->ai_addrlen, + paddr, sizeof(paddr), + NULL, 0, + NI_NUMERICHOST); + if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); + free (buf); + } + continue; + } + if (refused && timo <= 16) { + (void)sleep(timo); + timo *= 2; + ai = res; + refused = 0; + continue; + } + freeaddrinfo(res); + if (_IO_fwide (stderr, 0) > 0) + (void)__fwprintf(stderr, L"%s: %s\n", *ahost, + strerror_r(errno, + errbuf, sizeof (errbuf))); + else + (void)fprintf(stderr, "%s: %s\n", *ahost, + strerror_r(errno, + errbuf, sizeof (errbuf))); + __sigsetmask(oldmask); + return -1; + } + lport--; + if (fd2p == 0) { + __write(s, "", 1); + lport = 0; + } else { + char num[8]; + int s2 = rresvport_af(&lport, ai->ai_family), s3; + socklen_t len = ai->ai_addrlen; + + if (s2 < 0) + goto bad; + listen(s2, 1); + (void)snprintf(num, sizeof(num), "%d", lport); + if (__write(s, num, strlen(num)+1) != (ssize_t)strlen(num)+1) { + char *buf = NULL; + + if (__asprintf (&buf, _("\ +rcmd: write (setting up stderr): %m\n")) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s", buf); + else + fputs (buf, stderr); + free (buf); + } + (void)__close(s2); + goto bad; + } + pfd[0].fd = s; + pfd[1].fd = s2; + __set_errno (0); + if (__poll (pfd, 2, -1) < 1 || (pfd[1].revents & POLLIN) == 0){ + char *buf = NULL; + + if ((errno != 0 + && __asprintf(&buf, _("\ +rcmd: poll (setting up stderr): %m\n")) >= 0) + || (errno == 0 + && __asprintf(&buf, _("\ +poll: protocol failure in circuit setup\n")) >= 0)) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); + free (buf); + } + (void)__close(s2); + goto bad; + } + s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from, + &len)); + switch (from.ss_family) { + case AF_INET: + rport = ntohs(((struct sockaddr_in *)&from)->sin_port); + break; + case AF_INET6: + rport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port); + break; + default: + rport = 0; + break; + } + (void)__close(s2); + if (s3 < 0) { + if (_IO_fwide (stderr, 0) > 0) + (void)__fwprintf(stderr, + L"rcmd: accept: %m\n"); + else + (void)fprintf(stderr, + "rcmd: accept: %m\n"); + lport = 0; + goto bad; + } + *fd2p = s3; + + if (rport >= IPPORT_RESERVED || rport < IPPORT_RESERVED / 2){ + char *buf = NULL; + + if (__asprintf(&buf, _("\ +socket: protocol failure in circuit setup\n")) >= 0) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); + free (buf); + } + goto bad2; + } + } + struct iovec iov[3] = + { + [0] = { .iov_base = (void *) locuser, + .iov_len = strlen (locuser) + 1 }, + [1] = { .iov_base = (void *) remuser, + .iov_len = strlen (remuser) + 1 }, + [2] = { .iov_base = (void *) cmd, + .iov_len = strlen (cmd) + 1 } + }; + (void) TEMP_FAILURE_RETRY (writev (s, iov, 3)); + n = TEMP_FAILURE_RETRY (read(s, &c, 1)); + if (n != 1) { + char *buf = NULL; + + if ((n == 0 + && asprintf(&buf, _("rcmd: %s: short read"), + *ahost) >= 0) + || (n != 0 + && asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0)) + { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf (stderr, L"%s", buf); + else + fputs (buf, stderr); + free (buf); + } + goto bad2; + } + if (c != 0) { + while (__read(s, &c, 1) == 1) { + (void)__write(STDERR_FILENO, &c, 1); + if (c == '\n') + break; + } + goto bad2; + } + __sigsetmask(oldmask); + freeaddrinfo(res); + return s; +bad2: + if (lport) + (void)__close(*fd2p); +bad: + (void)__close(s); + __sigsetmask(oldmask); + freeaddrinfo(res); + return -1; +} +libc_hidden_def (rcmd_af) + +int +rcmd(ahost, rport, locuser, remuser, cmd, fd2p) + char **ahost; + u_short rport; + const char *locuser, *remuser, *cmd; + int *fd2p; +{ + return rcmd_af (ahost, rport, locuser, remuser, cmd, fd2p, AF_INET); +} + +int +rresvport_af(alport, family) + int *alport; + sa_family_t family; +{ + struct sockaddr_storage ss; + int s; + size_t len; + uint16_t *sport; + + switch(family){ + case AF_INET: + len = sizeof(struct sockaddr_in); + sport = &((struct sockaddr_in *)&ss)->sin_port; + break; + case AF_INET6: + len = sizeof(struct sockaddr_in6); + sport = &((struct sockaddr_in6 *)&ss)->sin6_port; + break; + default: + __set_errno (EAFNOSUPPORT); + return -1; + } + s = __socket(family, SOCK_STREAM, 0); + if (s < 0) + return -1; + + memset (&ss, '\0', sizeof(ss)); +#ifdef SALEN + ss.__ss_len = len; +#endif + ss.ss_family = family; + + /* Ignore invalid values. */ + if (*alport < IPPORT_RESERVED / 2) + *alport = IPPORT_RESERVED / 2; + else if (*alport >= IPPORT_RESERVED) + *alport = IPPORT_RESERVED - 1; + + int start = *alport; + do { + *sport = htons((uint16_t) *alport); + if (__bind(s, (struct sockaddr *)&ss, len) >= 0) + return s; + if (errno != EADDRINUSE) { + (void)__close(s); + return -1; + } + if ((*alport)-- == IPPORT_RESERVED/2) + *alport = IPPORT_RESERVED - 1; + } while (*alport != start); + (void)__close(s); + __set_errno (EAGAIN); + return -1; +} +libc_hidden_def (rresvport_af) + +int +rresvport(alport) + int *alport; +{ + return rresvport_af(alport, AF_INET); +} + +int __check_rhosts_file = 1; +char *__rcmd_errstr; + +int +ruserok_af(rhost, superuser, ruser, luser, af) + const char *rhost, *ruser, *luser; + int superuser; + sa_family_t af; +{ + struct addrinfo hints, *res, *res0; + int gai; + int ret; + + memset (&hints, '\0', sizeof(hints)); + hints.ai_family = af; + gai = getaddrinfo(rhost, NULL, &hints, &res0); + if (gai) + return -1; + ret = -1; + for (res=res0; res; res=res->ai_next) + if (ruserok2_sa(res->ai_addr, res->ai_addrlen, + superuser, ruser, luser, rhost) == 0){ + ret = 0; + break; + } + freeaddrinfo(res0); + return (ret); +} +libc_hidden_def (ruserok_af) + +int +ruserok(rhost, superuser, ruser, luser) + const char *rhost, *ruser, *luser; + int superuser; +{ + return ruserok_af(rhost, superuser, ruser, luser, AF_INET); +} + +/* Extremely paranoid file open function. */ +static FILE * +iruserfopen (const char *file, uid_t okuser) +{ + struct stat64 st; + char *cp = NULL; + FILE *res = NULL; + + /* If not a regular file, if owned by someone other than user or + root, if writeable by anyone but the owner, or if hardlinked + anywhere, quit. */ + cp = NULL; + if (__lxstat64 (_STAT_VER, file, &st)) + cp = _("lstat failed"); + else if (!S_ISREG (st.st_mode)) + cp = _("not regular file"); + else + { + res = fopen (file, "rc"); + if (!res) + cp = _("cannot open"); + else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0) + cp = _("fstat failed"); + else if (st.st_uid && st.st_uid != okuser) + cp = _("bad owner"); + else if (st.st_mode & (S_IWGRP|S_IWOTH)) + cp = _("writeable by other than owner"); + else if (st.st_nlink > 1) + cp = _("hard linked somewhere"); + } + + /* If there were any problems, quit. */ + if (cp != NULL) + { + __rcmd_errstr = cp; + if (res) + fclose (res); + return NULL; + } + + /* No threads use this stream. */ + __fsetlocking (res, FSETLOCKING_BYCALLER); + + return res; +} + +/* + * New .rhosts strategy: We are passed an ip address. We spin through + * hosts.equiv and .rhosts looking for a match. When the .rhosts only + * has ip addresses, we don't have to trust a nameserver. When it + * contains hostnames, we spin through the list of addresses the nameserver + * gives us and look for a match. + * + * Returns 0 if ok, -1 if not ok. + */ +static int +ruserok2_sa (ra, ralen, superuser, ruser, luser, rhost) + struct sockaddr *ra; + size_t ralen; + int superuser; + const char *ruser, *luser, *rhost; +{ + FILE *hostf = NULL; + int isbad = -1; + + if (!superuser) + hostf = iruserfopen (_PATH_HEQUIV, 0); + + if (hostf) + { + isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost); + fclose (hostf); + + if (!isbad) + return 0; + } + + if (__check_rhosts_file || superuser) + { + char *pbuf; + struct passwd pwdbuf, *pwd; + size_t dirlen; + size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX); + char *buffer = __alloca (buflen); + uid_t uid; + + if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0 + || pwd == NULL) + return -1; + + dirlen = strlen (pwd->pw_dir); + pbuf = alloca (dirlen + sizeof "/.rhosts"); + __mempcpy (__mempcpy (pbuf, pwd->pw_dir, dirlen), + "/.rhosts", sizeof "/.rhosts"); + + /* Change effective uid while reading .rhosts. If root and + reading an NFS mounted file system, can't read files that + are protected read/write owner only. */ + uid = __geteuid (); + seteuid (pwd->pw_uid); + hostf = iruserfopen (pbuf, pwd->pw_uid); + + if (hostf != NULL) + { + isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost); + fclose (hostf); + } + + seteuid (uid); + return isbad; + } + return -1; +} +/* + * ruserok_sa() is now discussed on ipng, so + * currently disabled for external use + */ +static int ruserok_sa(ra, ralen, superuser, ruser, luser) + struct sockaddr *ra; + size_t ralen; + int superuser; + const char *ruser, *luser; +{ + return ruserok2_sa(ra, ralen, superuser, ruser, luser, "-"); +} + +/* This is the exported version. */ +int +iruserok_af (raddr, superuser, ruser, luser, af) + const void *raddr; + int superuser; + const char *ruser, *luser; + sa_family_t af; +{ + struct sockaddr_storage ra; + size_t ralen; + + memset (&ra, '\0', sizeof(ra)); + switch (af){ + case AF_INET: + ((struct sockaddr_in *)&ra)->sin_family = AF_INET; + memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr, + sizeof(struct in_addr)); + ralen = sizeof(struct sockaddr_in); + break; + case AF_INET6: + ((struct sockaddr_in6 *)&ra)->sin6_family = AF_INET6; + memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr, + sizeof(struct in6_addr)); + ralen = sizeof(struct sockaddr_in6); + break; + default: + return 0; + } + return ruserok_sa ((struct sockaddr *)&ra, ralen, superuser, ruser, luser); +} +libc_hidden_def (iruserok_af) + +int +iruserok (raddr, superuser, ruser, luser) + u_int32_t raddr; + int superuser; + const char *ruser, *luser; +{ + return iruserok_af (&raddr, superuser, ruser, luser, AF_INET); +} + +/* + * XXX + * Don't make static, used by lpd(8). + * + * This function is not used anymore. It is only present because lpd(8) + * calls it (!?!). We simply call __invaliduser2() with an illegal rhost + * argument. This means that netgroups won't work in .rhost/hosts.equiv + * files. If you want lpd to work with netgroups, fix lpd to use ruserok() + * or PAM. + * Returns 0 if ok, -1 if not ok. + */ +int +__ivaliduser(hostf, raddr, luser, ruser) + FILE *hostf; + u_int32_t raddr; + const char *luser, *ruser; +{ + struct sockaddr_in ra; + memset(&ra, '\0', sizeof(ra)); + ra.sin_family = AF_INET; + ra.sin_addr.s_addr = raddr; + return __validuser2_sa(hostf, (struct sockaddr *)&ra, sizeof(ra), + luser, ruser, "-"); +} + + +/* Returns 1 on positive match, 0 on no match, -1 on negative match. */ +static int +internal_function +__checkhost_sa (struct sockaddr *ra, size_t ralen, char *lhost, + const char *rhost) +{ + struct addrinfo hints, *res0, *res; + char raddr[INET6_ADDRSTRLEN]; + int match; + int negate=1; /* Multiply return with this to get -1 instead of 1 */ + + /* Check nis netgroup. */ + if (strncmp ("+@", lhost, 2) == 0) + return innetgr (&lhost[2], rhost, NULL, NULL); + + if (strncmp ("-@", lhost, 2) == 0) + return -innetgr (&lhost[2], rhost, NULL, NULL); + + /* -host */ + if (strncmp ("-", lhost,1) == 0) { + negate = -1; + lhost++; + } else if (strcmp ("+",lhost) == 0) { + return 1; /* asking for trouble, but ok.. */ + } + + /* Try for raw ip address first. */ + /* XXX */ + if (getnameinfo(ra, ralen, + raddr, sizeof(raddr), NULL, 0, + NI_NUMERICHOST) == 0 + && strcmp(raddr, lhost) == 0) + return negate; + + /* Better be a hostname. */ + match = 0; + memset(&hints, '\0', sizeof(hints)); + hints.ai_family = ra->sa_family; + if (getaddrinfo(lhost, NULL, &hints, &res0) == 0){ + /* Spin through ip addresses. */ + for (res = res0; res; res = res->ai_next) + { + if (res->ai_family == ra->sa_family + && !memcmp(res->ai_addr, ra, res->ai_addrlen)) + { + match = 1; + break; + } + } + freeaddrinfo (res0); + } + return negate * match; +} + +/* Returns 1 on positive match, 0 on no match, -1 on negative match. */ +static int +internal_function +__icheckuser (const char *luser, const char *ruser) +{ + /* + luser is user entry from .rhosts/hosts.equiv file + ruser is user id on remote host + */ + + /* [-+]@netgroup */ + if (strncmp ("+@", luser, 2) == 0) + return innetgr (&luser[2], NULL, ruser, NULL); + + if (strncmp ("-@", luser,2) == 0) + return -innetgr (&luser[2], NULL, ruser, NULL); + + /* -user */ + if (strncmp ("-", luser, 1) == 0) + return -(strcmp (&luser[1], ruser) == 0); + + /* + */ + if (strcmp ("+", luser) == 0) + return 1; + + /* simple string match */ + return strcmp (ruser, luser) == 0; +} + +/* + * Returns 1 for blank lines (or only comment lines) and 0 otherwise + */ +static int +__isempty (char *p) +{ + while (*p && isspace (*p)) { + ++p; + } + + return (*p == '\0' || *p == '#') ? 1 : 0 ; +} + +/* + * Returns 0 if positive match, -1 if _not_ ok. + */ +static int +__validuser2_sa(hostf, ra, ralen, luser, ruser, rhost) + FILE *hostf; + struct sockaddr *ra; + size_t ralen; + const char *luser, *ruser, *rhost; +{ + register const char *user; + register char *p; + int hcheck, ucheck; + char *buf = NULL; + size_t bufsize = 0; + int retval = -1; + + while (__getline (&buf, &bufsize, hostf) > 0) { + buf[bufsize - 1] = '\0'; /* Make sure it's terminated. */ + p = buf; + + /* Skip empty or comment lines */ + if (__isempty (p)) { + continue; + } + + for (;*p && !isspace(*p); ++p) { + *p = _tolower (*p); + } + + /* Next we want to find the permitted name for the remote user. */ + if (*p == ' ' || *p == '\t') { + /* terminate hostname and skip spaces */ + for (*p++='\0'; *p && isspace (*p); ++p); + + user = p; /* this is the user's name */ + while (*p && !isspace (*p)) + ++p; /* find end of user's name */ + } else + user = p; + + *p = '\0'; /* terminate username (+host?) */ + + /* buf -> host(?) ; user -> username(?) */ + + /* First check host part */ + hcheck = __checkhost_sa (ra, ralen, buf, rhost); + + if (hcheck < 0) + break; + + if (hcheck) { + /* Then check user part */ + if (! (*user)) + user = luser; + + ucheck = __icheckuser (user, ruser); + + /* Positive 'host user' match? */ + if (ucheck > 0) { + retval = 0; + break; + } + + /* Negative 'host -user' match? */ + if (ucheck < 0) + break; + + /* Neither, go on looking for match */ + } + } + + if (buf != NULL) + free (buf); + + return retval; +}
rcmd.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: in6_addr.c =================================================================== --- in6_addr.c (nonexistent) +++ in6_addr.c (revision 520) @@ -0,0 +1,28 @@ +/* Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Philip Blundell , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include "libc-symbols.h" + +const struct in6_addr in6addr_any = +{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }; +libc_hidden_data_def (in6addr_any) +const struct in6_addr in6addr_loopback = +{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }; +libc_hidden_data_def (in6addr_loopback)
in6_addr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ruserpass.c =================================================================== --- ruserpass.c (nonexistent) +++ ruserpass.c (revision 520) @@ -0,0 +1,336 @@ +/* + * Copyright (c) 1985, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94"; +#endif /* not lint */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "local.h" + +/* #include "ftp_var.h" */ + +static int token (void); +static FILE *cfile; + +#define DEFAULT 1 +#define LOGIN 2 +#define PASSWD 3 +#define ACCOUNT 4 +#define MACDEF 5 +#define ID 10 +#define MACHINE 11 + +static char tokval[100]; + +static const char tokstr[] = +{ +#define TOK_DEFAULT_IDX 0 + "default\0" +#define TOK_LOGIN_IDX (TOK_DEFAULT_IDX + sizeof "default") + "login\0" +#define TOK_PASSWORD_IDX (TOK_LOGIN_IDX + sizeof "login") + "password\0" +#define TOK_PASSWD_IDX (TOK_PASSWORD_IDX + sizeof "password") + "passwd\0" +#define TOK_ACCOUNT_IDX (TOK_PASSWD_IDX + sizeof "passwd") + "account\0" +#define TOK_MACHINE_IDX (TOK_ACCOUNT_IDX + sizeof "account") + "machine\0" +#define TOK_MACDEF_IDX (TOK_MACHINE_IDX + sizeof "machine") + "macdef" +}; + +static const struct toktab { + int tokstr_off; + int tval; +} toktab[]= { + { TOK_DEFAULT_IDX, DEFAULT }, + { TOK_LOGIN_IDX, LOGIN }, + { TOK_PASSWORD_IDX, PASSWD }, + { TOK_PASSWD_IDX, PASSWD }, + { TOK_ACCOUNT_IDX, ACCOUNT }, + { TOK_MACHINE_IDX, MACHINE }, + { TOK_MACDEF_IDX, MACDEF } +}; + + +#define warnx(x) fprintf(stderr, x) +#define warnx2(x, y) fprintf(stderr, x, y) + +int +ruserpass(host, aname, apass) + const char *host, **aname, **apass; +{ + char *hdir, *buf, *tmp; + char myname[1024], *mydomain; + int t, usedefault = 0; + struct stat64 stb; + + hdir = getenv("HOME"); + if (hdir == NULL) { + /* If we can't get HOME, fail instead of trying ".", + which is no improvement. This really should call + getpwuid(getuid()). */ + /*hdir = ".";*/ + return -1; + } + + buf = alloca (strlen (hdir) + 8); + + stpcpy (stpcpy (buf, hdir), "/.netrc"); + cfile = fopen(buf, "rc"); + if (cfile == NULL) { + if (errno != ENOENT) { + char *t = asprintf("%s", buf); + perror(t); + } + return (0); + } + /* No threads use this stream. */ + __fsetlocking (cfile, FSETLOCKING_BYCALLER); + if (__gethostname(myname, sizeof(myname)) < 0) + myname[0] = '\0'; + tmp = strchr(myname, '.'); + if (tmp == NULL) + tmp = myname + strlen(myname); + mydomain = tmp; +next: + while ((t = token())) switch(t) { + + case DEFAULT: + usedefault = 1; + /* FALL THROUGH */ + + case MACHINE: + if (!usedefault) { + if (token() != ID) + continue; + /* + * Allow match either for user's input host name + * or official hostname. Also allow match of + * incompletely-specified host in local domain. + */ + if (strcasecmp(host, tokval) == 0) + goto match; +/* if (strcasecmp(hostname, tokval) == 0) + goto match; + if ((tmp = strchr(hostname, '.')) != NULL && + strcasecmp(tmp, mydomain) == 0 && + strncasecmp(hostname, tokval, tmp-hostname) == 0 && + tokval[tmp - hostname] == '\0') + goto match; */ + if ((tmp = strchr(host, '.')) != NULL && + strcasecmp(tmp, mydomain) == 0 && + strncasecmp(host, tokval, tmp - host) == 0 && + tokval[tmp - host] == '\0') + goto match; + continue; + } + match: + while ((t = token()) && t != MACHINE && t != DEFAULT) switch(t) { + + case LOGIN: + if (token()) { + if (*aname == 0) { + char *newp; + newp = malloc((unsigned) strlen(tokval) + 1); + if (newp == NULL) + { + warnx(_("out of memory")); + goto bad; + } + *aname = strcpy(newp, tokval); + } else { + if (strcmp(*aname, tokval)) + goto next; + } + } + break; + case PASSWD: + if (strcmp(*aname, "anonymous") && + fstat64(fileno(cfile), &stb) >= 0 && + (stb.st_mode & 077) != 0) { + warnx(_("Error: .netrc file is readable by others.")); + warnx(_("Remove password or make file unreadable by others.")); + goto bad; + } + if (token() && *apass == 0) { + char *newp; + newp = malloc((unsigned) strlen(tokval) + 1); + if (newp == NULL) + { + warnx(_("out of memory")); + goto bad; + } + *apass = strcpy(newp, tokval); + } + break; + case ACCOUNT: +#if 0 + if (fstat64(fileno(cfile), &stb) >= 0 + && (stb.st_mode & 077) != 0) { + warnx("Error: .netrc file is readable by others."); + warnx("Remove account or make file unreadable by others."); + goto bad; + } + if (token() && *aacct == 0) { + *aacct = malloc((unsigned) strlen(tokval) + 1); + (void) strcpy(*aacct, tokval); + } +#endif + break; + case MACDEF: +#if 0 + if (proxy) { + (void) fclose(cfile); + return (0); + } + while ((c=getc_unlocked(cfile)) != EOF && c == ' ' + || c == '\t'); + if (c == EOF || c == '\n') { + printf("Missing macdef name argument.\n"); + goto bad; + } + if (macnum == 16) { + printf("Limit of 16 macros have already been defined\n"); + goto bad; + } + tmp = macros[macnum].mac_name; + *tmp++ = c; + for (i=0; i < 8 && (c=getc_unlocked(cfile)) != EOF && + !isspace(c); ++i) { + *tmp++ = c; + } + if (c == EOF) { + printf("Macro definition missing null line terminator.\n"); + goto bad; + } + *tmp = '\0'; + if (c != '\n') { + while ((c=getc_unlocked(cfile)) != EOF + && c != '\n'); + } + if (c == EOF) { + printf("Macro definition missing null line terminator.\n"); + goto bad; + } + if (macnum == 0) { + macros[macnum].mac_start = macbuf; + } + else { + macros[macnum].mac_start = macros[macnum-1].mac_end + 1; + } + tmp = macros[macnum].mac_start; + while (tmp != macbuf + 4096) { + if ((c=getc_unlocked(cfile)) == EOF) { + printf("Macro definition missing null line terminator.\n"); + goto bad; + } + *tmp = c; + if (*tmp == '\n') { + if (*(tmp-1) == '\0') { + macros[macnum++].mac_end = tmp - 1; + break; + } + *tmp = '\0'; + } + tmp++; + } + if (tmp == macbuf + 4096) { + printf("4K macro buffer exceeded\n"); + goto bad; + } +#endif + break; + default: + warnx2(_("Unknown .netrc keyword %s"), tokval); + break; + } + goto done; + } +done: + (void) fclose(cfile); + return (0); +bad: + (void) fclose(cfile); + return (-1); +} +libc_hidden_def (ruserpass) + +static int +token() +{ + char *cp; + int c; + int i; + + if (feof(cfile) || ferror(cfile)) + return (0); + while ((c = getc_unlocked(cfile)) != EOF && + (c == '\n' || c == '\t' || c == ' ' || c == ',')) + continue; + if (c == EOF) + return (0); + cp = tokval; + if (c == '"') { + while ((c = getc_unlocked(cfile)) != EOF && c != '"') { + if (c == '\\') + c = getc_unlocked(cfile); + *cp++ = c; + } + } else { + *cp++ = c; + while ((c = getc_unlocked(cfile)) != EOF + && c != '\n' && c != '\t' && c != ' ' && c != ',') { + if (c == '\\') + c = getc_unlocked(cfile); + *cp++ = c; + } + } + *cp = 0; + if (tokval[0] == 0) + return (0); + for (i = 0; i < (int) (sizeof (toktab) / sizeof (toktab[0])); ++i) + if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval)) + return toktab[i].tval; + return (ID); +}
ruserpass.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: send.c =================================================================== --- send.c (nonexistent) +++ send.c (revision 520) @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)send.c 8.2 (Berkeley) 2/21/94"; +#endif /* LIBC_SCCS and not lint */ +#include +#include + +#include +#include + +#include +#include "un-namespace.h" + +ssize_t +send(s, msg, len, flags) + int s, flags; + size_t len; + const void *msg; +{ + return (sendto(s, msg, len, flags, NULL, 0)); +}
send.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns_print.c =================================================================== --- ns_print.c (nonexistent) +++ ns_print.c (revision 520) @@ -0,0 +1,827 @@ +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_print.c,v 8.18 2000/02/29 05:48:12 vixie Exp $"; +#endif + +/* Import. */ + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "libc-symbols.h" + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +/* Forward. */ + +static size_t prune_origin(const char *name, const char *origin); +static int charstr(const u_char *rdata, const u_char *edata, + char **buf, size_t *buflen); +static int addname(const u_char *msg, size_t msglen, + const u_char **p, const char *origin, + char **buf, size_t *buflen); +static void addlen(size_t len, char **buf, size_t *buflen); +static int addstr(const char *src, size_t len, + char **buf, size_t *buflen); +static int addtab(size_t len, size_t target, int spaced, + char **buf, size_t *buflen); + +/* Proto. */ + +#ifndef _LIBC +u_int16_t dst_s_dns_key_id(const u_char *, const int); +#endif + +/* Macros. */ + +#define T(x) \ + do { \ + if ((x) < 0) \ + return (-1); \ + } while (0) + +/* Public. */ + +/* + * int + * ns_sprintrr(handle, rr, name_ctx, origin, buf, buflen) + * Convert an RR to presentation format. + * return: + * Number of characters written to buf, or -1 (check errno). + */ +int +ns_sprintrr(const ns_msg *handle, const ns_rr *rr, + const char *name_ctx, const char *origin, + char *buf, size_t buflen) +{ + int n; + + n = ns_sprintrrf(ns_msg_base(*handle), ns_msg_size(*handle), + ns_rr_name(*rr), ns_rr_class(*rr), ns_rr_type(*rr), + ns_rr_ttl(*rr), ns_rr_rdata(*rr), ns_rr_rdlen(*rr), + name_ctx, origin, buf, buflen); + return (n); +} + +/* + * int + * ns_sprintrrf(msg, msglen, name, class, type, ttl, rdata, rdlen, + * name_ctx, origin, buf, buflen) + * Convert the fields of an RR into presentation format. + * return: + * Number of characters written to buf, or -1 (check errno). + */ +int +ns_sprintrrf(const u_char *msg, size_t msglen, + const char *name, ns_class class, ns_type type, + u_long ttl, const u_char *rdata, size_t rdlen, + const char *name_ctx, const char *origin, + char *buf, size_t buflen) +{ + const char *obuf = buf; + const u_char *edata = rdata + rdlen; + int spaced = 0; + + const char *comment; + char tmp[100]; + int len, x; + + /* + * Owner. + */ + if (name_ctx != NULL && ns_samename(name_ctx, name) == 1) { + T(addstr("\t\t\t", 3, &buf, &buflen)); + } else { + len = prune_origin(name, origin); + if (len == 0) { + T(addstr("@\t\t\t", 4, &buf, &buflen)); + } else { + T(addstr(name, len, &buf, &buflen)); + /* Origin not used or not root, and no trailing dot? */ + if (((origin == NULL || origin[0] == '\0') || + (origin[0] != '.' && origin[1] != '\0' && + name[len] == '\0')) && name[len - 1] != '.') { + T(addstr(".", 1, &buf, &buflen)); + len++; + } + T(spaced = addtab(len, 24, spaced, &buf, &buflen)); + } + } + + /* + * TTL, Class, Type. + */ + T(x = ns_format_ttl(ttl, buf, buflen)); + addlen(x, &buf, &buflen); + len = SPRINTF((tmp, " %s %s", p_class(class), p_type(type))); + T(addstr(tmp, len, &buf, &buflen)); + T(spaced = addtab(x + len, 16, spaced, &buf, &buflen)); + + /* + * RData. + */ + switch (type) { + case ns_t_a: + if (rdlen != NS_INADDRSZ) + goto formerr; + (void) inet_ntop(AF_INET, rdata, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + break; + + case ns_t_cname: + case ns_t_mb: + case ns_t_mg: + case ns_t_mr: + case ns_t_ns: + case ns_t_ptr: + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + break; + + case ns_t_hinfo: + case ns_t_isdn: + /* First word. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + + /* Second word, optional in ISDN records. */ + if (type == ns_t_isdn && rdata == edata) + break; + + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + break; + + case ns_t_soa: { + u_long t; + + /* Server name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Administrator name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" (\n", 3, &buf, &buflen)); + spaced = 0; + + if ((edata - rdata) != 5*NS_INT32SZ) + goto formerr; + + /* Serial number. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + len = SPRINTF((tmp, "%lu", t)); + T(addstr(tmp, len, &buf, &buflen)); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; serial\n", 9, &buf, &buflen)); + spaced = 0; + + /* Refresh interval. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; refresh\n", 10, &buf, &buflen)); + spaced = 0; + + /* Retry interval. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; retry\n", 8, &buf, &buflen)); + spaced = 0; + + /* Expiry. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; expiry\n", 9, &buf, &buflen)); + spaced = 0; + + /* Minimum TTL. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + T(addstr("\t\t\t\t\t", 5, &buf, &buflen)); + T(len = ns_format_ttl(t, buf, buflen)); + addlen(len, &buf, &buflen); + T(addstr(" )", 2, &buf, &buflen)); + T(spaced = addtab(len, 16, spaced, &buf, &buflen)); + T(addstr("; minimum\n", 10, &buf, &buflen)); + + break; + } + + case ns_t_mx: + case ns_t_afsdb: + case ns_t_rt: { + u_int t; + + if (rdlen < NS_INT16SZ) + goto formerr; + + /* Priority. */ + t = ns_get16(rdata); + rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u ", t)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Target. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + } + + case ns_t_px: { + u_int t; + + if (rdlen < NS_INT16SZ) + goto formerr; + + /* Priority. */ + t = ns_get16(rdata); + rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u ", t)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Name1. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Name2. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + } + + case ns_t_x25: + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + break; + + case ns_t_txt: + while (rdata < edata) { + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + if (rdata < edata) + T(addstr(" ", 1, &buf, &buflen)); + } + break; + + case ns_t_nsap: { + /* 2*255 for hex digits, 128 for '.' and '\0', 2 for + 0x if inet_nsap_ntoa starts using it. */ + char t[255*2 + 128 + 2]; + + (void) inet_nsap_ntoa(rdlen, rdata, t); + T(addstr(t, strlen(t), &buf, &buflen)); + break; + } + + case ns_t_aaaa: + if (rdlen != NS_IN6ADDRSZ) + goto formerr; + (void) inet_ntop(AF_INET6, rdata, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + break; + + case ns_t_loc: { + char t[255]; + + /* XXX protocol format checking? */ + (void) loc_ntoa(rdata, t); + T(addstr(t, strlen(t), &buf, &buflen)); + break; + } + + case ns_t_naptr: { + u_int order, preference; + char t[50]; + + if (rdlen < 2*NS_INT16SZ) + goto formerr; + + /* Order, Precedence. */ + order = ns_get16(rdata); rdata += NS_INT16SZ; + preference = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((t, "%u %u ", order, preference)); + T(addstr(t, len, &buf, &buflen)); + + /* Flags. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Service. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Regexp. */ + T(len = charstr(rdata, edata, &buf, &buflen)); + if (len < 0) + return (-1); + if (len == 0) + goto formerr; + rdata += len; + T(addstr(" ", 1, &buf, &buflen)); + + /* Server. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + break; + } + + case ns_t_srv: { + u_int priority, weight, port; + char t[50]; + + if (rdlen < NS_INT16SZ*3) + goto formerr; + + /* Priority, Weight, Port. */ + priority = ns_get16(rdata); rdata += NS_INT16SZ; + weight = ns_get16(rdata); rdata += NS_INT16SZ; + port = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((t, "%u %u %u ", priority, weight, port)); + T(addstr(t, len, &buf, &buflen)); + + /* Server. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + break; + } + + case ns_t_minfo: + case ns_t_rp: + /* Name1. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + + /* Name2. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + break; + + case ns_t_wks: { + int n, lcnt; + + if (rdlen < NS_INT32SZ + 1) + goto formerr; + + /* Address. */ + (void) inet_ntop(AF_INET, rdata, buf, buflen); + addlen(strlen(buf), &buf, &buflen); + rdata += NS_INADDRSZ; + + /* Protocol. */ + len = SPRINTF((tmp, " %u ( ", *rdata)); + T(addstr(tmp, len, &buf, &buflen)); + rdata += NS_INT8SZ; + + /* Bit map. */ + n = 0; + lcnt = 0; + while (rdata < edata) { + u_int c = *rdata++; + do { + if (c & 0200) { + if (lcnt == 0) { + T(addstr("\n\t\t\t\t", 5, + &buf, &buflen)); + lcnt = 10; + spaced = 0; + } + len = SPRINTF((tmp, "%d ", n)); + T(addstr(tmp, len, &buf, &buflen)); + lcnt--; + } + c <<= 1; + } while (++n & 07); + } + T(addstr(")", 1, &buf, &buflen)); + + break; + } + + case ns_t_key: { +#ifndef _LIBC + char base64_key[NS_MD5RSA_MAX_BASE64]; + u_int keyflags, protocol, algorithm, key_id; + const char *leader; + int n; + + if (rdlen < NS_INT16SZ + NS_INT8SZ + NS_INT8SZ) + goto formerr; + + /* Key flags, Protocol, Algorithm. */ + key_id = dst_s_dns_key_id(rdata, edata-rdata); + keyflags = ns_get16(rdata); rdata += NS_INT16SZ; + protocol = *rdata++; + algorithm = *rdata++; + len = SPRINTF((tmp, "0x%04x %u %u", + keyflags, protocol, algorithm)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Public key data. */ + len = b64_ntop(rdata, edata - rdata, + base64_key, sizeof base64_key); + if (len < 0) + goto formerr; + if (len > 15) { + T(addstr(" (", 2, &buf, &buflen)); + leader = "\n\t\t"; + spaced = 0; + } else + leader = " "; + for (n = 0; n < len; n += 48) { + T(addstr(leader, strlen(leader), &buf, &buflen)); + T(addstr(base64_key + n, MIN(len - n, 48), + &buf, &buflen)); + } + if (len > 15) + T(addstr(" )", 2, &buf, &buflen)); + n = SPRINTF((tmp, " ; key_tag= %u", key_id)); + T(addstr(tmp, n, &buf, &buflen)); +#endif /* !_LIBC */ + + break; + } + + case ns_t_sig: { +#ifndef _LIBC + char base64_key[NS_MD5RSA_MAX_BASE64]; + u_int type, algorithm, labels, footprint; + const char *leader; + u_long t; + int n; + + if (rdlen < 22) + goto formerr; + + /* Type covered, Algorithm, Label count, Original TTL. */ + type = ns_get16(rdata); rdata += NS_INT16SZ; + algorithm = *rdata++; + labels = *rdata++; + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s %d %d %lu ", + p_type(type), algorithm, labels, t)); + T(addstr(tmp, len, &buf, &buflen)); + if (labels > (u_int)dn_count_labels(name)) + goto formerr; + + /* Signature expiry. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s ", p_secstodate(t))); + T(addstr(tmp, len, &buf, &buflen)); + + /* Time signed. */ + t = ns_get32(rdata); rdata += NS_INT32SZ; + len = SPRINTF((tmp, "%s ", p_secstodate(t))); + T(addstr(tmp, len, &buf, &buflen)); + + /* Signature Footprint. */ + footprint = ns_get16(rdata); rdata += NS_INT16SZ; + len = SPRINTF((tmp, "%u ", footprint)); + T(addstr(tmp, len, &buf, &buflen)); + + /* Signer's name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + /* Signature. */ + len = b64_ntop(rdata, edata - rdata, + base64_key, sizeof base64_key); + if (len > 15) { + T(addstr(" (", 2, &buf, &buflen)); + leader = "\n\t\t"; + spaced = 0; + } else + leader = " "; + if (len < 0) + goto formerr; + for (n = 0; n < len; n += 48) { + T(addstr(leader, strlen(leader), &buf, &buflen)); + T(addstr(base64_key + n, MIN(len - n, 48), + &buf, &buflen)); + } + if (len > 15) + T(addstr(" )", 2, &buf, &buflen)); +#endif /* !_LIBC */ + break; + } + + case ns_t_nxt: { + int n, c; + + /* Next domain name. */ + T(addname(msg, msglen, &rdata, origin, &buf, &buflen)); + + /* Type bit map. */ + n = edata - rdata; + for (c = 0; c < n*8; c++) + if (NS_NXT_BIT_ISSET(c, rdata)) { + len = SPRINTF((tmp, " %s", p_type(c))); + T(addstr(tmp, len, &buf, &buflen)); + } + break; + } + + case ns_t_cert: { + u_int c_type, key_tag, alg; + int n, siz; + char base64_cert[8192], *leader, tmp[40]; + + c_type = ns_get16(rdata); rdata += NS_INT16SZ; + key_tag = ns_get16(rdata); rdata += NS_INT16SZ; + alg = (u_int) *rdata++; + + len = SPRINTF((tmp, "%d %d %d ", c_type, key_tag, alg)); + T(addstr(tmp, len, &buf, &buflen)); + siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */ + if (siz > sizeof(base64_cert) * 3/4) { + char *str = "record too long to print"; + T(addstr(str, strlen(str), &buf, &buflen)); + } + else { + len = b64_ntop(rdata, edata-rdata, base64_cert, siz); + + if (len < 0) + goto formerr; + else if (len > 15) { + T(addstr(" (", 2, &buf, &buflen)); + leader = "\n\t\t"; + spaced = 0; + } + else + leader = " "; + + for (n = 0; n < len; n += 48) { + T(addstr(leader, strlen(leader), + &buf, &buflen)); + T(addstr(base64_cert + n, MIN(len - n, 48), + &buf, &buflen)); + } + if (len > 15) + T(addstr(" )", 2, &buf, &buflen)); + } + break; + } + + case ns_t_tsig: { + /* BEW - need to complete this */ + int n; + + T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen)); + T(addstr(" ", 1, &buf, &buflen)); + rdata += 8; /* time */ + n = ns_get16(rdata); rdata += INT16SZ; + rdata += n; /* sig */ + n = ns_get16(rdata); rdata += INT16SZ; /* original id */ + sprintf(buf, "%d", ns_get16(rdata)); + rdata += INT16SZ; + addlen(strlen(buf), &buf, &buflen); + break; + } + + default: + comment = "unknown RR type"; + goto hexify; + } + return (buf - obuf); + formerr: + comment = "RR format error"; + hexify: { + int n, m; + char *p; + + len = SPRINTF((tmp, "\\#(\t\t; %s", comment)); + T(addstr(tmp, len, &buf, &buflen)); + while (rdata < edata) { + p = tmp; + p += SPRINTF((p, "\n\t")); + spaced = 0; + n = MIN(16, edata - rdata); + for (m = 0; m < n; m++) + p += SPRINTF((p, "%02x ", rdata[m])); + T(addstr(tmp, p - tmp, &buf, &buflen)); + if (n < 16) { + T(addstr(")", 1, &buf, &buflen)); + T(addtab(p - tmp + 1, 48, spaced, &buf, &buflen)); + } + p = tmp; + p += SPRINTF((p, "; ")); + for (m = 0; m < n; m++) + *p++ = (isascii(rdata[m]) && isprint(rdata[m])) + ? rdata[m] + : '.'; + T(addstr(tmp, p - tmp, &buf, &buflen)); + rdata += n; + } + return (buf - obuf); + } +} + +/* Private. */ + +/* + * size_t + * prune_origin(name, origin) + * Find out if the name is at or under the current origin. + * return: + * Number of characters in name before start of origin, + * or length of name if origin does not match. + * notes: + * This function should share code with samedomain(). + */ +static size_t +prune_origin(const char *name, const char *origin) { + const char *oname = name; + + while (*name != '\0') { + if (origin != NULL && ns_samename(name, origin) == 1) + return (name - oname - (name > oname)); + while (*name != '\0') { + if (*name == '\\') { + name++; + /* XXX need to handle \nnn form. */ + if (*name == '\0') + break; + } else if (*name == '.') { + name++; + break; + } + name++; + } + } + return (name - oname); +} + +/* + * int + * charstr(rdata, edata, buf, buflen) + * Format a into the presentation buffer. + * return: + * Number of rdata octets consumed + * 0 for protocol format error + * -1 for output buffer error + * side effects: + * buffer is advanced on success. + */ +static int +charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) { + const u_char *odata = rdata; + size_t save_buflen = *buflen; + char *save_buf = *buf; + + if (addstr("\"", 1, buf, buflen) < 0) + goto enospc; + if (rdata < edata) { + int n = *rdata; + + if (rdata + 1 + n <= edata) { + rdata++; + while (n-- > 0) { + if (strchr("\n\"\\", *rdata) != NULL) + if (addstr("\\", 1, buf, buflen) < 0) + goto enospc; + if (addstr((const char *)rdata, 1, + buf, buflen) < 0) + goto enospc; + rdata++; + } + } + } + if (addstr("\"", 1, buf, buflen) < 0) + goto enospc; + return (rdata - odata); + enospc: + __set_errno (ENOSPC); + *buf = save_buf; + *buflen = save_buflen; + return (-1); +} + +static int +addname(const u_char *msg, size_t msglen, + const u_char **pp, const char *origin, + char **buf, size_t *buflen) +{ + size_t newlen, save_buflen = *buflen; + char *save_buf = *buf; + int n; + + n = dn_expand(msg, msg + msglen, *pp, *buf, *buflen); + if (n < 0) + goto enospc; /* Guess. */ + newlen = prune_origin(*buf, origin); + if (newlen == 0) { + /* Use "@" instead of name. */ + if (newlen + 2 > *buflen) + goto enospc; /* No room for "@\0". */ + (*buf)[newlen++] = '@'; + (*buf)[newlen] = '\0'; + } else { + if (((origin == NULL || origin[0] == '\0') || + (origin[0] != '.' && origin[1] != '\0' && + (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') { + /* No trailing dot. */ + if (newlen + 2 > *buflen) + goto enospc; /* No room for ".\0". */ + (*buf)[newlen++] = '.'; + (*buf)[newlen] = '\0'; + } + } + *pp += n; + addlen(newlen, buf, buflen); + **buf = '\0'; + return (newlen); + enospc: + __set_errno (ENOSPC); + *buf = save_buf; + *buflen = save_buflen; + return (-1); +} + +static void +addlen(size_t len, char **buf, size_t *buflen) { + assert(len <= *buflen); + *buf += len; + *buflen -= len; +} + +static int +addstr(const char *src, size_t len, char **buf, size_t *buflen) { + if (len >= *buflen) { + __set_errno (ENOSPC); + return (-1); + } + memcpy(*buf, src, len); + addlen(len, buf, buflen); + **buf = '\0'; + return (0); +} + +static int +addtab(size_t len, size_t target, int spaced, char **buf, size_t *buflen) { + size_t save_buflen = *buflen; + char *save_buf = *buf; + int t; + + if (spaced || len >= target - 1) { + T(addstr(" ", 2, buf, buflen)); + spaced = 1; + } else { + for (t = (target - len - 1) / 8; t >= 0; t--) + if (addstr("\t", 1, buf, buflen) < 0) { + *buflen = save_buflen; + *buf = save_buf; + return (-1); + } + spaced = 0; + } + return (spaced); +}
ns_print.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: XXX-lookup.c =================================================================== --- XXX-lookup.c (nonexistent) +++ XXX-lookup.c (revision 520) @@ -0,0 +1,75 @@ +/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include "nsswitch.h" + +/*******************************************************************\ +|* Here we assume one symbol to be defined: *| +|* *| +|* DATABASE_NAME - name of the database the function accesses *| +|* (e.g., hosts, services, ...) *| +|* *| +|* One additional symbol may optionally be defined: *| +|* *| +|* ALTERNATE_NAME - name of another service which is examined in *| +|* case DATABASE_NAME is not found *| +|* *| +|* DEFAULT_CONFIG - string for default conf (e.g. "dns files") *| +|* *| +\*******************************************************************/ + +#define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup) +#define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post) +#define CONCAT3_2(Pre, Name, Post) Pre##Name##Post + +#define DATABASE_NAME_SYMBOL CONCAT3_1 (__nss_, DATABASE_NAME, _database) +#define DATABASE_NAME_STRING STRINGIFY1 (DATABASE_NAME) +#define STRINGIFY1(Name) STRINGIFY2 (Name) +#define STRINGIFY2(Name) #Name + +#ifdef ALTERNATE_NAME +#define ALTERNATE_NAME_STRING STRINGIFY1 (ALTERNATE_NAME) +#else +#define ALTERNATE_NAME_STRING NULL +#endif + +#ifndef DEFAULT_CONFIG +#define DEFAULT_CONFIG NULL +#endif + +service_user *DATABASE_NAME_SYMBOL attribute_hidden; + +extern int DB_LOOKUP_FCT (service_user **ni, const char *fct_name, + void **fctp) internal_function; +libc_hidden_proto (DB_LOOKUP_FCT) + +int +internal_function +DB_LOOKUP_FCT (service_user **ni, const char *fct_name, void **fctp) +{ + if (DATABASE_NAME_SYMBOL == NULL + && __nss_database_lookup (DATABASE_NAME_STRING, ALTERNATE_NAME_STRING, + DEFAULT_CONFIG, &DATABASE_NAME_SYMBOL) < 0) + return -1; + + *ni = DATABASE_NAME_SYMBOL; + + return __nss_lookup (ni, fct_name, fctp); +} +libc_hidden_def (DB_LOOKUP_FCT)
XXX-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstbyad.c =================================================================== --- gethstbyad.c (nonexistent) +++ gethstbyad.c (revision 520) @@ -0,0 +1,31 @@ +/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct hostent +#define FUNCTION_NAME gethostbyaddr +#define DATABASE_NAME hosts +#define ADD_PARAMS const void *addr, socklen_t len, int type +#define ADD_VARIABLES addr, len, type +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#include "getXXbyYY.c"
gethstbyad.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: local.h =================================================================== --- local.h (nonexistent) +++ local.h (revision 520) @@ -0,0 +1,24 @@ +#include +#include "libc-symbols.h" + +# define extend_alloca(buf, len, newlen) \ + (__typeof (buf)) ({ size_t __newlen = (newlen); \ + char *__newbuf = alloca (__newlen); \ + if (__newbuf > (char *)buf) \ + if ((char *)buf + len == __newbuf) { \ + len += __newlen; \ + __newbuf = buf; \ + } \ + else { \ + if (__newbuf + newlen == (char *)buf) \ + len += __newlen; \ + else \ + len = __newlen; \ + } \ + __newbuf; }) + +#define __fsetlocking(fp, x) fp + +extern const char *_res_opcodes[]; +libresolv_hidden_proto (_res_opcodes) +
local.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getaliasent.c =================================================================== --- getaliasent.c (nonexistent) +++ getaliasent.c (revision 520) @@ -0,0 +1,26 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct aliasent +#define GETFUNC_NAME getaliasent +#define BUFLEN 1024 + +#include "getXXent.c"
getaliasent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ascii2addr.c =================================================================== --- ascii2addr.c (nonexistent) +++ ascii2addr.c (revision 520) @@ -0,0 +1,70 @@ +/* + * Copyright 1996 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that both the above copyright notice and this + * permission notice appear in all copies, that both the above + * copyright notice and this permission notice appear in all + * 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. 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. + * + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $ANA: ascii2addr.c,v 1.2 1996/06/13 18:46:02 wollman Exp $ + */ + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +int +ascii2addr(af, ascii, result) + int af; + const char *ascii; + void *result; +{ + struct in_addr *ina; + char strbuf[4*sizeof("123")]; /* long enough for V4 only */ + + switch(af) { + case AF_INET: + ina = result; + strbuf[0] = '\0'; + strncat(strbuf, ascii, (sizeof strbuf)-1); + if (inet_aton(strbuf, ina)) + return sizeof(struct in_addr); + errno = EINVAL; + break; + + default: + errno = EPROTONOSUPPORT; + break; + } + + return -1; +}
ascii2addr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_net_pton.c =================================================================== --- inet_net_pton.c (nonexistent) +++ inet_net_pton.c (revision 520) @@ -0,0 +1,214 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char orig_rcsid[] = "From Id: inet_net_pton.c,v 1.8 1996/11/21 10:28:12 vixie Exp $"; +#endif +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +static int inet_net_pton_ipv4(const char *src, u_char *dst, size_t size); + +/* + * static int + * inet_net_pton(af, src, dst, size) + * convert network number from presentation to network format. + * accepts hex octets, hex strings, decimal octets, and /CIDR. + * "size" is in bytes and describes "dst". + * return: + * number of bits, either imputed classfully or specified with /CIDR, + * or -1 if some failure occurred (check errno). ENOENT means it was + * not a valid network specification. + * author: + * Paul Vixie (ISC), June 1996 + */ +int +inet_net_pton(af, src, dst, size) + int af; + const char *src; + void *dst; + size_t size; +{ + switch (af) { + case AF_INET: + return (inet_net_pton_ipv4(src, dst, size)); + default: + errno = EAFNOSUPPORT; + return (-1); + } +} + +/* + * static int + * inet_net_pton_ipv4(src, dst, size) + * convert IPv4 network number from presentation to network format. + * accepts hex octets, hex strings, decimal octets, and /CIDR. + * "size" is in bytes and describes "dst". + * return: + * number of bits, either imputed classfully or specified with /CIDR, + * or -1 if some failure occurred (check errno). ENOENT means it was + * not an IPv4 network specification. + * note: + * network byte order assumed. this means 192.5.5.240/28 has + * 0x11110000 in its fourth octet. + * author: + * Paul Vixie (ISC), June 1996 + */ +static int +inet_net_pton_ipv4(src, dst, size) + const char *src; + u_char *dst; + size_t size; +{ + static const char + xdigits[] = "0123456789abcdef", + digits[] = "0123456789"; + int n, ch, tmp, dirty, bits; + const u_char *odst = dst; + + ch = *src++; + if (ch == '0' && (src[0] == 'x' || src[0] == 'X') + && isascii(src[1]) && isxdigit(src[1])) { + /* Hexadecimal: Eat nybble string. */ + if (size <= 0) + goto emsgsize; + *dst = 0, dirty = 0; + src++; /* skip x or X. */ + while ((ch = *src++) != '\0' && + isascii(ch) && isxdigit(ch)) { + if (isupper(ch)) + ch = tolower(ch); + n = strchr(xdigits, ch) - xdigits; + assert(n >= 0 && n <= 15); + *dst |= n; + if (!dirty++) + *dst <<= 4; + else if (size-- > 0) + *++dst = 0, dirty = 0; + else + goto emsgsize; + } + if (dirty) + size--; + } else if (isascii(ch) && isdigit(ch)) { + /* Decimal: eat dotted digit string. */ + for (;;) { + tmp = 0; + do { + n = strchr(digits, ch) - digits; + assert(n >= 0 && n <= 9); + tmp *= 10; + tmp += n; + if (tmp > 255) + goto enoent; + } while ((ch = *src++) != '\0' && + isascii(ch) && isdigit(ch)); + if (size-- <= 0) + goto emsgsize; + *dst++ = (u_char) tmp; + if (ch == '\0' || ch == '/') + break; + if (ch != '.') + goto enoent; + ch = *src++; + if (!isascii(ch) || !isdigit(ch)) + goto enoent; + } + } else + goto enoent; + + bits = -1; + if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) { + /* CIDR width specifier. Nothing can follow it. */ + ch = *src++; /* Skip over the /. */ + bits = 0; + do { + n = strchr(digits, ch) - digits; + assert(n >= 0 && n <= 9); + bits *= 10; + bits += n; + } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); + if (ch != '\0') + goto enoent; + if (bits > 32) + goto emsgsize; + } + + /* Firey death and destruction unless we prefetched EOS. */ + if (ch != '\0') + goto enoent; + + /* If nothing was written to the destination, we found no address. */ + if (dst == odst) + goto enoent; + /* If no CIDR spec was given, infer width from net class. */ + if (bits == -1) { + if (*odst >= 240) /* Class E */ + bits = 32; + else if (*odst >= 224) /* Class D */ + bits = 4; + else if (*odst >= 192) /* Class C */ + bits = 24; + else if (*odst >= 128) /* Class B */ + bits = 16; + else /* Class A */ + bits = 8; + /* If imputed mask is narrower than specified octets, widen. */ + if (bits >= 8 && bits < ((dst - odst) * 8)) + bits = (dst - odst) * 8; + } + /* Extend network to cover the actual mask. */ + while (bits > ((dst - odst) * 8)) { + if (size-- <= 0) + goto emsgsize; + *dst++ = '\0'; + } + return (bits); + + enoent: + errno = ENOENT; + return (-1); + + emsgsize: + errno = EMSGSIZE; + return (-1); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_net_pton +__weak_reference(__inet_net_pton, inet_net_pton);
inet_net_pton.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getXXent.c =================================================================== --- getXXent.c (nonexistent) +++ getXXent.c (revision 520) @@ -0,0 +1,96 @@ +/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#define _IO_MTSAFE_IO +#include +#include + +#include "nsswitch.h" + +/*******************************************************************\ +|* Here we assume several symbols to be defined: *| +|* *| +|* LOOKUP_TYPE - the return type of the function *| +|* *| +|* GETFUNC_NAME - name of the non-reentrant getXXXent function *| +|* *| +|* BUFLEN - size of static buffer *| +|* *| +|* Optionally the following vars can be defined: *| +|* *| +|* NEED_H_ERRNO - an extra parameter will be passed to point to *| +|* the global `h_errno' variable. *| +|* *| +\*******************************************************************/ + +/* To make the real sources a bit prettier. */ +#define REENTRANT_GETNAME APPEND_R (GETFUNC_NAME) +#define APPEND_R(name) APPEND_R1 (name) +#define APPEND_R1(name) name##_r +#define INTERNAL(name) INTERNAL1 (name) +#define INTERNAL1(name) __##name + +/* Sometimes we need to store error codes in the `h_errno' variable. */ +#ifdef NEED_H_ERRNO +# define H_ERRNO_PARM , int *h_errnop +# define H_ERRNO_VAR &h_errno +#else +# define H_ERRNO_PARM +# define H_ERRNO_VAR NULL +#endif + +/* Prototype of the reentrant version. */ +extern int INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, + size_t buflen, LOOKUP_TYPE **result + H_ERRNO_PARM); + +/* We need to protect the dynamic buffer handling. */ +__libc_lock_define_initialized (static, lock); + +/* This points to the static buffer used. */ +libc_freeres_ptr (static char *buffer); + + +LOOKUP_TYPE * +GETFUNC_NAME (void) +{ + static size_t buffer_size; + static union + { + LOOKUP_TYPE l; + void *ptr; + } resbuf; + LOOKUP_TYPE *result; + int save; + + /* Get lock. */ + __libc_lock_lock (lock); + + result = (LOOKUP_TYPE *) + __nss_getent ((getent_r_function) INTERNAL (REENTRANT_GETNAME), + &resbuf.ptr, &buffer, BUFLEN, &buffer_size, + H_ERRNO_VAR); + + save = errno; + __libc_lock_unlock (lock); + __set_errno (save); + return result; +} + +static_link_warning (GETFUNC_NAME)
getXXent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rexec.c =================================================================== --- rexec.c (nonexistent) +++ rexec.c (revision 520) @@ -0,0 +1,202 @@ +/* + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)rexec.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +int rexecoptions; +libc_freeres_ptr (static char *ahostbuf); + +int +rexec_af(ahost, rport, name, pass, cmd, fd2p, af) + char **ahost; + int rport; + const char *name, *pass, *cmd; + int *fd2p; + sa_family_t af; +{ + struct sockaddr_storage sa2, from; + struct addrinfo hints, *res0; + const char *orig_name = name; + const char *orig_pass = pass; + u_short port = 0; + int s, timo = 1, s3; + char c; + int gai; + char servbuff[NI_MAXSERV]; + + snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport)); + servbuff[sizeof(servbuff) - 1] = '\0'; + + memset(&hints, '\0', sizeof(hints)); + hints.ai_family = af; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + gai = getaddrinfo(*ahost, servbuff, &hints, &res0); + if (gai){ + /* XXX: set errno? */ + return -1; + } + + if (res0->ai_canonname){ + free (ahostbuf); + ahostbuf = strdup (res0->ai_canonname); + if (ahostbuf == NULL) { + perror ("rexec: strdup"); + return (-1); + } + *ahost = ahostbuf; + } else + *ahost = NULL; + ruserpass(res0->ai_canonname, &name, &pass); +retry: + s = socket(res0->ai_family, res0->ai_socktype, 0); + if (s < 0) { + perror("rexec: socket"); + return (-1); + } + if (connect(s, res0->ai_addr, res0->ai_addrlen) < 0) { + if (errno == ECONNREFUSED && timo <= 16) { + (void) __close(s); + sleep(timo); + timo *= 2; + goto retry; + } + perror(res0->ai_canonname); + return (-1); + } + if (fd2p == 0) { + (void) write(s, "", 1); + port = 0; + } else { + char num[32]; + int s2, sa2len; + + s2 = socket(res0->ai_family, res0->ai_socktype, 0); + if (s2 < 0) { + (void) __close(s); + return (-1); + } + listen(s2, 1); + sa2len = sizeof (sa2); + if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) { + perror("getsockname"); + (void) __close(s2); + goto bad; +#ifdef SA_LEN + } else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) { + __set_errno(EINVAL); + (void) __close(s2); + goto bad; +#endif + } + port = 0; + if (!getnameinfo((struct sockaddr *)&sa2, sa2len, + NULL, 0, servbuff, sizeof(servbuff), + NI_NUMERICSERV)) + port = atoi(servbuff); + (void) sprintf(num, "%u", port); + (void) __write(s, num, strlen(num)+1); + { int len = sizeof (from); + s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from, + &len)); + __close(s2); + if (s3 < 0) { + perror("accept"); + port = 0; + goto bad; + } + } + *fd2p = s3; + } + + struct iovec iov[3] = + { + [0] = { .iov_base = (void *) name, .iov_len = strlen (name) + 1 }, + /* should public key encypt the password here */ + [1] = { .iov_base = (void *) pass, .iov_len = strlen (pass) + 1 }, + [2] = { .iov_base = (void *) cmd, .iov_len = strlen (cmd) + 1 } + }; + (void) TEMP_FAILURE_RETRY (writev (s, iov, 3)); + + /* We don't need the memory allocated for the name and the password + in ruserpass anymore. */ + if (name != orig_name) + free ((char *) name); + if (pass != orig_pass) + free ((char *) pass); + + if (__read(s, &c, 1) != 1) { + perror(*ahost); + goto bad; + } + if (c != 0) { + while (__read(s, &c, 1) == 1) { + (void) __write(2, &c, 1); + if (c == '\n') + break; + } + goto bad; + } + freeaddrinfo(res0); + return (s); +bad: + if (port) + (void) __close(*fd2p); + (void) __close(s); + freeaddrinfo(res0); + return (-1); +} +libc_hidden_def (rexec_af) + +int +rexec(ahost, rport, name, pass, cmd, fd2p) + char **ahost; + int rport; + const char *name, *pass, *cmd; + int *fd2p; +{ + return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET); +}
rexec.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnssent.c =================================================================== --- getnssent.c (nonexistent) +++ getnssent.c (revision 520) @@ -0,0 +1,58 @@ +/* Copyright (C) 2000, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include "nsswitch.h" + +void * +__nss_getent (getent_r_function func, void **resbuf, char **buffer, + size_t buflen, size_t *buffer_size, int *h_errnop) +{ + void *result; + + if (*buffer == NULL) + { + *buffer_size = buflen; + *buffer = malloc (*buffer_size); + } + + while (buffer != NULL + && func (resbuf, *buffer, *buffer_size, &result, h_errnop) == ERANGE + && (h_errnop == NULL || *h_errnop == NETDB_INTERNAL)) + { + char *new_buf; + *buffer_size *= 2; + new_buf = realloc (*buffer, *buffer_size); + if (new_buf == NULL) + { + /* We are out of memory. Free the current buffer so that the + process gets a chance for a normal termination. */ + int save = errno; + free (*buffer); + __set_errno (save); + } + *buffer = new_buf; + } + + if (*buffer == NULL) + result = NULL; + + return result; +}
getnssent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: issetugid-stub.c =================================================================== --- issetugid-stub.c (nonexistent) +++ issetugid-stub.c (revision 520) @@ -0,0 +1,5 @@ +int +issetugid(void) +{ + return 0; +}
issetugid-stub.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet6_option.c =================================================================== --- inet6_option.c (nonexistent) +++ inet6_option.c (revision 520) @@ -0,0 +1,346 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) + +static void +internal_function +add_pad (struct cmsghdr *cmsg, int len) +{ + unsigned char *p = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0); + + if (len == 1) + /* Special handling for 1, a one-byte solution. */ + *p++ = IP6OPT_PAD1; + else if (len != 0) + { + /* Multibyte padding. */ + *p++ = IP6OPT_PADN; + *p++ = len - 2; /* Discount the two header bytes. */ + /* The rest is filled with zero. */ + memset (p, '\0', len - 2); + p += len - 2; + } + + /* Account for the bytes. */ + cmsg->cmsg_len += len; +} + + +static int +get_opt_end (const uint8_t **result, const uint8_t *startp, + const uint8_t *endp) +{ + if (startp >= endp) + /* Out of bounds. */ + return -1; + + if (*startp == IP6OPT_PAD1) + { + /* Just this one byte. */ + *result = startp + 1; + return 0; + } + + /* Now we know there must be at least two bytes. */ + if (startp + 2 > endp + /* Now we can get the length byte. */ + || startp + startp[1] + 2 > endp) + return -1; + + *result = startp + startp[1] + 2; + + return 0; +} + + +/* RFC 2292, 6.3.1 + + This function returns the number of bytes required to hold an option + when it is stored as ancillary data, including the cmsghdr structure + at the beginning, and any padding at the end (to make its size a + multiple of 8 bytes). The argument is the size of the structure + defining the option, which must include any pad bytes at the + beginning (the value y in the alignment term "xn + y"), the type + byte, the length byte, and the option data. */ +int +inet6_option_space (nbytes) + int nbytes; +{ + /* Add room for the extension header. */ + nbytes += sizeof (struct ip6_ext); + + return CMSG_SPACE (roundup (nbytes, 8)); +} + + +/* RFC 2292, 6.3.2 + + This function is called once per ancillary data object that will + contain either Hop-by-Hop or Destination options. It returns 0 on + success or -1 on an error. */ +int +inet6_option_init (bp, cmsgp, type) + void *bp; + struct cmsghdr **cmsgp; + int type; +{ + /* Only Hop-by-Hop or Destination options allowed. */ + if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS) + return -1; + + /* BP is a pointer to the previously allocated space. */ + struct cmsghdr *newp = (struct cmsghdr *) bp; + + /* Initialize the message header. + + Length: No data yet, only the cmsghdr struct. */ + newp->cmsg_len = CMSG_LEN (0); + /* Originating protocol: obviously IPv6. */ + newp->cmsg_level = IPPROTO_IPV6; + /* Message type. */ + newp->cmsg_type = type; + + /* Pass up the result. */ + *cmsgp = newp; + + return 0; +} + + +/* RFC 2292, 6.3.3 + + This function appends a Hop-by-Hop option or a Destination option + into an ancillary data object that has been initialized by + inet6_option_init(). This function returns 0 if it succeeds or -1 on + an error. */ +int +inet6_option_append (cmsg, typep, multx, plusy) + struct cmsghdr *cmsg; + const uint8_t *typep; + int multx; + int plusy; +{ + /* typep is a pointer to the 8-bit option type. It is assumed that this + field is immediately followed by the 8-bit option data length field, + which is then followed immediately by the option data. + + The option types IP6OPT_PAD1 and IP6OPT_PADN also must be handled. */ + int len = typep[0] == IP6OPT_PAD1 ? 1 : typep[1] + 2; + + /* Get the pointer to the space in the message. */ + uint8_t *ptr = inet6_option_alloc (cmsg, len, multx, plusy); + if (ptr == NULL) + /* Some problem with the parameters. */ + return -1; + + /* Copy the content. */ + memcpy (ptr, typep, len); + + return 0; +} + + +/* RFC 2292, 6.3.4 + + This function appends a Hop-by-Hop option or a Destination option + into an ancillary data object that has been initialized by + inet6_option_init(). This function returns a pointer to the 8-bit + option type field that starts the option on success, or NULL on an + error. */ +uint8_t * +inet6_option_alloc (cmsg, datalen, multx, plusy) + struct cmsghdr *cmsg; + int datalen; + int multx; + int plusy; +{ + /* The RFC limits the value of the alignment values. */ + if ((multx != 1 && multx != 2 && multx != 4 && multx != 8) + || ! (plusy >= 0 && plusy <= 7)) + return NULL; + + /* Current data size. */ + int dsize = cmsg->cmsg_len - CMSG_LEN (0); + + /* The first two bytes of the option are for the extended header. */ + if (__builtin_expect (dsize == 0, 0)) + { + cmsg->cmsg_len += sizeof (struct ip6_ext); + dsize = sizeof (struct ip6_ext); + } + + /* First add padding. */ + add_pad (cmsg, ((multx - (dsize & (multx - 1))) & (multx - 1)) + plusy); + + /* Return the pointer to the start of the option space. */ + uint8_t *result = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0); + cmsg->cmsg_len += datalen; + + /* The extended option header length is measured in 8-byte groups. + To represent the current length we might have to add padding. */ + dsize = cmsg->cmsg_len - CMSG_LEN (0); + add_pad (cmsg, (8 - (dsize & (8 - 1))) & (8 - 1)); + + /* Record the new length of the option. */ + assert (((cmsg->cmsg_len - CMSG_LEN (0)) % 8) == 0); + int len8b = (cmsg->cmsg_len - CMSG_LEN (0)) / 8 - 1; + if (len8b >= 256) + /* Too long. */ + return NULL; + + ((struct ip6_ext *) CMSG_DATA (cmsg))->ip6e_len = len8b; + + return result; +} +libc_hidden_def (inet6_option_alloc) + + +/* RFC 2292, 6.3.5 + + This function processes the next Hop-by-Hop option or Destination + option in an ancillary data object. If another option remains to be + processed, the return value of the function is 0 and *tptrp points to + the 8-bit option type field (which is followed by the 8-bit option + data length, followed by the option data). If no more options remain + to be processed, the return value is -1 and *tptrp is NULL. If an + error occurs, the return value is -1 and *tptrp is not NULL. */ +int +inet6_option_next (cmsg, tptrp) + const struct cmsghdr *cmsg; + uint8_t **tptrp; +{ + /* Make sure it is an option of the right type. */ + if (cmsg->cmsg_level != IPPROTO_IPV6 + || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS)) + return -1; + + /* Pointer to the extension header. We only compute the address, we + don't access anything yet. */ + const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg); + + /* Make sure the message is long enough. */ + if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext)) + /* Now we can access the extension header. */ + || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8)) + /* Too small. */ + return -1; + + /* Determine the address of the byte past the message. */ + const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8; + + const uint8_t *result; + if (tptrp == NULL) + /* This is the first call, return the first option if there is one. */ + result = (const uint8_t *) (ip6e + 1); + else + { + /* Make sure *TPTRP points to a beginning of a new option in + the message. The upper limit is checked in get_opt_end. */ + if (*tptrp < (const uint8_t *) (ip6e + 1)) + return -1; + + /* Get the beginning of the next option. */ + if (get_opt_end (&result, *tptrp, endp) != 0) + return -1; + } + + /* We know where the next option starts. */ + *tptrp = (uint8_t *) result; + + /* Check the option is fully represented in the message. */ + return get_opt_end (&result, result, endp); +} + + +/* RFC 2292, 6.3.6 + + This function is similar to the previously described + inet6_option_next() function, except this function lets the caller + specify the option type to be searched for, instead of always + returning the next option in the ancillary data object. cmsg is a + pointer to cmsghdr structure of which cmsg_level equals IPPROTO_IPV6 + and cmsg_type equals either IPV6_HOPOPTS or IPV6_DSTOPTS. */ +int +inet6_option_find (cmsg, tptrp, type) + const struct cmsghdr *cmsg; + uint8_t **tptrp; + int type; +{ + /* Make sure it is an option of the right type. */ + if (cmsg->cmsg_level != IPPROTO_IPV6 + || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS)) + return -1; + + /* Pointer to the extension header. We only compute the address, we + don't access anything yet. */ + const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg); + + /* Make sure the message is long enough. */ + if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext)) + /* Now we can access the extension header. */ + || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8)) + /* Too small. */ + return -1; + + /* Determine the address of the byte past the message. */ + const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8; + + const uint8_t *next; + if (tptrp == NULL) + /* This is the first call, return the first option if there is one. */ + next = (const uint8_t *) (ip6e + 1); + else + { + /* Make sure *TPTRP points to a beginning of a new option in + the message. The upper limit is checked in get_opt_end. */ + if (*tptrp < (const uint8_t *) (ip6e + 1)) + return -1; + + /* Get the beginning of the next option. */ + if (get_opt_end (&next, *tptrp, endp) != 0) + return -1; + } + + /* Now search for the appropriate typed entry. */ + const uint8_t *result; + do + { + result = next; + + /* Get the end of this entry. */ + if (get_opt_end (&next, result, endp) != 0) + return -1; + } + while (*result != type); + + /* We know where the next option starts. */ + *tptrp = (uint8_t *) result; + + /* Success. */ + return 0; +}
inet6_option.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getsrvbynm_r.c =================================================================== --- getsrvbynm_r.c (nonexistent) +++ getsrvbynm_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct servent +#define FUNCTION_NAME getservbyname +#define DATABASE_NAME services +#define ADD_PARAMS const char *name, const char *proto +#define ADD_VARIABLES name, proto + +#include "getXXbyYY_r.c"
getsrvbynm_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: opensock.c =================================================================== --- opensock.c (nonexistent) +++ opensock.c (revision 520) @@ -0,0 +1,120 @@ +/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +/* Return a socket of any type. The socket can be used in subsequent + ioctl calls to talk to the kernel. */ +int internal_function +__opensock (void) +{ + static int last_family; /* Available socket family we will use. */ + static int last_type; + static const struct + { + int family; + const char procname[15]; + } afs[] = + { + /* The 2.2 kernels cannot handle ioctl(SIOCGIFCONF) on AF_UNIX sockets. + Give the kernel a chance to user inet sockets on old kernels. */ +#if __LINUX_KERNEL_VERSION < 132096 + { AF_INET, "" }, + { AF_UNIX, "net/unix" }, +#else + { AF_UNIX, "net/unix" }, + { AF_INET, "" }, +#endif + { AF_INET6, "net/if_inet6" }, + { AF_AX25, "net/ax25" }, + { AF_NETROM, "net/nr" }, + { AF_ROSE, "net/rose" }, + { AF_IPX, "net/ipx" }, + { AF_APPLETALK, "net/appletalk" }, + { AF_ECONET, "sys/net/econet" }, + { AF_ASH, "sys/net/ash" }, + { AF_X25, "net/x25" } + }; +#define nafs (sizeof (afs) / sizeof (afs[0])) + char fname[sizeof "/proc/" + 14]; + int result; + int has_proc; + size_t cnt; + + /* We already know which family to use from the last call. Use it + again. */ + if (last_family != 0) + { + assert (last_type != 0); + + result = socket (last_family, last_type, 0); + if (result != -1 || errno != EAFNOSUPPORT) + /* Maybe the socket type isn't supported anymore (module is + unloaded). In this case again try to find the type. */ + return result; + + /* Reset the values. They seem not valid anymore. */ + last_family = 0; + last_type = 0; + } + + /* Check whether the /proc filesystem is available. */ + has_proc = access ("/proc/net", R_OK) != -1; + strcpy (fname, "/proc/"); + + /* Iterate over the interface families and find one which is + available. */ + for (cnt = 0; cnt < nafs; ++cnt) + { + int type = SOCK_DGRAM; + + if (has_proc && afs[cnt].procname[0] != '\0') + { + strcpy (fname + 6, afs[cnt].procname); + if (access (fname, R_OK) == -1) + /* The /proc entry is not available. I.e., we cannot + create a socket of this type (without loading the + module). Don't look for it since this might trigger + loading the module. */ + continue; + } + + if (afs[cnt].family == AF_NETROM || afs[cnt].family == AF_X25) + type = SOCK_SEQPACKET; + + result = socket (afs[cnt].family, type, 0); + if (result != -1) + { + /* Found an available family. */ + last_type = type; + last_family = afs[cnt].family; + return result; + } + } + + /* None of the protocol families is available. It is unclear what kind + of error is returned. ENOENT seems like a reasonable choice. */ + __set_errno (ENOENT); + return -1; +}
opensock.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getprtname_r.c =================================================================== --- getprtname_r.c (nonexistent) +++ getprtname_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct protoent +#define FUNCTION_NAME getprotobyname +#define DATABASE_NAME protocols +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name + +#include "getXXbyYY_r.c"
getprtname_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nsap_addr.c =================================================================== --- nsap_addr.c (nonexistent) +++ nsap_addr.c (revision 520) @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char rcsid[] = "$BINDId: nsap_addr.c,v 8.10 1999/10/13 16:39:28 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "libc-symbols.h" + +static char +xtob(int c) { + return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); +} + +u_int +inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) { + u_char c, nib; + u_int len = 0; + + while ((c = *ascii++) != '\0' && len < (u_int)maxlen) { + if (c == '.' || c == '+' || c == '/') + continue; + if (!isascii(c)) + return (0); + c = toupper(c); + if (isxdigit(c)) { + nib = xtob(c); + c = *ascii++; + if (c != '\0') { + c = toupper(c); + if (isxdigit(c)) { + *binary++ = (nib << 4) | xtob(c); + len++; + } else + return (0); + } + else + return (0); + } + else + return (0); + } + return (len); +} + +char * +inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) { + int nib; + int i; + static char tmpbuf[255*2 + 128]; + char *start; + + if (ascii) + start = ascii; + else { + ascii = tmpbuf; + start = tmpbuf; + } + + if (binlen > 255) + binlen = 255; + + for (i = 0; i < binlen; i++) { + nib = *binary >> 4; + *ascii++ = nib + (nib < 10 ? '0' : '7'); + nib = *binary++ & 0x0f; + *ascii++ = nib + (nib < 10 ? '0' : '7'); + if (((i % 2) == 0 && (i + 1) < binlen)) + *ascii++ = '.'; + } + *ascii = '\0'; + return (start); +}
nsap_addr.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnameinfo.c =================================================================== --- getnameinfo.c (nonexistent) +++ getnameinfo.c (revision 520) @@ -0,0 +1,456 @@ +/* The Inner Net License, Version 2.00 + + The author(s) grant permission for redistribution and use in source and +binary forms, with or without modification, of the software and documentation +provided that the following conditions are met: + +0. If you receive a version of the software that is specifically labelled + as not being for redistribution (check the version message and/or README), + you are not permitted to redistribute that version of the software in any + way or form. +1. All terms of the all other applicable copyrights and licenses must be + followed. +2. Redistributions of source code must retain the authors' copyright + notice(s), this list of conditions, and the following disclaimer. +3. Redistributions in binary form must reproduce the authors' copyright + notice(s), this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. +4. [The copyright holder has authorized the removal of this clause.] +5. Neither the name(s) of the author(s) nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + If these license terms cause you a real problem, contact the author. */ + +/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define _IO_MTSAFE_IO +#include +#include +#include "local.h" + +#ifdef HAVE_LIBIDN +# include +extern int __idna_to_unicode_lzlz (const char *input, char **output, + int flags); +#endif + +#ifndef min +# define min(x,y) (((x) > (y)) ? (y) : (x)) +#endif /* min */ + +libc_freeres_ptr (static char *domain); + + +static char * +internal_function +nrl_domainname (void) +{ + static int not_first; + + if (! not_first) + { + __libc_lock_define_initialized (static, lock); + __libc_lock_lock (lock); + + if (! not_first) + { + char *c; + struct hostent *h, th; + size_t tmpbuflen = 1024; + char *tmpbuf = alloca (tmpbuflen); + int herror; + + not_first = 1; + + while (__gethostbyname_r ("localhost", &th, tmpbuf, tmpbuflen, &h, + &herror)) + { + if (herror == NETDB_INTERNAL && errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + else + break; + } + + if (h && (c = strchr (h->h_name, '.'))) + domain = strdup (++c); + else + { + /* The name contains no domain information. Use the name + now to get more information. */ + while (__gethostname (tmpbuf, tmpbuflen)) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + + if ((c = strchr (tmpbuf, '.'))) + domain = strdup (++c); + else + { + /* We need to preserve the hostname. */ + const char *hstname = alloca (strlen (tmpbuf) + 1); + strcpy (hstname, tmpbuf); + + while (__gethostbyname_r (hstname, &th, tmpbuf, tmpbuflen, + &h, &herror)) + { + if (herror == NETDB_INTERNAL && errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, + 2 * tmpbuflen); + else + break; + } + + if (h && (c = strchr(h->h_name, '.'))) + domain = strdup (++c); + else + { + struct in_addr in_addr; + + in_addr.s_addr = htonl (INADDR_LOOPBACK); + + while (__gethostbyaddr_r ((const char *) &in_addr, + sizeof (struct in_addr), + AF_INET, &th, tmpbuf, + tmpbuflen, &h, &herror)) + { + if (herror == NETDB_INTERNAL && errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, + 2 * tmpbuflen); + else + break; + } + + if (h && (c = strchr (h->h_name, '.'))) + domain = strdup (++c); + } + } + } + } + + __libc_lock_unlock (lock); + } + + return domain; +}; + + +int +getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, + socklen_t hostlen, char *serv, socklen_t servlen, + unsigned int flags) +{ + int serrno = errno; + int tmpbuflen = 1024; + int herrno; + char *tmpbuf = alloca (tmpbuflen); + struct hostent th; + int ok = 0; + + if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM +#ifdef HAVE_LIBIDN + |NI_IDN|NI_IDN_ALLOW_UNASSIGNED|NI_IDN_USE_STD3_ASCII_RULES +#endif + )) + return EAI_BADFLAGS; + + if (sa == NULL || addrlen < sizeof (sa_family_t)) + return EAI_FAMILY; + + switch (sa->sa_family) + { + case AF_LOCAL: + if (addrlen < (socklen_t) (((struct sockaddr_un *) NULL)->sun_path)) + return EAI_FAMILY; + break; + case AF_INET: + if (addrlen < sizeof (struct sockaddr_in)) + return EAI_FAMILY; + break; + case AF_INET6: + if (addrlen < sizeof (struct sockaddr_in6)) + return EAI_FAMILY; + break; + default: + return EAI_FAMILY; + } + + if (host != NULL && hostlen > 0) + switch (sa->sa_family) + { + case AF_INET: + case AF_INET6: + if (!(flags & NI_NUMERICHOST)) + { + struct hostent *h = NULL; + if (h == NULL) + { + if (sa->sa_family == AF_INET6) + { + while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr), + sizeof(struct in6_addr), + AF_INET6, &th, tmpbuf, tmpbuflen, + &h, &herrno)) + { + if (herrno == NETDB_INTERNAL) + { + if (errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, + 2 * tmpbuflen); + else + { + h_errno = (herrno); + errno = (serrno); + return EAI_SYSTEM; + } + } + else + { + break; + } + } + } + else + { + while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr), + sizeof(struct in_addr), AF_INET, + &th, tmpbuf, tmpbuflen, + &h, &herrno)) + { + if (errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, + 2 * tmpbuflen); + else + { + break; + } + } + } + } + + if (h) + { + char *c; + if ((flags & NI_NOFQDN) + && (c = nrl_domainname ()) + && (c = strstr (h->h_name, c)) + && (c != h->h_name) && (*(--c) == '.')) + /* Terminate the string after the prefix. */ + *c = '\0'; + +#ifdef HAVE_LIBIDN + /* If requested, convert from the IDN format. */ + if (flags & NI_IDN) + { + int idn_flags = 0; + if (flags & NI_IDN_ALLOW_UNASSIGNED) + idn_flags |= IDNA_ALLOW_UNASSIGNED; + if (flags & NI_IDN_USE_STD3_ASCII_RULES) + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + + char *out; + int rc = __idna_to_unicode_lzlz (h->h_name, &out, + idn_flags); + if (rc != IDNA_SUCCESS) + { + if (rc == IDNA_MALLOC_ERROR) + return EAI_MEMORY; + if (rc == IDNA_DLOPEN_ERROR) + return EAI_SYSTEM; + return EAI_IDN_ENCODE; + } + + if (out != h->h_name) + { + h->h_name = strdupa (out); + free (out); + } + } +#endif + + size_t len = strlen (h->h_name) + 1; + if (len > hostlen) + return EAI_OVERFLOW; + + memcpy (host, h->h_name, len); + + ok = 1; + } + } + + if (!ok) + { + if (flags & NI_NAMEREQD) + { + __set_errno (serrno); + return EAI_NONAME; + } + else + { + const char *c; + if (sa->sa_family == AF_INET6) + { + const struct sockaddr_in6 *sin6p; + uint32_t scopeid; + + sin6p = (const struct sockaddr_in6 *) sa; + + c = inet_ntop (AF_INET6, + (const void *) &sin6p->sin6_addr, host, hostlen); + scopeid = sin6p->sin6_scope_id; + if (scopeid != 0) + { + /* Buffer is >= IFNAMSIZ+1. */ + char scopebuf[IFNAMSIZ + 1]; + char *scopeptr; + int ni_numericscope = 0; + size_t real_hostlen = strnlen (host, hostlen); + size_t scopelen = 0; + + scopebuf[0] = SCOPE_DELIMITER; + scopebuf[1] = '\0'; + scopeptr = &scopebuf[1]; + + if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr) + || IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr)) + { + if (if_indextoname (scopeid, scopeptr) == NULL) + ++ni_numericscope; + else + scopelen = strlen (scopebuf); + } + else + ++ni_numericscope; + + if (ni_numericscope) + scopelen = 1 + snprintf (scopeptr, + (scopebuf + + sizeof scopebuf + - scopeptr), + "%u", scopeid); + + if (real_hostlen + scopelen + 1 > hostlen) + /* XXX We should not fail here. Simply enlarge + the buffer or return with out of memory. */ + return EAI_SYSTEM; + memcpy (host + real_hostlen, scopebuf, scopelen + 1); + } + } + else + c = inet_ntop (AF_INET, + (const void *) &(((const struct sockaddr_in *) sa)->sin_addr), + host, hostlen); + if (c == NULL) + { + __set_errno (serrno); + return EAI_SYSTEM; + } + } + ok = 1; + } + break; + + case AF_LOCAL: + if (!(flags & NI_NUMERICHOST)) + { + struct utsname utsname; + + if (!uname (&utsname)) + { + strncpy (host, utsname.nodename, hostlen); + break; + }; + }; + + if (flags & NI_NAMEREQD) + { + __set_errno (serrno); + return EAI_NONAME; + } + + strncpy (host, "localhost", hostlen); + break; + + default: + return EAI_FAMILY; + } + + if (serv && (servlen > 0)) + switch (sa->sa_family) + { + case AF_INET: + case AF_INET6: + if (!(flags & NI_NUMERICSERV)) + { + struct servent *s, ts; + while (__getservbyport_r (((const struct sockaddr_in *) sa)->sin_port, + ((flags & NI_DGRAM) ? "udp" : "tcp"), + &ts, tmpbuf, tmpbuflen, &s)) + { + if (herrno == NETDB_INTERNAL) + { + if (errno == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, + 2 * tmpbuflen); + else + { + __set_errno (serrno); + return EAI_SYSTEM; + } + } + else + { + break; + } + } + if (s) + { + strncpy (serv, s->s_name, servlen); + break; + } + } + + if (snprintf (serv, servlen, "%d", + ntohs (((const struct sockaddr_in *) sa)->sin_port)) + + 1 > servlen) + return EAI_OVERFLOW; + + break; + + case AF_LOCAL: + strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen); + break; + } + + if (host && (hostlen > 0)) + host[hostlen-1] = 0; + if (serv && (servlen > 0)) + serv[servlen-1] = 0; + errno = serrno; + return 0; +} +libc_hidden_def (getnameinfo)
getnameinfo.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetent.c =================================================================== --- getnetent.c (nonexistent) +++ getnetent.c (revision 520) @@ -0,0 +1,27 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct netent +#define GETFUNC_NAME getnetent +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#include "getXXent.c"
getnetent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetbynm_r.c =================================================================== --- getnetbynm_r.c (nonexistent) +++ getnetbynm_r.c (revision 520) @@ -0,0 +1,31 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct netent +#define FUNCTION_NAME getnetbyname +#define DATABASE_NAME networks +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define NEED__RES 1 +#define NEED_H_ERRNO 1 + +#include "getXXbyYY_r.c"
getnetbynm_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getXXbyYY_r.c =================================================================== --- getXXbyYY_r.c (nonexistent) +++ getXXbyYY_r.c (revision 520) @@ -0,0 +1,292 @@ +/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include "nsswitch.h" +#ifdef USE_NSCD +# include +#endif +#ifdef NEED__RES_HCONF +# include "res_hconf.h" +#endif +#ifdef NEED__RES +# include +#endif +/*******************************************************************\ +|* Here we assume several symbols to be defined: *| +|* *| +|* LOOKUP_TYPE - the return type of the function *| +|* *| +|* FUNCTION_NAME - name of the non-reentrant function *| +|* *| +|* DATABASE_NAME - name of the database the function accesses *| +|* (e.g., host, services, ...) *| +|* *| +|* ADD_PARAMS - additional parameter, can vary in number *| +|* *| +|* ADD_VARIABLES - names of additional parameter *| +|* *| +|* Optionally the following vars can be defined: *| +|* *| +|* NEED_H_ERRNO - an extra parameter will be passed to point to *| +|* the global `h_errno' variable. *| +|* *| +|* NEED__RES - the global _res variable might be used so we *| +|* will have to initialize it if necessary *| +|* *| +|* PREPROCESS - code run before anything else *| +|* *| +|* POSTPROCESS - code run after the lookup *| +|* *| +\*******************************************************************/ + +/* To make the real sources a bit prettier. */ +#define REENTRANT_NAME APPEND_R (FUNCTION_NAME) +#define APPEND_R(name) APPEND_R1 (name) +#define APPEND_R1(name) name##_r +#define INTERNAL(name) INTERNAL1 (name) +#define INTERNAL1(name) __##name +#define NEW(name) NEW1 (name) +#define NEW1(name) __new_##name + +#ifdef USE_NSCD +# define NSCD_NAME ADD_NSCD (REENTRANT_NAME) +# define ADD_NSCD(name) ADD_NSCD1 (name) +# define ADD_NSCD1(name) __nscd_##name +# define NOT_USENSCD_NAME ADD_NOT_NSCDUSE (DATABASE_NAME) +# define ADD_NOT_NSCDUSE(name) ADD_NOT_NSCDUSE1 (name) +# define ADD_NOT_NSCDUSE1(name) __nss_not_use_nscd_##name +#endif + +#define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME) +#define REENTRANT_NAME_STRING STRINGIZE (REENTRANT_NAME) +#define DATABASE_NAME_STRING STRINGIZE (DATABASE_NAME) +#define STRINGIZE(name) STRINGIZE1 (name) +#define STRINGIZE1(name) #name + +#ifndef DB_LOOKUP_FCT +# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup) +# define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post) +# define CONCAT3_2(Pre, Name, Post) Pre##Name##Post +#endif + +/* Sometimes we need to store error codes in the `h_errno' variable. */ +#ifdef NEED_H_ERRNO +# define H_ERRNO_PARM , int *h_errnop +# define H_ERRNO_VAR , h_errnop +# define H_ERRNO_VAR_P h_errnop +#else +# define H_ERRNO_PARM +# define H_ERRNO_VAR +# define H_ERRNO_VAR_P NULL +#endif + +#ifdef HAVE_AF +# define AF_VAL af +#else +# define AF_VAL AF_INET +#endif + +/* Type of the lookup function we need here. */ +typedef enum nss_status (*lookup_function) (ADD_PARAMS, LOOKUP_TYPE *, char *, + size_t, int * H_ERRNO_PARM); + +/* The lookup function for the first entry of this service. */ +extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp) + internal_function; +libc_hidden_proto (DB_LOOKUP_FCT) + + +int +INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, + size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM) +{ + static service_user *startp; + static lookup_function start_fct; + service_user *nip; + union + { + lookup_function l; + void *ptr; + } fct; + + int no_more; + enum nss_status status = NSS_STATUS_UNAVAIL; +#ifdef USE_NSCD + int nscd_status; +#endif +#ifdef NEED_H_ERRNO + bool any_service = false; +#endif + +#ifdef PREPROCESS + PREPROCESS; +#endif + +#ifdef HANDLE_DIGITS_DOTS + switch (__nss_hostname_digits_dots (name, resbuf, &buffer, NULL, + buflen, result, &status, AF_VAL, + H_ERRNO_VAR_P)) + { + case -1: + return errno; + case 1: + goto done; + } +#endif + +#ifdef USE_NSCD + if (NOT_USENSCD_NAME > 0 && ++NOT_USENSCD_NAME > NSS_NSCD_RETRY) + NOT_USENSCD_NAME = 0; + + if (!NOT_USENSCD_NAME) + { + nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result + H_ERRNO_VAR); + if (nscd_status >= 0) + return nscd_status; + } +#endif + + if (startp == NULL) + { + no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING, &fct.ptr); + if (no_more) + startp = (service_user *) -1l; + else + { + startp = nip; + start_fct = fct.l; + +#ifdef NEED__RES + /* The resolver code will really be used so we have to + initialize it. */ + if (__res_maybe_init (&_res, 0) == -1) + { + *h_errnop = NETDB_INTERNAL; + *result = NULL; + return errno; + } +#endif /* need _res */ +#ifdef NEED__RES_HCONF + if (!_res_hconf.initialized) + _res_hconf_init (); +#endif /* need _res_hconf */ + } + } + else + { + fct.l = start_fct; + no_more = (nip = startp) == (service_user *) -1l; + } + + while (no_more == 0) + { +#ifdef NEED_H_ERRNO + any_service = true; +#endif + + status = DL_CALL_FCT (fct.l, (ADD_VARIABLES, resbuf, buffer, buflen, + &errno H_ERRNO_VAR)); + + /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the + provided buffer is too small. In this case we should give + the user the possibility to enlarge the buffer and we should + not simply go on with the next service (even if the TRYAGAIN + action tells us so). */ + if (status == NSS_STATUS_TRYAGAIN +#ifdef NEED_H_ERRNO + && *h_errnop == NETDB_INTERNAL +#endif + && errno == ERANGE) + break; + + no_more = __nss_next (&nip, REENTRANT_NAME_STRING, + &fct.ptr, status, 0); + } + +#ifdef HANDLE_DIGITS_DOTS +done: +#endif + *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL; +#ifdef NEED_H_ERRNO + if (status != NSS_STATUS_SUCCESS && ! any_service) + /* We were not able to use any service. */ + *h_errnop = NO_RECOVERY; +#endif +#ifdef POSTPROCESS + POSTPROCESS; +#endif + + int res; + if (status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND) + res = 0; + /* Don't pass back ERANGE if this is not for a too-small buffer. */ + else if (errno == ERANGE && status != NSS_STATUS_TRYAGAIN) + res = EINVAL; +#ifdef NEED_H_ERRNO + /* These functions only set errno if h_errno is NETDB_INTERNAL. */ + else if (status == NSS_STATUS_TRYAGAIN && *h_errnop != NETDB_INTERNAL) + res = EAGAIN; +#endif + else + return errno; + + __set_errno (res); + return res; +} + + +#include +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2) +#define OLD(name) OLD1 (name) +#define OLD1(name) __old_##name + +int +attribute_compat_text_section +OLD (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer, + size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM) +{ + int ret = INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, resbuf, buffer, + buflen, result H_ERRNO_VAR); + + if (ret != 0 || result == NULL) + ret = -1; + + return ret; +} + +#define do_symbol_version(real, name, version) \ + compat_symbol (libc, real, name, version) +do_symbol_version (OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2_0); +#endif + +/* As INTERNAL (REENTRANT_NAME) may be hidden, we need an alias + in between so that the REENTRANT_NAME@@GLIBC_2.1.2 is not + hidden too. */ +strong_alias (INTERNAL (REENTRANT_NAME), NEW (REENTRANT_NAME)); + +#define do_default_symbol_version(real, name, version) \ + versioned_symbol (libc, real, name, version) +do_default_symbol_version (NEW (REENTRANT_NAME), + REENTRANT_NAME, GLIBC_2_1_2); + +static_link_warning (REENTRANT_NAME)
getXXbyYY_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_ntoh.c =================================================================== --- ether_ntoh.c (nonexistent) +++ ether_ntoh.c (revision 520) @@ -0,0 +1,86 @@ +/* Copyright (C) 1996, 1997, 1999, 2001, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include "etherent.h" + +#include "nsswitch.h" + + +/* Type of the lookup function we need here. */ +typedef int (*lookup_function) (const struct ether_addr *, struct etherent *, + char *, size_t, int *); + +/* The lookup function for the first entry of this service. */ +extern int __nss_ethers_lookup (service_user **nip, const char *name, + void **fctp) internal_function; + + +int +ether_ntohost (char *hostname, const struct ether_addr *addr) +{ + static service_user *startp; + static lookup_function start_fct; + service_user *nip; + union + { + lookup_function f; + void *ptr; + } fct; + int no_more; + enum nss_status status = NSS_STATUS_UNAVAIL; + struct etherent etherent; + + if (startp == NULL) + { + no_more = __nss_ethers_lookup (&nip, "getntohost_r", &fct.ptr); + if (no_more) + startp = (service_user *) -1; + else + { + startp = nip; + start_fct = fct.f; + } + } + else + { + fct.f = start_fct; + no_more = (nip = startp) == (service_user *) -1; + } + + while (no_more == 0) + { + char buffer[1024]; + + status = (*fct.f) (addr, ðerent, buffer, sizeof buffer, &errno); + + no_more = __nss_next (&nip, "getntohost_r", &fct.ptr, status, 0); + } + + if (status == NSS_STATUS_SUCCESS) + /* XXX This is a potential cause of trouble because the size of + the HOSTNAME buffer is not known but the interface does not + provide this information. */ + strcpy (hostname, etherent.e_name); + + return status == NSS_STATUS_SUCCESS ? 0 : -1; +}
ether_ntoh.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_neta.c =================================================================== --- inet_neta.c (nonexistent) +++ inet_neta.c (revision 520) @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char orig_rcsid[] = "From Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; +#endif +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +/* + * char * + * inet_neta(src, dst, size) + * format a in_addr_t network number into presentation format. + * return: + * pointer to dst, or NULL if an error occurred (check errno). + * note: + * format of ``src'' is as for inet_network(). + * author: + * Paul Vixie (ISC), July 1996 + */ +char * +inet_neta(src, dst, size) + in_addr_t src; + char *dst; + size_t size; +{ + char *odst = dst; + char *tp; + + while (src & 0xffffffff) { + u_char b = (src & 0xff000000) >> 24; + + src <<= 8; + if (b) { + if (size < sizeof "255.") + goto emsgsize; + tp = dst; + dst += SPRINTF((dst, "%u", b)); + if (src != 0L) { + *dst++ = '.'; + *dst = '\0'; + } + size -= (size_t)(dst - tp); + } + } + if (dst == odst) { + if (size < sizeof "0.0.0.0") + goto emsgsize; + strcpy(dst, "0.0.0.0"); + } + return (odst); + + emsgsize: + errno = EMSGSIZE; + return (NULL); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_neta +__weak_reference(__inet_neta, inet_neta);
inet_neta.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: hosts-lookup.c =================================================================== --- hosts-lookup.c (nonexistent) +++ hosts-lookup.c (revision 520) @@ -0,0 +1,23 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME hosts +#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files" + +#include "XXX-lookup.c"
hosts-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getrpcent_r.c =================================================================== --- getrpcent_r.c (nonexistent) +++ getrpcent_r.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct rpcent +#define SETFUNC_NAME setrpcent +#define GETFUNC_NAME getrpcent +#define ENDFUNC_NAME endrpcent +#define DATABASE_NAME rpc +#define STAYOPEN int stayopen +#define STAYOPEN_VAR stayopen + +#include "getXXent_r.c"
getrpcent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_init.c =================================================================== --- res_init.c (nonexistent) +++ res_init.c (revision 520) @@ -0,0 +1,608 @@ +/* + * Copyright (c) 1985, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; +static const char rcsid[] = "$BINDId: res_init.c,v 8.16 2000/05/09 07:10:12 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include "local.h" +#include + +/* Options. Should all be left alone. */ +#define RESOLVSORT +#define RFC1535 +/* #undef DEBUG */ + +static void res_setoptions (res_state, const char *, const char *) + internal_function; + +#ifdef RESOLVSORT +static const char sort_mask_chars[] = "/&"; +#define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL) +static u_int32_t net_mask (struct in_addr) __THROW; +#endif + +#if !defined(isascii) /* XXX - could be a function */ +# define isascii(c) (!(c & 0200)) +#endif + +#ifdef _LIBC +unsigned long long int __res_initstamp attribute_hidden; +#endif + +/* + * Resolver state default settings. + */ + +/* + * Set up default settings. If the configuration file exist, the values + * there will have precedence. Otherwise, the server address is set to + * INADDR_ANY and the default domain name comes from the gethostname(). + * + * An interrim version of this code (BIND 4.9, pre-4.4BSD) used 127.0.0.1 + * rather than INADDR_ANY ("0.0.0.0") as the default name server address + * since it was noted that INADDR_ANY actually meant ``the first interface + * you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface, + * it had to be "up" in order for you to reach your own name server. It + * was later decided that since the recommended practice is to always + * install local static routes through 127.0.0.1 for all your network + * interfaces, that we could solve this problem without a code change. + * + * The configuration file should always be used, since it is the only way + * to specify a default domain. If you are running a server on your local + * machine, you should say "nameserver 0.0.0.0" or "nameserver 127.0.0.1" + * in the configuration file. + * + * Return 0 if completes successfully, -1 on error + */ +int +res_ninit(res_state statp) { + extern int __res_vinit(res_state, int); + + return (__res_vinit(statp, 0)); +} +#ifdef _LIBC +libc_hidden_def (__res_ninit) +#endif + +/* This function has to be reachable by res_data.c but not publically. */ +int +__res_vinit(res_state statp, int preinit) { + register FILE *fp; + register char *cp, **pp; + register int n; + char buf[BUFSIZ]; + int nserv = 0; /* number of nameserver records read from file */ +#ifdef _LIBC + int nservall = 0; /* number of NS records read, nserv IPv4 only */ +#endif + int haveenv = 0; + int havesearch = 0; +#ifdef RESOLVSORT + int nsort = 0; + char *net; +#endif +#ifndef RFC1535 + int dots; +#endif +#ifdef _LIBC + statp->_u._ext.initstamp = __res_initstamp; +#endif + + if (!preinit) { + statp->retrans = RES_TIMEOUT; + statp->retry = RES_DFLRETRY; + statp->options = RES_DEFAULT; + statp->id = res_randomid(); + } + +#ifdef USELOOPBACK + statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1); +#else + statp->nsaddr.sin_addr.s_addr = INADDR_ANY; +#endif + statp->nsaddr.sin_family = AF_INET; + statp->nsaddr.sin_port = htons(NAMESERVER_PORT); + statp->nscount = 1; + statp->ndots = 1; + statp->pfcode = 0; + statp->_vcsock = -1; + statp->_flags = 0; + statp->qhook = NULL; + statp->rhook = NULL; + statp->_u._ext.nsinit = 0; + statp->_u._ext.nscount = 0; +#ifdef _LIBC + statp->_u._ext.nscount6 = 0; + for (n = 0; n < MAXNS; n++) { + statp->_u._ext.nsaddrs[n] = NULL; + statp->_u._ext.nsmap[n] = MAXNS; + } +#endif + + /* Allow user to override the local domain definition */ + if ((cp = getenv("LOCALDOMAIN")) != NULL) { + (void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); + statp->defdname[sizeof(statp->defdname) - 1] = '\0'; + haveenv++; + + /* + * Set search list to be blank-separated strings + * from rest of env value. Permits users of LOCALDOMAIN + * to still have a search list, and anyone to set the + * one that they want to use as an individual (even more + * important now that the rfc1535 stuff restricts searches) + */ + cp = statp->defdname; + pp = statp->dnsrch; + *pp++ = cp; + for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) { + if (*cp == '\n') /* silly backwards compat */ + break; + else if (*cp == ' ' || *cp == '\t') { + *cp = 0; + n = 1; + } else if (n) { + *pp++ = cp; + n = 0; + havesearch = 1; + } + } + /* null terminate last domain if there are excess */ + while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n') + cp++; + *cp = '\0'; + *pp++ = 0; + } + +#define MATCH(line, name) \ + (!strncmp(line, name, sizeof(name) - 1) && \ + (line[sizeof(name) - 1] == ' ' || \ + line[sizeof(name) - 1] == '\t')) + + if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) { + /* No threads use this stream. */ + __fsetlocking (fp, FSETLOCKING_BYCALLER); + /* read the config file */ + while (fgets(buf, sizeof(buf), fp) != NULL) { + /* skip comments */ + if (*buf == ';' || *buf == '#') + continue; + /* read default domain name */ + if (MATCH(buf, "domain")) { + if (haveenv) /* skip if have from environ */ + continue; + cp = buf + sizeof("domain") - 1; + while (*cp == ' ' || *cp == '\t') + cp++; + if ((*cp == '\0') || (*cp == '\n')) + continue; + strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); + statp->defdname[sizeof(statp->defdname) - 1] = '\0'; + if ((cp = strpbrk(statp->defdname, " \t\n")) != NULL) + *cp = '\0'; + havesearch = 0; + continue; + } + /* set search list */ + if (MATCH(buf, "search")) { + if (haveenv) /* skip if have from environ */ + continue; + cp = buf + sizeof("search") - 1; + while (*cp == ' ' || *cp == '\t') + cp++; + if ((*cp == '\0') || (*cp == '\n')) + continue; + strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1); + statp->defdname[sizeof(statp->defdname) - 1] = '\0'; + if ((cp = strchr(statp->defdname, '\n')) != NULL) + *cp = '\0'; + /* + * Set search list to be blank-separated strings + * on rest of line. + */ + cp = statp->defdname; + pp = statp->dnsrch; + *pp++ = cp; + for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) { + if (*cp == ' ' || *cp == '\t') { + *cp = 0; + n = 1; + } else if (n) { + *pp++ = cp; + n = 0; + } + } + /* null terminate last domain if there are excess */ + while (*cp != '\0' && *cp != ' ' && *cp != '\t') + cp++; + *cp = '\0'; + *pp++ = 0; + havesearch = 1; + continue; + } + /* read nameservers to query */ +#ifdef _LIBC + if (MATCH(buf, "nameserver") && nservall < MAXNS) { +#else + if (MATCH(buf, "nameserver") && nserv < MAXNS) { +#endif + struct in_addr a; + + cp = buf + sizeof("nameserver") - 1; + while (*cp == ' ' || *cp == '\t') + cp++; + if ((*cp != '\0') && (*cp != '\n') + && inet_aton(cp, &a)) { + statp->nsaddr_list[nserv].sin_addr = a; + statp->nsaddr_list[nserv].sin_family = AF_INET; + statp->nsaddr_list[nserv].sin_port = + htons(NAMESERVER_PORT); + nserv++; +#ifdef _LIBC + nservall++; + } else { + struct in6_addr a6; + char *el; + + if ((el = strchr(cp, '\n')) != NULL) + *el = '\0'; + if ((*cp != '\0') && + (inet_pton(AF_INET6, cp, &a6) > 0)) { + struct sockaddr_in6 *sa6; + + sa6 = malloc(sizeof(*sa6)); + if (sa6 != NULL) { + sa6->sin6_addr = a6; + sa6->sin6_family = AF_INET6; + sa6->sin6_port = htons(NAMESERVER_PORT); + statp->_u._ext.nsaddrs[nservall] = sa6; + statp->_u._ext.nssocks[nservall] = -1; + statp->_u._ext.nsmap[nservall] = MAXNS + 1; + nservall++; + } + } +#endif + } + continue; + } +#ifdef RESOLVSORT + if (MATCH(buf, "sortlist")) { + struct in_addr a; + + cp = buf + sizeof("sortlist") - 1; + while (nsort < MAXRESOLVSORT) { + while (*cp == ' ' || *cp == '\t') + cp++; + if (*cp == '\0' || *cp == '\n' || *cp == ';') + break; + net = cp; + while (*cp && !ISSORTMASK(*cp) && *cp != ';' && + isascii(*cp) && !isspace(*cp)) + cp++; + n = *cp; + *cp = 0; + if (inet_aton(net, &a)) { + statp->sort_list[nsort].addr = a; + if (ISSORTMASK(n)) { + *cp++ = n; + net = cp; + while (*cp && *cp != ';' && + isascii(*cp) && !isspace(*cp)) + cp++; + n = *cp; + *cp = 0; + if (inet_aton(net, &a)) { + statp->sort_list[nsort].mask = a.s_addr; + } else { + statp->sort_list[nsort].mask = + net_mask(statp->sort_list[nsort].addr); + } + } else { + statp->sort_list[nsort].mask = + net_mask(statp->sort_list[nsort].addr); + } + nsort++; + } + *cp = n; + } + continue; + } +#endif + if (MATCH(buf, "options")) { + res_setoptions(statp, buf + sizeof("options") - 1, "conf"); + continue; + } + } + if (nserv > 1) + statp->nscount = nserv; +#ifdef _LIBC + if (nservall - nserv > 0) + statp->_u._ext.nscount6 = nservall - nserv; +#endif +#ifdef RESOLVSORT + statp->nsort = nsort; +#endif + (void) fclose(fp); + } + if (statp->defdname[0] == 0 && + __gethostname(buf, sizeof(statp->defdname) - 1) == 0 && + (cp = strchr(buf, '.')) != NULL) + strcpy(statp->defdname, cp + 1); + + /* find components of local domain that might be searched */ + if (havesearch == 0) { + pp = statp->dnsrch; + *pp++ = statp->defdname; + *pp = NULL; + +#ifndef RFC1535 + dots = 0; + for (cp = statp->defdname; *cp; cp++) + dots += (*cp == '.'); + + cp = statp->defdname; + while (pp < statp->dnsrch + MAXDFLSRCH) { + if (dots < LOCALDOMAINPARTS) + break; + cp = memchr(cp, '.') + 1; /* we know there is one */ + *pp++ = cp; + dots--; + } + *pp = NULL; +#ifdef DEBUG + if (statp->options & RES_DEBUG) { + printf(";; res_init()... default dnsrch list:\n"); + for (pp = statp->dnsrch; *pp; pp++) + printf(";;\t%s\n", *pp); + printf(";;\t..END..\n"); + } +#endif +#endif /* !RFC1535 */ + } + + if ((cp = getenv("RES_OPTIONS")) != NULL) + res_setoptions(statp, cp, "env"); + statp->options |= RES_INIT; + return (0); +} + +static void +internal_function +res_setoptions(res_state statp, const char *options, const char *source) { + const char *cp = options; + int i; + +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_setoptions(\"%s\", \"%s\")...\n", + options, source); +#endif + while (*cp) { + /* skip leading and inner runs of spaces */ + while (*cp == ' ' || *cp == '\t') + cp++; + /* search for and process individual options */ + if (!strncmp(cp, "ndots:", sizeof("ndots:") - 1)) { + i = atoi(cp + sizeof("ndots:") - 1); + if (i <= RES_MAXNDOTS) + statp->ndots = i; + else + statp->ndots = RES_MAXNDOTS; +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";;\tndots=%d\n", statp->ndots); +#endif + } else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) { + i = atoi(cp + sizeof("timeout:") - 1); + if (i <= RES_MAXRETRANS) + statp->retrans = i; + else + statp->retrans = RES_MAXRETRANS; + } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){ + i = atoi(cp + sizeof("attempts:") - 1); + if (i <= RES_MAXRETRY) + statp->retry = i; + else + statp->retry = RES_MAXRETRY; + } else if (!strncmp(cp, "debug", sizeof("debug") - 1)) { +#ifdef DEBUG + if (!(statp->options & RES_DEBUG)) { + printf(";; res_setoptions(\"%s\", \"%s\")..\n", + options, source); + statp->options |= RES_DEBUG; + } + printf(";;\tdebug\n"); +#endif + } else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) { + statp->options |= RES_USE_INET6; + } else if (!strncmp(cp, "ip6-bytestring", + sizeof("ip6-bytestring") - 1)) { + statp->options |= RES_USEBSTRING; + } else if (!strncmp(cp, "no-ip6-dotint", + sizeof("no-ip6-dotint") - 1)) { + statp->options |= RES_NOIP6DOTINT; + } else if (!strncmp(cp, "ip6-dotint", + sizeof("ip6-dotint") - 1)) { + statp->options &= ~RES_NOIP6DOTINT; + } else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) { + statp->options |= RES_ROTATE; + } else if (!strncmp(cp, "no-check-names", + sizeof("no-check-names") - 1)) { + statp->options |= RES_NOCHECKNAME; + } else { + /* XXX - print a warning here? */ + } + /* skip to next run of spaces */ + while (*cp && *cp != ' ' && *cp != '\t') + cp++; + } +} + +#ifdef RESOLVSORT +/* XXX - should really support CIDR which means explicit masks always. */ +static u_int32_t +net_mask(in) /* XXX - should really use system's version of this */ + struct in_addr in; +{ + register u_int32_t i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return (htonl(IN_CLASSA_NET)); + else if (IN_CLASSB(i)) + return (htonl(IN_CLASSB_NET)); + return (htonl(IN_CLASSC_NET)); +} +#endif + +u_int +res_randomid(void) { + struct timeval now; + + gettimeofday(&now, NULL); + return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid())); +} +#ifdef _LIBC +libc_hidden_def (__res_randomid) +#endif + + +/* + * This routine is for closing the socket if a virtual circuit is used and + * the program wants to close it. This provides support for endhostent() + * which expects to close the socket. + * + * This routine is not expected to be user visible. + */ +void +res_nclose(res_state statp) { + int ns; + + if (statp->_vcsock >= 0) { + close_not_cancel_no_status(statp->_vcsock); + statp->_vcsock = -1; + statp->_flags &= ~(RES_F_VC | RES_F_CONN); + } +#ifdef _LIBC + for (ns = 0; ns < MAXNS; ns++) +#else + for (ns = 0; ns < statp->_u._ext.nscount; ns++) +#endif + if (statp->_u._ext.nsaddrs[ns] + && statp->_u._ext.nssocks[ns] != -1) { + close_not_cancel_no_status(statp->_u._ext.nssocks[ns]); + statp->_u._ext.nssocks[ns] = -1; + } + statp->_u._ext.nsinit = 0; +} +#ifdef _LIBC +libc_hidden_def (__res_nclose) +#endif + +#ifdef _LIBC +# ifdef _LIBC_REENTRANT +/* This is called when a thread is exiting to free resources held in _res. */ +static void __attribute__ ((section ("__libc_thread_freeres_fn"))) +res_thread_freeres (void) +{ + if (_res.nscount == 0) + /* Never called res_ninit. */ + return; + + __res_nclose (&_res); /* Close any VC sockets. */ + + for (int ns = 0; ns < MAXNS; ns++) + if (_res._u._ext.nsaddrs[ns] != NULL) + { + free (_res._u._ext.nsaddrs[ns]); + _res._u._ext.nsaddrs[ns] = NULL; + } + + /* Make sure we do a full re-initialization the next time. */ + _res.options = 0; +} +text_set_element (__libc_thread_subfreeres, res_thread_freeres); +text_set_element (__libc_subfreeres, res_thread_freeres); +# endif +#endif
res_init.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ns_samedomain.c =================================================================== --- ns_samedomain.c (nonexistent) +++ ns_samedomain.c (revision 520) @@ -0,0 +1,204 @@ +/* + * Copyright (c) 1995,1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if !defined(_LIBC) && !defined(lint) +static const char rcsid[] = "$BINDId: ns_samedomain.c,v 8.9 1999/10/15 21:06:51 vixie Exp $"; +#endif + +#include +#include +#include +#include + +#include "libc-symbols.h" + +/* + * int + * ns_samedomain(a, b) + * Check whether a name belongs to a domain. + * Inputs: + * a - the domain whose ancestory is being verified + * b - the potential ancestor we're checking against + * Return: + * boolean - is a at or below b? + * Notes: + * Trailing dots are first removed from name and domain. + * Always compare complete subdomains, not only whether the + * domain name is the trailing string of the given name. + * + * "host.foobar.top" lies in "foobar.top" and in "top" and in "" + * but NOT in "bar.top" + */ + +int +ns_samedomain(const char *a, const char *b) { + size_t la, lb; + int diff, i, escaped; + const char *cp; + + la = strlen(a); + lb = strlen(b); + + /* Ignore a trailing label separator (i.e. an unescaped dot) in 'a'. */ + if (la != 0 && a[la - 1] == '.') { + escaped = 0; + /* Note this loop doesn't get executed if la==1. */ + for (i = la - 2; i >= 0; i--) + if (a[i] == '\\') { + if (escaped) + escaped = 0; + else + escaped = 1; + } else + break; + if (!escaped) + la--; + } + + /* Ignore a trailing label separator (i.e. an unescaped dot) in 'b'. */ + if (lb != 0 && b[lb - 1] == '.') { + escaped = 0; + /* note this loop doesn't get executed if lb==1 */ + for (i = lb - 2; i >= 0; i--) + if (b[i] == '\\') { + if (escaped) + escaped = 0; + else + escaped = 1; + } else + break; + if (!escaped) + lb--; + } + + /* lb == 0 means 'b' is the root domain, so 'a' must be in 'b'. */ + if (lb == 0) + return (1); + + /* 'b' longer than 'a' means 'a' can't be in 'b'. */ + if (lb > la) + return (0); + + /* 'a' and 'b' being equal at this point indicates sameness. */ + if (lb == la) + return (strncasecmp(a, b, lb) == 0); + + /* Ok, we know la > lb. */ + + diff = la - lb; + + /* + * If 'a' is only 1 character longer than 'b', then it can't be + * a subdomain of 'b' (because of the need for the '.' label + * separator). + */ + if (diff < 2) + return (0); + + /* + * If the character before the last 'lb' characters of 'b' + * isn't '.', then it can't be a match (this lets us avoid + * having "foobar.com" match "bar.com"). + */ + if (a[diff - 1] != '.') + return (0); + + /* + * We're not sure about that '.', however. It could be escaped + * and thus not a really a label separator. + */ + escaped = 0; + for (i = diff - 2; i >= 0; i--) + if (a[i] == '\\') + if (escaped) + escaped = 0; + else + escaped = 1; + else + break; + if (escaped) + return (0); + + /* Now compare aligned trailing substring. */ + cp = a + diff; + return (strncasecmp(cp, b, lb) == 0); +} + +/* + * int + * ns_subdomain(a, b) + * is "a" a subdomain of "b"? + */ +int +ns_subdomain(const char *a, const char *b) { + return (ns_samename(a, b) != 1 && ns_samedomain(a, b)); +} + +/* + * int + * ns_makecanon(src, dst, dstsize) + * make a canonical copy of domain name "src" + * notes: + * foo -> foo. + * foo. -> foo. + * foo.. -> foo. + * foo\. -> foo\.. + * foo\\. -> foo\\. + */ + +int +ns_makecanon(const char *src, char *dst, size_t dstsize) { + size_t n = strlen(src); + + if (n + sizeof "." > dstsize) { + __set_errno (EMSGSIZE); + return (-1); + } + strcpy(dst, src); + while (n > 0 && dst[n - 1] == '.') /* Ends in "." */ + if (n > 1 && dst[n - 2] == '\\' && /* Ends in "\." */ + (n < 2 || dst[n - 3] != '\\')) /* But not "\\." */ + break; + else + dst[--n] = '\0'; + dst[n++] = '.'; + dst[n] = '\0'; + return (0); +} + +/* + * int + * ns_samename(a, b) + * determine whether domain name "a" is the same as domain name "b" + * return: + * -1 on error + * 0 if names differ + * 1 if names are the same + */ + +int +ns_samename(const char *a, const char *b) { + char ta[NS_MAXDNAME], tb[NS_MAXDNAME]; + + if (ns_makecanon(a, ta, sizeof ta) < 0 || + ns_makecanon(b, tb, sizeof tb) < 0) + return (-1); + if (strcasecmp(ta, tb) == 0) + return (1); + else + return (0); +}
ns_samedomain.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_line.c =================================================================== --- ether_line.c (nonexistent) +++ ether_line.c (revision 520) @@ -0,0 +1,81 @@ +/* Copyright (C) 1996, 1999, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include + + +int +ether_line (const char *line, struct ether_addr *addr, char *hostname) +{ + size_t cnt; + char *cp; + + for (cnt = 0; cnt < 6; ++cnt) + { + unsigned int number; + char ch; + + ch = _tolower (*line++); + if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f')) + return -1; + number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10); + + ch = _tolower (*line); + if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch))) + { + ++line; + if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f')) + return -1; + number <<= 4; + number += isdigit (ch) ? (ch - '0') : (ch - 'a' + 10); + + ch = *line; + if (cnt < 5 && ch != ':') + return -1; + } + + /* Store result. */ + addr->ether_addr_octet[cnt] = (unsigned char) number; + + /* Skip ':'. */ + if (ch != '\0') + ++line; + } + + /* Remove trailing white space. */ + cp = strchr (line, '#'); + if (cp == NULL) + cp = line + strlen (line); + while (cp > line && isspace (cp[-1])) + --cp; + + if (cp == line) + /* No hostname. */ + return -1; + + /* XXX This can cause trouble because the hostname might be too long + but we have no possibility to check it here. */ + memcpy (hostname, line, cp - line); + hostname [cp - line] = '\0'; + + return 0; +}
ether_line.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: res_query.c =================================================================== --- res_query.c (nonexistent) +++ res_query.c (revision 520) @@ -0,0 +1,485 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; +static const char rcsid[] = "$BINDId: res_query.c,v 8.20 2000/02/29 05:39:12 vixie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libc-symbols.h" + +/* Options. Leave them on. */ +/* #undef DEBUG */ + +#if PACKETSZ > 65536 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 65536 +#endif + +#define QUERYSIZE (HFIXEDSZ + QFIXEDSZ + MAXCDNAME + 1) + +static int +__libc_res_nquerydomain(res_state statp, const char *name, const char *domain, + int class, int type, u_char *answer, int anslen, + u_char **answerp); + +/* + * Formulate a normal query, send, and await answer. + * Returned answer is placed in supplied buffer "answer". + * Perform preliminary check of answer, returning success only + * if no error is indicated and the answer count is nonzero. + * Return the size of the response on success, -1 on error. + * Error number is left in H_ERRNO. + * + * Caller must parse answer and determine whether it answers the question. + */ +int +__libc_res_nquery(res_state statp, + const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen, /* size of answer buffer */ + u_char **answerp) /* if buffer needs to be enlarged */ +{ + u_char *buf; + HEADER *hp = (HEADER *) answer; + int n, use_malloc = 0; + + hp->rcode = NOERROR; /* default */ + + buf = alloca (QUERYSIZE); + +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_query(%s, %d, %d)\n", name, class, type); +#endif + + n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL, + buf, QUERYSIZE); + if (__builtin_expect (n <= 0, 0)) { + /* Retry just in case res_nmkquery failed because of too + short buffer. Shouldn't happen. */ + buf = malloc (MAXPACKET); + if (buf != NULL) { + use_malloc = 1; + n = res_nmkquery(statp, QUERY, name, class, type, NULL, + 0, NULL, buf, MAXPACKET); + } + } + if (__builtin_expect (n <= 0, 0)) { +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_query: mkquery failed\n"); +#endif + RES_SET_H_ERRNO(statp, NO_RECOVERY); + if (use_malloc) + free (buf); + return (n); + } + n = __libc_res_nsend(statp, buf, n, answer, anslen, answerp); + if (use_malloc) + free (buf); + if (n < 0) { +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_query: send error\n"); +#endif + RES_SET_H_ERRNO(statp, TRY_AGAIN); + return (n); + } + + if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) { +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; rcode = %d, ancount=%d\n", hp->rcode, + ntohs(hp->ancount)); +#endif + switch (hp->rcode) { + case NXDOMAIN: + RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); + break; + case SERVFAIL: + RES_SET_H_ERRNO(statp, TRY_AGAIN); + break; + case NOERROR: + RES_SET_H_ERRNO(statp, NO_DATA); + break; + case FORMERR: + case NOTIMP: + case REFUSED: + default: + RES_SET_H_ERRNO(statp, NO_RECOVERY); + break; + } + return (-1); + } + return (n); +} +libresolv_hidden_def (__libc_res_nquery) + +int +res_nquery(res_state statp, + const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer buffer */ +{ + return __libc_res_nquery(statp, name, class, type, answer, anslen, + NULL); +} +libresolv_hidden_def (res_nquery) + +/* + * Formulate a normal query, send, and retrieve answer in supplied buffer. + * Return the size of the response on success, -1 on error. + * If enabled, implement search rules until answer or unrecoverable failure + * is detected. Error code, if any, is left in H_ERRNO. + */ +int +__libc_res_nsearch(res_state statp, + const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen, /* size of answer */ + u_char **answerp) +{ + const char *cp, * const *domain; + HEADER *hp = (HEADER *) answer; + char tmp[NS_MAXDNAME]; + u_int dots; + int trailing_dot, ret, saved_herrno; + int got_nodata = 0, got_servfail = 0, root_on_list = 0; + int tried_as_is = 0; + + __set_errno (0); + RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /* True if we never query. */ + + dots = 0; + for (cp = name; *cp != '\0'; cp++) + dots += (*cp == '.'); + trailing_dot = 0; + if (cp > name && *--cp == '.') + trailing_dot++; + + /* If there aren't any dots, it could be a user-level alias. */ + if (!dots && (cp = res_hostalias(statp, name, tmp, sizeof tmp))!= NULL) + return (__libc_res_nquery(statp, cp, class, type, answer, + anslen, answerp)); + +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf("dots=%d, statp->ndots=%d, trailing_dot=%d, name=%s\n", + (int)dots,(int)statp->ndots,(int)trailing_dot,name); +#endif + + /* + * If there are enough dots in the name, let's just give it a + * try 'as is'. The threshold can be set with the "ndots" option. + * Also, query 'as is', if there is a trailing dot in the name. + */ + saved_herrno = -1; + if (dots >= statp->ndots || trailing_dot) { + ret = __libc_res_nquerydomain(statp, name, NULL, class, type, + answer, anslen, answerp); + if (ret > 0 || trailing_dot) + return (ret); + saved_herrno = h_errno; + tried_as_is++; + if (answerp && *answerp != answer) { + answer = *answerp; + anslen = MAXPACKET; + } + } + + /* + * We do at least one level of search if + * - there is no dot and RES_DEFNAME is set, or + * - there is at least one dot, there is no trailing dot, + * and RES_DNSRCH is set. + */ + if ((!dots && (statp->options & RES_DEFNAMES) != 0) || + (dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0)) { + int done = 0; + + for (domain = (const char * const *)statp->dnsrch; + *domain && !done; + domain++) { + + if (domain[0][0] == '\0' || + (domain[0][0] == '.' && domain[0][1] == '\0')) + root_on_list++; + + ret = __libc_res_nquerydomain(statp, name, *domain, + class, type, + answer, anslen, answerp); + if (ret > 0) + return (ret); + + if (answerp && *answerp != answer) { + answer = *answerp; + anslen = MAXPACKET; + } + + /* + * If no server present, give up. + * If name isn't found in this domain, + * keep trying higher domains in the search list + * (if that's enabled). + * On a NO_DATA error, keep trying, otherwise + * a wildcard entry of another type could keep us + * from finding this entry higher in the domain. + * If we get some other error (negative answer or + * server failure), then stop searching up, + * but try the input name below in case it's + * fully-qualified. + */ + if (errno == ECONNREFUSED) { + RES_SET_H_ERRNO(statp, TRY_AGAIN); + return (-1); + } + + switch (statp->res_h_errno) { + case NO_DATA: + got_nodata++; + /* FALLTHROUGH */ + case HOST_NOT_FOUND: + /* keep trying */ + break; + case TRY_AGAIN: + if (hp->rcode == SERVFAIL) { + /* try next search element, if any */ + got_servfail++; + break; + } + /* FALLTHROUGH */ + default: + /* anything else implies that we're done */ + done++; + } + + /* if we got here for some reason other than DNSRCH, + * we only wanted one iteration of the loop, so stop. + */ + if ((statp->options & RES_DNSRCH) == 0) + done++; + } + } + + /* + * If the name has any dots at all, and no earlier 'as-is' query + * for the name, and "." is not on the search list, then try an as-is + * query now. + */ + if (dots && !(tried_as_is || root_on_list)) { + ret = __libc_res_nquerydomain(statp, name, NULL, class, type, + answer, anslen, answerp); + if (ret > 0) + return (ret); + } + + /* if we got here, we didn't satisfy the search. + * if we did an initial full query, return that query's H_ERRNO + * (note that we wouldn't be here if that query had succeeded). + * else if we ever got a nodata, send that back as the reason. + * else send back meaningless H_ERRNO, that being the one from + * the last DNSRCH we did. + */ + if (saved_herrno != -1) + RES_SET_H_ERRNO(statp, saved_herrno); + else if (got_nodata) + RES_SET_H_ERRNO(statp, NO_DATA); + else if (got_servfail) + RES_SET_H_ERRNO(statp, TRY_AGAIN); + return (-1); +} +libresolv_hidden_def (__libc_res_nsearch) + +int +res_nsearch(res_state statp, + const char *name, /* domain name */ + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer */ +{ + return __libc_res_nsearch(statp, name, class, type, answer, + anslen, NULL); +} +libresolv_hidden_def (res_nsearch) + +/* + * Perform a call on res_query on the concatenation of name and domain, + * removing a trailing dot from name if domain is NULL. + */ +static int +__libc_res_nquerydomain(res_state statp, + const char *name, + const char *domain, + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen, /* size of answer */ + u_char **answerp) +{ + char nbuf[MAXDNAME]; + const char *longname = nbuf; + int n, d; + +#ifdef DEBUG + if (statp->options & RES_DEBUG) + printf(";; res_nquerydomain(%s, %s, %d, %d)\n", + name, domain?domain:"", class, type); +#endif + if (domain == NULL) { + /* + * Check for trailing '.'; + * copy without '.' if present. + */ + n = strlen(name); + if (n >= MAXDNAME) { + RES_SET_H_ERRNO(statp, NO_RECOVERY); + return (-1); + } + n--; + if (n >= 0 && name[n] == '.') { + strncpy(nbuf, name, n); + nbuf[n] = '\0'; + } else + longname = name; + } else { + n = strlen(name); + d = strlen(domain); + if (n + d + 1 >= MAXDNAME) { + RES_SET_H_ERRNO(statp, NO_RECOVERY); + return (-1); + } + sprintf(nbuf, "%s.%s", name, domain); + } + return (__libc_res_nquery(statp, longname, class, type, answer, + anslen, answerp)); +} + +int +res_nquerydomain(res_state statp, + const char *name, + const char *domain, + int class, int type, /* class and type of query */ + u_char *answer, /* buffer to put answer */ + int anslen) /* size of answer */ +{ + return __libc_res_nquerydomain(statp, name, domain, class, type, + answer, anslen, NULL); +} +libresolv_hidden_def (res_nquerydomain) + +const char * +res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) { + char *file, *cp1, *cp2; + char buf[BUFSIZ]; + FILE *fp; + + if (statp->options & RES_NOALIASES) + return (NULL); + file = getenv("HOSTALIASES"); + if (file == NULL || (fp = fopen(file, "r")) == NULL) + return (NULL); + setbuf(fp, NULL); + buf[sizeof(buf) - 1] = '\0'; + while (fgets(buf, sizeof(buf), fp)) { + for (cp1 = buf; *cp1 && !isspace(*cp1); ++cp1) + ; + if (!*cp1) + break; + *cp1 = '\0'; + if (ns_samename(buf, name) == 1) { + while (isspace(*++cp1)) + ; + if (!*cp1) + break; + for (cp2 = cp1 + 1; *cp2 && !isspace(*cp2); ++cp2) + ; + *cp2 = '\0'; + strncpy(dst, cp1, siz - 1); + dst[siz - 1] = '\0'; + fclose(fp); + return (dst); + } + } + fclose(fp); + return (NULL); +} +libresolv_hidden_def (res_hostalias)
res_query.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getaliasent_r.c =================================================================== --- getaliasent_r.c (nonexistent) +++ getaliasent_r.c (revision 520) @@ -0,0 +1,29 @@ +/* Copyright (C) 1996, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct aliasent +#define SETFUNC_NAME setaliasent +#define GETFUNC_NAME getaliasent +#define ENDFUNC_NAME endaliasent +#define DATABASE_NAME aliases + +#include "getXXent_r.c"
getaliasent_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstbynm.c =================================================================== --- gethstbynm.c (nonexistent) +++ gethstbynm.c (revision 520) @@ -0,0 +1,38 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +#define LOOKUP_TYPE struct hostent +#define FUNCTION_NAME gethostbyname +#define DATABASE_NAME hosts +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define BUFLEN 1024 +#define NEED_H_ERRNO 1 + +#define HANDLE_DIGITS_DOTS 1 + +#include
gethstbynm.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getnetgrent.c =================================================================== --- getnetgrent.c (nonexistent) +++ getnetgrent.c (revision 520) @@ -0,0 +1,52 @@ +/* Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#define _IO_MTSAFE_IO +#include +#include "libc-symbols.h" + +/* Static buffer for return value. We allocate it when needed. */ +libc_freeres_ptr (static char *buffer); +/* All three strings should fit in a block of 1kB size. */ +#define BUFSIZE 1024 + + + +static void +allocate (void) +{ + buffer = (char *) malloc (BUFSIZE); +} + +int +getnetgrent (char **hostp, char **userp, char **domainp) +{ + __libc_once_define (static, once); + __libc_once (once, allocate); + + if (buffer == NULL) + { + __set_errno (ENOMEM); + return -1; + } + + return __getnetgrent_r (hostp, userp, domainp, buffer, BUFSIZE); +}
getnetgrent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: gethstbynm2_r.c =================================================================== --- gethstbynm2_r.c (nonexistent) +++ gethstbynm2_r.c (revision 520) @@ -0,0 +1,46 @@ +/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include + + +#define LOOKUP_TYPE struct hostent +#define FUNCTION_NAME gethostbyname2 +#define DATABASE_NAME hosts +#define ADD_PARAMS const char *name, int af +#define ADD_VARIABLES name, af +#define NEED_H_ERRNO 1 +#define NEED__RES_HCONF 1 +#define POSTPROCESS \ + if (status == NSS_STATUS_SUCCESS) \ + _res_hconf_reorder_addrs (resbuf); + +#define HANDLE_DIGITS_DOTS 1 +#define HAVE_LOOKUP_BUFFER 1 +#define HAVE_AF 1 + +/* Special name for the lookup function. */ +#define DB_LOOKUP_FCT __nss_hosts_lookup + +#include "getXXbyYY_r.c"
gethstbynm2_r.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getaliasname.c =================================================================== --- getaliasname.c (nonexistent) +++ getaliasname.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct aliasent +#define FUNCTION_NAME getaliasbyname +#define DATABASE_NAME aliases +#define ADD_PARAMS const char *name +#define ADD_VARIABLES name +#define BUFLEN 1024 + +#include "getXXbyYY.c"
getaliasname.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_netof.c =================================================================== --- inet_netof.c (nonexistent) +++ inet_netof.c (revision 520) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include +#include "libc-symbols.h" + +/* + * Return the network number from an internet + * address; handles class a/b/c network #'s. + */ +in_addr_t +inet_netof(in) + struct in_addr in; +{ + register u_int32_t i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); + else if (IN_CLASSB(i)) + return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT); + else + return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); +} +libc_hidden_def (inet_netof)
inet_netof.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getrpcent.c =================================================================== --- getrpcent.c (nonexistent) +++ getrpcent.c (revision 520) @@ -0,0 +1,26 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +#define LOOKUP_TYPE struct rpcent +#define GETFUNC_NAME getrpcent +#define BUFLEN 1024 + +#include "getXXent.c"
getrpcent.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: herrno.c =================================================================== --- herrno.c (nonexistent) +++ herrno.c (revision 520) @@ -0,0 +1,6 @@ +#include + +int *__h_errno_location() { + return &(_REENT->_new._reent._h_errno); +} +
herrno.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inet_net_ntop.c =================================================================== --- inet_net_ntop.c (nonexistent) +++ inet_net_ntop.c (revision 520) @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1996 by Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static const char orig_rcsid[] = "From Id: inet_net_ntop.c,v 8.2 1996/08/08 06:54:44 vixie Exp"; +#endif +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#ifdef SPRINTF_CHAR +# define SPRINTF(x) strlen(sprintf/**/x) +#else +# define SPRINTF(x) ((size_t)sprintf x) +#endif + +static char * inet_net_ntop_ipv4(const u_char *src, int bits, char *dst, + size_t size); + +/* + * char * + * inet_net_ntop(af, src, bits, dst, size) + * convert network number from network to presentation format. + * generates CIDR style result always. + * return: + * pointer to dst, or NULL if an error occurred (check errno). + * author: + * Paul Vixie (ISC), July 1996 + */ +char * +inet_net_ntop(af, src, bits, dst, size) + int af; + const void *src; + int bits; + char *dst; + size_t size; +{ + switch (af) { + case AF_INET: + return (inet_net_ntop_ipv4(src, bits, dst, size)); + default: + errno = EAFNOSUPPORT; + return (NULL); + } +} + +/* + * static char * + * inet_net_ntop_ipv4(src, bits, dst, size) + * convert IPv4 network number from network to presentation format. + * generates CIDR style result always. + * return: + * pointer to dst, or NULL if an error occurred (check errno). + * note: + * network byte order assumed. this means 192.5.5.240/28 has + * 0x11110000 in its fourth octet. + * author: + * Paul Vixie (ISC), July 1996 + */ +static char * +inet_net_ntop_ipv4(src, bits, dst, size) + const u_char *src; + int bits; + char *dst; + size_t size; +{ + char *odst = dst; + char *t; + u_int m; + int b; + + if (bits < 0 || bits > 32) { + errno = EINVAL; + return (NULL); + } + if (bits == 0) { + if (size < sizeof "0") + goto emsgsize; + *dst++ = '0'; + *dst = '\0'; + } + + /* Format whole octets. */ + for (b = bits / 8; b > 0; b--) { + if (size < sizeof "255.") + goto emsgsize; + t = dst; + dst += SPRINTF((dst, "%u", *src++)); + if (b > 1) { + *dst++ = '.'; + *dst = '\0'; + } + size -= (size_t)(dst - t); + } + + /* Format partial octet. */ + b = bits % 8; + if (b > 0) { + if (size < sizeof ".255") + goto emsgsize; + t = dst; + if (dst != odst) + *dst++ = '.'; + m = ((1 << b) - 1) << (8 - b); + dst += SPRINTF((dst, "%u", *src & m)); + size -= (size_t)(dst - t); + } + + /* Format CIDR /width. */ + if (size < sizeof "/32") + goto emsgsize; + dst += SPRINTF((dst, "/%u", bits)); + return (odst); + + emsgsize: + errno = EMSGSIZE; + return (NULL); +} + +/* + * Weak aliases for applications that use certain private entry points, + * and fail to include . + */ +#undef inet_net_ntop +__weak_reference(__inet_net_ntop, inet_net_ntop);
inet_net_ntop.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: netgrp-lookup.c =================================================================== --- netgrp-lookup.c (nonexistent) +++ netgrp-lookup.c (revision 520) @@ -0,0 +1,22 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME netgroup + +#include "XXX-lookup.c"
netgrp-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: service-lookup.c =================================================================== --- service-lookup.c (nonexistent) +++ service-lookup.c (revision 520) @@ -0,0 +1,22 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME services + +#include "XXX-lookup.c"
service-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: netgroup.h =================================================================== --- netgroup.h (nonexistent) +++ netgroup.h (revision 520) @@ -0,0 +1,80 @@ +/* Internal header for netgroup related functions. + Copyright (C) 1996, 1997, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#ifndef _NETGROUP_H +#define _NETGROUP_H 1 + +#include + +/* A netgroup can consist of names of other netgroups. We have to + track which netgroups were read and which still have to be read. */ +struct name_list +{ + struct name_list *next; + char name[0]; +}; + + +/* Dataset for iterating netgroups. */ +struct __netgrent +{ + enum { triple_val, group_val } type; + + union + { + struct + { + const char *host; + const char *user; + const char *domain; + } + triple; + + const char *group; + } val; + + /* Room for the data kept between the calls to the netgroup + functions. We must avoid global variables. */ + char *data; + size_t data_size; + union + { + char *cursor; + unsigned long int position; + }; + int first; + + struct name_list *known_groups; + struct name_list *needed_groups; + + /* This handle for the NSS data base is shared between all + set/get/endXXXent functions. */ + service_user *nip; +}; + + +/* The internal netgroup handling functions might be called from outside. */ +extern int __internal_setnetgrent (const char *group, + struct __netgrent *datap); +extern void __internal_endnetgrent (struct __netgrent *datap); +extern int __internal_getnetgrent_r (char **hostp, char **userp, + char **domainp, struct __netgrent *datap, + char *buffer, size_t buflen, int *errnop); + +#endif /* netgroup.h */
netgroup.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: getaddrinfo.c =================================================================== --- getaddrinfo.c (nonexistent) +++ getaddrinfo.c (revision 520) @@ -0,0 +1,1700 @@ +/* The Inner Net License, Version 2.00 + + The author(s) grant permission for redistribution and use in source and +binary forms, with or without modification, of the software and documentation +provided that the following conditions are met: + +0. If you receive a version of the software that is specifically labelled + as not being for redistribution (check the version message and/or README), + you are not permitted to redistribute that version of the software in any + way or form. +1. All terms of the all other applicable copyrights and licenses must be + followed. +2. Redistributions of source code must retain the authors' copyright + notice(s), this list of conditions, and the following disclaimer. +3. Redistributions in binary form must reproduce the authors' copyright + notice(s), this list of conditions, and the following disclaimer in the + documentation and/or other materials provided with the distribution. +4. [The copyright holder has authorized the removal of this clause.] +5. Neither the name(s) of the author(s) nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + If these license terms cause you a real problem, contact the author. */ + +/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "local.h" + +#ifdef HAVE_LIBIDN +extern int __idna_to_ascii_lz (const char *input, char **output, int flags); +extern int __idna_to_unicode_lzlz (const char *input, char **output, + int flags); +# include +#endif + +#define GAIH_OKIFUNSPEC 0x0100 +#define GAIH_EAI ~(GAIH_OKIFUNSPEC) + +#ifndef UNIX_PATH_MAX +#define UNIX_PATH_MAX 108 +#endif + +struct gaih_service + { + const char *name; + int num; + }; + +struct gaih_servtuple + { + struct gaih_servtuple *next; + int socktype; + int protocol; + int port; + }; + +static const struct gaih_servtuple nullserv; + +struct gaih_addrtuple + { + struct gaih_addrtuple *next; + char *name; + int family; + uint32_t addr[4]; + uint32_t scopeid; + }; + +struct gaih_typeproto + { + int socktype; + int protocol; + char name[4]; + int protoflag; + }; + +/* Values for `protoflag'. */ +#define GAI_PROTO_NOSERVICE 1 +#define GAI_PROTO_PROTOANY 2 + +static const struct gaih_typeproto gaih_inet_typeproto[] = +{ + { 0, 0, "", 0 }, + { SOCK_STREAM, IPPROTO_TCP, "tcp", 0 }, + { SOCK_DGRAM, IPPROTO_UDP, "udp", 0 }, + { SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE }, + { 0, 0, "", 0 } +}; + +struct gaih + { + int family; + int (*gaih)(const char *name, const struct gaih_service *service, + const struct addrinfo *req, struct addrinfo **pai); + }; + +static const struct addrinfo default_hints = + { + .ai_flags = AI_DEFAULT, + .ai_family = PF_UNSPEC, + .ai_socktype = 0, + .ai_protocol = 0, + .ai_addrlen = 0, + .ai_addr = NULL, + .ai_canonname = NULL, + .ai_next = NULL + }; + +#define s6_addr32 __u6_addr.__u6_addr32 + +#if 0 +/* Using Unix sockets this way is a security risk. */ +static int +gaih_local (const char *name, const struct gaih_service *service, + const struct addrinfo *req, struct addrinfo **pai) +{ + struct utsname utsname; + + if ((name != NULL) && (req->ai_flags & AI_NUMERICHOST)) + return GAIH_OKIFUNSPEC | -EAI_NONAME; + + if ((name != NULL) || (req->ai_flags & AI_CANONNAME)) + if (uname (&utsname) < 0) + return -EAI_SYSTEM; + + if (name != NULL) + { + if (strcmp(name, "localhost") && + strcmp(name, "local") && + strcmp(name, "unix") && + strcmp(name, utsname.nodename)) + return GAIH_OKIFUNSPEC | -EAI_NONAME; + } + + if (req->ai_protocol || req->ai_socktype) + { + const struct gaih_typeproto *tp = gaih_inet_typeproto + 1; + + while (tp->name[0] + && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0 + || (req->ai_socktype != 0 && req->ai_socktype != tp->socktype) + || (req->ai_protocol != 0 + && !(tp->protoflag & GAI_PROTO_PROTOANY) + && req->ai_protocol != tp->protocol))) + ++tp; + + if (! tp->name[0]) + { + if (req->ai_socktype) + return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); + else + return (GAIH_OKIFUNSPEC | -EAI_SERVICE); + } + } + + *pai = malloc (sizeof (struct addrinfo) + sizeof (struct sockaddr_un) + + ((req->ai_flags & AI_CANONNAME) + ? (strlen(utsname.nodename) + 1): 0)); + if (*pai == NULL) + return -EAI_MEMORY; + + (*pai)->ai_next = NULL; + (*pai)->ai_flags = req->ai_flags; + (*pai)->ai_family = AF_LOCAL; + (*pai)->ai_socktype = req->ai_socktype ? req->ai_socktype : SOCK_STREAM; + (*pai)->ai_protocol = req->ai_protocol; + (*pai)->ai_addrlen = sizeof (struct sockaddr_un); + (*pai)->ai_addr = (void *) (*pai) + sizeof (struct addrinfo); + +#if SALEN + ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len = + sizeof (struct sockaddr_un); +#endif /* SALEN */ + + ((struct sockaddr_un *)(*pai)->ai_addr)->sun_family = AF_LOCAL; + memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX); + + if (service) + { + struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr; + + if (strchr (service->name, '/') != NULL) + { + if (strlen (service->name) >= sizeof (sunp->sun_path)) + return GAIH_OKIFUNSPEC | -EAI_SERVICE; + + strcpy (sunp->sun_path, service->name); + } + else + { + if (strlen (P_tmpdir "/") + 1 + strlen (service->name) >= + sizeof (sunp->sun_path)) + return GAIH_OKIFUNSPEC | -EAI_SERVICE; + + __stpcpy (__stpcpy (sunp->sun_path, P_tmpdir "/"), service->name); + } + } + else + { + /* This is a dangerous use of the interface since there is a time + window between the test for the file and the actual creation + (done by the caller) in which a file with the same name could + be created. */ + char *buf = ((struct sockaddr_un *) (*pai)->ai_addr)->sun_path; + + if (__builtin_expect (__path_search (buf, L_tmpnam, NULL, NULL, 0), + 0) != 0 + || __builtin_expect (__gen_tempname (buf, __GT_NOCREATE), 0) != 0) + return -EAI_SYSTEM; + } + + if (req->ai_flags & AI_CANONNAME) + (*pai)->ai_canonname = strcpy ((char *) *pai + sizeof (struct addrinfo) + + sizeof (struct sockaddr_un), + utsname.nodename); + else + (*pai)->ai_canonname = NULL; + return 0; +} +#endif /* 0 */ + +static int +gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp, + const struct addrinfo *req, struct gaih_servtuple *st) +{ + struct servent *s; + size_t tmpbuflen = 1024; + struct servent ts; + char *tmpbuf; + int r; + + do + { + tmpbuf = alloca (tmpbuflen); + + r = __getservbyname_r (servicename, tp->name, &ts, tmpbuf, tmpbuflen, + &s); + if (r != 0 || s == NULL) + { + if (r == ERANGE) + tmpbuflen *= 2; + else + return GAIH_OKIFUNSPEC | -EAI_SERVICE; + } + } + while (r); + + st->next = NULL; + st->socktype = tp->socktype; + st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) + ? req->ai_protocol : tp->protocol); + st->port = s->s_port; + + return 0; +} + +#define gethosts(_family, _type) \ + { \ + int i; \ + int herrno; \ + struct hostent th; \ + struct hostent *h; \ + char *localcanon = NULL; \ + no_data = 0; \ + while (1) { \ + rc = 0; \ + status = DL_CALL_FCT (fct, (name, _family, &th, tmpbuf, tmpbuflen, \ + &rc, &herrno, NULL, &localcanon)); \ + if (rc != ERANGE || herrno != NETDB_INTERNAL) \ + break; \ + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); \ + } \ + if (status == NSS_STATUS_SUCCESS && rc == 0) \ + h = &th; \ + else \ + h = NULL; \ + if (rc != 0) \ + { \ + if (herrno == NETDB_INTERNAL) \ + { \ + h_errno = (herrno); \ + return -EAI_SYSTEM; \ + } \ + if (herrno == TRY_AGAIN) \ + no_data = EAI_AGAIN; \ + else \ + no_data = herrno == NO_DATA; \ + } \ + else if (h != NULL) \ + { \ + for (i = 0; h->h_addr_list[i]; i++) \ + { \ + if (*pat == NULL) \ + { \ + *pat = alloca (sizeof (struct gaih_addrtuple)); \ + (*pat)->scopeid = 0; \ + } \ + uint32_t *addr = (*pat)->addr; \ + (*pat)->next = NULL; \ + if (i == 0) \ + { \ + (*pat)->name = alloca (strlen (h->h_name) + 1); \ + strcpy ((*pat)->name, h->h_name); \ + } \ + else \ + (*pat)->name = NULL; \ + if (_family == AF_INET && req->ai_family == AF_INET6) \ + { \ + (*pat)->family = AF_INET6; \ + addr[3] = *(uint32_t *) h->h_addr_list[i]; \ + addr[2] = htonl (0xffff); \ + addr[1] = 0; \ + addr[0] = 0; \ + } \ + else \ + { \ + (*pat)->family = _family; \ + memcpy (addr, h->h_addr_list[i], sizeof(_type)); \ + } \ + pat = &((*pat)->next); \ + } \ + \ + if (localcanon != NULL && canon == NULL) \ + { \ + canon = alloca (strlen (localcanon) + 1); \ + strcpy (canon, localcanon); \ + } \ + \ + if (_family == AF_INET6 && i > 0) \ + got_ipv6 = true; \ + } \ + } + + +typedef enum nss_status (*nss_gethostbyname3_r) + (const char *name, int af, struct hostent *host, + char *buffer, size_t buflen, int *errnop, + int *h_errnop, int32_t *ttlp, char **canonp); +typedef enum nss_status (*nss_getcanonname_r) + (const char *name, char *buffer, size_t buflen, char **result, + int *errnop, int *h_errnop); +extern service_user *__nss_hosts_database attribute_hidden; + +static int +gaih_inet (const char *name, const struct gaih_service *service, + const struct addrinfo *req, struct addrinfo **pai) +{ + const struct gaih_typeproto *tp = gaih_inet_typeproto; + struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv; + struct gaih_addrtuple *at = NULL; + int rc; + bool got_ipv6 = false; + const char *canon = NULL; + const char *orig_name = name; + + if (req->ai_protocol || req->ai_socktype) + { + ++tp; + + while (tp->name[0] + && ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype) + || (req->ai_protocol != 0 + && !(tp->protoflag & GAI_PROTO_PROTOANY) + && req->ai_protocol != tp->protocol))) + ++tp; + + if (! tp->name[0]) + { + if (req->ai_socktype) + return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE); + else + return (GAIH_OKIFUNSPEC | -EAI_SERVICE); + } + } + + if (service != NULL) + { + if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) + return (GAIH_OKIFUNSPEC | -EAI_SERVICE); + + if (service->num < 0) + { + if (tp->name[0]) + { + st = (struct gaih_servtuple *) + alloca (sizeof (struct gaih_servtuple)); + + if ((rc = gaih_inet_serv (service->name, tp, req, st))) + return rc; + } + else + { + struct gaih_servtuple **pst = &st; + for (tp++; tp->name[0]; tp++) + { + struct gaih_servtuple *newp; + + if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0) + continue; + + if (req->ai_socktype != 0 + && req->ai_socktype != tp->socktype) + continue; + if (req->ai_protocol != 0 + && !(tp->protoflag & GAI_PROTO_PROTOANY) + && req->ai_protocol != tp->protocol) + continue; + + newp = (struct gaih_servtuple *) + alloca (sizeof (struct gaih_servtuple)); + + if ((rc = gaih_inet_serv (service->name, tp, req, newp))) + { + if (rc & GAIH_OKIFUNSPEC) + continue; + return rc; + } + + *pst = newp; + pst = &(newp->next); + } + if (st == (struct gaih_servtuple *) &nullserv) + return (GAIH_OKIFUNSPEC | -EAI_SERVICE); + } + } + else + { + if (req->ai_socktype || req->ai_protocol) + { + st = alloca (sizeof (struct gaih_servtuple)); + st->next = NULL; + st->socktype = tp->socktype; + st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) + ? req->ai_protocol : tp->protocol); + st->port = htons (service->num); + } + else + { + /* Neither socket type nor protocol is set. Return all + socket types we know about. */ + struct gaih_servtuple **lastp = &st; + for (tp = gaih_inet_typeproto + 1; tp->name[0]; ++tp) + if ((tp->protoflag & GAI_PROTO_NOSERVICE) == 0) + { + struct gaih_servtuple *newp; + + newp = alloca (sizeof (struct gaih_servtuple)); + newp->next = NULL; + newp->socktype = tp->socktype; + newp->protocol = tp->protocol; + newp->port = htons (service->num); + + *lastp = newp; + lastp = &newp->next; + } + } + } + } + else if (req->ai_socktype || req->ai_protocol) + { + st = alloca (sizeof (struct gaih_servtuple)); + st->next = NULL; + st->socktype = tp->socktype; + st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY) + ? req->ai_protocol : tp->protocol); + st->port = 0; + } + else + { + /* Neither socket type nor protocol is set. Return all socket types + we know about. */ + struct gaih_servtuple **lastp = &st; + for (++tp; tp->name[0]; ++tp) + { + struct gaih_servtuple *newp; + + newp = alloca (sizeof (struct gaih_servtuple)); + newp->next = NULL; + newp->socktype = tp->socktype; + newp->protocol = tp->protocol; + newp->port = 0; + + *lastp = newp; + lastp = &newp->next; + } + } + + if (name != NULL) + { + at = alloca (sizeof (struct gaih_addrtuple)); + + at->family = AF_UNSPEC; + at->scopeid = 0; + at->next = NULL; + +#ifdef HAVE_LIBIDN + if (req->ai_flags & AI_IDN) + { + int idn_flags = 0; + if (req->ai_flags & AI_IDN_ALLOW_UNASSIGNED) + idn_flags |= IDNA_ALLOW_UNASSIGNED; + if (req->ai_flags & AI_IDN_USE_STD3_ASCII_RULES) + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + + char *p = NULL; + rc = __idna_to_ascii_lz (name, &p, idn_flags); + if (rc != IDNA_SUCCESS) + { + if (rc == IDNA_MALLOC_ERROR) + return -EAI_MEMORY; + if (rc == IDNA_DLOPEN_ERROR) + return -EAI_SYSTEM; + return -EAI_IDN_ENCODE; + } + /* In case the output string is the same as the input string + no new string has been allocated. */ + if (p != name) + { + name = alloca (strlen (p) + 1); + strcpy (name, p); + free (p); + } + } +#endif + + if (inet_aton (name, (struct in_addr *) at->addr) != 0) + { + if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET) + at->family = AF_INET; + else if (req->ai_family == AF_INET6 && req->ai_flags & AI_V4MAPPED) + { + at->addr[3] = at->addr[0]; + at->addr[2] = htonl (0xffff); + at->addr[1] = 0; + at->addr[0] = 0; + at->family = AF_INET6; + } + else + return -EAI_ADDRFAMILY; + + dupname: + if (req->ai_flags & AI_CANONNAME) + { + canon = strdup (name); + if (canon == NULL) + return -EAI_MEMORY; + } + } + + if (at->family == AF_UNSPEC) + { + char *scope_delim; + char *namebuf = alloca (strlen (name) + 1); + strcpy (namebuf, name); + + scope_delim = strchr (namebuf, SCOPE_DELIMITER); + if (scope_delim != NULL) + *scope_delim = '\0'; + + if (inet_pton (AF_INET6, namebuf, at->addr) > 0) + { + if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) + at->family = AF_INET6; + else if (req->ai_family == AF_INET + && IN6_IS_ADDR_V4MAPPED ((struct in6_addr *)at->addr)) + { + at->addr[0] = at->addr[3]; + at->family = AF_INET; + } + else + return -EAI_ADDRFAMILY; + + if (scope_delim != NULL) + { + int try_numericscope = 0; + if (IN6_IS_ADDR_LINKLOCAL ((struct in6_addr *)at->addr) + || IN6_IS_ADDR_MC_LINKLOCAL ((struct in6_addr *)at->addr)) + { + at->scopeid = if_nametoindex (scope_delim + 1); + if (at->scopeid == 0) + try_numericscope = 1; + } + else + try_numericscope = 1; + + if (try_numericscope != 0) + { + char *end; + assert (sizeof (uint32_t) <= sizeof (unsigned long)); + at->scopeid = (uint32_t) strtoul (scope_delim + 1, &end, + 10); + if (*end != '\0') + return GAIH_OKIFUNSPEC | -EAI_NONAME; + } + } + + goto dupname; + } + } + + if (at->family == AF_UNSPEC && (req->ai_flags & AI_NUMERICHOST) == 0) + { + struct gaih_addrtuple **pat = &at; + int no_data = 0; + int no_inet6_data = 0; + service_user *nip = NULL; + enum nss_status inet6_status = NSS_STATUS_UNAVAIL; + enum nss_status status = NSS_STATUS_UNAVAIL; + int no_more; + int old_res_options; + + /* If we do not have to look for IPv4 and IPv6 together, use + the simple, old functions. */ + if (req->ai_family == AF_INET || req->ai_family == AF_INET6) + { + int family = req->ai_family; + size_t tmpbuflen = 512; + char *tmpbuf = alloca (tmpbuflen); + int rc; + struct hostent th; + struct hostent *h; + int herrno; + + simple_again: + while (1) + { + rc = __gethostbyname2_r (name, family, &th, tmpbuf, + tmpbuflen, &h, &herrno); + if (rc != ERANGE || herrno != NETDB_INTERNAL) + break; + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); + } + + if (rc == 0) + { + if (h == NULL) + { + if (req->ai_family == AF_INET6 + && (req->ai_flags & AI_V4MAPPED) + && family == AF_INET6) + { + /* Try again, this time looking for IPv4 + addresses. */ + family = AF_INET; + goto simple_again; + } + } + else + { + /* We found data, now convert it into the list. */ + int i = 0; + for (i = 0; h->h_addr_list[i]; ++i) + { + if (*pat == NULL) + { + *pat = alloca (sizeof (struct gaih_addrtuple)); + (*pat)->scopeid = 0; + } + (*pat)->next = NULL; + (*pat)->family = req->ai_family; + if (family == req->ai_family) + memcpy ((*pat)->addr, h->h_addr_list[i], + h->h_length); + else + { + int32_t *addr = (uint32_t *) (*pat)->addr; + addr[3] = *(uint32_t *) h->h_addr_list[i]; + addr[2] = htonl (0xffff); + addr[1] = 0; + addr[0] = 0; + } + pat = &((*pat)->next); + } + } + } + else + { + if (herrno == NETDB_INTERNAL) + { + h_errno = (herrno); + return -EAI_SYSTEM; + } + if (herrno == TRY_AGAIN) + { + return -EAI_AGAIN; + } + /* We made requests but they turned out no data. + The name is known, though. */ + return (GAIH_OKIFUNSPEC | -EAI_NODATA); + } + + goto process_list; + } + +#ifdef USE_NSCD + if (__nss_not_use_nscd_hosts > 0 + && ++__nss_not_use_nscd_hosts > NSS_NSCD_RETRY) + __nss_not_use_nscd_hosts = 0; + + if (!__nss_not_use_nscd_hosts) + { + /* Try to use nscd. */ + struct nscd_ai_result *air = NULL; + int herrno; + int err = __nscd_getai (name, &air, &herrno); + if (air != NULL) + { + /* Transform into gaih_addrtuple list. */ + bool added_canon = (req->ai_flags & AI_CANONNAME) == 0; + char *addrs = air->addrs; + + for (int i = 0; i < air->naddrs; ++i) + { + socklen_t size = (air->family[i] == AF_INET + ? INADDRSZ : IN6ADDRSZ); + if (*pat == NULL) + { + *pat = alloca (sizeof (struct gaih_addrtuple)); + (*pat)->scopeid = 0; + } + uint32_t *pataddr = (*pat)->addr; + (*pat)->next = NULL; + if (added_canon || air->canon == NULL) + (*pat)->name = NULL; + else { + canon = (*pat)->name = alloca (strlen (air->canon) + 1); + strcpy (canon, air->canon); + } + + if (air->family[i] == AF_INET + && req->ai_family == AF_INET6 + && (req->ai_flags & AI_V4MAPPED)) + { + (*pat)->family = AF_INET6; + pataddr[3] = *(uint32_t *) addrs; + pataddr[2] = htonl (0xffff); + pataddr[1] = 0; + pataddr[0] = 0; + pat = &((*pat)->next); + added_canon = true; + } + else if (req->ai_family == AF_UNSPEC + || air->family[i] == req->ai_family) + { + (*pat)->family = air->family[i]; + memcpy (pataddr, addrs, size); + pat = &((*pat)->next); + added_canon = true; + if (air->family[i] == AF_INET6) + got_ipv6 = true; + } + addrs += size; + } + + free (air); + + if (at->family == AF_UNSPEC) + return (GAIH_OKIFUNSPEC | -EAI_NONAME); + + goto process_list; + } + else if (err != 0 && __nss_not_use_nscd_hosts == 0) + { + if (herrno == NETDB_INTERNAL && errno == ENOMEM) + return -EAI_MEMORY; + if (herrno == TRY_AGAIN) + return -EAI_AGAIN; + return -EAI_SYSTEM; + } + } +#endif + + if (__nss_hosts_database != NULL) + { + no_more = 0; + nip = __nss_hosts_database; + } + else + no_more = __nss_database_lookup ("hosts", NULL, + "dns [!UNAVAIL=return] files", + &nip); + + if (__res_maybe_init (&_res, 0) == -1) + no_more = 1; + + /* If we are looking for both IPv4 and IPv6 address we don't + want the lookup functions to automatically promote IPv4 + addresses to IPv6 addresses. Currently this is decided + by setting the RES_USE_INET6 bit in _res.options. */ + old_res_options = _res.options; + _res.options &= ~RES_USE_INET6; + + size_t tmpbuflen = 512; + char *tmpbuf = alloca (tmpbuflen); + + while (!no_more) + { + nss_gethostbyname3_r fct = NULL; + if (req->ai_flags & AI_CANONNAME) + /* No need to use this function if we do not look for + the canonical name. The function does not exist in + all NSS modules and therefore the lookup would + often fail. */ + fct = __nss_lookup_function (nip, "gethostbyname3_r"); + if (fct == NULL) + /* We are cheating here. The gethostbyname2_r function does + not have the same interface as gethostbyname3_r but the + extra arguments the latter takes are added at the end. + So the gethostbyname2_r code will just ignore them. */ + fct = __nss_lookup_function (nip, "gethostbyname2_r"); + + if (fct != NULL) + { + if (req->ai_family == AF_INET6 + || req->ai_family == AF_UNSPEC) + { + gethosts (AF_INET6, struct in6_addr); + no_inet6_data = no_data; + inet6_status = status; + } + if (req->ai_family == AF_INET + || req->ai_family == AF_UNSPEC + || (req->ai_family == AF_INET6 + && (req->ai_flags & AI_V4MAPPED) + /* Avoid generating the mapped addresses if we + know we are not going to need them. */ + && ((req->ai_flags & AI_ALL) || !got_ipv6))) + { + gethosts (AF_INET, struct in_addr); + + if (req->ai_family == AF_INET) + { + no_inet6_data = no_data; + inet6_status = status; + } + } + + /* If we found one address for AF_INET or AF_INET6, + don't continue the search. */ + if (inet6_status == NSS_STATUS_SUCCESS + || status == NSS_STATUS_SUCCESS) + { + if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL) + { + /* If we need the canonical name, get it + from the same service as the result. */ + nss_getcanonname_r cfct; + int herrno; + + cfct = __nss_lookup_function (nip, "getcanonname_r"); + if (cfct != NULL) + { + const size_t max_fqdn_len = 256; + char *buf = alloca (max_fqdn_len); + char *s; + + if (DL_CALL_FCT (cfct, (at->name ?: name, buf, + max_fqdn_len, &s, &rc, + &herrno)) + == NSS_STATUS_SUCCESS) + canon = s; + else + /* Set to name now to avoid using + gethostbyaddr. */ + canon = name; + } + } + + break; + } + + /* We can have different states for AF_INET and + AF_INET6. Try to find a useful one for both. */ + if (inet6_status == NSS_STATUS_TRYAGAIN) + status = NSS_STATUS_TRYAGAIN; + else if (status == NSS_STATUS_UNAVAIL && + inet6_status != NSS_STATUS_UNAVAIL) + status = inet6_status; + } + + if (nss_next_action (nip, status) == NSS_ACTION_RETURN) + break; + + if (nip->next == NULL) + no_more = -1; + else + nip = nip->next; + } + + _res.options = old_res_options; + + if (no_data != 0 && no_inet6_data != 0) + { + /* If both requests timed out report this. */ + if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN) + return -EAI_AGAIN; + + /* We made requests but they turned out no data. The name + is known, though. */ + return (GAIH_OKIFUNSPEC | -EAI_NODATA); + } + } + + process_list: + if (at->family == AF_UNSPEC) + return (GAIH_OKIFUNSPEC | -EAI_NONAME); + } + else + { + struct gaih_addrtuple *atr; + atr = at = alloca (sizeof (struct gaih_addrtuple)); + memset (at, '\0', sizeof (struct gaih_addrtuple)); + + if (req->ai_family == AF_UNSPEC) + { + at->next = alloca (sizeof (struct gaih_addrtuple)); + memset (at->next, '\0', sizeof (struct gaih_addrtuple)); + } + + if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6) + { + at->family = AF_INET6; + if ((req->ai_flags & AI_PASSIVE) == 0) + memcpy (at->addr, &in6addr_loopback, sizeof (struct in6_addr)); + atr = at->next; + } + + if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET) + { + atr->family = AF_INET; + if ((req->ai_flags & AI_PASSIVE) == 0) + atr->addr[0] = htonl (INADDR_LOOPBACK); + } + } + + if (pai == NULL) + return 0; + + { + struct gaih_servtuple *st2; + struct gaih_addrtuple *at2 = at; + size_t socklen; + sa_family_t family; + + /* + buffer is the size of an unformatted IPv6 address in printable format. + */ + while (at2 != NULL) + { + /* Only the first entry gets the canonical name. */ + if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0) + { + if (canon == NULL) + { + struct hostent *h = NULL; + int herrno; + struct hostent th; + size_t tmpbuflen = 512; + char *tmpbuf = NULL; + + do + { + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2); + rc = __gethostbyaddr_r (at2->addr, + ((at2->family == AF_INET6) + ? sizeof (struct in6_addr) + : sizeof (struct in_addr)), + at2->family, &th, tmpbuf, + tmpbuflen, &h, &herrno); + } + while (rc == ERANGE && herrno == NETDB_INTERNAL); + + if (rc != 0 && herrno == NETDB_INTERNAL) + { + h_errno = (herrno); + return -EAI_SYSTEM; + } + + if (h != NULL) + canon = h->h_name; + else + { + assert (orig_name != NULL); + /* If the canonical name cannot be determined, use + the passed in string. */ + canon = orig_name; + } + } + +#ifdef HAVE_LIBIDN + if (req->ai_flags & AI_CANONIDN) + { + int idn_flags = 0; + if (req->ai_flags & AI_IDN_ALLOW_UNASSIGNED) + idn_flags |= IDNA_ALLOW_UNASSIGNED; + if (req->ai_flags & AI_IDN_USE_STD3_ASCII_RULES) + idn_flags |= IDNA_USE_STD3_ASCII_RULES; + + char *out; + int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags); + if (rc != IDNA_SUCCESS) + { + if (rc == IDNA_MALLOC_ERROR) + return -EAI_MEMORY; + if (rc == IDNA_DLOPEN_ERROR) + return -EAI_SYSTEM; + return -EAI_IDN_ENCODE; + } + /* In case the output string is the same as the input + string no new string has been allocated. Otherwise + make a copy. */ + if (out == canon) + goto make_copy; + } + else +#endif + { +#ifdef HAVE_LIBIDN + make_copy: +#endif + canon = strdup (canon); + if (canon == NULL) + return -EAI_MEMORY; + } + } + + if (at2->family == AF_INET6) + { + family = AF_INET6; + socklen = sizeof (struct sockaddr_in6); + + /* If we looked up IPv4 mapped address discard them here if + the caller isn't interested in all address and we have + found at least one IPv6 address. */ + if (got_ipv6 + && (req->ai_flags & (AI_V4MAPPED|AI_ALL)) == AI_V4MAPPED + && IN6_IS_ADDR_V4MAPPED ((struct in6_addr *)at2->addr)) + goto ignore; + } + else + { + family = AF_INET; + socklen = sizeof (struct sockaddr_in); + } + + for (st2 = st; st2 != NULL; st2 = st2->next) + { + struct addrinfo *ai; + ai = *pai = malloc (sizeof (struct addrinfo) + socklen); + if (ai == NULL) + return -EAI_MEMORY; + + ai->ai_flags = req->ai_flags; + ai->ai_family = family; + ai->ai_socktype = st2->socktype; + ai->ai_protocol = st2->protocol; + ai->ai_addrlen = socklen; + ai->ai_addr = (void *) (ai + 1); + + /* We only add the canonical name once. */ + ai->ai_canonname = (char *) canon; + canon = NULL; + +#if SALEN + ai->ai_addr->sa_len = socklen; +#endif /* SALEN */ + ai->ai_addr->sa_family = family; + + if (family == AF_INET6) + { + struct sockaddr_in6 *sin6p = + (struct sockaddr_in6 *) ai->ai_addr; + + sin6p->sin6_port = st2->port; + sin6p->sin6_flowinfo = 0; + memcpy (&sin6p->sin6_addr, + at2->addr, sizeof (struct in6_addr)); + sin6p->sin6_scope_id = at2->scopeid; + } + else + { + struct sockaddr_in *sinp = + (struct sockaddr_in *) ai->ai_addr; + sinp->sin_port = st2->port; + memcpy (&sinp->sin_addr, + at2->addr, sizeof (struct in_addr)); + memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero)); + } + + pai = &(ai->ai_next); + } + *pai = NULL; + + ignore: + at2 = at2->next; + } + } + return 0; +} + +static struct gaih gaih[] = + { + { PF_INET6, gaih_inet }, + { PF_INET, gaih_inet }, +#if 0 + { PF_LOCAL, gaih_local }, +#endif + { PF_UNSPEC, NULL } + }; + +struct sort_result +{ + struct addrinfo *dest_addr; + struct sockaddr_storage source_addr; + uint8_t source_addr_len; + bool got_source_addr; +}; + + +static int +get_scope (const struct sockaddr_storage *ss) +{ + int scope; + if (ss->ss_family == PF_INET6) + { + const struct sockaddr_in6 *in6 = (const struct sockaddr_in6 *) ss; + + if (! IN6_IS_ADDR_MULTICAST (&in6->sin6_addr)) + { + if (IN6_IS_ADDR_LINKLOCAL (&in6->sin6_addr)) + scope = 2; + else if (IN6_IS_ADDR_SITELOCAL (&in6->sin6_addr)) + scope = 5; + else + /* XXX Is this the correct default behavior? */ + scope = 14; + } + else + scope = in6->sin6_addr.s6_addr[1] & 0xf; + } + else if (ss->ss_family == PF_INET) + { + const struct sockaddr_in *in = (const struct sockaddr_in *) ss; + const uint8_t *addr = (const uint8_t *) &in->sin_addr; + + /* RFC 3484 specifies how to map IPv6 addresses to scopes. + 169.254/16 and 127/8 are link-local. */ + if ((addr[0] == 169 && addr[1] == 254) || addr[0] == 127) + scope = 2; + else if (addr[0] == 10 || (addr[0] == 172 && addr[1] == 16) + || (addr[0] == 192 && addr[1] == 168)) + scope = 5; + else + scope = 14; + } + else + /* XXX What is a good default? */ + scope = 15; + + return scope; +} + + +/* XXX The system administrator should be able to install other + tables. We need to make this configurable. The problem is that + the kernel is also involved since it needs the same table. */ +static const struct prefixlist +{ + struct in6_addr prefix; + unsigned int bits; + int val; +} default_labels[] = + { + /* See RFC 3484 for the details. */ + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0001 } } }, + 128, 0 }, + { { .__u6_addr = { .__u6_addr16 = { 0x2002, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000 } } }, + 16, 2 }, + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000 } } }, + 96, 3 }, + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xffff, 0x0000, 0x0000 } } }, + 96, 4 }, + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000 } } }, + 0, 1 } + }; + + +static const struct prefixlist default_precedence[] = + { + /* See RFC 3484 for the details. */ + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0001 } } }, + 128, 50 }, + { { .__u6_addr = { .__u6_addr16 = { 0x2002, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000 } } }, + 16, 30 }, + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000 } } }, + 96, 20 }, + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xffff, 0x0000, 0x0000 } } }, + 96, 10 }, + { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000 } } }, + 0, 40 } + }; + + +static int +match_prefix (const struct sockaddr_storage *ss, const struct prefixlist *list, + int default_val) +{ + int idx; + struct sockaddr_in6 in6_mem; + const struct sockaddr_in6 *in6; + + if (ss->ss_family == PF_INET6) + in6 = (const struct sockaddr_in6 *) ss; + else if (ss->ss_family == PF_INET) + { + const struct sockaddr_in *in = (const struct sockaddr_in *) ss; + + /* Convert to IPv6 address. */ + in6_mem.sin6_family = PF_INET6; + in6_mem.sin6_port = in->sin_port; + in6_mem.sin6_flowinfo = 0; + if (in->sin_addr.s_addr == htonl (0x7f000001)) + in6_mem.sin6_addr = (struct in6_addr) IN6ADDR_LOOPBACK_INIT; + else + { + /* Construct a V4-to-6 mapped address. */ + memset (&in6_mem.sin6_addr, '\0', sizeof (in6_mem.sin6_addr)); + in6_mem.sin6_addr.__u6_addr.__u6_addr16[5] = 0xffff; + in6_mem.sin6_addr.__u6_addr.__u6_addr32[3] = in->sin_addr.s_addr; + in6_mem.sin6_scope_id = 0; + } + + in6 = &in6_mem; + } + else + return default_val; + + for (idx = 0; ; ++idx) + { + unsigned int bits = list[idx].bits; + uint8_t *mask = list[idx].prefix.s6_addr; + uint8_t *val = in6->sin6_addr.s6_addr; + + while (bits > 8) + { + if (*mask != *val) + break; + + ++mask; + ++val; + bits -= 8; + } + + if (bits < 8) + { + if ((*mask & (0xff00 >> bits)) == (*val & (0xff00 >> bits))) + /* Match! */ + break; + } + } + + return list[idx].val; +} + + +static int +get_label (const struct sockaddr_storage *ss) +{ + /* XXX What is a good default value? */ + return match_prefix (ss, default_labels, INT_MAX); +} + + +static int +get_precedence (const struct sockaddr_storage *ss) +{ + /* XXX What is a good default value? */ + return match_prefix (ss, default_precedence, 0); +} + + +static int +rfc3484_sort (const void *p1, const void *p2) +{ + const struct sort_result *a1 = (const struct sort_result *) p1; + const struct sort_result *a2 = (const struct sort_result *) p2; + + /* Rule 1: Avoid unusable destinations. + We have the got_source_addr flag set if the destination is reachable. */ + if (a1->got_source_addr && ! a2->got_source_addr) + return -1; + if (! a1->got_source_addr && a2->got_source_addr) + return 1; + + + /* Rule 2: Prefer matching scope. Only interesting if both + destination addresses are IPv6. */ + int a1_dst_scope + = get_scope ((struct sockaddr_storage *) a1->dest_addr->ai_addr); + + int a2_dst_scope + = get_scope ((struct sockaddr_storage *) a2->dest_addr->ai_addr); + + if (a1->got_source_addr) + { + int a1_src_scope = get_scope (&a1->source_addr); + int a2_src_scope = get_scope (&a2->source_addr); + + if (a1_dst_scope == a1_src_scope && a2_dst_scope != a2_src_scope) + return -1; + if (a1_dst_scope != a1_src_scope && a2_dst_scope == a2_src_scope) + return 1; + } + + + /* Rule 3: Avoid deprecated addresses. + That's something only the kernel could decide. */ + + /* Rule 4: Prefer home addresses. + Another thing only the kernel can decide. */ + + /* Rule 5: Prefer matching label. */ + if (a1->got_source_addr) + { + int a1_dst_label + = get_label ((struct sockaddr_storage *) a1->dest_addr->ai_addr); + int a1_src_label = get_label (&a1->source_addr); + + int a2_dst_label + = get_label ((struct sockaddr_storage *) a2->dest_addr->ai_addr); + int a2_src_label = get_label (&a2->source_addr); + + if (a1_dst_label == a1_src_label && a2_dst_label != a2_src_label) + return -1; + if (a1_dst_label != a1_src_label && a2_dst_label == a2_src_label) + return 1; + } + + + /* Rule 6: Prefer higher precedence. */ + int a1_prec + = get_precedence ((struct sockaddr_storage *) a1->dest_addr->ai_addr); + int a2_prec + = get_precedence ((struct sockaddr_storage *) a2->dest_addr->ai_addr); + + if (a1_prec > a2_prec) + return -1; + if (a1_prec < a2_prec) + return 1; + + + /* Rule 7: Prefer native transport. + XXX How to recognize tunnels? */ + + + /* Rule 8: Prefer smaller scope. */ + if (a1_dst_scope < a2_dst_scope) + return -1; + if (a1_dst_scope > a2_dst_scope) + return 1; + + + /* Rule 9: Use longest matching prefix. */ + if (a1->got_source_addr + && a1->dest_addr->ai_family == a2->dest_addr->ai_family) + { + int bit1 = 0; + int bit2 = 0; + + if (a1->dest_addr->ai_family == PF_INET) + { + assert (a1->source_addr.ss_family == PF_INET); + assert (a2->source_addr.ss_family == PF_INET); + + struct sockaddr_in *in1_dst; + struct sockaddr_in *in1_src; + struct sockaddr_in *in2_dst; + struct sockaddr_in *in2_src; + + in1_dst = (struct sockaddr_in *) a1->dest_addr->ai_addr; + in1_src = (struct sockaddr_in *) &a1->source_addr; + in2_dst = (struct sockaddr_in *) a2->dest_addr->ai_addr; + in2_src = (struct sockaddr_in *) &a2->source_addr; + + bit1 = ffs (in1_dst->sin_addr.s_addr ^ in1_src->sin_addr.s_addr); + bit2 = ffs (in2_dst->sin_addr.s_addr ^ in2_src->sin_addr.s_addr); + } + else if (a1->dest_addr->ai_family == PF_INET6) + { + assert (a1->source_addr.ss_family == PF_INET6); + assert (a2->source_addr.ss_family == PF_INET6); + + struct sockaddr_in6 *in1_dst; + struct sockaddr_in6 *in1_src; + struct sockaddr_in6 *in2_dst; + struct sockaddr_in6 *in2_src; + + in1_dst = (struct sockaddr_in6 *) a1->dest_addr->ai_addr; + in1_src = (struct sockaddr_in6 *) &a1->source_addr; + in2_dst = (struct sockaddr_in6 *) a2->dest_addr->ai_addr; + in2_src = (struct sockaddr_in6 *) &a2->source_addr; + + int i; + for (i = 0; i < 4; ++i) + if (in1_dst->sin6_addr.s6_addr32[i] + != in1_src->sin6_addr.s6_addr32[i] + || (in2_dst->sin6_addr.s6_addr32[i] + != in2_src->sin6_addr.s6_addr32[i])) + break; + + if (i < 4) + { + bit1 = ffs (in1_dst->sin6_addr.s6_addr32[i] + ^ in1_src->sin6_addr.s6_addr32[i]); + bit2 = ffs (in2_dst->sin6_addr.s6_addr32[i] + ^ in2_src->sin6_addr.s6_addr32[i]); + } + } + + if (bit1 > bit2) + return -1; + if (bit1 < bit2) + return 1; + } + + + /* Rule 10: Otherwise, leave the order unchanged. */ + return 0; +} + + +int +getaddrinfo (const char *name, const char *service, + const struct addrinfo *hints, struct addrinfo **pai) +{ + int i = 0, j = 0, last_i = 0; + int nresults = 0; + struct addrinfo *p = NULL, **end; + struct gaih *g = gaih, *pg = NULL; + struct gaih_service gaih_service, *pservice; + struct addrinfo local_hints; + + if (name != NULL && name[0] == '*' && name[1] == 0) + name = NULL; + + if (service != NULL && service[0] == '*' && service[1] == 0) + service = NULL; + + if (name == NULL && service == NULL) + return EAI_NONAME; + + if (hints == NULL) + hints = &default_hints; + + if (hints->ai_flags + & ~(AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST|AI_ADDRCONFIG|AI_V4MAPPED +#ifdef HAVE_LIBIDN + |AI_IDN|AI_CANONIDN|AI_IDN_ALLOW_UNASSIGNED + |AI_IDN_USE_STD3_ASCII_RULES +#endif + |AI_NUMERICSERV|AI_ALL)) + return EAI_BADFLAGS; + + if ((hints->ai_flags & AI_CANONNAME) && name == NULL) + return EAI_BADFLAGS; + + if (hints->ai_flags & AI_ADDRCONFIG) + { + /* Determine whether we have IPv4 or IPv6 interfaces or both. + We cannot cache the results since new interfaces could be + added at any time. */ + bool seen_ipv4; + bool seen_ipv6; + __check_pf (&seen_ipv4, &seen_ipv6); + + /* Now make a decision on what we return, if anything. */ + if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6)) + { + /* If we haven't seen both IPv4 and IPv6 interfaces we can + narrow down the search. */ + if (! seen_ipv4 || ! seen_ipv6) + { + local_hints = *hints; + local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6; + hints = &local_hints; + } + } + else if ((hints->ai_family == PF_INET && ! seen_ipv4) + || (hints->ai_family == PF_INET6 && ! seen_ipv6)) + /* We cannot possibly return a valid answer. */ + return EAI_NONAME; + } + + if (service && service[0]) + { + char *c; + gaih_service.name = service; + gaih_service.num = strtoul (gaih_service.name, &c, 10); + if (*c != '\0') + { + if (hints->ai_flags & AI_NUMERICSERV) + return EAI_NONAME; + + gaih_service.num = -1; + } + + pservice = &gaih_service; + } + else + pservice = NULL; + + if (pai) + end = &p; + else + end = NULL; + + while (g->gaih) + { + if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC) + { + j++; + if (pg == NULL || pg->gaih != g->gaih) + { + pg = g; + i = g->gaih (name, pservice, hints, end); + if (i != 0) + { + /* EAI_NODATA is a more specific result as it says that + we found a result but it is not usable. */ + if (last_i != (GAIH_OKIFUNSPEC | -EAI_NODATA)) + last_i = i; + + if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC)) + { + ++g; + continue; + } + + freeaddrinfo (p); + + return -(i & GAIH_EAI); + } + if (end) + while (*end) + { + end = &((*end)->ai_next); + ++nresults; + } + } + } + ++g; + } + + if (j == 0) + return EAI_FAMILY; + + if (nresults > 1) + { + /* Sort results according to RFC 3484. */ + struct sort_result results[nresults]; + struct addrinfo *q; + struct addrinfo *last = NULL; + char *canonname = NULL; + + for (i = 0, q = p; q != NULL; ++i, last = q, q = q->ai_next) + { + results[i].dest_addr = q; + results[i].got_source_addr = false; + + /* If we just looked up the address for a different + protocol, reuse the result. */ + if (last != NULL && last->ai_addrlen == q->ai_addrlen + && memcmp (last->ai_addr, q->ai_addr, q->ai_addrlen) == 0) + { + memcpy (&results[i].source_addr, &results[i - 1].source_addr, + results[i - 1].source_addr_len); + results[i].source_addr_len = results[i - 1].source_addr_len; + results[i].got_source_addr = results[i - 1].got_source_addr; + } + else + { + /* We overwrite the type with SOCK_DGRAM since we do not + want connect() to connect to the other side. If we + cannot determine the source address remember this + fact. */ + int fd = socket (q->ai_family, SOCK_DGRAM, IPPROTO_IP); + socklen_t sl = sizeof (results[i].source_addr); + if (fd != -1 + && connect (fd, q->ai_addr, q->ai_addrlen) == 0 + && getsockname (fd, + (struct sockaddr *) &results[i].source_addr, + &sl) == 0) + { + results[i].source_addr_len = sl; + results[i].got_source_addr = true; + } + else + /* Just make sure that if we have to process the same + address again we do not copy any memory. */ + results[i].source_addr_len = 0; + + if (fd != -1) + close_not_cancel_no_status (fd); + } + + /* Remember the canonical name. */ + if (q->ai_canonname != NULL) + { + assert (canonname == NULL); + canonname = q->ai_canonname; + q->ai_canonname = NULL; + } + } + + /* We got all the source addresses we can get, now sort using + the information. */ + qsort (results, nresults, sizeof (results[0]), rfc3484_sort); + + /* Queue the results up as they come out of sorting. */ + q = p = results[0].dest_addr; + for (i = 1; i < nresults; ++i) + q = q->ai_next = results[i].dest_addr; + q->ai_next = NULL; + + /* Fill in the canonical name into the new first entry. */ + p->ai_canonname = canonname; + } + + if (p) + { + *pai = p; + return 0; + } + + if (pai == NULL && last_i == 0) + return 0; + + return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME; +} +libc_hidden_def (getaddrinfo) + +static_link_warning (getaddrinfo) + +void +freeaddrinfo (struct addrinfo *ai) +{ + struct addrinfo *p; + + while (ai != NULL) + { + p = ai; + ai = ai->ai_next; + free (p->ai_canonname); + free (p); + } +} +libc_hidden_def (freeaddrinfo)
getaddrinfo.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ether_ntoa.c =================================================================== --- ether_ntoa.c (nonexistent) +++ ether_ntoa.c (revision 520) @@ -0,0 +1,30 @@ +/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +char * +ether_ntoa (const struct ether_addr *addr) +{ + static char asc[18]; + + return ether_ntoa_r (addr, asc); +}
ether_ntoa.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rpc-lookup.c =================================================================== --- rpc-lookup.c (nonexistent) +++ rpc-lookup.c (revision 520) @@ -0,0 +1,22 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#define DATABASE_NAME rpc + +#include "XXX-lookup.c"
rpc-lookup.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.