freebsd-dev/crypto/openssh/openbsd-compat/kludge-fd_set.c
Dag-Erling Smørgrav a0ee8cc636 Upgrade to OpenSSH 6.7p1, retaining libwrap support (which has been removed
upstream) and a number of security fixes which we had already backported.

MFC after:	1 week
2016-01-19 16:18:26 +00:00

29 lines
882 B
C

/* Placed in the public domain. */
/*
* _FORTIFY_SOURCE includes a misguided check for FD_SET(n)/FD_ISSET(b)
* where n > FD_SETSIZE. This breaks OpenSSH and other programs that
* explicitly allocate fd_sets. To avoid this, we wrap FD_SET in a
* function compiled without _FORTIFY_SOURCE.
*/
#include "config.h"
#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)
# undef _FORTIFY_SOURCE
# undef __USE_FORTIFY_LEVEL
# include <sys/socket.h>
void kludge_FD_SET(int n, fd_set *set) {
FD_SET(n, set);
}
int kludge_FD_ISSET(int n, fd_set *set) {
return FD_ISSET(n, set);
}
# endif /* __GLIBC_PREREQ(2, 15) && (_FORTIFY_SOURCE > 0) */
# endif /* __GNU_LIBRARY__ && __GLIBC_PREREQ */
#endif /* HAVE_FEATURES_H && _FORTIFY_SOURCE */