1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/* common utility macros
* See https://www.python-ldap.org/ for details. */
#ifndef __h_common
#define __h_common
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <lber.h>
#include <ldap.h>
#include <ldap_features.h>
#if LDAP_VENDOR_VERSION < 20400
#error Current python-ldap requires OpenLDAP 2.4.x
#endif
#if LDAP_VENDOR_VERSION >= 20448
/* openldap.h with ldap_init_fd() was introduced in 2.4.48
* see https://bugs.openldap.org/show_bug.cgi?id=8671
*/
#define HAVE_LDAP_INIT_FD 1
#include <openldap.h>
#elif (defined(__APPLE__) && (LDAP_VENDOR_VERSION == 20428))
/* macOS system libldap 2.4.28 does not have ldap_init_fd symbol */
#undef HAVE_LDAP_INIT_FD
#else
/* ldap_init_fd() has been around for a very long time
* SSSD has been defining the function for a while, so it's probably OK.
*/
#define HAVE_LDAP_INIT_FD 1
#define LDAP_PROTO_TCP 1
#define LDAP_PROTO_UDP 2
#define LDAP_PROTO_IPC 3
extern int ldap_init_fd(ber_socket_t fd, int proto, LDAP_CONST char *url,
LDAP **ldp);
#endif
#if defined(MS_WINDOWS)
#include <winsock.h>
#else /* unix */
#include <netdb.h>
#include <sys/time.h>
#include <sys/types.h>
#endif
#include <string.h>
#define streq( a, b ) \
( (*(a)==*(b)) && 0==strcmp(a,b) )
extern PyObject *LDAPerror_TypeError(const char *, PyObject *);
void LDAPadd_methods(PyObject *d, PyMethodDef *methods);
#define PyNone_Check(o) ((o) == Py_None)
/* Py2/3 compatibility */
#if PY_VERSION_HEX >= 0x03000000
/* In Python 3, alias PyInt to PyLong */
#define PyInt_FromLong PyLong_FromLong
#endif
#endif /* __h_common_ */
|