From: Arran Cudbard-Bell Date: Thu, 13 Apr 2017 16:13:17 +0000 (-0400) Subject: Limit the message types we call ldap_result for X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f752c38fdcbcb8f0bba33dbf0bc21a0df8099c0c;p=thirdparty%2Ffreeradius-server.git Limit the message types we call ldap_result for --- diff --git a/src/lib/ldap/.gitignore b/src/lib/ldap/.gitignore new file mode 100644 index 00000000000..01a5daa3cc5 --- /dev/null +++ b/src/lib/ldap/.gitignore @@ -0,0 +1 @@ +all.mk diff --git a/src/lib/ldap/all.mk b/src/lib/ldap/all.mk deleted file mode 100644 index 9a13798a7e4..00000000000 --- a/src/lib/ldap/all.mk +++ /dev/null @@ -1,10 +0,0 @@ -TARGETNAME := libfreeradius-ldap - -ifneq "$(TARGETNAME)" "" -TARGET := $(TARGETNAME).a -endif - -SOURCES := libfreeradius-ldap.c control.c directory.c edir.c util.c - -SRC_CFLAGS := -TGT_LDLIBS := -llber -lldap diff --git a/src/lib/ldap/libfreeradius-ldap.c b/src/lib/ldap/libfreeradius-ldap.c index 3ff93cfe7c1..0b9ba7c65e2 100644 --- a/src/lib/ldap/libfreeradius-ldap.c +++ b/src/lib/ldap/libfreeradius-ldap.c @@ -252,16 +252,28 @@ ldap_rcode_t fr_ldap_result(ldap_handle_t const *conn, * ldap_result returns -1 on failure, and 0 on timeout */ lib_errno = ldap_result(conn->handle, msgid, all, &tv, result); - if (lib_errno == 0) { + switch (lib_errno) { + case 0: lib_errno = LDAP_TIMEOUT; - goto process_error; - } - if (lib_errno == -1) { + case -1: ldap_get_option(conn->handle, LDAP_OPT_ERROR_NUMBER, &lib_errno); - goto process_error; + + /* + * ldap_parse_result only works on: + * - LDAPResult + * - BindResponse + * - ExtendedResponse + */ + case LDAP_RES_SEARCH_RESULT: + case LDAP_RES_BIND: + case LDAP_RES_EXTENDED: + break; + + default: + return LDAP_PROC_SUCCESS; } /*