Globus Toolkit
6.0.1493989444
gsi_openssh
source
defines.h
1
/*
2
* Copyright (c) 1999-2003 Damien Miller. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
6
* are met:
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* 2. Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
*
13
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
*/
24
25
#ifndef _DEFINES_H
26
#define _DEFINES_H
27
28
/* $Id: defines.h,v 1.183 2014/09/02 19:33:26 djm Exp $ */
29
30
31
/* Constants */
32
33
#if defined(HAVE_DECL_SHUT_RD) && HAVE_DECL_SHUT_RD == 0
34
enum
35
{
36
SHUT_RD = 0,
/* No more receptions. */
37
SHUT_WR,
/* No more transmissions. */
38
SHUT_RDWR
/* No more receptions or transmissions. */
39
};
40
# define SHUT_RD SHUT_RD
41
# define SHUT_WR SHUT_WR
42
# define SHUT_RDWR SHUT_RDWR
43
#endif
44
45
/*
46
* Cygwin doesn't really have a notion of reserved ports. It is still
47
* is useful on the client side so for compatibility it defines as 1024 via
48
* netinet/in.h inside an enum. We * don't actually want that restriction
49
* so we want to set that to zero, but we can't do it direct in config.h
50
* because it'll cause a conflicting definition the first time we include
51
* netinet/in.h.
52
*/
53
54
#ifdef HAVE_CYGWIN
55
#define IPPORT_RESERVED 0
56
#endif
57
58
/*
59
* Definitions for IP type of service (ip_tos)
60
*/
61
#include <netinet/in_systm.h>
62
#include <netinet/ip.h>
63
#ifndef IPTOS_LOWDELAY
64
# define IPTOS_LOWDELAY 0x10
65
# define IPTOS_THROUGHPUT 0x08
66
# define IPTOS_RELIABILITY 0x04
67
# define IPTOS_LOWCOST 0x02
68
# define IPTOS_MINCOST IPTOS_LOWCOST
69
#endif
/* IPTOS_LOWDELAY */
70
71
/*
72
* Definitions for DiffServ Codepoints as per RFC2474
73
*/
74
#ifndef IPTOS_DSCP_AF11
75
# define IPTOS_DSCP_AF11 0x28
76
# define IPTOS_DSCP_AF12 0x30
77
# define IPTOS_DSCP_AF13 0x38
78
# define IPTOS_DSCP_AF21 0x48
79
# define IPTOS_DSCP_AF22 0x50
80
# define IPTOS_DSCP_AF23 0x58
81
# define IPTOS_DSCP_AF31 0x68
82
# define IPTOS_DSCP_AF32 0x70
83
# define IPTOS_DSCP_AF33 0x78
84
# define IPTOS_DSCP_AF41 0x88
85
# define IPTOS_DSCP_AF42 0x90
86
# define IPTOS_DSCP_AF43 0x98
87
# define IPTOS_DSCP_EF 0xb8
88
#endif
/* IPTOS_DSCP_AF11 */
89
#ifndef IPTOS_DSCP_CS0
90
# define IPTOS_DSCP_CS0 0x00
91
# define IPTOS_DSCP_CS1 0x20
92
# define IPTOS_DSCP_CS2 0x40
93
# define IPTOS_DSCP_CS3 0x60
94
# define IPTOS_DSCP_CS4 0x80
95
# define IPTOS_DSCP_CS5 0xa0
96
# define IPTOS_DSCP_CS6 0xc0
97
# define IPTOS_DSCP_CS7 0xe0
98
#endif
/* IPTOS_DSCP_CS0 */
99
#ifndef IPTOS_DSCP_EF
100
# define IPTOS_DSCP_EF 0xb8
101
#endif
/* IPTOS_DSCP_EF */
102
103
#ifndef PATH_MAX
104
# ifdef _POSIX_PATH_MAX
105
# define PATH_MAX _POSIX_PATH_MAX
106
# endif
107
#endif
108
109
#ifndef MAXPATHLEN
110
# ifdef PATH_MAX
111
# define MAXPATHLEN PATH_MAX
112
# else
/* PATH_MAX */
113
# define MAXPATHLEN 64
114
/* realpath uses a fixed buffer of size MAXPATHLEN, so force use of ours */
115
# ifndef BROKEN_REALPATH
116
# define BROKEN_REALPATH 1
117
# endif
/* BROKEN_REALPATH */
118
# endif
/* PATH_MAX */
119
#endif
/* MAXPATHLEN */
120
121
#ifndef HOST_NAME_MAX
122
# include "netdb.h"
/* for MAXHOSTNAMELEN */
123
# if defined(_POSIX_HOST_NAME_MAX)
124
# define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
125
# elif defined(MAXHOSTNAMELEN)
126
# define HOST_NAME_MAX MAXHOSTNAMELEN
127
# else
128
# define HOST_NAME_MAX 255
129
# endif
130
#endif
/* HOST_NAME_MAX */
131
132
#if defined(HAVE_DECL_MAXSYMLINKS) && HAVE_DECL_MAXSYMLINKS == 0
133
# define MAXSYMLINKS 5
134
#endif
135
136
#ifndef STDIN_FILENO
137
# define STDIN_FILENO 0
138
#endif
139
#ifndef STDOUT_FILENO
140
# define STDOUT_FILENO 1
141
#endif
142
#ifndef STDERR_FILENO
143
# define STDERR_FILENO 2
144
#endif
145
146
#ifndef NGROUPS_MAX
/* Disable groupaccess if NGROUP_MAX is not set */
147
#ifdef NGROUPS
148
#define NGROUPS_MAX NGROUPS
149
#else
150
#define NGROUPS_MAX 0
151
#endif
152
#endif
153
154
#if defined(HAVE_DECL_O_NONBLOCK) && HAVE_DECL_O_NONBLOCK == 0
155
# define O_NONBLOCK 00004
/* Non Blocking Open */
156
#endif
157
158
#ifndef S_IFSOCK
159
# define S_IFSOCK 0
160
#endif
/* S_IFSOCK */
161
162
#ifndef S_ISDIR
163
# define S_ISDIR(mode) (((mode) & (_S_IFMT)) == (_S_IFDIR))
164
#endif
/* S_ISDIR */
165
166
#ifndef S_ISREG
167
# define S_ISREG(mode) (((mode) & (_S_IFMT)) == (_S_IFREG))
168
#endif
/* S_ISREG */
169
170
#ifndef S_ISLNK
171
# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
172
#endif
/* S_ISLNK */
173
174
#ifndef S_IXUSR
175
# define S_IXUSR 0000100
/* execute/search permission, */
176
# define S_IXGRP 0000010
/* execute/search permission, */
177
# define S_IXOTH 0000001
/* execute/search permission, */
178
# define _S_IWUSR 0000200
/* write permission, */
179
# define S_IWUSR _S_IWUSR
/* write permission, owner */
180
# define S_IWGRP 0000020
/* write permission, group */
181
# define S_IWOTH 0000002
/* write permission, other */
182
# define S_IRUSR 0000400
/* read permission, owner */
183
# define S_IRGRP 0000040
/* read permission, group */
184
# define S_IROTH 0000004
/* read permission, other */
185
# define S_IRWXU 0000700
/* read, write, execute */
186
# define S_IRWXG 0000070
/* read, write, execute */
187
# define S_IRWXO 0000007
/* read, write, execute */
188
#endif
/* S_IXUSR */
189
190
#if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
191
#define MAP_ANON MAP_ANONYMOUS
192
#endif
193
194
#ifndef MAP_FAILED
195
# define MAP_FAILED ((void *)-1)
196
#endif
197
198
/*
199
SCO Open Server 3 has INADDR_LOOPBACK defined in rpc/rpc.h but
200
including rpc/rpc.h breaks Solaris 6
201
*/
202
#ifndef INADDR_LOOPBACK
203
#define INADDR_LOOPBACK ((u_long)0x7f000001)
204
#endif
205
206
/* Types */
207
208
/* If sys/types.h does not supply intXX_t, supply them ourselves */
209
/* (or die trying) */
210
211
#ifndef HAVE_U_INT
212
typedef
unsigned
int
u_int;
213
#endif
214
215
#ifndef HAVE_INTXX_T
216
typedef
signed
char
int8_t;
217
# if (SIZEOF_SHORT_INT == 2)
218
typedef
short
int
int16_t;
219
# else
220
# ifdef _UNICOS
221
# if (SIZEOF_SHORT_INT == 4)
222
typedef
short
int16_t;
223
# else
224
typedef
long
int16_t;
225
# endif
226
# else
227
# error "16 bit int type not found."
228
# endif
/* _UNICOS */
229
# endif
230
# if (SIZEOF_INT == 4)
231
typedef
int
int32_t;
232
# else
233
# ifdef _UNICOS
234
typedef
long
int32_t;
235
# else
236
# error "32 bit int type not found."
237
# endif
/* _UNICOS */
238
# endif
239
#endif
240
241
/* If sys/types.h does not supply u_intXX_t, supply them ourselves */
242
#ifndef HAVE_U_INTXX_T
243
# ifdef HAVE_UINTXX_T
244
typedef
uint8_t u_int8_t;
245
typedef
uint16_t u_int16_t;
246
typedef
uint32_t u_int32_t;
247
# define HAVE_U_INTXX_T 1
248
# else
249
typedef
unsigned
char
u_int8_t;
250
# if (SIZEOF_SHORT_INT == 2)
251
typedef
unsigned
short
int
u_int16_t;
252
# else
253
# ifdef _UNICOS
254
# if (SIZEOF_SHORT_INT == 4)
255
typedef
unsigned
short
u_int16_t;
256
# else
257
typedef
unsigned
long
u_int16_t;
258
# endif
259
# else
260
# error "16 bit int type not found."
261
# endif
262
# endif
263
# if (SIZEOF_INT == 4)
264
typedef
unsigned
int
u_int32_t;
265
# else
266
# ifdef _UNICOS
267
typedef
unsigned
long
u_int32_t;
268
# else
269
# error "32 bit int type not found."
270
# endif
271
# endif
272
# endif
273
#define __BIT_TYPES_DEFINED__
274
#endif
275
276
/* 64-bit types */
277
#ifndef HAVE_INT64_T
278
# if (SIZEOF_LONG_INT == 8)
279
typedef
long
int
int64_t;
280
# else
281
# if (SIZEOF_LONG_LONG_INT == 8)
282
typedef
long
long
int
int64_t;
283
# endif
284
# endif
285
#endif
286
#ifndef HAVE_U_INT64_T
287
# if (SIZEOF_LONG_INT == 8)
288
typedef
unsigned
long
int
u_int64_t;
289
# else
290
# if (SIZEOF_LONG_LONG_INT == 8)
291
typedef
unsigned
long
long
int
u_int64_t;
292
# endif
293
# endif
294
#endif
295
296
#ifndef HAVE_UINTXX_T
297
typedef
u_int8_t uint8_t;
298
typedef
u_int16_t uint16_t;
299
typedef
u_int32_t uint32_t;
300
typedef
u_int64_t uint64_t;
301
#endif
302
303
#ifndef HAVE_INTMAX_T
304
typedef
long
long
intmax_t;
305
#endif
306
307
#ifndef HAVE_UINTMAX_T
308
typedef
unsigned
long
long
uintmax_t;
309
#endif
310
311
#ifndef HAVE_U_CHAR
312
typedef
unsigned
char
u_char;
313
# define HAVE_U_CHAR
314
#endif
/* HAVE_U_CHAR */
315
316
#ifndef ULLONG_MAX
317
# define ULLONG_MAX ((unsigned long long)-1)
318
#endif
319
320
#ifndef SIZE_T_MAX
321
#define SIZE_T_MAX ULONG_MAX
322
#endif
/* SIZE_T_MAX */
323
324
#ifndef HAVE_SIZE_T
325
typedef
unsigned
int
size_t;
326
# define HAVE_SIZE_T
327
# define SIZE_T_MAX UINT_MAX
328
#endif
/* HAVE_SIZE_T */
329
330
#ifndef SIZE_MAX
331
#define SIZE_MAX SIZE_T_MAX
332
#endif
333
334
#ifndef HAVE_SSIZE_T
335
typedef
int
ssize_t;
336
# define HAVE_SSIZE_T
337
#endif
/* HAVE_SSIZE_T */
338
339
#ifndef HAVE_CLOCK_T
340
typedef
long
clock_t;
341
# define HAVE_CLOCK_T
342
#endif
/* HAVE_CLOCK_T */
343
344
#ifndef HAVE_SA_FAMILY_T
345
typedef
int
sa_family_t;
346
# define HAVE_SA_FAMILY_T
347
#endif
/* HAVE_SA_FAMILY_T */
348
349
#ifndef HAVE_PID_T
350
typedef
int
pid_t;
351
# define HAVE_PID_T
352
#endif
/* HAVE_PID_T */
353
354
#ifndef HAVE_SIG_ATOMIC_T
355
typedef
int
sig_atomic_t;
356
# define HAVE_SIG_ATOMIC_T
357
#endif
/* HAVE_SIG_ATOMIC_T */
358
359
#ifndef HAVE_MODE_T
360
typedef
int
mode_t;
361
# define HAVE_MODE_T
362
#endif
/* HAVE_MODE_T */
363
364
#if !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE___SS_FAMILY_IN_SS)
365
# define ss_family __ss_family
366
#endif
/* !defined(HAVE_SS_FAMILY_IN_SS) && defined(HAVE_SA_FAMILY_IN_SS) */
367
368
#ifndef HAVE_SYS_UN_H
369
struct
sockaddr_un {
370
short
sun_family;
/* AF_UNIX */
371
char
sun_path[108];
/* path name (gag) */
372
};
373
#endif
/* HAVE_SYS_UN_H */
374
375
#ifndef HAVE_IN_ADDR_T
376
typedef
u_int32_t in_addr_t;
377
#endif
378
#ifndef HAVE_IN_PORT_T
379
typedef
u_int16_t in_port_t;
380
#endif
381
382
#if defined(BROKEN_SYS_TERMIO_H) && !defined(_STRUCT_WINSIZE)
383
#define _STRUCT_WINSIZE
384
struct
winsize {
385
unsigned
short
ws_row;
/* rows, in characters */
386
unsigned
short
ws_col;
/* columns, in character */
387
unsigned
short
ws_xpixel;
/* horizontal size, pixels */
388
unsigned
short
ws_ypixel;
/* vertical size, pixels */
389
};
390
#endif
391
392
/* bits needed for select that may not be in the system headers */
393
#ifndef HAVE_FD_MASK
394
typedef
unsigned
long
int
fd_mask;
395
#endif
396
397
#if defined(HAVE_DECL_NFDBITS) && HAVE_DECL_NFDBITS == 0
398
# define NFDBITS (8 * sizeof(unsigned long))
399
#endif
400
401
#if defined(HAVE_DECL_HOWMANY) && HAVE_DECL_HOWMANY == 0
402
# define howmany(x,y) (((x)+((y)-1))/(y))
403
#endif
404
405
/* Paths */
406
407
#ifndef _PATH_BSHELL
408
# define _PATH_BSHELL "/bin/sh"
409
#endif
410
411
#ifdef USER_PATH
412
# ifdef _PATH_STDPATH
413
# undef _PATH_STDPATH
414
# endif
415
# define _PATH_STDPATH USER_PATH
416
#endif
417
418
#ifndef _PATH_STDPATH
419
# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
420
#endif
421
422
#ifndef SUPERUSER_PATH
423
# define SUPERUSER_PATH _PATH_STDPATH
424
#endif
425
426
#ifndef _PATH_DEVNULL
427
# define _PATH_DEVNULL "/dev/null"
428
#endif
429
430
/* user may have set a different path */
431
#if defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY)
432
# undef _PATH_MAILDIR
433
#endif
/* defined(_PATH_MAILDIR) && defined(MAIL_DIRECTORY) */
434
435
#ifdef MAIL_DIRECTORY
436
# define _PATH_MAILDIR MAIL_DIRECTORY
437
#endif
438
439
#ifndef _PATH_NOLOGIN
440
# define _PATH_NOLOGIN "/etc/nologin"
441
#endif
442
443
/* Define this to be the path of the xauth program. */
444
#ifdef XAUTH_PATH
445
#define _PATH_XAUTH XAUTH_PATH
446
#endif
/* XAUTH_PATH */
447
448
/* derived from XF4/xc/lib/dps/Xlibnet.h */
449
#ifndef X_UNIX_PATH
450
# ifdef __hpux
451
# define X_UNIX_PATH "/var/spool/sockets/X11/%u"
452
# else
453
# define X_UNIX_PATH "/tmp/.X11-unix/X%u"
454
# endif
455
#endif
/* X_UNIX_PATH */
456
#define _PATH_UNIX_X X_UNIX_PATH
457
458
#ifndef _PATH_TTY
459
# define _PATH_TTY "/dev/tty"
460
#endif
461
462
/* Macros */
463
464
#if defined(HAVE_LOGIN_GETCAPBOOL) && defined(HAVE_LOGIN_CAP_H)
465
# define HAVE_LOGIN_CAP
466
#endif
467
468
#ifndef MAX
469
# define MAX(a,b) (((a)>(b))?(a):(b))
470
# define MIN(a,b) (((a)<(b))?(a):(b))
471
#endif
472
473
#ifndef roundup
474
# define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
475
#endif
476
477
#ifndef timersub
478
#define timersub(a, b, result) \
479
do { \
480
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
481
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
482
if ((result)->tv_usec < 0) { \
483
--(result)->tv_sec; \
484
(result)->tv_usec += 1000000; \
485
} \
486
} while (0)
487
#endif
488
489
#ifndef TIMEVAL_TO_TIMESPEC
490
#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
491
(ts)->tv_sec = (tv)->tv_sec; \
492
(ts)->tv_nsec = (tv)->tv_usec * 1000; \
493
}
494
#endif
495
496
#ifndef TIMESPEC_TO_TIMEVAL
497
#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
498
(tv)->tv_sec = (ts)->tv_sec; \
499
(tv)->tv_usec = (ts)->tv_nsec / 1000; \
500
}
501
#endif
502
503
#ifndef __P
504
# define __P(x) x
505
#endif
506
507
#if !defined(IN6_IS_ADDR_V4MAPPED)
508
# define IN6_IS_ADDR_V4MAPPED(a) \
509
((((u_int32_t *) (a))[0] == 0) && (((u_int32_t *) (a))[1] == 0) && \
510
(((u_int32_t *) (a))[2] == htonl (0xffff)))
511
#endif
/* !defined(IN6_IS_ADDR_V4MAPPED) */
512
513
#if !defined(__GNUC__) || (__GNUC__ < 2)
514
# define __attribute__(x)
515
#endif
/* !defined(__GNUC__) || (__GNUC__ < 2) */
516
517
#if !defined(HAVE_ATTRIBUTE__SENTINEL__) && !defined(__sentinel__)
518
# define __sentinel__
519
#endif
520
521
#if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
522
# define __bounded__(x, y, z)
523
#endif
524
525
#if !defined(HAVE_ATTRIBUTE__NONNULL__) && !defined(__nonnull__)
526
# define __nonnull__(x)
527
#endif
528
529
#ifndef OSSH_ALIGNBYTES
530
#define OSSH_ALIGNBYTES (sizeof(int) - 1)
531
#endif
532
#ifndef __CMSG_ALIGN
533
#define __CMSG_ALIGN(p) (((u_int)(p) + OSSH_ALIGNBYTES) &~ OSSH_ALIGNBYTES)
534
#endif
535
536
/* Length of the contents of a control message of length len */
537
#ifndef CMSG_LEN
538
#define CMSG_LEN(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
539
#endif
540
541
/* Length of the space taken up by a padded control message of length len */
542
#ifndef CMSG_SPACE
543
#define CMSG_SPACE(len) (__CMSG_ALIGN(sizeof(struct cmsghdr)) + __CMSG_ALIGN(len))
544
#endif
545
546
/* given pointer to struct cmsghdr, return pointer to data */
547
#ifndef CMSG_DATA
548
#define CMSG_DATA(cmsg) ((u_char *)(cmsg) + __CMSG_ALIGN(sizeof(struct cmsghdr)))
549
#endif
/* CMSG_DATA */
550
551
/*
552
* RFC 2292 requires to check msg_controllen, in case that the kernel returns
553
* an empty list for some reasons.
554
*/
555
#ifndef CMSG_FIRSTHDR
556
#define CMSG_FIRSTHDR(mhdr) \
557
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
558
(struct cmsghdr *)(mhdr)->msg_control : \
559
(struct cmsghdr *)NULL)
560
#endif
/* CMSG_FIRSTHDR */
561
562
#if defined(HAVE_DECL_OFFSETOF) && HAVE_DECL_OFFSETOF == 0
563
# define offsetof(type, member) ((size_t) &((type *)0)->member)
564
#endif
565
566
/* Set up BSD-style BYTE_ORDER definition if it isn't there already */
567
/* XXX: doesn't try to cope with strange byte orders (PDP_ENDIAN) */
568
#ifndef BYTE_ORDER
569
# ifndef LITTLE_ENDIAN
570
# define LITTLE_ENDIAN 1234
571
# endif
/* LITTLE_ENDIAN */
572
# ifndef BIG_ENDIAN
573
# define BIG_ENDIAN 4321
574
# endif
/* BIG_ENDIAN */
575
# ifdef WORDS_BIGENDIAN
576
# define BYTE_ORDER BIG_ENDIAN
577
# else
/* WORDS_BIGENDIAN */
578
# define BYTE_ORDER LITTLE_ENDIAN
579
# endif
/* WORDS_BIGENDIAN */
580
#endif
/* BYTE_ORDER */
581
582
/* Function replacement / compatibility hacks */
583
584
#if !defined(HAVE_GETADDRINFO) && (defined(HAVE_OGETADDRINFO) || defined(HAVE_NGETADDRINFO))
585
# define HAVE_GETADDRINFO
586
#endif
587
588
#ifndef HAVE_GETOPT_OPTRESET
589
# undef getopt
590
# undef opterr
591
# undef optind
592
# undef optopt
593
# undef optreset
594
# undef optarg
595
# define getopt(ac, av, o) BSDgetopt(ac, av, o)
596
# define opterr BSDopterr
597
# define optind BSDoptind
598
# define optopt BSDoptopt
599
# define optreset BSDoptreset
600
# define optarg BSDoptarg
601
#endif
602
603
#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GETADDRINFO)
604
# undef HAVE_GETADDRINFO
605
#endif
606
#if defined(BROKEN_GETADDRINFO) && defined(HAVE_FREEADDRINFO)
607
# undef HAVE_FREEADDRINFO
608
#endif
609
#if defined(BROKEN_GETADDRINFO) && defined(HAVE_GAI_STRERROR)
610
# undef HAVE_GAI_STRERROR
611
#endif
612
613
#if defined(HAVE_GETADDRINFO)
614
# if defined(HAVE_DECL_AI_NUMERICSERV) && HAVE_DECL_AI_NUMERICSERV == 0
615
# define AI_NUMERICSERV 0
616
# endif
617
#endif
618
619
#if defined(BROKEN_UPDWTMPX) && defined(HAVE_UPDWTMPX)
620
# undef HAVE_UPDWTMPX
621
#endif
622
623
#if defined(BROKEN_SHADOW_EXPIRE) && defined(HAS_SHADOW_EXPIRE)
624
# undef HAS_SHADOW_EXPIRE
625
#endif
626
627
#if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) && \
628
defined(SYSLOG_R_SAFE_IN_SIGHAND)
629
# define DO_LOG_SAFE_IN_SIGHAND
630
#endif
631
632
#if !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY)
633
# define memmove(s1, s2, n) bcopy((s2), (s1), (n))
634
#endif
/* !defined(HAVE_MEMMOVE) && defined(HAVE_BCOPY) */
635
636
#ifndef GETPGRP_VOID
637
# include <unistd.h>
638
# define getpgrp() getpgrp(0)
639
#endif
640
641
#ifdef USE_BSM_AUDIT
642
# define SSH_AUDIT_EVENTS
643
# define CUSTOM_SSH_AUDIT_EVENTS
644
#endif
645
646
#ifdef USE_LINUX_AUDIT
647
# define SSH_AUDIT_EVENTS
648
# define CUSTOM_SSH_AUDIT_EVENTS
649
#endif
650
651
#if !defined(HAVE___func__) && defined(HAVE___FUNCTION__)
652
# define __func__ __FUNCTION__
653
#elif !defined(HAVE___func__)
654
# define __func__ ""
655
#endif
656
657
#if defined(KRB5) && !defined(HEIMDAL)
658
# define krb5_get_err_text(context,code) error_message(code)
659
#endif
660
661
#if defined(SKEYCHALLENGE_4ARG)
662
# define _compat_skeychallenge(a,b,c,d) skeychallenge(a,b,c,d)
663
#else
664
# define _compat_skeychallenge(a,b,c,d) skeychallenge(a,b,c)
665
#endif
666
667
/* Maximum number of file descriptors available */
668
#ifdef HAVE_SYSCONF
669
# define SSH_SYSFDMAX sysconf(_SC_OPEN_MAX)
670
#else
671
# define SSH_SYSFDMAX 10000
672
#endif
673
674
#ifdef FSID_HAS_VAL
675
/* encode f_fsid into a 64 bit value */
676
#define FSID_TO_ULONG(f) \
677
((((u_int64_t)(f).val[0] & 0xffffffffUL) << 32) | \
678
((f).val[1] & 0xffffffffUL))
679
#elif defined(FSID_HAS___VAL)
680
#define FSID_TO_ULONG(f) \
681
((((u_int64_t)(f).__val[0] & 0xffffffffUL) << 32) | \
682
((f).__val[1] & 0xffffffffUL))
683
#else
684
# define FSID_TO_ULONG(f) ((f))
685
#endif
686
687
#if defined(__Lynx__)
688
/*
689
* LynxOS defines these in param.h which we do not want to include since
690
* it will also pull in a bunch of kernel definitions.
691
*/
692
# define ALIGNBYTES (sizeof(int) - 1)
693
# define ALIGN(p) (((unsigned)p + ALIGNBYTES) & ~ALIGNBYTES)
694
/* Missing prototypes on LynxOS */
695
int
snprintf (
char
*,
size_t
,
const
char
*, ...);
696
int
mkstemp (
char
*);
697
char
*crypt (
const
char
*,
const
char
*);
698
int
seteuid (uid_t);
699
int
setegid (gid_t);
700
char
*mkdtemp (
char
*);
701
int
rresvport_af (
int
*, sa_family_t);
702
int
innetgr (
const
char
*,
const
char
*,
const
char
*,
const
char
*);
703
#endif
704
705
/*
706
* Define this to use pipes instead of socketpairs for communicating with the
707
* client program. Socketpairs do not seem to work on all systems.
708
*
709
* configure.ac sets this for a few OS's which are known to have problems
710
* but you may need to set it yourself
711
*/
712
/* #define USE_PIPES 1 */
713
718
/* FIXME: put default paths back in */
719
#ifndef UTMP_FILE
720
# ifdef _PATH_UTMP
721
# define UTMP_FILE _PATH_UTMP
722
# else
723
# ifdef CONF_UTMP_FILE
724
# define UTMP_FILE CONF_UTMP_FILE
725
# endif
726
# endif
727
#endif
728
#ifndef WTMP_FILE
729
# ifdef _PATH_WTMP
730
# define WTMP_FILE _PATH_WTMP
731
# else
732
# ifdef CONF_WTMP_FILE
733
# define WTMP_FILE CONF_WTMP_FILE
734
# endif
735
# endif
736
#endif
737
/* pick up the user's location for lastlog if given */
738
#ifndef LASTLOG_FILE
739
# ifdef _PATH_LASTLOG
740
# define LASTLOG_FILE _PATH_LASTLOG
741
# else
742
# ifdef CONF_LASTLOG_FILE
743
# define LASTLOG_FILE CONF_LASTLOG_FILE
744
# endif
745
# endif
746
#endif
747
748
#if defined(HAVE_SHADOW_H) && !defined(DISABLE_SHADOW)
749
# define USE_SHADOW
750
#endif
751
752
/* The login() library function in libutil is first choice */
753
#if defined(HAVE_LOGIN) && !defined(DISABLE_LOGIN)
754
# define USE_LOGIN
755
756
#else
757
/* Simply select your favourite login types. */
758
/* Can't do if-else because some systems use several... <sigh> */
759
# if !defined(DISABLE_UTMPX)
760
# define USE_UTMPX
761
# endif
762
# if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
763
# define USE_UTMP
764
# endif
765
# if defined(WTMPX_FILE) && !defined(DISABLE_WTMPX)
766
# define USE_WTMPX
767
# endif
768
# if defined(WTMP_FILE) && !defined(DISABLE_WTMP)
769
# define USE_WTMP
770
# endif
771
772
#endif
773
774
#ifndef UT_LINESIZE
775
# define UT_LINESIZE 8
776
#endif
777
778
/* I hope that the presence of LASTLOG_FILE is enough to detect this */
779
#if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG)
780
# define USE_LASTLOG
781
#endif
782
783
#ifdef HAVE_OSF_SIA
784
# ifdef USE_SHADOW
785
# undef USE_SHADOW
786
# endif
787
# define CUSTOM_SYS_AUTH_PASSWD 1
788
#endif
789
790
#if defined(HAVE_LIBIAF) && defined(HAVE_SET_ID) && !defined(HAVE_SECUREWARE)
791
# define CUSTOM_SYS_AUTH_PASSWD 1
792
#endif
793
#if defined(HAVE_LIBIAF) && defined(HAVE_SET_ID) && !defined(BROKEN_LIBIAF)
794
# define USE_LIBIAF
795
#endif
796
797
/* HP-UX 11.11 */
798
#ifdef BTMP_FILE
799
# define _PATH_BTMP BTMP_FILE
800
#endif
801
802
#if defined(USE_BTMP) && defined(_PATH_BTMP)
803
# define CUSTOM_FAILED_LOGIN
804
#endif
805
808
#ifdef BROKEN_GETGROUPS
809
# define getgroups(a,b) ((a)==0 && (b)==NULL ? NGROUPS_MAX : getgroups((a),(b)))
810
#endif
811
812
#if defined(HAVE_MMAP) && defined(BROKEN_MMAP)
813
# undef HAVE_MMAP
814
#endif
815
816
#ifndef IOV_MAX
817
# if defined(_XOPEN_IOV_MAX)
818
# define IOV_MAX _XOPEN_IOV_MAX
819
# elif defined(DEF_IOV_MAX)
820
# define IOV_MAX DEF_IOV_MAX
821
# else
822
# define IOV_MAX 16
823
# endif
824
#endif
825
826
#ifndef EWOULDBLOCK
827
# define EWOULDBLOCK EAGAIN
828
#endif
829
830
#ifndef INET6_ADDRSTRLEN
/* for non IPv6 machines */
831
#define INET6_ADDRSTRLEN 46
832
#endif
833
834
#ifndef SSH_IOBUFSZ
835
# define SSH_IOBUFSZ 8192
836
#endif
837
838
/*
839
* Platforms that have arc4random_uniform() and not arc4random_stir()
840
* shouldn't need the latter.
841
*/
842
#if defined(HAVE_ARC4RANDOM) && defined(HAVE_ARC4RANDOM_UNIFORM) && \
843
!defined(HAVE_ARC4RANDOM_STIR)
844
# define arc4random_stir()
845
#endif
846
847
#ifndef HAVE_VA_COPY
848
# ifdef HAVE___VA_COPY
849
# define va_copy(dest, src) __va_copy(dest, src)
850
# else
851
# define va_copy(dest, src) (dest) = (src)
852
# endif
853
#endif
854
855
#ifndef __predict_true
856
# if defined(__GNUC__) && \
857
((__GNUC__ > (2)) || (__GNUC__ == (2) && __GNUC_MINOR__ >= (96)))
858
# define __predict_true(exp) __builtin_expect(((exp) != 0), 1)
859
# define __predict_false(exp) __builtin_expect(((exp) != 0), 0)
860
# else
861
# define __predict_true(exp) ((exp) != 0)
862
# define __predict_false(exp) ((exp) != 0)
863
# endif
/* gcc version */
864
#endif
/* __predict_true */
865
866
#if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \
867
defined(GLOB_HAS_GL_MATCHC) && defined(GLOB_HAS_GL_STATV) && \
868
defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 && \
869
!defined(BROKEN_GLOB)
870
# define USE_SYSTEM_GLOB
871
#endif
872
873
#endif
/* _DEFINES_H */
Generated by
1.8.13