Damien Miller | 0e220db | 2004-06-15 10:34:08 +1000 | [diff] [blame] | 1 | /* $OpenBSD: includes.h,v 1.18 2004/06/13 15:03:02 djm Exp $ */ |
Ben Lindstrom | 36579d3 | 2001-01-29 07:39:26 +0000 | [diff] [blame] | 2 | |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 3 | /* |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 5 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
| 6 | * All rights reserved |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 7 | * This file includes most of the needed system headers. |
Damien Miller | 4af5130 | 2000-04-16 11:18:38 +1000 | [diff] [blame] | 8 | * |
Damien Miller | e4340be | 2000-09-16 13:29:08 +1100 | [diff] [blame] | 9 | * As far as I am concerned, the code I have written for this software |
| 10 | * can be used freely for any purpose. Any derived versions of this |
| 11 | * software must be clearly marked as such, and if the derived work is |
| 12 | * incompatible with the protocol description in the RFC file, it must be |
| 13 | * called by a name other than "ssh" or "Secure Shell". |
Damien Miller | 95def09 | 1999-11-25 00:26:21 +1100 | [diff] [blame] | 14 | */ |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 15 | |
| 16 | #ifndef INCLUDES_H |
| 17 | #define INCLUDES_H |
| 18 | |
| 19 | #define RCSID(msg) \ |
| 20 | static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } |
| 21 | |
Damien Miller | 4874c79 | 1999-11-16 13:29:26 +1100 | [diff] [blame] | 22 | #include "config.h" |
| 23 | |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 24 | #include <stdio.h> |
| 25 | #include <ctype.h> |
| 26 | #include <errno.h> |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 27 | #include <fcntl.h> /* For O_NONBLOCK */ |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 28 | #include <signal.h> |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 29 | #include <stdlib.h> |
| 30 | #include <string.h> |
| 31 | #include <stdarg.h> |
| 32 | #include <pwd.h> |
| 33 | #include <grp.h> |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 34 | #include <time.h> |
Damien Miller | d4a8b7e | 1999-10-27 13:42:43 +1000 | [diff] [blame] | 35 | #include <dirent.h> |
Damien Miller | 0e220db | 2004-06-15 10:34:08 +1000 | [diff] [blame] | 36 | #include <stddef.h> |
Damien Miller | 72c9a7e | 2000-09-24 11:10:13 +1100 | [diff] [blame] | 37 | |
Ben Lindstrom | 603bdfd | 2001-02-12 07:29:45 +0000 | [diff] [blame] | 38 | #ifdef HAVE_LIMITS_H |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 39 | # include <limits.h> /* For PATH_MAX */ |
Ben Lindstrom | 603bdfd | 2001-02-12 07:29:45 +0000 | [diff] [blame] | 40 | #endif |
Damien Miller | 72c9a7e | 2000-09-24 11:10:13 +1100 | [diff] [blame] | 41 | #ifdef HAVE_GETOPT_H |
Ben Lindstrom | 603bdfd | 2001-02-12 07:29:45 +0000 | [diff] [blame] | 42 | # include <getopt.h> |
Damien Miller | bac2d8a | 2000-09-05 16:13:06 +1100 | [diff] [blame] | 43 | #endif |
Damien Miller | beb4ba5 | 1999-12-28 15:09:35 +1100 | [diff] [blame] | 44 | #ifdef HAVE_BSTRING_H |
| 45 | # include <bstring.h> |
Kevin Steves | ef4eea9 | 2001-02-05 12:42:17 +0000 | [diff] [blame] | 46 | #endif |
Ben Lindstrom | 45b14db | 2001-03-17 01:15:38 +0000 | [diff] [blame] | 47 | #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \ |
| 48 | defined(GLOB_HAS_GL_MATCHC) |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 49 | # include <glob.h> |
| 50 | #endif |
Damien Miller | 3bd49ec | 1999-11-15 15:40:55 +1100 | [diff] [blame] | 51 | #ifdef HAVE_NETGROUP_H |
| 52 | # include <netgroup.h> |
Kevin Steves | ef4eea9 | 2001-02-05 12:42:17 +0000 | [diff] [blame] | 53 | #endif |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 54 | #ifdef HAVE_ENDIAN_H |
| 55 | # include <endian.h> |
| 56 | #endif |
Damien Miller | 348c9b7 | 2000-08-15 10:01:22 +1000 | [diff] [blame] | 57 | #ifdef HAVE_TTYENT_H |
| 58 | # include <ttyent.h> |
| 59 | #endif |
Ben Lindstrom | 42202bc | 2001-01-15 02:34:37 +0000 | [diff] [blame] | 60 | #ifdef HAVE_UTIME_H |
| 61 | # include <utime.h> |
| 62 | #endif |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 63 | #ifdef HAVE_MAILLOCK_H |
| 64 | # include <maillock.h> /* For _PATH_MAILDIR */ |
| 65 | #endif |
| 66 | #ifdef HAVE_NEXT |
| 67 | # include <libc.h> |
| 68 | #endif |
Damien Miller | 5fe46a4 | 2003-06-05 09:53:31 +1000 | [diff] [blame] | 69 | #define __USE_GNU /* before unistd.h, activate extra prototypes for glibc */ |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 70 | #include <unistd.h> /* For STDIN_FILENO, etc */ |
| 71 | #include <termios.h> /* Struct winsize */ |
| 72 | |
| 73 | /* |
| 74 | *-*-nto-qnx needs these headers for strcasecmp and LASTLOG_FILE respectively |
| 75 | */ |
| 76 | #ifdef HAVE_STRINGS_H |
| 77 | # include <strings.h> |
| 78 | #endif |
| 79 | #ifdef HAVE_LOGIN_H |
| 80 | # include <login.h> |
| 81 | #endif |
| 82 | |
| 83 | #ifdef HAVE_UTMP_H |
| 84 | # include <utmp.h> |
| 85 | #endif |
| 86 | #ifdef HAVE_UTMPX_H |
| 87 | # ifdef HAVE_TV_IN_UTMPX |
| 88 | # include <sys/time.h> |
| 89 | # endif |
| 90 | # include <utmpx.h> |
| 91 | #endif |
| 92 | #ifdef HAVE_LASTLOG_H |
| 93 | # include <lastlog.h> |
| 94 | #endif |
| 95 | #ifdef HAVE_PATHS_H |
| 96 | # include <paths.h> /* For _PATH_XXX */ |
| 97 | #endif |
| 98 | |
| 99 | #include <sys/types.h> |
| 100 | #include <sys/socket.h> |
| 101 | #include <sys/ioctl.h> |
| 102 | #include <sys/wait.h> |
| 103 | #ifdef HAVE_SYS_TIME_H |
| 104 | # include <sys/time.h> /* For timersub */ |
| 105 | #endif |
| 106 | #include <sys/resource.h> |
| 107 | #ifdef HAVE_SYS_SELECT_H |
| 108 | # include <sys/select.h> |
| 109 | #endif |
| 110 | #ifdef HAVE_SYS_BSDTTY_H |
| 111 | # include <sys/bsdtty.h> |
| 112 | #endif |
| 113 | #include <sys/param.h> /* For MAXPATHLEN and roundup() */ |
| 114 | #ifdef HAVE_SYS_UN_H |
| 115 | # include <sys/un.h> /* For sockaddr_un */ |
| 116 | #endif |
Tim Rice | eae876e | 2002-07-18 11:49:32 -0700 | [diff] [blame] | 117 | #ifdef HAVE_STDINT_H |
| 118 | # include <stdint.h> |
| 119 | #endif |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 120 | #ifdef HAVE_SYS_BITYPES_H |
| 121 | # include <sys/bitypes.h> /* For u_intXX_t */ |
| 122 | #endif |
| 123 | #ifdef HAVE_SYS_CDEFS_H |
| 124 | # include <sys/cdefs.h> /* For __P() */ |
| 125 | #endif |
| 126 | #ifdef HAVE_SYS_STAT_H |
| 127 | # include <sys/stat.h> /* For S_* constants and macros */ |
| 128 | #endif |
| 129 | #ifdef HAVE_SYS_SYSMACROS_H |
| 130 | # include <sys/sysmacros.h> /* For MIN, MAX, etc */ |
| 131 | #endif |
| 132 | #ifdef HAVE_SYS_MMAN_H |
| 133 | #include <sys/mman.h> /* for MAP_ANONYMOUS */ |
| 134 | #endif |
Darren Tucker | 5d0ccf3 | 2003-05-15 21:42:59 +1000 | [diff] [blame] | 135 | #ifdef HAVE_SYS_STRTIO_H |
| 136 | #include <sys/strtio.h> /* for TIOCCBRK on HP-UX */ |
| 137 | #endif |
Tim Rice | 2597bfd | 2004-01-26 19:03:39 -0800 | [diff] [blame] | 138 | #if defined(HAVE_SYS_PTMS_H) && defined(HAVE_DEV_PTMX) |
Darren Tucker | 0745935 | 2004-02-06 21:29:41 +1100 | [diff] [blame] | 139 | # if defined(HAVE_SYS_STREAM_H) |
| 140 | # include <sys/stream.h> /* reqd for queue_t on Solaris 2.5.1 */ |
| 141 | # endif |
Tim Rice | 2597bfd | 2004-01-26 19:03:39 -0800 | [diff] [blame] | 142 | #include <sys/ptms.h> /* for grantpt() and friends */ |
| 143 | #endif |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 144 | |
| 145 | #include <netinet/in_systm.h> /* For typedefs */ |
| 146 | #include <netinet/in.h> /* For IPv6 macros */ |
| 147 | #include <netinet/ip.h> /* For IPTOS macros */ |
| 148 | #include <netinet/tcp.h> |
| 149 | #include <arpa/inet.h> |
Darren Tucker | cc9fd54 | 2003-06-29 21:23:37 +1000 | [diff] [blame] | 150 | #if defined(HAVE_NETDB_H) |
| 151 | # include <netdb.h> |
| 152 | #endif |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 153 | #ifdef HAVE_RPC_TYPES_H |
| 154 | # include <rpc/types.h> /* For INADDR_LOOPBACK */ |
| 155 | #endif |
| 156 | #ifdef USE_PAM |
Damien Miller | 0f47c53 | 2004-01-02 18:01:30 +1100 | [diff] [blame] | 157 | #if defined(HAVE_SECURITY_PAM_APPL_H) |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 158 | # include <security/pam_appl.h> |
Damien Miller | 0f47c53 | 2004-01-02 18:01:30 +1100 | [diff] [blame] | 159 | #elif defined (HAVE_PAM_PAM_APPL_H) |
| 160 | # include <pam/pam_appl.h> |
| 161 | #endif |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 162 | #endif |
Damien Miller | f71d2a5 | 2002-05-13 15:14:08 +1000 | [diff] [blame] | 163 | #ifdef HAVE_READPASSPHRASE_H |
| 164 | # include <readpassphrase.h> |
| 165 | #endif |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 166 | |
Tim Rice | 81ed518 | 2002-09-25 17:38:46 -0700 | [diff] [blame] | 167 | #ifdef HAVE_IA_H |
| 168 | # include <ia.h> |
| 169 | #endif |
| 170 | |
| 171 | #ifdef HAVE_TMPDIR_H |
| 172 | # include <tmpdir.h> |
| 173 | #endif |
| 174 | |
Damien Miller | 7b3f58c | 2002-10-21 10:50:25 +1000 | [diff] [blame] | 175 | #ifdef HAVE_LIBUTIL_H |
| 176 | # include <libutil.h> /* Openpty on FreeBSD at least */ |
| 177 | #endif |
| 178 | |
Darren Tucker | 3c78c5e | 2004-01-23 22:03:10 +1100 | [diff] [blame] | 179 | #if defined(KRB5) && defined(USE_AFS) |
Darren Tucker | 409cb32 | 2004-01-05 22:36:51 +1100 | [diff] [blame] | 180 | # include <krb5.h> |
| 181 | # include <kafs.h> |
| 182 | #endif |
| 183 | |
Darren Tucker | 3d50c9b | 2004-08-15 00:01:48 +1000 | [diff] [blame] | 184 | /* |
| 185 | * On HP-UX 11.11, shadow.h and prot.h provide conflicting declarations |
| 186 | * of getspnam when _INCLUDE__STDC__ is defined, so we unset it here. |
| 187 | */ |
Darren Tucker | a56f191 | 2004-11-02 20:30:54 +1100 | [diff] [blame] | 188 | #ifdef GETSPNAM_CONFLICTING_DEFS |
Darren Tucker | 3d50c9b | 2004-08-15 00:01:48 +1000 | [diff] [blame] | 189 | # ifdef _INCLUDE__STDC__ |
| 190 | # undef _INCLUDE__STDC__ |
| 191 | # endif |
| 192 | #endif |
| 193 | |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 194 | #include <openssl/opensslv.h> /* For OPENSSL_VERSION_NUMBER */ |
| 195 | |
| 196 | #include "defines.h" |
| 197 | |
Damien Miller | ab18c41 | 1999-11-11 10:40:23 +1100 | [diff] [blame] | 198 | #include "version.h" |
Damien Miller | 3c02768 | 2001-03-14 11:39:45 +1100 | [diff] [blame] | 199 | #include "openbsd-compat/openbsd-compat.h" |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 200 | #include "openbsd-compat/bsd-nextstep.h" |
Damien Miller | 5f05637 | 2000-04-16 12:31:48 +1000 | [diff] [blame] | 201 | |
Tim Rice | 813f045 | 2002-04-11 20:35:39 -0700 | [diff] [blame] | 202 | #include "entropy.h" |
Ben Lindstrom | dc0594c | 2002-04-06 04:11:28 +0000 | [diff] [blame] | 203 | |
Damien Miller | 72c9a7e | 2000-09-24 11:10:13 +1100 | [diff] [blame] | 204 | #endif /* INCLUDES_H */ |