mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:41:40 +03:00
ldap: provide version for "legacy" ldap as well
It displays in version output as WinLDAP and LDAP/1, compared to OpenLDAP/[version] for the OpenLDAP backend code. Closes #19808
This commit is contained in:
parent
b30c1b97b9
commit
3e2a946926
4 changed files with 35 additions and 27 deletions
|
|
@ -1331,4 +1331,24 @@ ldapsb_tls_write(Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len)
|
|||
}
|
||||
#endif /* USE_SSL */
|
||||
|
||||
void Curl_ldap_version(char *buf, size_t bufsz)
|
||||
{
|
||||
LDAPAPIInfo api;
|
||||
api.ldapai_info_version = LDAP_API_INFO_VERSION;
|
||||
|
||||
if(ldap_get_option(NULL, LDAP_OPT_API_INFO, &api) == LDAP_OPT_SUCCESS) {
|
||||
unsigned int patch = (unsigned int)(api.ldapai_vendor_version % 100);
|
||||
unsigned int major = (unsigned int)(api.ldapai_vendor_version / 10000);
|
||||
unsigned int minor =
|
||||
(((unsigned int)api.ldapai_vendor_version - major * 10000)
|
||||
- patch) / 100;
|
||||
curl_msnprintf(buf, bufsz, "%s/%u.%u.%u",
|
||||
api.ldapai_vendor_name, major, minor, patch);
|
||||
ldap_memfree(api.ldapai_vendor_name);
|
||||
ber_memvfree((void **)api.ldapai_extensions);
|
||||
}
|
||||
else
|
||||
curl_msnprintf(buf, bufsz, "OpenLDAP");
|
||||
}
|
||||
|
||||
#endif /* !CURL_DISABLE_LDAP && USE_OPENLDAP */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue