← Commit list

859ce48de1

Viktor Szakats
Viktor Szakats
2025-12-04
SUCCESS Duration: 228s

Subject

ldap: detect version of "legacy" LDAP

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/ldap.c+21 -1
@@ -1029,7 +1029,27 @@ void Curl_ldap_version(char *buf, size_t bufsz)
#ifdef USE_WIN32_LDAP
curl_msnprintf(buf, bufsz, "WinLDAP");
#else
- curl_msnprintf(buf, bufsz, "LDAP/1");
+#ifdef __APPLE__
+ static const char *flavor = "/Apple";
+#else
+ static const char *flavor = "";
+#endif
+ 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%s",
+ api.ldapai_vendor_name, major, minor, patch, flavor);
+ ldap_memfree(api.ldapai_vendor_name);
+ ber_memvfree((void **)api.ldapai_extensions);
+ }
+ else
+ curl_msnprintf(buf, bufsz, "LDAP/1");
#endif
}