diff options
author | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2022-02-16 10:33:53 +0300 |
---|---|---|
committer | Dmitrijs Goloscapovs <dmitrijs.goloscapovs@zabbix.com> | 2022-02-17 17:02:13 +0300 |
commit | 6fdb83e4a1d331a8545f0758fd11c0a7660c1f4b (patch) | |
tree | ec9a749a55adf684bfc3ce1848b3687add878d51 /src | |
parent | da34f02b4fc8710106e5f1c9395e1ccfbaccbd8b (diff) |
........S. [ZBX-19789] added SourceIP support to ldap simple checks
Merge in ZBX/zabbix from feature/ZBX-19789-5.0 to release/5.0
* commit 'fee486b0b07412cbaf5cb3bbec14d7ea94afa0ac':
........S. [ZBX-19789] fixed usage of sourceip with bugged lib versions
........S. [ZBX-19789] added SourceIP support to ldap simple checks
(cherry picked from commit e36333e41c1a79f6cd0d336bc981e5c0f123bd0c)
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxsysinfo/simple/simple.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libs/zbxsysinfo/simple/simple.c b/src/libs/zbxsysinfo/simple/simple.c index 191c19650d2..be1b9f9d29c 100644 --- a/src/libs/zbxsysinfo/simple/simple.c +++ b/src/libs/zbxsysinfo/simple/simple.c @@ -68,6 +68,18 @@ static int check_ldap(const char *host, unsigned short port, int timeout, int *v goto lbl_ret; } + #if defined(LDAP_OPT_SOCKET_BIND_ADDRESSES) && defined(HAVE_LDAP_SOURCEIP) + if (NULL != CONFIG_SOURCE_IP) + { + if (LDAP_SUCCESS != (ldapErr = ldap_set_option(ldap, LDAP_OPT_SOCKET_BIND_ADDRESSES, CONFIG_SOURCE_IP))) + { + zabbix_log(LOG_LEVEL_DEBUG, "LDAP - failed to set source ip address [%s]", + ldap_err2string(ldapErr)); + goto lbl_ret; + } + } + #endif + if (LDAP_SUCCESS != (ldapErr = ldap_search_s(ldap, "", LDAP_SCOPE_BASE, "(objectClass=*)", attrs, 0, &res))) { zabbix_log(LOG_LEVEL_DEBUG, "LDAP - searching failed [%s] [%s]", host, ldap_err2string(ldapErr)); |