source: trunk/third/ssh/includes.h @ 12646

Revision 12646, 9.3 KB checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12645, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2
3includes.h
4
5Author: Tatu Ylonen <ylo@cs.hut.fi>
6
7Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8                   All rights reserved
9
10Created: Thu Mar 23 16:29:37 1995 ylo
11
12This file includes most of the needed system headers.
13
14*/
15
16/*
17 * $Id: includes.h,v 1.1.1.4 1999-03-08 17:43:37 danw Exp $
18 * $Log: not supported by cvs2svn $
19 * Revision 1.12  1998/04/30  01:51:53  kivinen
20 *      Added linux sparc fix.
21 *
22 * Revision 1.11  1998/01/21 14:01:11  kivinen
23 *      Fixed bug raported Paul J. Sanchez <paul@spectrum.slu.edu>
24 *      about S_ISLNK macro defination.
25 *
26 * Revision 1.10  1998/01/02 06:18:20  kivinen
27 *      Added sys/resource.h include. Added _S_IFLNK and S_ISLNK
28 *      defines if not defined by system.
29 *
30 * Revision 1.9  1997/03/19 18:02:19  kivinen
31 *      Added SECURE_RPC, SECURE_NFS and NIS_PLUS support from Andy
32 *      Polyakov <appro@fy.chalmers.se>.
33 *
34 * Revision 1.8  1996/10/14 16:16:19  ttsalo
35 *       Support for OpenBSD (from Thorsten Lockert <tholo@SigmaSoft.COM>
36 *
37 * Revision 1.7  1996/10/14 02:37:12  ylo
38 *      Removed spaces from error tokens so that compiler reports the
39 *      error in the right place.
40 *
41 * Revision 1.6  1996/10/07 11:40:20  ttsalo
42 *      Configuring for hurd and a small fix to do_popen()
43 *      from "Charles M. Hannum" <mycroft@gnu.ai.mit.edu> added.
44 *
45 * Revision 1.5  1996/08/11 22:30:59  ylo
46 *      Changed the way machine/endian.h include is tested (no longer
47 *      lists specific systems).
48 *      Added optional defines of _S_IFMT and _S_IFDIR.
49 *
50 * Revision 1.4  1996/07/12 07:19:23  ttsalo
51 *      SCO v5 support
52 *
53 * Revision 1.3  1996/04/26 00:33:48  ylo
54 *      Added support for HPUX 7.x.
55 *
56 * Revision 1.2  1996/04/22 23:40:42  huima
57 * Added #define SUPPORT_OLD_CHANNELS.
58 *
59 * Revision 1.1.1.1  1996/02/18  21:38:10  ylo
60 *      Imported ssh-1.2.13.
61 *
62 * Revision 1.12  1995/10/02  01:22:37  ylo
63 *      Added machine/endian.h on Paragon.
64 *
65 * Revision 1.11  1995/09/27  02:14:08  ylo
66 *      Added support for SCO unix.
67 *
68 * Revision 1.10  1995/09/21  17:11:28  ylo
69 *      Added Paragon support.
70 *      Added definition of AF_UNIX_SIZE.
71 *
72 * Revision 1.9  1995/09/13  11:57:21  ylo
73 *      Changed the code so that "short" gets used as word32 on Cray.
74 *      Some of the code depends on that.  (BTW, "short" has really
75 *      weird semantics on Cray...)
76 *
77 * Revision 1.8  1995/09/11  17:35:27  ylo
78 *      Define word32 properly if any int type is 32 bits.
79 *
80 * Revision 1.7  1995/08/18  22:54:59  ylo
81 *      Added using netinet/in_system.h if netinet/in_systm.h does not
82 *      exist (some old linux versions, at least).
83 *
84 *      Added support for NextStep.
85 *
86 * Revision 1.6  1995/07/27  03:27:46  ylo
87 *      Moved sparc HAVE_SYS_IOCTL_H stuff to the proper place.
88 *
89 * Revision 1.5  1995/07/26  23:35:32  ylo
90 *      Undef HAVE_VHANGUP on Sony News.
91 *
92 * Revision 1.4  1995/07/26  23:15:05  ylo
93 *      Include version.h.
94 *      Fixed SIZEOF_LONG test.
95 *      Added ultrix specific porting stuff.
96 *      Added sparc/sunos specific porting stuff.
97 *
98 * Revision 1.3  1995/07/13  01:46:00  ylo
99 *      Added snabb's patches for IRIX 4.
100 *
101 * Revision 1.2  1995/07/13  01:25:11  ylo
102 *      Removed "Last modified" header.
103 *      Added cvs log.
104 *
105 * $Endlog$
106 */
107
108#ifndef INCLUDES_H
109#define INCLUDES_H
110
111/* Note: autoconf documentation tells to use the <...> syntax and have -I. */
112#include <config.h>
113
114#include "version.h"
115
116typedef unsigned short word16;
117
118#if SIZEOF_LONG == 4
119typedef unsigned long word32;
120#else
121#if SIZEOF_INT == 4
122typedef unsigned int word32;
123#else
124#if SIZEOF_SHORT >= 4
125typedef unsigned short word32;
126#else
127YOU_LOSE
128#endif
129#endif
130#endif
131
132#if defined(SCO) && !defined(SCO5)
133/* this is defined so that winsize gets ifdef'd in termio.h */
134#define _IBCS2
135#endif
136
137#if defined(__mips)
138/* Mach3 on MIPS defines conflicting garbage. */
139#define uint32 hidden_uint32
140#endif /* __mips */
141#include <sys/types.h>
142#if defined(__mips)
143#undef uint32
144#endif /* __mips */
145
146#ifdef HAVE_MACHINE_ENDIAN_H
147#include <sys/param.h>
148#include <machine/endian.h>
149#endif
150
151#if defined(linux)
152#include <endian.h>
153#endif
154
155#include <stdio.h>
156#include <ctype.h>
157#include <sys/stat.h>
158#include <errno.h>
159#include <fcntl.h>
160#include <assert.h>
161#include <signal.h>
162
163#ifdef sparc
164#ifdef linux
165#undef HAVE_UTMPX_H
166#else
167#undef HAVE_SYS_IOCTL_H
168#endif
169#endif
170
171#ifdef HAVE_SYS_IOCTL_H
172#include <sys/ioctl.h>
173#endif /* HAVE_SYS_IOCTL_H */
174
175#ifdef HAVE_TERMIOS_H
176#include <termios.h>
177#define USING_TERMIOS
178#endif /* HAVE_TERMIOS_H */
179
180#if defined(HAVE_SGTTY_H) && !defined(USING_TERMIOS)
181#include <sgtty.h>
182#define USING_SGTTY
183#endif
184
185#if !defined(USING_SGTTY) && !defined(USING_TERMIOS)
186  ERROR NO TERMIOS OR SGTTY
187#endif
188
189#ifdef STDC_HEADERS
190#include <stdlib.h>
191#include <string.h>
192#include <stdarg.h>
193#else /* STDC_HEADERS */
194/* stdarg.h is present almost everywhere, and comes with gcc; I am too lazy
195   to make things work with both it and varargs. */
196#include <stdarg.h>
197#ifndef HAVE_STRCHR
198#define strchr index
199#define strrchr rindex
200#endif
201char *strchr(), *strrchr();
202#ifndef HAVE_MEMCPY
203#define memcpy(d, s, n) bcopy((s), (d), (n))
204#define memmove(d, s, n) bcopy((s), (d), (n))
205#define memset(d, ch, n) bzero((d), (n)) /* We only memset to 0. */
206#define memcmp(a, b, n) bcmp((a), (b), (n))
207#endif
208#endif /* STDC_HEADERS */
209
210#include <sys/socket.h>
211#include <netinet/in.h>
212#ifdef HAVE_NETINET_IN_SYSTM_H
213#include <netinet/in_systm.h>
214#else /* Some old linux systems at least have in_system.h instead. */
215#ifdef HAVE_NETINET_IN_SYSTEM_H
216#include <netinet/in_system.h>
217#endif /* HAVE_NETINET_IN_SYSTEM_H */
218#endif /* HAVE_NETINET_IN_SYSTM_H */
219#ifdef __OpenBSD__
220#include <netgroup.h>
221#include <util.h>
222#endif
223#ifdef SCO
224/* SCO does not have a un.h and there is no appropriate substitute. */
225/* Latest news: it doesn't have AF_UNIX at all, but this allows
226   it to compile, and outgoing forwarded connections appear to work. */
227struct  sockaddr_un {
228        short   sun_family;             /* AF_UNIX */
229        char    sun_path[108];          /* path name (gag) */
230};
231/* SCO needs sys/stream.h and sys/ptem.h */
232#include <sys/stream.h>
233#include <sys/ptem.h>
234#else /* SCO */
235#include <sys/un.h>
236#endif /* SCO */
237#ifdef HAVE_NETINET_IP_H
238#include <netinet/ip.h>
239#endif /* HAVE_NETINET_IP_H */
240#ifdef HAVE_NETINET_TCP_H
241#include <netinet/tcp.h>
242#endif /* HAVE_NETINET_TCP_H */
243#if defined(HPSUX7_KLUDGES)
244struct linger {
245        int             l_onoff;/* option on/off */
246        int             l_linger;       /* linger time */
247};
248#else /* normal system */
249#include <arpa/inet.h>
250#endif
251#include <netdb.h>
252#ifdef HAVE_SYS_SELECT_H
253#include <sys/select.h>
254#endif /* HAVE_SYS_SELECT_H */
255
256#include <pwd.h>
257#include <grp.h>
258#ifdef HAVE_GETSPNAM
259#include <shadow.h>
260#endif /* HAVE_GETSPNAM */
261
262#ifdef HAVE_SYS_WAIT_H
263#include <sys/wait.h>
264#else /* HAVE_SYS_WAIT_H */
265#if !defined(WNOHANG) /* && (defined(bsd43) || defined(vax)) */
266#define WNOHANG 1
267#endif
268#ifndef WEXITSTATUS
269#define WEXITSTATUS(X) ((unsigned)(X) >> 8)
270#endif
271#ifndef WIFEXITED
272#define WIFEXITED(X) (((X) & 255) == 0)
273#endif
274#ifndef WIFSIGNALED
275#define WIFSIGNALED(X) ((((X) & 255) != 0x255 && ((X) & 255) != 0))
276#endif
277#ifndef WTERMSIG
278#define WTERMSIG(X) ((X) & 255)
279#endif
280#endif /* HAVE_SYS_WAIT_H */
281
282#ifdef HAVE_UNISTD_H
283#include <unistd.h>
284#endif /* HAVE_UNISTD_H */
285
286#ifdef TIME_WITH_SYS_TIME
287#ifndef SCO
288/* I excluded <sys/time.h> to avoid redefinition of timeval
289   which SCO puts in both <sys/select.h> and <sys/time.h> */
290#include <sys/time.h>
291#endif /* SCO */
292#include <time.h>
293#else /* TIME_WITH_SYS_TIME */
294#ifdef HAVE_SYS_TIME_H
295#include <sys/time.h>
296#else /* HAVE_SYS_TIME_H */
297#include <time.h>
298#endif /* HAVE_SYS_TIME_H */
299#endif /* TIME_WITH_SYS_TIME */
300
301#if HAVE_SYS_RESOURCE_H
302#include <sys/resource.h>
303#endif
304
305#ifdef HAVE_PATHS_H
306#include <paths.h>
307#endif
308
309#if HAVE_DIRENT_H
310#include <dirent.h>
311#define NAMLEN(dirent) strlen((dirent)->d_name)
312#else
313#define dirent direct
314#define NAMLEN(dirent) (dirent)->d_namlen
315#if HAVE_SYS_NDIR_H
316#include <sys/ndir.h>
317#endif
318#if HAVE_SYS_DIR_H
319#include <sys/dir.h>
320#endif
321#if HAVE_NDIR_H
322#include <ndir.h>
323#endif
324#endif
325
326/* These POSIX macros are not defined in every system. */
327
328#ifndef S_IRWXU
329#define S_IRWXU 00700           /* read, write, execute: owner */
330#define S_IRUSR 00400           /* read permission: owner */
331#define S_IWUSR 00200           /* write permission: owner */
332#define S_IXUSR 00100           /* execute permission: owner */
333#define S_IRWXG 00070           /* read, write, execute: group */
334#define S_IRGRP 00040           /* read permission: group */
335#define S_IWGRP 00020           /* write permission: group */
336#define S_IXGRP 00010           /* execute permission: group */
337#define S_IRWXO 00007           /* read, write, execute: other */
338#define S_IROTH 00004           /* read permission: other */
339#define S_IWOTH 00002           /* write permission: other */
340#define S_IXOTH 00001           /* execute permission: other */
341#endif /* S_IRWXU */
342
343#ifndef S_ISUID
344#define S_ISUID 0x800
345#endif /* S_ISUID */
346#ifndef S_ISGID
347#define S_ISGID 0x400
348#endif /* S_ISGID */
349
350#ifndef S_ISDIR
351/* NextStep apparently fails to define this. */
352#define S_ISDIR(mode)   (((mode)&(_S_IFMT))==(_S_IFDIR))
353#endif
354#ifndef _S_IFMT
355#define _S_IFMT 0170000
356#endif
357#ifndef _S_IFDIR
358#define _S_IFDIR 0040000
359#endif
360#ifndef _S_IFLNK
361#define _S_IFLNK 0120000
362#endif
363#ifndef S_ISLNK
364#define S_ISLNK(mode) (((mode)&(_S_IFMT))==(_S_IFLNK))
365#endif
366
367#if USE_STRLEN_FOR_AF_UNIX
368#define AF_UNIX_SIZE(unaddr) \
369  (sizeof((unaddr).sun_family) + strlen((unaddr).sun_path) + 1)
370#else
371#define AF_UNIX_SIZE(unaddr) sizeof(unaddr)
372#endif
373
374#define SUPPORT_OLD_CHANNELS
375
376#ifdef _HPUX_SOURCE
377#define seteuid(uid) setresuid(-1,(uid),-1)
378#endif
379
380#endif /* INCLUDES_H */
Note: See TracBrowser for help on using the repository browser.