FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-ldap/Modules/pythonldap.h at main · python-ldap/python-ldap · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python-ldap
/
python-ldap
Public
Notifications
You must be signed in to change notification settings
Fork
135
Star
441
Code
Issues
83
Pull requests
17
Actions
Projects
Security and quality
3
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-ldap
/
Modules
/
pythonldap.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
133 lines (105 loc) · 4.04 KB
Breadcrumbs
python-ldap
/
Modules
/
pythonldap.h
Copy path
File metadata and controls
133 lines (105 loc) · 4.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* common utility macros
* See https://www.python-ldap.org/ for details. */
#ifndef
pythonldap_h
#define
pythonldap_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
LDAP_F
(
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
#define
PYLDAP_FUNC
(
rtype
) rtype
#define
PYLDAP_DATA
(
rtype
) extern rtype
PYLDAP_FUNC
(
PyObject
*
)
LDAPerror_TypeError
(
const
char
*
,
PyObject
*
);
PYLDAP_FUNC
(
void
)
LDAPadd_methods
(
PyObject
*
d
,
PyMethodDef
*
methods
);
#define
PyNone_Check
(
o
) ((o) == Py_None)
/* *** berval *** */
PYLDAP_FUNC
(
PyObject
*
)
LDAPberval_to_object
(
const
struct
berval
*
bv
);
PYLDAP_FUNC
(
PyObject
*
)
LDAPberval_to_unicode_object
(
const
struct
berval
*
bv
);
/* *** constants *** */
PYLDAP_FUNC
(
int
)
LDAPinit_constants
(
PyObject
*
m
);
PYLDAP_DATA
(
PyObject
*
)
LDAPexception_class
;
PYLDAP_FUNC
(
PyObject
*
)
LDAPerror
(
LDAP
*
);
PYLDAP_FUNC
(
PyObject
*
)
LDAPraise_for_message
(
LDAP
*
,
LDAPMessage
*
m
);
PYLDAP_FUNC
(
PyObject
*
)
LDAPerr
(
int
errnum
);
PYLDAP_DATA
(
LDAPAPIInfo
)
ldap_version_info
;
#ifndef
LDAP_CONTROL_PAGE_OID
#define
LDAP_CONTROL_PAGE_OID
"1.2.840.113556.1.4.319"
#endif
/* !LDAP_CONTROL_PAGE_OID */
#ifndef
LDAP_CONTROL_VALUESRETURNFILTER
#define
LDAP_CONTROL_VALUESRETURNFILTER
"1.2.826.0.1.3344810.2.3"
/* RFC 3876 */
#endif
/* !LDAP_CONTROL_VALUESRETURNFILTER */
/* *** functions *** */
PYLDAP_FUNC
(
void
)
LDAPinit_functions
(
PyObject
*
);
/* *** ldapcontrol *** */
PYLDAP_FUNC
(
void
)
LDAPinit_control
(
PyObject
*
d
);
PYLDAP_FUNC
(
void
)
LDAPControl_List_DEL
(
LDAPControl
*
*
);
PYLDAP_FUNC
(
int
)
LDAPControls_from_object
(
PyObject
*
,
LDAPControl
*
*
*
);
PYLDAP_FUNC
(
PyObject
*
)
LDAPControls_to_List
(
LDAPControl
*
*
ldcs
);
/* *** ldapobject *** */
typedef
struct
{
PyObject_HEAD
LDAP
*
ldap
;
PyThreadState
*
_save
;
/* for thread saving on referrals */
int
valid
;
}
LDAPObject
;
PYLDAP_DATA
(
PyTypeObject
)
LDAP_Type
;
PYLDAP_FUNC
(
LDAPObject
*
)
newLDAPObject
(
LDAP
*
);
/* macros to allow thread saving in the context of an LDAP connection */
#define
LDAP_BEGIN_ALLOW_THREADS
(
l
) \
{ \
LDAPObject *lo = (l); \
if (lo->_save != NULL) \
Py_FatalError( "saving thread twice?" ); \
lo->_save = PyEval_SaveThread(); \
}
#define
LDAP_END_ALLOW_THREADS
(
l
) \
{ \
LDAPObject *lo = (l); \
PyThreadState *_save = lo->_save; \
lo->_save = NULL; \
PyEval_RestoreThread( _save ); \
}
/* *** messages *** */
PYLDAP_FUNC
(
PyObject
*
)
LDAPmessage_to_python
(
LDAP
*
ld
,
LDAPMessage
*
m
,
int
add_ctrls
,
int
add_intermediates
);
/* *** options *** */
PYLDAP_FUNC
(
int
)
LDAP_optionval_by_name
(
const
char
*
name
);
PYLDAP_FUNC
(
int
)
LDAP_set_option
(
LDAPObject
*
self
,
int
option
,
PyObject
*
value
);
PYLDAP_FUNC
(
PyObject
*
)
LDAP_get_option
(
LDAPObject
*
self
,
int
option
);
PYLDAP_FUNC
(
void
)
set_timeval_from_double
(
struct
timeval
*
tv
,
double
d
);
#endif
/* pythonldap_h */
Back
|
FazBrowse Home
|
New Git URL