File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,14 @@ LDAPinit_constants(PyObject *m)
231231 if (PyModule_AddIntConstant (m , "LIBLDAP_R" , thread_safe ) != 0 )
232232 return -1 ;
233233
234+ if (ldap_get_option (NULL , LDAP_OPT_API_INFO , & ldap_version_info ) != LDAP_SUCCESS ) {
235+ PyErr_SetString (PyExc_ImportError , "unrecognised libldap version" );
236+ return -1 ;
237+ }
238+ if (PyModule_AddIntConstant (m , "VENDOR_VERSION_RUNTIME" ,
239+ ldap_version_info .ldapai_vendor_version ) != 0 )
240+ return -1 ;
241+
234242 /* Generated constants -- see Lib/ldap/constants.py */
235243
236244#define add_err (n ) do { \
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ extern PyObject *LDAPerror(LDAP *);
1313extern PyObject * LDAPraise_for_message (LDAP * , LDAPMessage * m );
1414PyObject * LDAPerr (int errnum );
1515
16+ extern LDAPAPIInfo ldap_version_info ;
17+
1618#ifndef LDAP_CONTROL_PAGE_OID
1719#define LDAP_CONTROL_PAGE_OID "1.2.840.113556.1.4.319"
1820#endif /* !LDAP_CONTROL_PAGE_OID */
Original file line number Diff line number Diff line change @@ -16,6 +16,10 @@ PyMODINIT_FUNC init_ldap(void);
1616#define _STR (x ) #x
1717#define STR (x ) _STR(x)
1818
19+ LDAPAPIInfo ldap_version_info = {
20+ .ldapai_info_version = LDAP_API_INFO_VERSION ,
21+ };
22+
1923static char version_str [] = STR (LDAPMODULE_VERSION );
2024static char author_str [] = STR (LDAPMODULE_AUTHOR );
2125static char license_str [] = STR (LDAPMODULE_LICENSE );
You can’t perform that action at this time.
0 commit comments