X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Flookups%2Fldap.c;h=e2dbe51624b23e3ef3c04a87c6bcc84faef91e06;hb=7f83b348ccf4cd815e9758ab9ca1012e66324e9d;hp=8972d1074b81ec6f2f3af7e0370bc5febe11a93c;hpb=870ce70e11912e8858ef4c071f2778b93a4b2ac9;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c index 8972d1074..e2dbe5162 100644 --- a/src/src/lookups/ldap.c +++ b/src/src/lookups/ldap.c @@ -3,6 +3,7 @@ *************************************************/ /* Copyright (c) University of Cambridge 1995 - 2018 */ +/* Copyright (c) The Exim Maintainers 2020 */ /* See the file NOTICE for conditions of use and distribution. */ /* Many thanks to Stuart Lynne for contributing the original code for this @@ -1283,38 +1284,33 @@ are handled by a common function, with a flag to differentiate between them. The handle and filename arguments are not used. */ static int -eldap_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, uint *do_cache) +eldap_find(void * handle, const uschar * filename, const uschar * ldap_url, + int length, uschar ** result, uschar ** errmsg, uint * do_cache, + const uschar * opts) { -/* Keep picky compilers happy */ -do_cache = do_cache; return(control_ldap_search(ldap_url, SEARCH_LDAP_SINGLE, result, errmsg)); } static int -eldapm_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, uint *do_cache) +eldapm_find(void * handle, const uschar * filename, const uschar * ldap_url, + int length, uschar ** result, uschar ** errmsg, uint * do_cache, + const uschar * opts) { -/* Keep picky compilers happy */ -do_cache = do_cache; return(control_ldap_search(ldap_url, SEARCH_LDAP_MULTIPLE, result, errmsg)); } static int -eldapdn_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, uint *do_cache) +eldapdn_find(void * handle, const uschar * filename, const uschar * ldap_url, + int length, uschar ** result, uschar ** errmsg, uint * do_cache, + const uschar * opts) { -/* Keep picky compilers happy */ -do_cache = do_cache; return(control_ldap_search(ldap_url, SEARCH_LDAP_DN, result, errmsg)); } int -eldapauth_find(void *handle, uschar *filename, const uschar *ldap_url, int length, - uschar **result, uschar **errmsg, uint *do_cache) +eldapauth_find(void * handle, const uschar * filename, const uschar * ldap_url, + int length, uschar ** result, uschar ** errmsg, uint * do_cache) { -/* Keep picky compilers happy */ -do_cache = do_cache; return(control_ldap_search(ldap_url, SEARCH_LDAP_AUTH, result, errmsg)); } @@ -1327,7 +1323,7 @@ return(control_ldap_search(ldap_url, SEARCH_LDAP_AUTH, result, errmsg)); /* See local README for interface description. */ static void * -eldap_open(uschar *filename, uschar **errmsg) +eldap_open(const uschar * filename, uschar ** errmsg) { return (void *)(1); /* Just return something non-null */ } @@ -1344,16 +1340,13 @@ Make sure that eldap_dn does not refer to reclaimed or worse, freed store */ static void eldap_tidy(void) { -LDAP_CONNECTION *lcp = NULL; eldap_dn = NULL; -while ((lcp = ldap_connections) != NULL) +for (LDAP_CONNECTION *lcp; lcp = ldap_connections; ldap_connections = lcp->next) { - DEBUG(D_lookup) debug_printf_indent("unbind LDAP connection to %s:%d\n", lcp->host, - lcp->port); - if(lcp->bound == TRUE) - ldap_unbind(lcp->ld); - ldap_connections = lcp->next; + DEBUG(D_lookup) debug_printf_indent("unbind LDAP connection to %s:%d\n", + lcp->host, lcp->port); + if(lcp->bound) ldap_unbind(lcp->ld); } } @@ -1577,39 +1570,39 @@ fprintf(f, "Library version: LDAP: Exim version %s\n", EXIM_VERSION_STR); static lookup_info ldap_lookup_info = { - US"ldap", /* lookup name */ - lookup_querystyle, /* query-style lookup */ - eldap_open, /* open function */ - NULL, /* check function */ - eldap_find, /* find function */ - NULL, /* no close function */ - eldap_tidy, /* tidy function */ - eldap_quote, /* quoting function */ - ldap_version_report /* version reporting */ + .name = US"ldap", /* lookup name */ + .type = lookup_querystyle, /* query-style lookup */ + .open = eldap_open, /* open function */ + .check = NULL, /* check function */ + .find = eldap_find, /* find function */ + .close = NULL, /* no close function */ + .tidy = eldap_tidy, /* tidy function */ + .quote = eldap_quote, /* quoting function */ + .version_report = ldap_version_report /* version reporting */ }; static lookup_info ldapdn_lookup_info = { - US"ldapdn", /* lookup name */ - lookup_querystyle, /* query-style lookup */ - eldap_open, /* sic */ /* open function */ - NULL, /* check function */ - eldapdn_find, /* find function */ - NULL, /* no close function */ - eldap_tidy, /* sic */ /* tidy function */ - eldap_quote, /* sic */ /* quoting function */ - NULL /* no version reporting (redundant) */ + .name = US"ldapdn", /* lookup name */ + .type = lookup_querystyle, /* query-style lookup */ + .open = eldap_open, /* sic */ /* open function */ + .check = NULL, /* check function */ + .find = eldapdn_find, /* find function */ + .close = NULL, /* no close function */ + .tidy = eldap_tidy, /* sic */ /* tidy function */ + .quote = eldap_quote, /* sic */ /* quoting function */ + .version_report = NULL /* no version reporting (redundant) */ }; static lookup_info ldapm_lookup_info = { - US"ldapm", /* lookup name */ - lookup_querystyle, /* query-style lookup */ - eldap_open, /* sic */ /* open function */ - NULL, /* check function */ - eldapm_find, /* find function */ - NULL, /* no close function */ - eldap_tidy, /* sic */ /* tidy function */ - eldap_quote, /* sic */ /* quoting function */ - NULL /* no version reporting (redundant) */ + .name = US"ldapm", /* lookup name */ + .type = lookup_querystyle, /* query-style lookup */ + .open = eldap_open, /* sic */ /* open function */ + .check = NULL, /* check function */ + .find = eldapm_find, /* find function */ + .close = NULL, /* no close function */ + .tidy = eldap_tidy, /* sic */ /* tidy function */ + .quote = eldap_quote, /* sic */ /* quoting function */ + .version_report = NULL /* no version reporting (redundant) */ }; #ifdef DYNLOOKUP