From a8e525a2104a9548510538f0910c920bf5ecd9bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Wed, 22 Dec 2021 13:57:36 +0100 Subject: [PATCH] Rename all function starting with ldap_ in dlz plugin To prevent any future conflicts, rename all functions starting with ldap_. --- bind-9.16-openldap-2.6-all.patch | 199 +++++++++++++++++++++++++++++++ bind.spec | 5 +- 2 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 bind-9.16-openldap-2.6-all.patch diff --git a/bind-9.16-openldap-2.6-all.patch b/bind-9.16-openldap-2.6-all.patch new file mode 100644 index 0000000..6af2714 --- /dev/null +++ b/bind-9.16-openldap-2.6-all.patch @@ -0,0 +1,199 @@ +From d02a805719d593863dd438798a29312a4177d207 Mon Sep 17 00:00:00 2001 +From: Petr Mensik +Date: Wed, 22 Dec 2021 13:38:02 +0100 +Subject: [PATCH 2/2] Change all internal functions to dlz_ldap prefix + +To prevent any conflict in the future, avoid ldap_ prefix in any +internal functions. Keep it reserved for openldap only. +--- + contrib/dlz/modules/ldap/dlz_ldap_dynamic.c | 52 ++++++++++----------- + 1 file changed, 26 insertions(+), 26 deletions(-) + +diff --git a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c +index 317a691..a653fac 100644 +--- a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c ++++ b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c +@@ -128,7 +128,7 @@ b9_add_helper(ldap_instance_t *db, const char *helper_name, void *ptr); + + /*% checks that the LDAP URL parameters make sense */ + static isc_result_t +-ldap_checkURL(ldap_instance_t *db, char *URL, int attrCnt, const char *msg) { ++dlz_ldap_checkURL(ldap_instance_t *db, char *URL, int attrCnt, const char *msg) { + isc_result_t result = ISC_R_SUCCESS; + int ldap_result; + LDAPURLDesc *ldap_url = NULL; +@@ -248,7 +248,7 @@ cleanup: + * multithreaded operation. + */ + static void +-ldap_destroy_dblist(db_list_t *dblist) { ++dlz_ldap_destroy_dblist(db_list_t *dblist) { + dbinstance_t *ndbi = NULL; + dbinstance_t *dbi = NULL; + +@@ -282,7 +282,7 @@ ldap_destroy_dblist(db_list_t *dblist) { + * multithreaded operation. + */ + static dbinstance_t * +-ldap_find_avail_conn(ldap_instance_t *ldap) { ++dlz_ldap_find_avail_conn(ldap_instance_t *ldap) { + dbinstance_t *dbi = NULL; + dbinstance_t *head; + int count = 0; +@@ -315,7 +315,7 @@ ldap_find_avail_conn(ldap_instance_t *ldap) { + #endif /* PTHREADS */ + + static isc_result_t +-ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg, ++dlz_ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg, + char **attrs, void *ptr, bool allnodes) { + isc_result_t result = ISC_R_SUCCESS; + int i = 0; +@@ -543,7 +543,7 @@ cleanup: + * obtain a result set. + */ + static isc_result_t +-ldap_get_results(const char *zone, const char *record, const char *client, ++dlz_ldap_get_results(const char *zone, const char *record, const char *client, + unsigned int query, void *dbdata, void *ptr) { + isc_result_t result; + ldap_instance_t *db = (ldap_instance_t *)dbdata; +@@ -558,7 +558,7 @@ ldap_get_results(const char *zone, const char *record, const char *client, + /* get db instance / connection */ + #if PTHREADS + /* find an available DBI from the list */ +- dbi = ldap_find_avail_conn(db); ++ dbi = dlz_ldap_find_avail_conn(db); + #else /* PTHREADS */ + /* + * only 1 DBI - no need to lock instance lock either +@@ -667,7 +667,7 @@ ldap_get_results(const char *zone, const char *record, const char *client, + * screwed up! + */ + db->log(ISC_LOG_ERROR, "Incorrect query flag passed to " +- "ldap_get_results"); ++ "dlz_ldap_get_results"); + result = ISC_R_UNEXPECTED; + goto cleanup; + } +@@ -755,13 +755,13 @@ ldap_get_results(const char *zone, const char *record, const char *client, + + switch (query) { + case ALLNODES: +- result = ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg, +- ldap_url->lud_attrs, ptr, true); ++ result = dlz_ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg, ++ ldap_url->lud_attrs, ptr, true); + break; + case AUTHORITY: + case LOOKUP: +- result = ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg, +- ldap_url->lud_attrs, ptr, false); ++ result = dlz_ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg, ++ ldap_url->lud_attrs, ptr, false); + break; + case ALLOWXFR: + entries = ldap_count_entries((LDAP *)dbi->dbconn, ldap_msg); +@@ -789,7 +789,7 @@ ldap_get_results(const char *zone, const char *record, const char *client, + * screwed up! + */ + db->log(ISC_LOG_ERROR, "Incorrect query flag passed to " +- "ldap_get_results"); ++ "dlz_ldap_get_results"); + result = ISC_R_UNEXPECTED; + } + +@@ -847,18 +847,18 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client) { + } + + /* get all the zone data */ +- result = ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL); ++ result = dlz_ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL); + return (result); + } + + isc_result_t + dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) { +- return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes)); ++ return (dlz_ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes)); + } + + isc_result_t + dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) { +- return (ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup)); ++ return (dlz_ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup)); + } + + #if DLZ_DLOPEN_VERSION < 3 +@@ -874,7 +874,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods, + UNUSED(methods); + UNUSED(clientinfo); + #endif /* if DLZ_DLOPEN_VERSION >= 3 */ +- return (ldap_get_results(name, NULL, NULL, FINDZONE, dbdata, NULL)); ++ return (dlz_ldap_get_results(name, NULL, NULL, FINDZONE, dbdata, NULL)); + } + + #if DLZ_DLOPEN_VERSION == 1 +@@ -896,11 +896,11 @@ dlz_lookup(const char *zone, const char *name, void *dbdata, + #endif /* if DLZ_DLOPEN_VERSION >= 2 */ + + if (strcmp(name, "*") == 0) { +- result = ldap_get_results(zone, "~", NULL, LOOKUP, dbdata, +- lookup); ++ result = dlz_ldap_get_results(zone, "~", NULL, LOOKUP, dbdata, ++ lookup); + } else { +- result = ldap_get_results(zone, name, NULL, LOOKUP, dbdata, +- lookup); ++ result = dlz_ldap_get_results(zone, name, NULL, LOOKUP, dbdata, ++ lookup); + } + return (result); + } +@@ -1000,29 +1000,29 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata, + /* check that LDAP URL parameters make sense */ + switch (argc) { + case 12: +- result = ldap_checkURL(ldap, argv[11], 0, ++ result = dlz_ldap_checkURL(ldap, argv[11], 0, + "allow zone transfer"); + if (result != ISC_R_SUCCESS) { + goto cleanup; + } + case 11: +- result = ldap_checkURL(ldap, argv[10], 3, "all nodes"); ++ result = dlz_ldap_checkURL(ldap, argv[10], 3, "all nodes"); + if (result != ISC_R_SUCCESS) { + goto cleanup; + } + case 10: + if (strlen(argv[9]) > 0) { +- result = ldap_checkURL(ldap, argv[9], 3, "authority"); ++ result = dlz_ldap_checkURL(ldap, argv[9], 3, "authority"); + if (result != ISC_R_SUCCESS) { + goto cleanup; + } + } + case 9: +- result = ldap_checkURL(ldap, argv[8], 3, "lookup"); ++ result = dlz_ldap_checkURL(ldap, argv[8], 3, "lookup"); + if (result != ISC_R_SUCCESS) { + goto cleanup; + } +- result = ldap_checkURL(ldap, argv[7], 0, "find zone"); ++ result = dlz_ldap_checkURL(ldap, argv[7], 0, "find zone"); + if (result != ISC_R_SUCCESS) { + goto cleanup; + } +@@ -1199,7 +1199,7 @@ dlz_destroy(void *dbdata) { + #if PTHREADS + /* cleanup the list of DBI's */ + if (db->db != NULL) { +- ldap_destroy_dblist((db_list_t *)(db->db)); ++ dlz_ldap_destroy_dblist((db_list_t *)(db->db)); + } + #else /* PTHREADS */ + if (db->db->dbconn != NULL) { +-- +2.31.1 + diff --git a/bind.spec b/bind.spec index 6d8ecfb..9a6712d 100644 --- a/bind.spec +++ b/bind.spec @@ -102,7 +102,9 @@ Patch149:bind-9.11-kyua-pkcs11.patch Patch157:bind-9.11-fips-tests.patch # https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/2689 Patch164:bind-9.11-rh1666814.patch +# https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/5665 Patch165:bind-9.16-openldap-2.6.patch +Patch166:bind-9.16-openldap-2.6-all.patch %{?systemd_ordering} Requires: coreutils @@ -401,7 +403,8 @@ in HTML and PDF format. %patch130 -p1 -b .libdb %patch157 -p1 -b .fips-tests %patch164 -p1 -b .rh1666814 -%patch165 -p1 +%patch165 -p1 -b .rh2032704 +%patch166 -p1 -b .rh2032704-2 %if %{with PKCS11} %patch135 -p1 -b .config-pkcs11