mirror of
https://github.com/moparisthebest/curl
synced 2025-03-03 02:41:59 -05:00
version: add OpenLDAP version in the output
Assisted-by: Howard Chu Closes #7054
This commit is contained in:
parent
ba3452cafc
commit
bf0feae776
@ -70,6 +70,10 @@
|
||||
#include <gsasl.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENLDAP
|
||||
#include <ldap.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BROTLI
|
||||
static size_t brotli_version(char *buf, size_t bufsz)
|
||||
{
|
||||
@ -104,7 +108,7 @@ static size_t zstd_version(char *buf, size_t bufsz)
|
||||
* zeros in the data.
|
||||
*/
|
||||
|
||||
#define VERSION_PARTS 16 /* number of substrings we can concatenate */
|
||||
#define VERSION_PARTS 17 /* number of substrings we can concatenate */
|
||||
|
||||
char *curl_version(void)
|
||||
{
|
||||
@ -153,6 +157,9 @@ char *curl_version(void)
|
||||
#endif
|
||||
#ifdef USE_GSASL
|
||||
char gsasl_buf[30];
|
||||
#endif
|
||||
#ifdef USE_OPENLDAP
|
||||
char ldap_buf[30];
|
||||
#endif
|
||||
int i = 0;
|
||||
int j;
|
||||
@ -247,6 +254,22 @@ char *curl_version(void)
|
||||
gsasl_check_version(NULL));
|
||||
src[i++] = gsasl_buf;
|
||||
#endif
|
||||
#ifdef USE_OPENLDAP
|
||||
{
|
||||
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 = api.ldapai_vendor_version % 100;
|
||||
unsigned int major = api.ldapai_vendor_version / 10000;
|
||||
unsigned int minor =
|
||||
((api.ldapai_vendor_version - major * 10000) - patch) / 100;
|
||||
msnprintf(ldap_buf, sizeof(ldap_buf), "%s/%u.%u.%u",
|
||||
api.ldapai_vendor_name, major, minor, patch);
|
||||
src[i++] = ldap_buf;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(i <= VERSION_PARTS);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user