summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-05-12 11:09:12 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-05-13 11:51:02 +0200
commitbf0feae7768d9214e2e7b52dc96fc80f88be730d (patch)
tree69bbf539cc1d3ac925746ad79ffeb52f2979eb60 /lib
parentba3452cafc9920d133cb8f38ade2377be21acf0d (diff)
downloadcurl-bf0feae7768d9214e2e7b52dc96fc80f88be730d.tar.gz
version: add OpenLDAP version in the output
Assisted-by: Howard Chu Closes #7054
Diffstat (limited to 'lib')
-rw-r--r--lib/version.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/version.c b/lib/version.c
index 4b1e7542c..d18cf0e3f 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -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)
{
@@ -154,6 +158,9 @@ char *curl_version(void)
#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);