xref: /titanic_53/usr/src/lib/libwrap/tcpd.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
6*7c478bd9Sstevel@tonic-gate 
7*7c478bd9Sstevel@tonic-gate  /*
8*7c478bd9Sstevel@tonic-gate   * @(#) tcpd.h 1.5 96/03/19 16:22:24
9*7c478bd9Sstevel@tonic-gate   *
10*7c478bd9Sstevel@tonic-gate   * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
11*7c478bd9Sstevel@tonic-gate   */
12*7c478bd9Sstevel@tonic-gate 
13*7c478bd9Sstevel@tonic-gate /*
14*7c478bd9Sstevel@tonic-gate  * HAVE_IPV6 is traditionally configured at tcp_wrappers build time but for
15*7c478bd9Sstevel@tonic-gate  * Solaris it must always be defined to keep the library interface binary
16*7c478bd9Sstevel@tonic-gate  * compatible.
17*7c478bd9Sstevel@tonic-gate  */
18*7c478bd9Sstevel@tonic-gate #define	HAVE_IPV6
19*7c478bd9Sstevel@tonic-gate 
20*7c478bd9Sstevel@tonic-gate /* Structure to describe one communications endpoint. */
21*7c478bd9Sstevel@tonic-gate 
22*7c478bd9Sstevel@tonic-gate #define STRING_LENGTH	128		/* hosts, users, processes */
23*7c478bd9Sstevel@tonic-gate 
24*7c478bd9Sstevel@tonic-gate #include <sys/socket.h>
25*7c478bd9Sstevel@tonic-gate #include <netinet/in.h>
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate typedef struct sockaddr_gen {
28*7c478bd9Sstevel@tonic-gate     union {
29*7c478bd9Sstevel@tonic-gate 	struct sockaddr	_sg_sa;
30*7c478bd9Sstevel@tonic-gate 	struct sockaddr_in	_sg_sin;
31*7c478bd9Sstevel@tonic-gate #ifdef HAVE_IPV6
32*7c478bd9Sstevel@tonic-gate 	struct sockaddr_in6	_sg_sin6;
33*7c478bd9Sstevel@tonic-gate #endif
34*7c478bd9Sstevel@tonic-gate     } sg_addr;
35*7c478bd9Sstevel@tonic-gate } sockaddr_gen;
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate typedef union gen_addr {
38*7c478bd9Sstevel@tonic-gate     struct in_addr	ga_in;
39*7c478bd9Sstevel@tonic-gate #ifdef HAVE_IPV6
40*7c478bd9Sstevel@tonic-gate     struct in6_addr	ga_in6;
41*7c478bd9Sstevel@tonic-gate #endif
42*7c478bd9Sstevel@tonic-gate } gen_addr;
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate extern void sockgen_simplify();
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #define sg_sa		sg_addr._sg_sa
47*7c478bd9Sstevel@tonic-gate #define sg_sin		sg_addr._sg_sin
48*7c478bd9Sstevel@tonic-gate #define sg_sin6		sg_addr._sg_sin6
49*7c478bd9Sstevel@tonic-gate #define sg_family	sg_sa.sa_family
50*7c478bd9Sstevel@tonic-gate #ifdef HAVE_IPV6
51*7c478bd9Sstevel@tonic-gate #define SGADDRSZ(sag)		((sag)->sg_family == AF_INET6 ? \
52*7c478bd9Sstevel@tonic-gate 				    sizeof (struct in6_addr) : \
53*7c478bd9Sstevel@tonic-gate 				    sizeof (struct in_addr))
54*7c478bd9Sstevel@tonic-gate #define SGSOCKADDRSZ(sag)	((sag)->sg_family == AF_INET6 ? \
55*7c478bd9Sstevel@tonic-gate 				    sizeof (struct sockaddr_in6) : \
56*7c478bd9Sstevel@tonic-gate 				    sizeof (struct sockaddr_in))
57*7c478bd9Sstevel@tonic-gate #define SGPORT(sag)		(*((sag)->sg_family == AF_INET6 ? \
58*7c478bd9Sstevel@tonic-gate 				    &(sag)->sg_sin6.sin6_port : \
59*7c478bd9Sstevel@tonic-gate 				    &(sag)->sg_sin.sin_port))
60*7c478bd9Sstevel@tonic-gate #define SGADDRP(sag)		(((sag)->sg_family == AF_INET6 ? \
61*7c478bd9Sstevel@tonic-gate 				    (char *) &(sag)->sg_sin6.sin6_addr : \
62*7c478bd9Sstevel@tonic-gate 				    (char *) &(sag)->sg_sin.sin_addr))
63*7c478bd9Sstevel@tonic-gate #define SGFAM(sag)		((sag)->sg_family == AF_INET6 ? \
64*7c478bd9Sstevel@tonic-gate 				    AF_INET6 : AF_INET)
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate #define SG_IS_UNSPECIFIED(sag) \
67*7c478bd9Sstevel@tonic-gate 		((sag)->sg_family == AF_INET6 ? \
68*7c478bd9Sstevel@tonic-gate 			IN6_IS_ADDR_UNSPECIFIED(&(sag)->sg_sin6.sin6_addr) : \
69*7c478bd9Sstevel@tonic-gate 			(sag)->sg_sin.sin_addr.s_addr == 0)
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate #define VALID_ADDRTYPE(t)	((t) == AF_INET || (t) == AF_INET6)
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate #ifndef IPV6_ABITS
74*7c478bd9Sstevel@tonic-gate #define IPV6_ABITS 128			/* Size of IPV6 address in bits */
75*7c478bd9Sstevel@tonic-gate #endif
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #else /* HAVE_IPV6 */
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate #define SGADDRSZ(sag)		sizeof(struct in_addr)
80*7c478bd9Sstevel@tonic-gate #define SGSOCKADDRSZ(sag)	sizeof(struct sockaddr_in)
81*7c478bd9Sstevel@tonic-gate #define SGPORT(sag)		((sag)->sg_sin.sin_port)
82*7c478bd9Sstevel@tonic-gate #define SGADDRP(sag)		((char*) &(sag)->sg_sin.sin_addr)
83*7c478bd9Sstevel@tonic-gate #define SGFAM(sag)		AF_INET
84*7c478bd9Sstevel@tonic-gate #define SG_IS_UNSPECIFIED(sag)  ((sag)->sg_sin.sin_addr.s_addr == 0)
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate #define VALID_ADDRTYPE(t)	((t) == AF_INET)
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate #endif /* HAVE_IPV6 */
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate struct host_info {
91*7c478bd9Sstevel@tonic-gate     char    name[STRING_LENGTH];	/* access via eval_hostname(host) */
92*7c478bd9Sstevel@tonic-gate     char    addr[STRING_LENGTH];	/* access via eval_hostaddr(host) */
93*7c478bd9Sstevel@tonic-gate     struct sockaddr_gen *sin;		/* socket address or 0 */
94*7c478bd9Sstevel@tonic-gate     struct t_unitdata *unit;		/* TLI transport address or 0 */
95*7c478bd9Sstevel@tonic-gate     struct request_info *request;	/* for shared information */
96*7c478bd9Sstevel@tonic-gate };
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate /* Structure to describe what we know about a service request. */
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate struct request_info {
101*7c478bd9Sstevel@tonic-gate     int     fd;				/* socket handle */
102*7c478bd9Sstevel@tonic-gate     char    user[STRING_LENGTH];	/* access via eval_user(request) */
103*7c478bd9Sstevel@tonic-gate     char    daemon[STRING_LENGTH];	/* access via eval_daemon(request) */
104*7c478bd9Sstevel@tonic-gate     char    pid[10];			/* access via eval_pid(request) */
105*7c478bd9Sstevel@tonic-gate     struct host_info client[1];		/* client endpoint info */
106*7c478bd9Sstevel@tonic-gate     struct host_info server[1];		/* server endpoint info */
107*7c478bd9Sstevel@tonic-gate     void  (*sink) ();			/* datagram sink function or 0 */
108*7c478bd9Sstevel@tonic-gate     void  (*hostname) ();		/* address to printable hostname */
109*7c478bd9Sstevel@tonic-gate     void  (*hostaddr) ();		/* address to printable address */
110*7c478bd9Sstevel@tonic-gate     void  (*cleanup) ();		/* cleanup function or 0 */
111*7c478bd9Sstevel@tonic-gate     struct netconfig *config;		/* netdir handle */
112*7c478bd9Sstevel@tonic-gate };
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate /* Common string operations. Less clutter should be more readable. */
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #define STRN_CPY(d,s,l)	{ strncpy((d),(s),(l)); (d)[(l)-1] = 0; }
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate #define STRN_EQ(x,y,l)	(strncasecmp((x),(y),(l)) == 0)
119*7c478bd9Sstevel@tonic-gate #define STRN_NE(x,y,l)	(strncasecmp((x),(y),(l)) != 0)
120*7c478bd9Sstevel@tonic-gate #define STR_EQ(x,y)	(strcasecmp((x),(y)) == 0)
121*7c478bd9Sstevel@tonic-gate #define STR_NE(x,y)	(strcasecmp((x),(y)) != 0)
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate  /*
124*7c478bd9Sstevel@tonic-gate   * Initially, all above strings have the empty value. Information that
125*7c478bd9Sstevel@tonic-gate   * cannot be determined at runtime is set to "unknown", so that we can
126*7c478bd9Sstevel@tonic-gate   * distinguish between `unavailable' and `not yet looked up'. A hostname
127*7c478bd9Sstevel@tonic-gate   * that we do not believe in is set to "paranoid".
128*7c478bd9Sstevel@tonic-gate   */
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate #define STRING_UNKNOWN	"unknown"	/* lookup failed */
131*7c478bd9Sstevel@tonic-gate #define STRING_PARANOID	"paranoid"	/* hostname conflict */
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate extern char unknown[];
134*7c478bd9Sstevel@tonic-gate extern char paranoid[];
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate #define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid))
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #ifdef HAVE_IPV6
139*7c478bd9Sstevel@tonic-gate #define NOT_INADDR(s) (strchr(s,':') == 0 && s[strspn(s,"0123456789./")] != 0)
140*7c478bd9Sstevel@tonic-gate #else
141*7c478bd9Sstevel@tonic-gate #define NOT_INADDR(s) (s[strspn(s,"0123456789./")] != 0)
142*7c478bd9Sstevel@tonic-gate #endif
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate /* Global functions. */
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
147*7c478bd9Sstevel@tonic-gate extern void fromhost();			/* get/validate client host info */
148*7c478bd9Sstevel@tonic-gate #else
149*7c478bd9Sstevel@tonic-gate #define fromhost sock_host		/* no TLI support needed */
150*7c478bd9Sstevel@tonic-gate #endif
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate extern int hosts_access();		/* access control */
153*7c478bd9Sstevel@tonic-gate extern void shell_cmd();		/* execute shell command */
154*7c478bd9Sstevel@tonic-gate extern char *percent_x();		/* do %<char> expansion */
155*7c478bd9Sstevel@tonic-gate extern void rfc931();			/* client name from RFC 931 daemon */
156*7c478bd9Sstevel@tonic-gate extern void clean_exit();		/* clean up and exit */
157*7c478bd9Sstevel@tonic-gate extern void refuse();			/* clean up and exit */
158*7c478bd9Sstevel@tonic-gate extern char *xgets();			/* fgets() on steroids */
159*7c478bd9Sstevel@tonic-gate extern char *split_at();		/* strchr() and split */
160*7c478bd9Sstevel@tonic-gate extern unsigned long dot_quad_addr();	/* restricted inet_addr() */
161*7c478bd9Sstevel@tonic-gate extern int numeric_addr();		/* IP4/IP6 inet_addr (restricted) */
162*7c478bd9Sstevel@tonic-gate extern struct hostent *tcpd_gethostbyname();
163*7c478bd9Sstevel@tonic-gate 					/* IP4/IP6 gethostbyname */
164*7c478bd9Sstevel@tonic-gate #ifdef HAVE_IPV6
165*7c478bd9Sstevel@tonic-gate extern char *skip_ipv6_addrs();		/* skip over colons in IPv6 addrs */
166*7c478bd9Sstevel@tonic-gate #else
167*7c478bd9Sstevel@tonic-gate #define skip_ipv6_addrs(x)	x
168*7c478bd9Sstevel@tonic-gate #endif
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate /* Global variables. */
171*7c478bd9Sstevel@tonic-gate 
172*7c478bd9Sstevel@tonic-gate extern int allow_severity;		/* for connection logging */
173*7c478bd9Sstevel@tonic-gate extern int deny_severity;		/* for connection logging */
174*7c478bd9Sstevel@tonic-gate extern char *hosts_allow_table;		/* for verification mode redirection */
175*7c478bd9Sstevel@tonic-gate extern char *hosts_deny_table;		/* for verification mode redirection */
176*7c478bd9Sstevel@tonic-gate extern int hosts_access_verbose;	/* for verbose matching mode */
177*7c478bd9Sstevel@tonic-gate extern int rfc931_timeout;		/* user lookup timeout */
178*7c478bd9Sstevel@tonic-gate extern int resident;			/* > 0 if resident process */
179*7c478bd9Sstevel@tonic-gate 
180*7c478bd9Sstevel@tonic-gate  /*
181*7c478bd9Sstevel@tonic-gate   * Routines for controlled initialization and update of request structure
182*7c478bd9Sstevel@tonic-gate   * attributes. Each attribute has its own key.
183*7c478bd9Sstevel@tonic-gate   */
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
186*7c478bd9Sstevel@tonic-gate extern struct request_info *request_init(struct request_info *,...);
187*7c478bd9Sstevel@tonic-gate extern struct request_info *request_set(struct request_info *,...);
188*7c478bd9Sstevel@tonic-gate #else
189*7c478bd9Sstevel@tonic-gate extern struct request_info *request_init();	/* initialize request */
190*7c478bd9Sstevel@tonic-gate extern struct request_info *request_set();	/* update request structure */
191*7c478bd9Sstevel@tonic-gate #endif
192*7c478bd9Sstevel@tonic-gate 
193*7c478bd9Sstevel@tonic-gate #define RQ_FILE		1		/* file descriptor */
194*7c478bd9Sstevel@tonic-gate #define RQ_DAEMON	2		/* server process (argv[0]) */
195*7c478bd9Sstevel@tonic-gate #define RQ_USER		3		/* client user name */
196*7c478bd9Sstevel@tonic-gate #define RQ_CLIENT_NAME	4		/* client host name */
197*7c478bd9Sstevel@tonic-gate #define RQ_CLIENT_ADDR	5		/* client host address */
198*7c478bd9Sstevel@tonic-gate #define RQ_CLIENT_SIN	6		/* client endpoint (internal) */
199*7c478bd9Sstevel@tonic-gate #define RQ_SERVER_NAME	7		/* server host name */
200*7c478bd9Sstevel@tonic-gate #define RQ_SERVER_ADDR	8		/* server host address */
201*7c478bd9Sstevel@tonic-gate #define RQ_SERVER_SIN	9		/* server endpoint (internal) */
202*7c478bd9Sstevel@tonic-gate 
203*7c478bd9Sstevel@tonic-gate  /*
204*7c478bd9Sstevel@tonic-gate   * Routines for delayed evaluation of request attributes. Each attribute
205*7c478bd9Sstevel@tonic-gate   * type has its own access method. The trivial ones are implemented by
206*7c478bd9Sstevel@tonic-gate   * macros. The other ones are wrappers around the transport-specific host
207*7c478bd9Sstevel@tonic-gate   * name, address, and client user lookup methods. The request_info and
208*7c478bd9Sstevel@tonic-gate   * host_info structures serve as caches for the lookup results.
209*7c478bd9Sstevel@tonic-gate   */
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate extern char *eval_user();		/* client user */
212*7c478bd9Sstevel@tonic-gate extern char *eval_hostname();		/* printable hostname */
213*7c478bd9Sstevel@tonic-gate extern char *eval_hostaddr();		/* printable host address */
214*7c478bd9Sstevel@tonic-gate extern char *eval_hostinfo();		/* host name or address */
215*7c478bd9Sstevel@tonic-gate extern char *eval_client();		/* whatever is available */
216*7c478bd9Sstevel@tonic-gate extern char *eval_server();		/* whatever is available */
217*7c478bd9Sstevel@tonic-gate #define eval_daemon(r)	((r)->daemon)	/* daemon process name */
218*7c478bd9Sstevel@tonic-gate #define eval_pid(r)	((r)->pid)	/* process id */
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate /* Socket-specific methods, including DNS hostname lookups. */
221*7c478bd9Sstevel@tonic-gate 
222*7c478bd9Sstevel@tonic-gate extern void sock_host();		/* look up endpoint addresses */
223*7c478bd9Sstevel@tonic-gate extern void sock_hostname();		/* translate address to hostname */
224*7c478bd9Sstevel@tonic-gate extern void sock_hostaddr();		/* address to printable address */
225*7c478bd9Sstevel@tonic-gate #define sock_methods(r) \
226*7c478bd9Sstevel@tonic-gate 	{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
227*7c478bd9Sstevel@tonic-gate 
228*7c478bd9Sstevel@tonic-gate /* The System V Transport-Level Interface (TLI) interface. */
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate #if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
231*7c478bd9Sstevel@tonic-gate extern void tli_host();			/* look up endpoint addresses etc. */
232*7c478bd9Sstevel@tonic-gate #endif
233*7c478bd9Sstevel@tonic-gate 
234*7c478bd9Sstevel@tonic-gate  /*
235*7c478bd9Sstevel@tonic-gate   * Problem reporting interface. Additional file/line context is reported
236*7c478bd9Sstevel@tonic-gate   * when available. The jump buffer (tcpd_buf) is not declared here, or
237*7c478bd9Sstevel@tonic-gate   * everyone would have to include <setjmp.h>.
238*7c478bd9Sstevel@tonic-gate   */
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
241*7c478bd9Sstevel@tonic-gate extern void tcpd_warn(char *, ...);	/* report problem and proceed */
242*7c478bd9Sstevel@tonic-gate extern void tcpd_jump(char *, ...);	/* report problem and jump */
243*7c478bd9Sstevel@tonic-gate #else
244*7c478bd9Sstevel@tonic-gate extern void tcpd_warn();
245*7c478bd9Sstevel@tonic-gate extern void tcpd_jump();
246*7c478bd9Sstevel@tonic-gate #endif
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate struct tcpd_context {
249*7c478bd9Sstevel@tonic-gate     char   *file;			/* current file */
250*7c478bd9Sstevel@tonic-gate     int     line;			/* current line */
251*7c478bd9Sstevel@tonic-gate };
252*7c478bd9Sstevel@tonic-gate extern struct tcpd_context tcpd_context;
253*7c478bd9Sstevel@tonic-gate 
254*7c478bd9Sstevel@tonic-gate  /*
255*7c478bd9Sstevel@tonic-gate   * While processing access control rules, error conditions are handled by
256*7c478bd9Sstevel@tonic-gate   * jumping back into the hosts_access() routine. This is cleaner than
257*7c478bd9Sstevel@tonic-gate   * checking the return value of each and every silly little function. The
258*7c478bd9Sstevel@tonic-gate   * (-1) returns are here because zero is already taken by longjmp().
259*7c478bd9Sstevel@tonic-gate   */
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate #define AC_PERMIT	1		/* permit access */
262*7c478bd9Sstevel@tonic-gate #define AC_DENY		(-1)		/* deny_access */
263*7c478bd9Sstevel@tonic-gate #define AC_ERROR	AC_DENY		/* XXX */
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate  /*
266*7c478bd9Sstevel@tonic-gate   * In verification mode an option function should just say what it would do,
267*7c478bd9Sstevel@tonic-gate   * instead of really doing it. An option function that would not return
268*7c478bd9Sstevel@tonic-gate   * should clear the dry_run flag to inform the caller of this unusual
269*7c478bd9Sstevel@tonic-gate   * behavior.
270*7c478bd9Sstevel@tonic-gate   */
271*7c478bd9Sstevel@tonic-gate 
272*7c478bd9Sstevel@tonic-gate extern void process_options();		/* execute options */
273*7c478bd9Sstevel@tonic-gate extern int dry_run;			/* verification flag */
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate /* Bug workarounds. */
276*7c478bd9Sstevel@tonic-gate 
277*7c478bd9Sstevel@tonic-gate #ifdef INET_ADDR_BUG			/* inet_addr() returns struct */
278*7c478bd9Sstevel@tonic-gate #define inet_addr fix_inet_addr
279*7c478bd9Sstevel@tonic-gate extern long fix_inet_addr();
280*7c478bd9Sstevel@tonic-gate #endif
281*7c478bd9Sstevel@tonic-gate 
282*7c478bd9Sstevel@tonic-gate #ifdef BROKEN_FGETS			/* partial reads from sockets */
283*7c478bd9Sstevel@tonic-gate #define fgets fix_fgets
284*7c478bd9Sstevel@tonic-gate extern char *fix_fgets();
285*7c478bd9Sstevel@tonic-gate #endif
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate #ifdef RECVFROM_BUG			/* no address family info */
288*7c478bd9Sstevel@tonic-gate #define recvfrom fix_recvfrom
289*7c478bd9Sstevel@tonic-gate extern int fix_recvfrom();
290*7c478bd9Sstevel@tonic-gate #endif
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate #ifdef GETPEERNAME_BUG			/* claims success with UDP */
293*7c478bd9Sstevel@tonic-gate #define getpeername fix_getpeername
294*7c478bd9Sstevel@tonic-gate extern int fix_getpeername();
295*7c478bd9Sstevel@tonic-gate #endif
296*7c478bd9Sstevel@tonic-gate 
297*7c478bd9Sstevel@tonic-gate #ifdef SOLARIS_24_GETHOSTBYNAME_BUG	/* lists addresses as aliases */
298*7c478bd9Sstevel@tonic-gate #define gethostbyname fix_gethostbyname
299*7c478bd9Sstevel@tonic-gate extern struct hostent *fix_gethostbyname();
300*7c478bd9Sstevel@tonic-gate #endif
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate #ifdef USE_STRSEP			/* libc calls strtok() */
303*7c478bd9Sstevel@tonic-gate #define strtok	fix_strtok
304*7c478bd9Sstevel@tonic-gate extern char *fix_strtok();
305*7c478bd9Sstevel@tonic-gate #endif
306*7c478bd9Sstevel@tonic-gate 
307*7c478bd9Sstevel@tonic-gate #ifdef LIBC_CALLS_STRTOK		/* libc calls strtok() */
308*7c478bd9Sstevel@tonic-gate #define strtok	my_strtok
309*7c478bd9Sstevel@tonic-gate extern char *my_strtok();
310*7c478bd9Sstevel@tonic-gate #endif
311