2003-06-11 14:51:32 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1999-2003 Damien Miller. All rights reserved.
|
2003-08-29 18:59:52 +02:00
|
|
|
* Copyright (c) 2003 Ben Lindstrom. All rights reserved.
|
|
|
|
* Copyright (c) 2002 Tim Rice. All rights reserved.
|
2003-06-11 14:51:32 +02:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef _OPENBSD_COMPAT_H
|
|
|
|
#define _OPENBSD_COMPAT_H
|
2001-01-31 22:52:01 +01:00
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#include "includes.h"
|
2001-01-31 22:52:01 +01:00
|
|
|
|
2006-07-10 13:33:04 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
|
2006-07-10 16:20:51 +02:00
|
|
|
#include <sys/socket.h>
|
|
|
|
|
2016-07-14 02:59:09 +02:00
|
|
|
#include <stddef.h> /* for wchar_t */
|
|
|
|
|
2001-01-31 22:52:01 +01:00
|
|
|
/* OpenBSD function replacements */
|
|
|
|
#include "base64.h"
|
2001-02-24 01:24:19 +01:00
|
|
|
#include "sigact.h"
|
2001-06-25 10:09:16 +02:00
|
|
|
#include "readpassphrase.h"
|
2003-01-07 07:04:18 +01:00
|
|
|
#include "vis.h"
|
2003-05-15 04:27:08 +02:00
|
|
|
#include "getrrsetbyname.h"
|
2015-01-14 16:21:31 +01:00
|
|
|
#include "sha1.h"
|
2006-03-15 03:02:28 +01:00
|
|
|
#include "sha2.h"
|
2015-01-14 16:21:31 +01:00
|
|
|
#include "md5.h"
|
2013-12-07 01:51:51 +01:00
|
|
|
#include "blf.h"
|
2019-11-01 08:24:29 +01:00
|
|
|
#include "fnmatch.h"
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2024-01-08 04:45:14 +01:00
|
|
|
#ifndef __THROW
|
|
|
|
# if defined __cplusplus
|
|
|
|
# define __THROW throw()
|
|
|
|
# else
|
|
|
|
# define __THROW
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2021-02-18 01:25:38 +01:00
|
|
|
#if defined(HAVE_LOGIN_CAP) && !defined(HAVE_LOGIN_GETPWCLASS)
|
2021-05-27 13:14:15 +02:00
|
|
|
# include <login_cap.h>
|
2021-02-18 01:25:38 +01:00
|
|
|
# define login_getpwclass(pw) login_getclass(pw->pw_class)
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef HAVE_BASENAME
|
|
|
|
char *basename(const char *path);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_BINDRESVPORT_SA
|
|
|
|
int bindresvport_sa(int sd, struct sockaddr *sa);
|
|
|
|
#endif
|
|
|
|
|
2004-08-15 10:40:59 +02:00
|
|
|
#ifndef HAVE_CLOSEFROM
|
|
|
|
void closefrom(int);
|
|
|
|
#endif
|
|
|
|
|
2022-03-08 23:29:30 +01:00
|
|
|
#if defined(HAVE_DECL_FTRUNCATE) && HAVE_DECL_FTRUNCATE == 0
|
|
|
|
int ftruncate(int filedes, off_t length);
|
|
|
|
#endif
|
|
|
|
|
2018-07-02 13:16:58 +02:00
|
|
|
#ifndef HAVE_GETLINE
|
2018-11-25 11:44:05 +01:00
|
|
|
#include <stdio.h>
|
2018-07-02 13:16:58 +02:00
|
|
|
ssize_t getline(char **, size_t *, FILE *);
|
|
|
|
#endif
|
|
|
|
|
2017-06-01 07:25:13 +02:00
|
|
|
#ifndef HAVE_GETPAGESIZE
|
|
|
|
int getpagesize(void);
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef HAVE_GETCWD
|
|
|
|
char *getcwd(char *pt, size_t size);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2022-03-08 23:41:56 +01:00
|
|
|
#ifndef HAVE_KILLPG
|
|
|
|
int killpg(pid_t, int);
|
|
|
|
#endif
|
|
|
|
|
2019-12-11 03:22:06 +01:00
|
|
|
#if defined(HAVE_DECL_MEMMEM) && HAVE_DECL_MEMMEM == 0
|
2019-07-16 01:20:23 +02:00
|
|
|
void *memmem(const void *, size_t, const void *, size_t);
|
|
|
|
#endif
|
|
|
|
|
2014-12-09 15:32:23 +01:00
|
|
|
#ifndef HAVE_REALLOCARRAY
|
|
|
|
void *reallocarray(void *, size_t, size_t);
|
|
|
|
#endif
|
|
|
|
|
2017-06-01 07:25:13 +02:00
|
|
|
#ifndef HAVE_RECALLOCARRAY
|
|
|
|
void *recallocarray(void *, size_t, size_t, size_t);
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef HAVE_RRESVPORT_AF
|
|
|
|
int rresvport_af(int *alport, sa_family_t af);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRLCPY
|
|
|
|
size_t strlcpy(char *dst, const char *src, size_t siz);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRLCAT
|
|
|
|
size_t strlcat(char *dst, const char *src, size_t siz);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2016-12-13 02:54:23 +01:00
|
|
|
#ifndef HAVE_STRCASESTR
|
|
|
|
char *strcasestr(const char *, const char *);
|
|
|
|
#endif
|
|
|
|
|
2019-07-06 05:13:57 +02:00
|
|
|
#ifndef HAVE_STRNLEN
|
|
|
|
size_t strnlen(const char *, size_t);
|
|
|
|
#endif
|
|
|
|
|
2019-07-06 04:54:43 +02:00
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
char *strndup(const char *s, size_t n);
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef HAVE_SETENV
|
|
|
|
int setenv(register const char *name, register const char *value, int rewrite);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRMODE
|
|
|
|
void strmode(int mode, char *p);
|
|
|
|
#endif
|
|
|
|
|
2010-08-16 05:15:23 +02:00
|
|
|
#ifndef HAVE_STRPTIME
|
|
|
|
#include <time.h>
|
|
|
|
char *strptime(const char *buf, const char *fmt, struct tm *tm);
|
|
|
|
#endif
|
|
|
|
|
2020-10-27 06:46:31 +01:00
|
|
|
#if !defined(HAVE_MKDTEMP)
|
2003-08-29 18:59:52 +02:00
|
|
|
int mkstemps(char *path, int slen);
|
|
|
|
int mkstemp(char *path);
|
|
|
|
char *mkdtemp(char *path);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2023-03-10 03:27:29 +01:00
|
|
|
#define mkstemp(x) _ssh_mkstemp(x)
|
2023-03-10 04:46:57 +01:00
|
|
|
int _ssh_mkstemp(char *);
|
2023-03-10 03:27:29 +01:00
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef HAVE_DAEMON
|
|
|
|
int daemon(int nochdir, int noclose);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
|
|
|
#ifndef HAVE_DIRNAME
|
|
|
|
char *dirname(const char *path);
|
|
|
|
#endif
|
|
|
|
|
2008-05-20 00:57:06 +02:00
|
|
|
#ifndef HAVE_FMT_SCALED
|
|
|
|
#define FMT_SCALED_STRSIZE 7
|
|
|
|
int fmt_scaled(long long number, char *result);
|
|
|
|
#endif
|
|
|
|
|
2013-05-16 12:47:31 +02:00
|
|
|
#ifndef HAVE_SCAN_SCALED
|
|
|
|
int scan_scaled(char *, long long *);
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#if defined(BROKEN_INET_NTOA) || !defined(HAVE_INET_NTOA)
|
|
|
|
char *inet_ntoa(struct in_addr in);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_INET_NTOP
|
2011-09-23 03:16:09 +02:00
|
|
|
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
|
2003-08-29 18:59:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_INET_ATON
|
|
|
|
int inet_aton(const char *cp, struct in_addr *addr);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
|
|
|
#ifndef HAVE_STRSEP
|
|
|
|
char *strsep(char **stringp, const char *delim);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_SETPROCTITLE
|
|
|
|
void setproctitle(const char *fmt, ...);
|
|
|
|
void compat_init_setproctitle(int argc, char *argv[]);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_GETGROUPLIST
|
|
|
|
int getgrouplist(const char *, gid_t, gid_t *, int *);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_GETOPT) || !defined(HAVE_GETOPT_OPTRESET)
|
2024-01-08 04:45:14 +01:00
|
|
|
int BSDgetopt(int argc, char * const *argv, const char *opts) __THROW;
|
2013-05-10 10:08:49 +02:00
|
|
|
#include "openbsd-compat/getopt.h"
|
2003-08-29 18:59:52 +02:00
|
|
|
#endif
|
|
|
|
|
2018-02-24 11:06:48 +01:00
|
|
|
#if ((defined(HAVE_DECL_READV) && HAVE_DECL_READV == 0) || \
|
|
|
|
(defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0))
|
2006-09-03 14:44:49 +02:00
|
|
|
# include <sys/types.h>
|
|
|
|
# include <sys/uio.h>
|
2018-02-24 11:06:48 +01:00
|
|
|
|
|
|
|
# if defined(HAVE_DECL_READV) && HAVE_DECL_READV == 0
|
|
|
|
int readv(int, struct iovec *, int);
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# if defined(HAVE_DECL_WRITEV) && HAVE_DECL_WRITEV == 0
|
2006-09-03 14:44:49 +02:00
|
|
|
int writev(int, struct iovec *, int);
|
2018-02-24 11:06:48 +01:00
|
|
|
# endif
|
2006-09-03 14:44:49 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2001-01-31 22:52:01 +01:00
|
|
|
/* Home grown routines */
|
2021-08-14 22:08:07 +02:00
|
|
|
#include "bsd-signal.h"
|
2001-01-31 22:52:01 +01:00
|
|
|
#include "bsd-misc.h"
|
2012-11-05 07:04:37 +01:00
|
|
|
#include "bsd-setres_id.h"
|
2008-06-08 19:32:29 +02:00
|
|
|
#include "bsd-statvfs.h"
|
2001-01-31 22:52:01 +01:00
|
|
|
#include "bsd-waitpid.h"
|
2007-06-25 14:15:12 +02:00
|
|
|
#include "bsd-poll.h"
|
2001-01-31 22:52:01 +01:00
|
|
|
|
2020-02-17 12:48:50 +01:00
|
|
|
#if defined(HAVE_DECL_GETPEEREID) && HAVE_DECL_GETPEEREID == 0
|
2003-08-29 18:59:52 +02:00
|
|
|
int getpeereid(int , uid_t *, gid_t *);
|
2013-11-08 08:54:38 +01:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2022-09-02 06:28:14 +02:00
|
|
|
#ifndef HAVE_ARC4RANDOM
|
|
|
|
uint32_t arc4random(void);
|
2003-08-29 18:59:52 +02:00
|
|
|
#endif /* !HAVE_ARC4RANDOM */
|
|
|
|
|
2008-05-19 06:47:37 +02:00
|
|
|
#ifndef HAVE_ARC4RANDOM_BUF
|
|
|
|
void arc4random_buf(void *, size_t);
|
|
|
|
#endif
|
|
|
|
|
2022-09-02 06:28:14 +02:00
|
|
|
#ifndef HAVE_ARC4RANDOM_STIR
|
|
|
|
# define arc4random_stir()
|
|
|
|
#endif
|
|
|
|
|
2008-05-19 06:47:37 +02:00
|
|
|
#ifndef HAVE_ARC4RANDOM_UNIFORM
|
2022-08-08 02:30:34 +02:00
|
|
|
uint32_t arc4random_uniform(uint32_t);
|
2008-05-19 06:47:37 +02:00
|
|
|
#endif
|
|
|
|
|
2005-11-24 09:58:19 +01:00
|
|
|
#ifndef HAVE_ASPRINTF
|
|
|
|
int asprintf(char **, const char *, ...);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2005-11-24 09:58:19 +01:00
|
|
|
|
2004-01-21 07:07:16 +01:00
|
|
|
#ifndef HAVE_OPENPTY
|
2006-03-15 12:25:54 +01:00
|
|
|
# include <sys/ioctl.h> /* for struct winsize */
|
2004-01-21 07:07:16 +01:00
|
|
|
int openpty(int *, int *, char *, struct termios *, struct winsize *);
|
|
|
|
#endif /* HAVE_OPENPTY */
|
2003-08-29 18:59:52 +02:00
|
|
|
|
|
|
|
#ifndef HAVE_SNPRINTF
|
2006-06-30 02:51:32 +02:00
|
|
|
int snprintf(char *, size_t, SNPRINTF_CONST char *, ...);
|
2016-08-02 01:44:25 +02:00
|
|
|
#endif
|
2003-08-29 18:59:52 +02:00
|
|
|
|
2005-09-30 01:55:49 +02:00
|
|
|
#ifndef HAVE_STRTOLL
|
|
|
|
long long strtoll(const char *, char **, int);
|
|
|
|
#endif
|
|
|
|
|
2013-02-15 02:20:41 +01:00
|
|
|
#ifndef HAVE_STRTOUL
|
|
|
|
unsigned long strtoul(const char *, char **, int);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_STRTOULL
|
|
|
|
unsigned long long strtoull(const char *, char **, int);
|
|
|
|
#endif
|
|
|
|
|
2005-05-26 12:48:25 +02:00
|
|
|
#ifndef HAVE_STRTONUM
|
|
|
|
long long strtonum(const char *, long long, long long, const char **);
|
|
|
|
#endif
|
|
|
|
|
2013-06-06 00:30:20 +02:00
|
|
|
/* multibyte character support */
|
|
|
|
#ifndef HAVE_MBLEN
|
2015-05-08 03:07:27 +02:00
|
|
|
# define mblen(x, y) (1)
|
2013-06-06 00:30:20 +02:00
|
|
|
#endif
|
|
|
|
|
2016-07-14 02:59:09 +02:00
|
|
|
#ifndef HAVE_WCWIDTH
|
|
|
|
# define wcwidth(x) (((x) >= 0x20 && (x) <= 0x7e) ? 1 : -1)
|
|
|
|
/* force our no-op nl_langinfo and mbtowc */
|
|
|
|
# undef HAVE_NL_LANGINFO
|
|
|
|
# undef HAVE_MBTOWC
|
|
|
|
# undef HAVE_LANGINFO_H
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_NL_LANGINFO
|
|
|
|
# define nl_langinfo(x) ""
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_MBTOWC
|
|
|
|
int mbtowc(wchar_t *, const char*, size_t);
|
|
|
|
#endif
|
|
|
|
|
2006-07-12 15:10:33 +02:00
|
|
|
#if !defined(HAVE_VASPRINTF) || !defined(HAVE_VSNPRINTF)
|
|
|
|
# include <stdarg.h>
|
|
|
|
#endif
|
|
|
|
|
2016-07-15 06:48:30 +02:00
|
|
|
/*
|
|
|
|
* Some platforms unconditionally undefine va_copy() so we define VA_COPY()
|
|
|
|
* instead. This is known to be the case on at least some configurations of
|
|
|
|
* AIX with the xlc compiler.
|
|
|
|
*/
|
|
|
|
#ifndef VA_COPY
|
|
|
|
# ifdef HAVE_VA_COPY
|
|
|
|
# define VA_COPY(dest, src) va_copy(dest, src)
|
|
|
|
# else
|
|
|
|
# ifdef HAVE___VA_COPY
|
|
|
|
# define VA_COPY(dest, src) __va_copy(dest, src)
|
|
|
|
# else
|
|
|
|
# define VA_COPY(dest, src) (dest) = (src)
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2005-11-24 09:58:19 +01:00
|
|
|
#ifndef HAVE_VASPRINTF
|
|
|
|
int vasprintf(char **, const char *, va_list);
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#ifndef HAVE_VSNPRINTF
|
|
|
|
int vsnprintf(char *, size_t, const char *, va_list);
|
|
|
|
#endif
|
|
|
|
|
2010-01-16 01:53:07 +01:00
|
|
|
#ifndef HAVE_USER_FROM_UID
|
2010-01-16 03:30:30 +01:00
|
|
|
char *user_from_uid(uid_t, int);
|
2010-01-16 01:53:07 +01:00
|
|
|
#endif
|
|
|
|
|
2010-01-16 13:58:37 +01:00
|
|
|
#ifndef HAVE_GROUP_FROM_GID
|
2010-01-16 03:30:30 +01:00
|
|
|
char *group_from_gid(gid_t, int);
|
2010-01-16 01:53:07 +01:00
|
|
|
#endif
|
|
|
|
|
2010-10-07 12:25:27 +02:00
|
|
|
#ifndef HAVE_TIMINGSAFE_BCMP
|
|
|
|
int timingsafe_bcmp(const void *, const void *, size_t);
|
|
|
|
#endif
|
|
|
|
|
2013-12-07 01:51:51 +01:00
|
|
|
#ifndef HAVE_BCRYPT_PBKDF
|
2021-11-29 02:30:22 +01:00
|
|
|
int bcrypt_pbkdf(const char *, size_t, const uint8_t *, size_t,
|
|
|
|
uint8_t *, size_t, unsigned int);
|
2013-12-07 01:51:51 +01:00
|
|
|
#endif
|
|
|
|
|
2014-02-04 01:18:20 +01:00
|
|
|
#ifndef HAVE_EXPLICIT_BZERO
|
|
|
|
void explicit_bzero(void *p, size_t n);
|
|
|
|
#endif
|
|
|
|
|
2017-09-19 04:29:23 +02:00
|
|
|
#ifndef HAVE_FREEZERO
|
|
|
|
void freezero(void *, size_t);
|
|
|
|
#endif
|
|
|
|
|
2019-11-01 04:41:07 +01:00
|
|
|
#ifndef HAVE_LOCALTIME_R
|
|
|
|
struct tm *localtime_r(const time_t *, struct tm *);
|
|
|
|
#endif
|
|
|
|
|
2022-08-11 14:48:23 +02:00
|
|
|
#ifndef HAVE_TIMEGM
|
2022-11-02 18:24:39 +01:00
|
|
|
#include <time.h>
|
2022-08-11 14:48:23 +02:00
|
|
|
time_t timegm(struct tm *);
|
|
|
|
#endif
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
char *xcrypt(const char *password, const char *salt);
|
|
|
|
char *shadow_pw(struct passwd *pw);
|
|
|
|
|
2001-01-31 22:52:01 +01:00
|
|
|
/* rfc2553 socket API replacements */
|
2003-06-05 10:52:47 +02:00
|
|
|
#include "fake-rfc2553.h"
|
2001-01-31 22:52:01 +01:00
|
|
|
|
2001-08-07 01:29:16 +02:00
|
|
|
/* Routines for a single OS platform */
|
2003-05-04 02:41:20 +02:00
|
|
|
#include "bsd-cygwin_util.h"
|
2006-08-30 19:24:41 +02:00
|
|
|
|
|
|
|
#include "port-aix.h"
|
2002-02-19 21:02:48 +01:00
|
|
|
#include "port-irix.h"
|
2006-04-22 13:26:08 +02:00
|
|
|
#include "port-linux.h"
|
2006-08-30 19:24:41 +02:00
|
|
|
#include "port-solaris.h"
|
2017-10-25 04:13:57 +02:00
|
|
|
#include "port-net.h"
|
2006-08-30 19:24:41 +02:00
|
|
|
#include "port-uw.h"
|
2001-08-07 01:29:16 +02:00
|
|
|
|
2014-10-01 01:43:07 +02:00
|
|
|
/* _FORTIFY_SOURCE breaks FD_ISSET(n)/FD_SET(n) for n > FD_SETSIZE. Avoid. */
|
|
|
|
#if defined(HAVE_FEATURES_H) && defined(_FORTIFY_SOURCE)
|
|
|
|
# include <features.h>
|
|
|
|
# if defined(__GNU_LIBRARY__) && defined(__GLIBC_PREREQ)
|
|
|
|
# if __GLIBC_PREREQ(2, 15) && (_FORTIFY_SOURCE > 0)
|
|
|
|
# include <sys/socket.h> /* Ensure include guard is defined */
|
|
|
|
# undef FD_SET
|
|
|
|
# undef FD_ISSET
|
|
|
|
# define FD_SET(n, set) kludge_FD_SET(n, set)
|
|
|
|
# define FD_ISSET(n, set) kludge_FD_ISSET(n, set)
|
|
|
|
void kludge_FD_SET(int, fd_set *);
|
|
|
|
int kludge_FD_ISSET(int, fd_set *);
|
|
|
|
# endif /* __GLIBC_PREREQ(2, 15) && (_FORTIFY_SOURCE > 0) */
|
|
|
|
# endif /* __GNU_LIBRARY__ && __GLIBC_PREREQ */
|
|
|
|
#endif /* HAVE_FEATURES_H && _FORTIFY_SOURCE */
|
|
|
|
|
2003-08-29 18:59:52 +02:00
|
|
|
#endif /* _OPENBSD_COMPAT_H */
|