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