diff options
author | molotkov-and <molotkov-and@ydb.tech> | 2023-08-18 17:20:47 +0300 |
---|---|---|
committer | molotkov-and <molotkov-and@ydb.tech> | 2023-08-18 19:42:07 +0300 |
commit | 73215359bc33e76f5b94d1832a377072bf245cfc (patch) | |
tree | 9cb8ad61d8c3cd107353d42951560ff3cf1b966d /contrib/libs/openldap/include/ac | |
parent | 1cbfd34a55732f7b1d407986b45e40853f01f2c2 (diff) | |
download | ydb-73215359bc33e76f5b94d1832a377072bf245cfc.tar.gz |
KIKIMR-18220: Enrich token with groups from LDAP
Add ldap functions wrapper and separate in different files for compatibility with different OS.
Add user groups fetching from ldap server.
Limitations:
- Fixed 'memberOf' attribute
- No tests to check how filter for search created
- Fetched groups are returned in event as is.
Diffstat (limited to 'contrib/libs/openldap/include/ac')
-rw-r--r-- | contrib/libs/openldap/include/ac/assert.h | 57 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/bytes.h | 78 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/ctype.h | 33 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/dirent.h | 54 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/errno.h | 32 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/fdset.h | 42 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/localize.h | 44 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/param.h | 39 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/signal.h | 80 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/socket.h | 264 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/stdarg.h | 28 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/stdlib.h | 48 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/string.h | 118 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/syslog.h | 38 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/time.h | 35 | ||||
-rw-r--r-- | contrib/libs/openldap/include/ac/unistd.h | 72 |
16 files changed, 1062 insertions, 0 deletions
diff --git a/contrib/libs/openldap/include/ac/assert.h b/contrib/libs/openldap/include/ac/assert.h new file mode 100644 index 0000000000..dbb22951c3 --- /dev/null +++ b/contrib/libs/openldap/include/ac/assert.h @@ -0,0 +1,57 @@ +/* Generic assert.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_ASSERT_H +#define _AC_ASSERT_H + +#undef assert + +#ifdef LDAP_DEBUG + +#if defined( HAVE_ASSERT_H ) || defined( STDC_HEADERS ) + +#undef NDEBUG +#include <assert.h> + +#else /* !(HAVE_ASSERT_H || STDC_HEADERS) */ + +#define LDAP_NEED_ASSERT 1 + +/* + * no assert()... must be a very old compiler. + * create a replacement and hope it works + */ + +LBER_F (void) ber_pvt_assert LDAP_P(( const char *file, int line, + const char *test )); + +/* Can't use LDAP_STRING(test), that'd expand to "test" */ +#if defined(__STDC__) || defined(__cplusplus) +#define assert(test) \ + ((test) ? (void)0 : ber_pvt_assert( __FILE__, __LINE__, #test ) ) +#else +#define assert(test) \ + ((test) ? (void)0 : ber_pvt_assert( __FILE__, __LINE__, "test" ) ) +#endif + +#endif /* (HAVE_ASSERT_H || STDC_HEADERS) */ + +#else /* !LDAP_DEBUG */ +/* no asserts */ +#define assert(test) ((void)0) +#endif /* LDAP_DEBUG */ + +#endif /* _AC_ASSERT_H */ diff --git a/contrib/libs/openldap/include/ac/bytes.h b/contrib/libs/openldap/include/ac/bytes.h new file mode 100644 index 0000000000..f8a6314eb2 --- /dev/null +++ b/contrib/libs/openldap/include/ac/bytes.h @@ -0,0 +1,78 @@ +/* Generic bytes.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_BYTES_H +#define _AC_BYTES_H + +/* cross compilers should define both AC_INT{2,4}_TYPE in CPPFLAGS */ + +#if !defined( AC_INT4_TYPE ) + /* use autoconf defines to provide sized typedefs */ +# if SIZEOF_LONG == 4 +# define AC_INT4_TYPE long +# elif SIZEOF_INT == 4 +# define AC_INT4_TYPE int +# elif SIZEOF_SHORT == 4 +# define AC_INT4_TYPE short +# else +# error "AC_INT4_TYPE?" +# endif +#endif + +typedef AC_INT4_TYPE ac_int4; +typedef signed AC_INT4_TYPE ac_sint4; +typedef unsigned AC_INT4_TYPE ac_uint4; + +#if !defined( AC_INT2_TYPE ) +# if SIZEOF_SHORT == 2 +# define AC_INT2_TYPE short +# elif SIZEOF_INT == 2 +# define AC_INT2_TYPE int +# elif SIZEOF_LONG == 2 +# define AC_INT2_TYPE long +# else +# error "AC_INT2_TYPE?" +# endif +#endif + +#if defined( AC_INT2_TYPE ) +typedef AC_INT2_TYPE ac_int2; +typedef signed AC_INT2_TYPE ac_sint2; +typedef unsigned AC_INT2_TYPE ac_uint2; +#endif + +#ifndef BYTE_ORDER +/* cross compilers should define BYTE_ORDER in CPPFLAGS */ + +/* + * Definitions for byte order, according to byte significance from low + * address to high. + */ +#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ +#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ + +/* assume autoconf's AC_C_BIGENDIAN has been ran */ +/* if it hasn't, we assume (maybe falsely) the order is LITTLE ENDIAN */ +# ifdef WORDS_BIGENDIAN +# define BYTE_ORDER BIG_ENDIAN +# else +# define BYTE_ORDER LITTLE_ENDIAN +# endif + +#endif /* BYTE_ORDER */ + +#endif /* _AC_BYTES_H */ diff --git a/contrib/libs/openldap/include/ac/ctype.h b/contrib/libs/openldap/include/ac/ctype.h new file mode 100644 index 0000000000..e385f3acbc --- /dev/null +++ b/contrib/libs/openldap/include/ac/ctype.h @@ -0,0 +1,33 @@ +/* Generic ctype.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_CTYPE_H +#define _AC_CTYPE_H + +#include <ctype.h> + +#undef TOUPPER +#undef TOLOWER + +#ifdef C_UPPER_LOWER +# define TOUPPER(c) (islower(c) ? toupper(c) : (c)) +# define TOLOWER(c) (isupper(c) ? tolower(c) : (c)) +#else +# define TOUPPER(c) toupper(c) +# define TOLOWER(c) tolower(c) +#endif + +#endif /* _AC_CTYPE_H */ diff --git a/contrib/libs/openldap/include/ac/dirent.h b/contrib/libs/openldap/include/ac/dirent.h new file mode 100644 index 0000000000..93df7b6f2a --- /dev/null +++ b/contrib/libs/openldap/include/ac/dirent.h @@ -0,0 +1,54 @@ +/* Generic dirent.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_DIRENT_H +#define _AC_DIRENT_H + +#ifdef HAVE_DIRENT_H +# include <dirent.h> +# define NAMLEN(dirent) strlen((dirent)->d_name) +#elif defined(_MSC_VER) +#include <windows.h> +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif +struct dirent { + char *d_name; +}; +typedef struct DIR { + HANDLE dir; + struct dirent data; + int first; + char buf[MAX_PATH+1]; +} DIR; +DIR *opendir(const char *name); +struct dirent *readdir(DIR *dir); +int closedir(DIR *dir); +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# ifdef HAVE_SYS_NDIR_H +# include <sys/ndir.h> +# endif +# ifdef HAVE_SYS_DIR_H +# include <sys/dir.h> +# endif +# ifdef HAVE_NDIR_H +# include <ndir.h> +# endif +#endif + +#endif /* _AC_DIRENT_H */ diff --git a/contrib/libs/openldap/include/ac/errno.h b/contrib/libs/openldap/include/ac/errno.h new file mode 100644 index 0000000000..8a7f32c909 --- /dev/null +++ b/contrib/libs/openldap/include/ac/errno.h @@ -0,0 +1,32 @@ +/* Generic errno.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_ERRNO_H +#define _AC_ERRNO_H + +#if defined( HAVE_ERRNO_H ) +# include <errno.h> +#elif defined( HAVE_SYS_ERRNO_H ) +# include <sys/errno.h> +#endif + +#if defined( HAVE_SYS_ERRLIST ) && defined( DECL_SYS_ERRLIST ) + /* have sys_errlist but need declaration */ + LDAP_LIBC_V(int) sys_nerr; + LDAP_LIBC_V(char) *sys_errlist[]; +#endif + +#endif /* _AC_ERRNO_H */ diff --git a/contrib/libs/openldap/include/ac/fdset.h b/contrib/libs/openldap/include/ac/fdset.h new file mode 100644 index 0000000000..620850b1fc --- /dev/null +++ b/contrib/libs/openldap/include/ac/fdset.h @@ -0,0 +1,42 @@ +/* redefine FD_SET */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +/* + * This header is to be included by portable.h to ensure + * tweaking of FD_SETSIZE is done early enough to be effective. + */ + +#ifndef _AC_FDSET_H +#define _AC_FDSET_H + +#if !defined( OPENLDAP_FD_SETSIZE ) && !defined( FD_SETSIZE ) +# define OPENLDAP_FD_SETSIZE 4096 +#endif + +#ifdef OPENLDAP_FD_SETSIZE + /* assume installer desires to enlarge fd_set */ +# ifdef HAVE_BITS_TYPES_H +# include <bits/types.h> +# endif +# ifdef __FD_SETSIZE +# undef __FD_SETSIZE +# define __FD_SETSIZE OPENLDAP_FD_SETSIZE +# else +# define FD_SETSIZE OPENLDAP_FD_SETSIZE +# endif +#endif + +#endif /* _AC_FDSET_H */ diff --git a/contrib/libs/openldap/include/ac/localize.h b/contrib/libs/openldap/include/ac/localize.h new file mode 100644 index 0000000000..9e19fe6e96 --- /dev/null +++ b/contrib/libs/openldap/include/ac/localize.h @@ -0,0 +1,44 @@ +/* localize.h (i18n/l10n) */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_LOCALIZE_H +#define _AC_LOCALIZE_H + +#ifdef LDAP_LOCALIZE + +# include <locale.h> +# include <libintl.h> + + /* enable i18n/l10n */ +# define gettext_noop(s) s +# define _(s) gettext(s) +# define N_(s) gettext_noop(s) +# define ldap_pvt_setlocale(c,l) ((void) setlocale(c, l)) +# define ldap_pvt_textdomain(d) ((void) textdomain(d)) +# define ldap_pvt_bindtextdomain(p,d) ((void) bindtextdomain(p, d)) + +#else + + /* disable i18n/l10n */ +# define _(s) s +# define N_(s) s +# define ldap_pvt_setlocale(c,l) ((void) 0) +# define ldap_pvt_textdomain(d) ((void) 0) +# define ldap_pvt_bindtextdomain(p,d) ((void) 0) + +#endif + +#endif /* _AC_LOCALIZE_H */ diff --git a/contrib/libs/openldap/include/ac/param.h b/contrib/libs/openldap/include/ac/param.h new file mode 100644 index 0000000000..a3f5d675e0 --- /dev/null +++ b/contrib/libs/openldap/include/ac/param.h @@ -0,0 +1,39 @@ +/* Generic param.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_PARAM_H +#define _AC_PARAM_H + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif + +/* MAXPATHLEN should come from <unistd.h> */ +#include <ac/unistd.h> + +#ifndef MAXPATHLEN +# if defined(PATH_MAX) +# define MAXPATHLEN PATH_MAX + +# elif defined(_MAX_PATH) +# define MAXPATHLEN _MAX_PATH + +# else +# define MAXPATHLEN 4096 +# endif +#endif + +#endif /* _AC_PARAM_H */ diff --git a/contrib/libs/openldap/include/ac/signal.h b/contrib/libs/openldap/include/ac/signal.h new file mode 100644 index 0000000000..1c7293bba2 --- /dev/null +++ b/contrib/libs/openldap/include/ac/signal.h @@ -0,0 +1,80 @@ +/* Generic signal.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_SIGNAL_H +#define _AC_SIGNAL_H + +#include <signal.h> + +#undef SIGNAL + +#if defined( HAVE_SIGACTION ) +#define SIGNAL lutil_sigaction +typedef void (*lutil_sig_t)(int); +LDAP_LUTIL_F(lutil_sig_t) lutil_sigaction( int sig, lutil_sig_t func ); +#define SIGNAL_REINSTALL(sig,act) (void)0 +#elif defined( HAVE_SIGSET ) +#define SIGNAL sigset +#define SIGNAL_REINSTALL sigset +#else +#define SIGNAL signal +#define SIGNAL_REINSTALL signal +#endif + +#if !defined( LDAP_SIGUSR1 ) || !defined( LDAP_SIGUSR2 ) +#undef LDAP_SIGUSR1 +#undef LDAP_SIGUSR2 + +# if defined(WINNT) || defined(_WINNT) || defined(_WIN32) +# define LDAP_SIGUSR1 SIGILL +# define LDAP_SIGUSR2 SIGTERM + +# elif !defined(HAVE_LINUX_THREADS) +# define LDAP_SIGUSR1 SIGUSR1 +# define LDAP_SIGUSR2 SIGUSR2 + +# else + /* + * Some versions of LinuxThreads unfortunately uses the only + * two signals reserved for user applications. This forces + * OpenLDAP to use other signals reserved for other uses. + */ + +# if defined( SIGSTKFLT ) +# define LDAP_SIGUSR1 SIGSTKFLT +# elif defined ( SIGSYS ) +# define LDAP_SIGUSR1 SIGSYS +# endif + +# if defined( SIGUNUSED ) +# define LDAP_SIGUSR2 SIGUNUSED +# elif defined ( SIGINFO ) +# define LDAP_SIGUSR2 SIGINFO +# elif defined ( SIGEMT ) +# define LDAP_SIGUSR2 SIGEMT +# endif +# endif +#endif + +#ifndef LDAP_SIGCHLD +#ifdef SIGCHLD +#define LDAP_SIGCHLD SIGCHLD +#elif SIGCLD +#define LDAP_SIGCHLD SIGCLD +#endif +#endif + +#endif /* _AC_SIGNAL_H */ diff --git a/contrib/libs/openldap/include/ac/socket.h b/contrib/libs/openldap/include/ac/socket.h new file mode 100644 index 0000000000..ce46c6f8b7 --- /dev/null +++ b/contrib/libs/openldap/include/ac/socket.h @@ -0,0 +1,264 @@ +/* Generic socket.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_SOCKET_H_ +#define _AC_SOCKET_H_ + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifdef HAVE_POLL_H +#include <poll.h> +#elif defined(HAVE_SYS_POLL_H) +#include <sys/poll.h> +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> + +#ifdef HAVE_SYS_UN_H +#include <sys/un.h> +#endif + +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif + +#include <netinet/in.h> + +#ifdef HAVE_NETINET_TCP_H +#include <netinet/tcp.h> +#endif + +#ifdef HAVE_ARPA_INET_H +#include <arpa/inet.h> +#endif + +#ifdef HAVE_ARPA_NAMESER_H +#include <arpa/nameser.h> +#endif + +#include <netdb.h> + +#ifdef HAVE_RESOLV_H +#include <resolv.h> +#endif + +#endif /* HAVE_SYS_SOCKET_H */ + +#ifdef HAVE_WINSOCK2 +#include <winsock2.h> +#include <ws2tcpip.h> +#elif defined(HAVE_WINSOCK) +#include <winsock.h> +#endif + +#ifdef HAVE_PCNFS +#error #include <tklib.h> +#endif /* HAVE_PCNFS */ + +#ifndef INADDR_LOOPBACK +#define INADDR_LOOPBACK (0x7f000001UL) +#endif + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif + +#undef sock_errno +#undef sock_errstr +#define sock_errno() errno +#define sock_errstr(e, b, l) AC_STRERROR_R(e, b, l) +#define sock_errset(e) ((void) (errno = (e))) + +#ifdef HAVE_WINSOCK +# define tcp_read( s, buf, len ) recv( s, buf, len, 0 ) +# define tcp_write( s, buf, len ) send( s, buf, len, 0 ) +# define ioctl( s, c, a ) ioctlsocket( (s), (c), (a) ) +# define ioctl_t u_long +# define AC_SOCKET_INVALID ((unsigned int) -1) + +# ifdef SD_BOTH +# define tcp_close( s ) (shutdown( s, SD_BOTH ), closesocket( s )) +# else +# define tcp_close( s ) closesocket( s ) +# endif + +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EINPROGRESS WSAEINPROGRESS +#define ETIMEDOUT WSAETIMEDOUT + +#undef sock_errno +#undef sock_errstr +#undef sock_errset +#define sock_errno() WSAGetLastError() +#define sock_errstr(e, b, l) ber_pvt_wsa_err2string(e) +#define sock_errset(e) WSASetLastError(e) + +LBER_F( char * ) ber_pvt_wsa_err2string LDAP_P((int)); + +#elif defined(MACOS) +# define tcp_close( s ) tcpclose( s ) +# define tcp_read( s, buf, len ) tcpread( s, buf, len ) +# define tcp_write( s, buf, len ) tcpwrite( s, buf, len ) + +#elif defined(HAVE_PCNFS) +# define tcp_close( s ) close( s ) +# define tcp_read( s, buf, len ) recv( s, buf, len, 0 ) +# define tcp_write( s, buf, len ) send( s, buf, len, 0 ) + +#elif defined(HAVE_NCSA) +# define tcp_close( s ) do { netclose( s ); netshut() } while(0) +# define tcp_read( s, buf, len ) nread( s, buf, len ) +# define tcp_write( s, buf, len ) netwrite( s, buf, len ) + +#elif defined(HAVE_CLOSESOCKET) +# define tcp_close( s ) closesocket( s ) + +# ifdef __BEOS__ +# define tcp_read( s, buf, len ) recv( s, buf, len, 0 ) +# define tcp_write( s, buf, len ) send( s, buf, len, 0 ) +# endif + +#else +# define tcp_read( s, buf, len) read( s, buf, len ) +# define tcp_write( s, buf, len) write( s, buf, len ) + +# ifdef SHUT_RDWR +# define tcp_close( s ) (shutdown( s, SHUT_RDWR ), close( s )) +# else +# define tcp_close( s ) close( s ) +# endif + +#ifdef HAVE_PIPE +/* + * Only use pipe() on systems where file and socket descriptors + * are interchangeable + */ +# define USE_PIPE HAVE_PIPE +#endif + +#endif /* MACOS */ + +#ifndef ioctl_t +# define ioctl_t int +#endif + +#ifndef AC_SOCKET_INVALID +# define AC_SOCKET_INVALID (-1) +#endif +#ifndef AC_SOCKET_ERROR +# define AC_SOCKET_ERROR (-1) +#endif + +#if !defined( HAVE_INET_ATON ) && !defined( inet_aton ) +# define inet_aton ldap_pvt_inet_aton +struct in_addr; +LDAP_F (int) ldap_pvt_inet_aton LDAP_P(( const char *, struct in_addr * )); +#endif + +#if defined(__WIN32) && defined(_ALPHA) +/* NT on Alpha is hosed. */ +# define AC_HTONL( l ) \ + ((((l)&0xffU)<<24) + (((l)&0xff00U)<<8) + \ + (((l)&0xff0000U)>>8) + (((l)&0xff000000U)>>24)) +# define AC_NTOHL(l) AC_HTONL(l) + +#else +# define AC_HTONL( l ) htonl( l ) +# define AC_NTOHL( l ) ntohl( l ) +#endif + +/* htons()/ntohs() may be broken much like htonl()/ntohl() */ +#define AC_HTONS( s ) htons( s ) +#define AC_NTOHS( s ) ntohs( s ) + +#ifdef LDAP_PF_LOCAL +# if !defined( AF_LOCAL ) && defined( AF_UNIX ) +# define AF_LOCAL AF_UNIX +# endif +# if !defined( PF_LOCAL ) && defined( PF_UNIX ) +# define PF_LOCAL PF_UNIX +# endif +#endif + +#ifndef INET_ADDRSTRLEN +# define INET_ADDRSTRLEN 16 +#endif +#ifndef INET6_ADDRSTRLEN +# define INET6_ADDRSTRLEN 46 +#endif + +#if defined( HAVE_GETADDRINFO ) || defined( HAVE_GETNAMEINFO ) +# ifdef HAVE_GAI_STRERROR +# define AC_GAI_STRERROR(x) (gai_strerror((x))) +# else +# define AC_GAI_STRERROR(x) (ldap_pvt_gai_strerror((x))) + LDAP_F (char *) ldap_pvt_gai_strerror( int ); +# endif +#endif + +#if defined(LDAP_PF_LOCAL) && \ + !defined(HAVE_GETPEEREID) && \ + !defined(HAVE_GETPEERUCRED) && \ + !defined(SO_PEERCRED) && !defined(LOCAL_PEERCRED) && \ + defined(HAVE_SENDMSG) && (defined(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTSLEN) || \ + defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)) +# define LDAP_PF_LOCAL_SENDMSG 1 +#endif + +#ifdef HAVE_GETPEEREID +#define LUTIL_GETPEEREID( s, uid, gid, bv ) getpeereid( s, uid, gid ) +#elif defined(LDAP_PF_LOCAL_SENDMSG) +struct berval; +LDAP_LUTIL_F( int ) lutil_getpeereid( int s, uid_t *, gid_t *, struct berval *bv ); +#define LUTIL_GETPEEREID( s, uid, gid, bv ) lutil_getpeereid( s, uid, gid, bv ) +#else +LDAP_LUTIL_F( int ) lutil_getpeereid( int s, uid_t *, gid_t * ); +#define LUTIL_GETPEEREID( s, uid, gid, bv ) lutil_getpeereid( s, uid, gid ) +#endif + +typedef union Sockaddr { + struct sockaddr sa_addr; + struct sockaddr_in sa_in_addr; +#ifdef LDAP_PF_INET6 + struct sockaddr_storage sa_storage; + struct sockaddr_in6 sa_in6_addr; +#endif +#ifdef LDAP_PF_LOCAL + struct sockaddr_un sa_un_addr; +#endif +} Sockaddr; + +/* DNS RFC defines max host name as 255. New systems seem to use 1024 */ +#ifndef NI_MAXHOST +#define NI_MAXHOST 256 +#endif + +#ifdef HAVE_POLL +# ifndef INFTIM +# define INFTIM (-1) +# endif +#undef POLL_OTHER +#define POLL_OTHER (POLLERR|POLLHUP) +#undef POLL_READ +#define POLL_READ (POLLIN|POLLPRI|POLL_OTHER) +#undef POLL_WRITE +#define POLL_WRITE (POLLOUT|POLL_OTHER) +#endif + +#endif /* _AC_SOCKET_H_ */ diff --git a/contrib/libs/openldap/include/ac/stdarg.h b/contrib/libs/openldap/include/ac/stdarg.h new file mode 100644 index 0000000000..7ba29737e3 --- /dev/null +++ b/contrib/libs/openldap/include/ac/stdarg.h @@ -0,0 +1,28 @@ +/* Generic stdarg.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_STDARG_H +#define _AC_STDARG_H 1 + +/* require STDC variable argument support */ + +#include <stdarg.h> + +#ifndef HAVE_STDARG +# define HAVE_STDARG 1 +#endif + +#endif /* _AC_STDARG_H */ diff --git a/contrib/libs/openldap/include/ac/stdlib.h b/contrib/libs/openldap/include/ac/stdlib.h new file mode 100644 index 0000000000..d9a95136ac --- /dev/null +++ b/contrib/libs/openldap/include/ac/stdlib.h @@ -0,0 +1,48 @@ +/* Generic stdlib.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_STDLIB_H +#define _AC_STDLIB_H + +#if defined( HAVE_CSRIMALLOC ) +#include <stdio.h> +#define MALLOC_TRACE +#error #include <libmalloc.h> +#endif + +#include <stdlib.h> + +/* Ignore malloc.h if we have STDC_HEADERS */ +#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS) +# include <malloc.h> +#endif + +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +#endif + +#ifdef HAVE_LIMITS_H +#include <limits.h> +#endif + +#if defined(LINE_MAX) +# define AC_LINE_MAX LINE_MAX +#else +# define AC_LINE_MAX 2048 /* POSIX MIN */ +#endif + +#endif /* _AC_STDLIB_H */ diff --git a/contrib/libs/openldap/include/ac/string.h b/contrib/libs/openldap/include/ac/string.h new file mode 100644 index 0000000000..c4c135410e --- /dev/null +++ b/contrib/libs/openldap/include/ac/string.h @@ -0,0 +1,118 @@ +/* Generic string.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_STRING_H +#define _AC_STRING_H + +#ifdef STDC_HEADERS +# include <string.h> + +#else +# ifdef HAVE_STRING_H +# include <string.h> +# endif +# if defined(HAVE_STRINGS_H) && (!defined(HAVE_STRING_H) || defined(BOTH_STRINGS_H)) +# include <strings.h> +# endif + +# ifdef HAVE_MEMORY_H +# include <memory.h> +# endif + +# ifndef HAVE_STRRCHR +# undef strchr +# define strchr index +# undef strrchr +# define strrchr rindex +# endif + +# ifndef HAVE_MEMCPY +# undef memcpy +# define memcpy(d, s, n) ((void) bcopy ((s), (d), (n))) +# undef memmove +# define memmove(d, s, n) ((void) bcopy ((s), (d), (n))) +# endif +#endif + +/* use ldap_pvt_strtok instead of strtok or strtok_r! */ +LDAP_F(char *) ldap_pvt_strtok LDAP_P(( char *str, + const char *delim, char **pos )); + +#ifndef HAVE_STRDUP + /* strdup() is missing, declare our own version */ +# undef strdup +# define strdup(s) ber_strdup(s) +#elif !defined(_WIN32) + /* some systems fail to declare strdup */ + /* Windows does not require this declaration */ + LDAP_LIBC_F(char *) (strdup)(); +#endif + +/* + * some systems fail to declare strcasecmp() and strncasecmp() + * we need them declared so we can obtain pointers to them + */ + +/* we don't want these declared for Windows or Mingw */ +#ifndef _WIN32 +int (strcasecmp)(); +int (strncasecmp)(); +#endif + +#ifndef SAFEMEMCPY +# if defined( HAVE_MEMMOVE ) +# define SAFEMEMCPY( d, s, n ) memmove((d), (s), (n)) +# elif defined( HAVE_BCOPY ) +# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n)) +# else + /* nothing left but memcpy() */ +# define SAFEMEMCPY( d, s, n ) memcpy((d), (s), (n)) +# endif +#endif + +#define AC_MEMCPY( d, s, n ) (SAFEMEMCPY((d),(s),(n))) +#define AC_FMEMCPY( d, s, n ) do { \ + if((n) == 1) *((char*)(d)) = *((char*)(s)); \ + else AC_MEMCPY( (d), (s), (n) ); \ + } while(0) + +#ifdef NEED_MEMCMP_REPLACEMENT + int (lutil_memcmp)(const void *b1, const void *b2, size_t len); +#define memcmp lutil_memcmp +#endif + +void *(lutil_memrchr)(const void *b, int c, size_t n); +/* GNU extension (glibc >= 2.1.91), only declared when defined(_GNU_SOURCE) */ +#if defined(HAVE_MEMRCHR) && defined(_GNU_SOURCE) +#define lutil_memrchr(b, c, n) memrchr(b, c, n) +#endif /* ! HAVE_MEMRCHR */ + +#define STRLENOF(s) (sizeof(s)-1) + +#if defined( HAVE_NONPOSIX_STRERROR_R ) +# define AC_STRERROR_R(e,b,l) (strerror_r((e), (b), (l))) +#elif defined( HAVE_STRERROR_R ) +# define AC_STRERROR_R(e,b,l) (strerror_r((e), (b), (l)) == 0 ? (b) : "Unknown error") +#elif defined( HAVE_SYS_ERRLIST ) +# define AC_STRERROR_R(e,b,l) ((e) > -1 && (e) < sys_nerr \ + ? sys_errlist[(e)] : "Unknown error" ) +#elif defined( HAVE_STRERROR ) +# define AC_STRERROR_R(e,b,l) (strerror(e)) /* NOTE: may be NULL */ +#else +# define AC_STRERROR_R(e,b,l) ("Unknown error") +#endif + +#endif /* _AC_STRING_H */ diff --git a/contrib/libs/openldap/include/ac/syslog.h b/contrib/libs/openldap/include/ac/syslog.h new file mode 100644 index 0000000000..90028ae704 --- /dev/null +++ b/contrib/libs/openldap/include/ac/syslog.h @@ -0,0 +1,38 @@ +/* Generic syslog.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_SYSLOG_H_ +#define _AC_SYSLOG_H_ + +#if defined( HAVE_SYSLOG_H ) +#include <syslog.h> +#elif defined ( HAVE_SYS_SYSLOG_H ) +#include <sys/syslog.h> +#endif + +#if defined( LOG_NDELAY ) && defined( LOG_NOWAIT ) +# define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY | LOG_NOWAIT ) +#elif defined( LOG_NDELAY ) +# define OPENLOG_OPTIONS ( LOG_PID | LOG_NDELAY ) +#elif defined( LOG_NOWAIT ) +# define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT ) +#elif defined( LOG_PID ) +# define OPENLOG_OPTIONS ( LOG_PID ) +#else +# define OPENLOG_OPTIONS ( 0 ) +#endif + +#endif /* _AC_SYSLOG_H_ */ diff --git a/contrib/libs/openldap/include/ac/time.h b/contrib/libs/openldap/include/ac/time.h new file mode 100644 index 0000000000..b715db04e8 --- /dev/null +++ b/contrib/libs/openldap/include/ac/time.h @@ -0,0 +1,35 @@ +/* Generic time.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_TIME_H +#define _AC_TIME_H + +#if defined(HAVE_SYS_TIME_H) +# include <sys/time.h> +# ifdef HAVE_SYS_TIMEB_H +# include <sys/timeb.h> +# endif +#endif +# include <time.h> + +#if defined(_WIN32) && !defined(HAVE_CLOCK_GETTIME) + struct timespec { + time_t tv_sec; + int tv_nsec; + }; +#endif + +#endif /* _AC_TIME_H */ diff --git a/contrib/libs/openldap/include/ac/unistd.h b/contrib/libs/openldap/include/ac/unistd.h new file mode 100644 index 0000000000..64e8a8301b --- /dev/null +++ b/contrib/libs/openldap/include/ac/unistd.h @@ -0,0 +1,72 @@ +/* Generic unistd.h */ +/* $OpenLDAP$ */ +/* This work is part of OpenLDAP Software <http://www.openldap.org/>. + * + * Copyright 1998-2022 The OpenLDAP Foundation. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted only as authorized by the OpenLDAP + * Public License. + * + * A copy of this license is available in file LICENSE in the + * top-level directory of the distribution or, alternatively, at + * <http://www.OpenLDAP.org/license.html>. + */ + +#ifndef _AC_UNISTD_H +#define _AC_UNISTD_H + +#ifdef HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif + +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif + +#ifdef HAVE_PROCESS_H +# include <process.h> +#endif + +/* note: callers of crypt(3) should include <ac/crypt.h> */ + +#if defined(HAVE_GETPASSPHRASE) +LDAP_LIBC_F(char*)(getpassphrase)(); + +#else +#define getpassphrase(p) lutil_getpass(p) +LDAP_LUTIL_F(char*)(lutil_getpass) LDAP_P((const char *getpass)); +#endif + +/* getopt() defines may be in separate include file */ +#ifdef HAVE_GETOPT_H +# include <getopt.h> + +#elif !defined(HAVE_GETOPT) + /* no getopt, assume we need getopt-compat.h */ +# error #include <getopt-compat.h> + +#else + /* assume we need to declare these externs */ + LDAP_LIBC_V (char *) optarg; + LDAP_LIBC_V (int) optind, opterr, optopt; +#endif + +/* use lutil file locking */ +#define ldap_lockf(x) lutil_lockf(x) +#define ldap_unlockf(x) lutil_unlockf(x) +#include <lutil_lockf.h> + +/* + * Windows: although sleep() will be resolved by both MSVC and Mingw GCC + * linkers, the function is not declared in header files. This is + * because Windows' version of the function is called Sleep(), and it + * is declared in windows.h + */ + +#ifdef _WIN32 +#define sleep(x) Sleep((x) * 1000) +#endif + +#endif /* _AC_UNISTD_H */ |