Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 1 | #include <sys/types.h> /* For u_intXX_t */ |
| 2 | #include <sys/socket.h> /* For SHUT_XXXX */ |
| 3 | |
| 4 | #ifdef HAVE_PATHS_H |
| 5 | # include <paths.h> /* For _PATH_XXX */ |
| 6 | #endif |
| 7 | |
| 8 | #ifdef HAVE_UTMP_H |
| 9 | # include <utmp.h> /* For _PATH_XXX */ |
| 10 | #endif |
| 11 | |
| 12 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
| 13 | # include <utmpx.h> /* For _PATH_XXX */ |
| 14 | #endif |
| 15 | |
| 16 | #ifdef HAVE_SYS_TIME_H |
| 17 | # include <sys/time.h> /* For timersub */ |
| 18 | #endif |
| 19 | |
| 20 | #ifdef HAVE_MAILLOCK_H |
Damien Miller | beb4ba5 | 1999-12-28 15:09:35 +1100 | [diff] [blame^] | 21 | # include <maillock.h> /* For _PATH_MAILDIR */ |
Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 22 | #endif |
| 23 | |
Damien Miller | beb4ba5 | 1999-12-28 15:09:35 +1100 | [diff] [blame^] | 24 | #ifdef HAVE_SYS_CDEFS_H |
| 25 | # include <sys/cdefs.h> /* For __P() */ |
| 26 | #endif |
| 27 | |
Damien Miller | 5a3e683 | 1999-12-27 09:48:56 +1100 | [diff] [blame] | 28 | #ifndef SHUT_RDWR |
| 29 | enum |
| 30 | { |
| 31 | SHUT_RD = 0, /* No more receptions. */ |
| 32 | SHUT_WR, /* No more transmissions. */ |
| 33 | SHUT_RDWR /* No more receptions or transmissions. */ |
| 34 | }; |
| 35 | # define SHUT_RD SHUT_RD |
| 36 | # define SHUT_WR SHUT_WR |
| 37 | # define SHUT_RDWR SHUT_RDWR |
| 38 | #endif |
| 39 | |
| 40 | /* If sys/types.h does not supply intXX_t, supply them ourselves */ |
| 41 | /* (or die trying) */ |
| 42 | #ifndef HAVE_INTXX_T |
| 43 | # if (SIZEOF_SHORT_INT == 2) |
| 44 | # define int16_t short int |
| 45 | # else |
| 46 | # error "16 bit int type not found." |
| 47 | # endif |
| 48 | # if (SIZEOF_INT == 4) |
| 49 | # define int32_t int |
| 50 | # else |
| 51 | # error "32 bit int type not found." |
| 52 | # endif |
| 53 | # if (SIZEOF_LONG_INT == 8) |
| 54 | # define int64_t long int |
| 55 | # else |
| 56 | # if (SIZEOF_LONG_LONG_INT == 8) |
| 57 | # define int64_t long long int |
| 58 | # else |
| 59 | # error "64 bit int type not found." |
| 60 | # endif |
| 61 | # endif |
| 62 | #endif |
| 63 | |
| 64 | /* If sys/types.h does not supply u_intXX_t, supply them ourselves */ |
| 65 | #ifndef HAVE_U_INTXX_T |
| 66 | # ifdef HAVE_UINTXX_T |
| 67 | # define u_int16_t uint16_t |
| 68 | # define u_int32_t uint32_t |
| 69 | # define u_int64_t uint64_t |
| 70 | # else |
| 71 | # if (SIZEOF_SHORT_INT == 2) |
| 72 | # define u_int16_t unsigned short int |
| 73 | # else |
| 74 | # error "16 bit int type not found." |
| 75 | # endif |
| 76 | # if (SIZEOF_INT == 4) |
| 77 | # define u_int32_t unsigned int |
| 78 | # else |
| 79 | # error "32 bit int type not found." |
| 80 | # endif |
| 81 | # if (SIZEOF_LONG_INT == 8) |
| 82 | # define u_int64_t unsigned long int |
| 83 | # else |
| 84 | # if (SIZEOF_LONG_LONG_INT == 8) |
| 85 | # define u_int64_t unsigned long long int |
| 86 | # else |
| 87 | # error "64 bit int type not found." |
| 88 | # endif |
| 89 | # endif |
| 90 | # endif |
| 91 | #endif |
| 92 | |
| 93 | /* If quad_t is not supplied, then supply it now. We can rely on int64_t */ |
| 94 | /* being defined by the above */ |
| 95 | #ifndef HAVE_QUAD_T |
| 96 | # define quad_t int64_t |
| 97 | #endif |
| 98 | |
| 99 | /* If _PATH_LASTLOG is not defined by system headers, set it to the */ |
| 100 | /* lastlog file detected by autoconf */ |
| 101 | #ifndef _PATH_LASTLOG |
| 102 | # ifdef LASTLOG_LOCATION |
| 103 | # define _PATH_LASTLOG LASTLOG_LOCATION |
| 104 | # endif |
| 105 | #endif |
| 106 | |
| 107 | #ifndef _PATH_UTMP |
| 108 | # ifdef UTMP_FILE |
| 109 | # define _PATH_UTMP UTMP_FILE |
| 110 | # else |
| 111 | # define _PATH_UTMP "/var/adm/utmp" |
| 112 | # endif |
| 113 | #endif |
| 114 | |
| 115 | #ifndef _PATH_WTMP |
| 116 | # ifdef WTMP_FILE |
| 117 | # define _PATH_WTMP WTMP_FILE |
| 118 | # else |
| 119 | # define _PATH_WTMP "/var/adm/wtmp" |
| 120 | # endif |
| 121 | #endif |
| 122 | |
| 123 | #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) |
| 124 | # ifndef _PATH_UTMPX |
| 125 | # ifdef UTMPX_FILE |
| 126 | # define _PATH_UTMPX UTMPX_FILE |
| 127 | # else |
| 128 | # define _PATH_UTMPX "/var/adm/utmpx" |
| 129 | # endif |
| 130 | # endif |
| 131 | # ifndef _PATH_WTMPX |
| 132 | # ifdef WTMPX_FILE |
| 133 | # define _PATH_WTMPX WTMPX_FILE |
| 134 | # else |
| 135 | # define _PATH_WTMPX "/var/adm/wtmp" |
| 136 | # endif |
| 137 | # endif |
| 138 | #endif |
| 139 | |
| 140 | #ifndef _PATH_BSHELL |
| 141 | # define _PATH_BSHELL "/bin/sh" |
| 142 | #endif |
| 143 | |
| 144 | #ifdef USER_PATH |
| 145 | # ifdef _PATH_STDPATH |
| 146 | # undef _PATH_STDPATH |
| 147 | # endif |
| 148 | # define _PATH_STDPATH USER_PATH |
| 149 | #endif |
| 150 | |
| 151 | #ifndef _PATH_STDPATH |
| 152 | # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" |
| 153 | #endif |
| 154 | |
| 155 | #ifndef _PATH_DEVNULL |
| 156 | # define _PATH_DEVNULL "/dev/null" |
| 157 | #endif |
| 158 | |
| 159 | #ifndef MAILDIR |
| 160 | # define MAILDIR MAIL_DIRECTORY |
| 161 | #endif |
| 162 | |
| 163 | #if !defined(_PATH_MAILDIR) && defined(MAILDIR) |
| 164 | # define _PATH_MAILDIR MAILDIR |
| 165 | #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */ |
| 166 | |
| 167 | #ifndef MAX |
| 168 | # define MAX(a,b) (((a)>(b))?(a):(b)) |
| 169 | # define MIN(a,b) (((a)<(b))?(a):(b)) |
| 170 | #endif |
| 171 | |
| 172 | #ifndef timersub |
| 173 | #define timersub(a, b, result) \ |
| 174 | do { \ |
| 175 | (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ |
| 176 | (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ |
| 177 | if ((result)->tv_usec < 0) { \ |
| 178 | --(result)->tv_sec; \ |
| 179 | (result)->tv_usec += 1000000; \ |
| 180 | } \ |
| 181 | } while (0) |
| 182 | #endif |
| 183 | |
| 184 | /* In older versions of libpam, pam_strerror takes a single argument */ |
| 185 | #ifdef HAVE_OLD_PAM |
| 186 | # define PAM_STRERROR(a,b) pam_strerror((b)) |
| 187 | #else |
| 188 | # define PAM_STRERROR(a,b) pam_strerror((a),(b)) |
| 189 | #endif |
| 190 | |
| 191 | #ifndef __P |
| 192 | # define __P(x) x |
| 193 | #endif |
| 194 | |
| 195 | #if !defined(__GNUC__) || (__GNUC__ < 2) |
| 196 | # define __attribute__(x) |
| 197 | #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */ |
| 198 | |
| 199 | #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) |
| 200 | # define seteuid(a) setreuid(-1,a) |
| 201 | #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ |
| 202 | |
| 203 | #ifndef HAVE_INNETGR |
| 204 | # define innetgr(a,b,c,d) (0) |
| 205 | #endif /* HAVE_INNETGR */ |
| 206 | |
| 207 | #ifndef _PATH_RSH |
| 208 | # ifdef RSH_PATH |
| 209 | # define _PATH_RSH RSH_PATH |
| 210 | # endif /* RSH_PATH */ |
| 211 | #endif /* _PATH_RSH */ |
Damien Miller | beb4ba5 | 1999-12-28 15:09:35 +1100 | [diff] [blame^] | 212 | |
| 213 | #if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) |
| 214 | # define USE_PAM |
| 215 | #endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */ |
| 216 | |