]> andersk Git - openssh.git/blob - defines.h
- Calls to pam_setcred, patch from Nalin Dahyabhai
[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 /* Paths */
110
111 /* If _PATH_LASTLOG is not defined by system headers, set it to the */
112 /* lastlog file detected by autoconf */
113 #ifndef _PATH_LASTLOG
114 # ifdef LASTLOG_LOCATION
115 #  define _PATH_LASTLOG LASTLOG_LOCATION
116 # endif
117 #endif
118
119 #ifndef _PATH_UTMP
120 # ifdef UTMP_FILE
121 #  define _PATH_UTMP UTMP_FILE
122 # else
123 #  define _PATH_UTMP "/var/adm/utmp"
124 # endif
125 #endif
126
127 #ifndef _PATH_WTMP
128 # ifdef WTMP_FILE
129 #  define _PATH_WTMP WTMP_FILE
130 # else
131 #  define _PATH_WTMP "/var/adm/wtmp"
132 # endif
133 #endif
134
135 #if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
136 # ifndef _PATH_UTMPX
137 #  ifdef UTMPX_FILE
138 #   define _PATH_UTMPX UTMPX_FILE
139 #  else
140 #   define _PATH_UTMPX "/var/adm/utmpx"
141 #  endif
142 # endif
143 # ifndef _PATH_WTMPX
144 #  ifdef WTMPX_FILE
145 #   define _PATH_WTMPX WTMPX_FILE
146 #  else
147 #   define _PATH_WTMPX "/var/adm/wtmp"
148 #  endif
149 # endif
150 #endif
151
152 #ifndef _PATH_BSHELL
153 # define _PATH_BSHELL "/bin/sh"
154 #endif
155
156 #ifdef USER_PATH
157 # ifdef _PATH_STDPATH
158 #  undef _PATH_STDPATH
159 # endif
160 # define _PATH_STDPATH USER_PATH
161 #endif
162
163 #ifndef _PATH_STDPATH
164 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
165 #endif
166
167 #ifndef _PATH_DEVNULL
168 # define _PATH_DEVNULL "/dev/null"
169 #endif
170
171 #ifndef MAILDIR
172 # define MAILDIR MAIL_DIRECTORY
173 #endif
174
175 #if !defined(_PATH_MAILDIR) && defined(MAILDIR)
176 # define _PATH_MAILDIR MAILDIR
177 #endif /* !defined(_PATH_MAILDIR) && defined(MAILDIR) */
178
179 #ifndef _PATH_RSH
180 # ifdef RSH_PATH
181 #  define _PATH_RSH RSH_PATH
182 # endif /* RSH_PATH */
183 #endif /* _PATH_RSH */
184
185 /* Macros */
186
187 #ifndef MAX
188 # define MAX(a,b) (((a)>(b))?(a):(b))
189 # define MIN(a,b) (((a)<(b))?(a):(b))
190 #endif
191
192 #ifndef timersub
193 #define timersub(a, b, result)                                                                            \
194    do {                                                                                                                                           \
195       (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;           \
196       (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;        \
197       if ((result)->tv_usec < 0) {                            \
198          --(result)->tv_sec;                                  \
199          (result)->tv_usec += 1000000;                        \
200       }                                                       \
201    } while (0)
202 #endif
203
204 #ifndef __P
205 # define __P(x) x
206 #endif
207
208 #if !defined(__GNUC__) || (__GNUC__ < 2)
209 #  define __attribute__(x)
210 #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
211
212 #if defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM)
213 # define USE_PAM
214 #endif /* defined(HAVE_SECURITY_PAM_APPL_H) && !defined(DISABLE_PAM) */
215
216 /* Function replacement / compatibility hacks */
217
218 /* In older versions of libpam, pam_strerror takes a single argument */
219 #ifdef HAVE_OLD_PAM
220 # define PAM_STRERROR(a,b) pam_strerror((b))
221 #else
222 # define PAM_STRERROR(a,b) pam_strerror((a),(b))
223 #endif
224
225 #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID)
226 # define seteuid(a) setreuid(-1,a)
227 #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */
228
229 #ifndef HAVE_INNETGR
230 # define innetgr(a,b,c,d) (0)
231 #endif /* HAVE_INNETGR */
232
This page took 0.182079 seconds and 5 git commands to generate.