a8e525
From d02a805719d593863dd438798a29312a4177d207 Mon Sep 17 00:00:00 2001
a8e525
From: Petr Mensik <pemensik@redhat.com>
a8e525
Date: Wed, 22 Dec 2021 13:38:02 +0100
a8e525
Subject: [PATCH 2/2] Change all internal functions to dlz_ldap prefix
a8e525
a8e525
To prevent any conflict in the future, avoid ldap_ prefix in any
a8e525
internal functions. Keep it reserved for openldap only.
a8e525
---
a8e525
 contrib/dlz/modules/ldap/dlz_ldap_dynamic.c | 52 ++++++++++-----------
a8e525
 1 file changed, 26 insertions(+), 26 deletions(-)
a8e525
a8e525
diff --git a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c
a8e525
index 317a691..a653fac 100644
a8e525
--- a/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c
a8e525
+++ b/contrib/dlz/modules/ldap/dlz_ldap_dynamic.c
a8e525
@@ -128,7 +128,7 @@ b9_add_helper(ldap_instance_t *db, const char *helper_name, void *ptr);
a8e525
 
a8e525
 /*% checks that the LDAP URL parameters make sense */
a8e525
 static isc_result_t
a8e525
-ldap_checkURL(ldap_instance_t *db, char *URL, int attrCnt, const char *msg) {
a8e525
+dlz_ldap_checkURL(ldap_instance_t *db, char *URL, int attrCnt, const char *msg) {
a8e525
 	isc_result_t result = ISC_R_SUCCESS;
a8e525
 	int ldap_result;
a8e525
 	LDAPURLDesc *ldap_url = NULL;
a8e525
@@ -248,7 +248,7 @@ cleanup:
a8e525
  * multithreaded operation.
a8e525
  */
a8e525
 static void
a8e525
-ldap_destroy_dblist(db_list_t *dblist) {
a8e525
+dlz_ldap_destroy_dblist(db_list_t *dblist) {
a8e525
 	dbinstance_t *ndbi = NULL;
a8e525
 	dbinstance_t *dbi = NULL;
a8e525
 
a8e525
@@ -282,7 +282,7 @@ ldap_destroy_dblist(db_list_t *dblist) {
a8e525
  * multithreaded operation.
a8e525
  */
a8e525
 static dbinstance_t *
a8e525
-ldap_find_avail_conn(ldap_instance_t *ldap) {
a8e525
+dlz_ldap_find_avail_conn(ldap_instance_t *ldap) {
a8e525
 	dbinstance_t *dbi = NULL;
a8e525
 	dbinstance_t *head;
a8e525
 	int count = 0;
a8e525
@@ -315,7 +315,7 @@ ldap_find_avail_conn(ldap_instance_t *ldap) {
a8e525
 #endif /* PTHREADS */
a8e525
 
a8e525
 static isc_result_t
a8e525
-ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg,
a8e525
+dlz_ldap_process_results(ldap_instance_t *db, LDAP *dbc, LDAPMessage *msg,
a8e525
 		     char **attrs, void *ptr, bool allnodes) {
a8e525
 	isc_result_t result = ISC_R_SUCCESS;
a8e525
 	int i = 0;
a8e525
@@ -543,7 +543,7 @@ cleanup:
a8e525
  * obtain a result set.
a8e525
  */
a8e525
 static isc_result_t
a8e525
-ldap_get_results(const char *zone, const char *record, const char *client,
a8e525
+dlz_ldap_get_results(const char *zone, const char *record, const char *client,
a8e525
 		 unsigned int query, void *dbdata, void *ptr) {
a8e525
 	isc_result_t result;
a8e525
 	ldap_instance_t *db = (ldap_instance_t *)dbdata;
a8e525
@@ -558,7 +558,7 @@ ldap_get_results(const char *zone, const char *record, const char *client,
a8e525
 	/* get db instance / connection */
a8e525
 #if PTHREADS
a8e525
 	/* find an available DBI from the list */
a8e525
-	dbi = ldap_find_avail_conn(db);
a8e525
+	dbi = dlz_ldap_find_avail_conn(db);
a8e525
 #else  /* PTHREADS */
a8e525
 	/*
a8e525
 	 * only 1 DBI - no need to lock instance lock either
a8e525
@@ -667,7 +667,7 @@ ldap_get_results(const char *zone, const char *record, const char *client,
a8e525
 		 * screwed up!
a8e525
 		 */
a8e525
 		db->log(ISC_LOG_ERROR, "Incorrect query flag passed to "
a8e525
-				       "ldap_get_results");
a8e525
+				       "dlz_ldap_get_results");
a8e525
 		result = ISC_R_UNEXPECTED;
a8e525
 		goto cleanup;
a8e525
 	}
a8e525
@@ -755,13 +755,13 @@ ldap_get_results(const char *zone, const char *record, const char *client,
a8e525
 
a8e525
 	switch (query) {
a8e525
 	case ALLNODES:
a8e525
-		result = ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg,
a8e525
-					      ldap_url->lud_attrs, ptr, true);
a8e525
+		result = dlz_ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg,
a8e525
+					          ldap_url->lud_attrs, ptr, true);
a8e525
 		break;
a8e525
 	case AUTHORITY:
a8e525
 	case LOOKUP:
a8e525
-		result = ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg,
a8e525
-					      ldap_url->lud_attrs, ptr, false);
a8e525
+		result = dlz_ldap_process_results(db, (LDAP *)dbi->dbconn, ldap_msg,
a8e525
+					          ldap_url->lud_attrs, ptr, false);
a8e525
 		break;
a8e525
 	case ALLOWXFR:
a8e525
 		entries = ldap_count_entries((LDAP *)dbi->dbconn, ldap_msg);
a8e525
@@ -789,7 +789,7 @@ ldap_get_results(const char *zone, const char *record, const char *client,
a8e525
 		 * screwed up!
a8e525
 		 */
a8e525
 		db->log(ISC_LOG_ERROR, "Incorrect query flag passed to "
a8e525
-				       "ldap_get_results");
a8e525
+				       "dlz_ldap_get_results");
a8e525
 		result = ISC_R_UNEXPECTED;
a8e525
 	}
a8e525
 
a8e525
@@ -847,18 +847,18 @@ dlz_allowzonexfr(void *dbdata, const char *name, const char *client) {
a8e525
 	}
a8e525
 
a8e525
 	/* get all the zone data */
a8e525
-	result = ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL);
a8e525
+	result = dlz_ldap_get_results(name, NULL, client, ALLOWXFR, dbdata, NULL);
a8e525
 	return (result);
a8e525
 }
a8e525
 
a8e525
 isc_result_t
a8e525
 dlz_allnodes(const char *zone, void *dbdata, dns_sdlzallnodes_t *allnodes) {
a8e525
-	return (ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes));
a8e525
+	return (dlz_ldap_get_results(zone, NULL, NULL, ALLNODES, dbdata, allnodes));
a8e525
 }
a8e525
 
a8e525
 isc_result_t
a8e525
 dlz_authority(const char *zone, void *dbdata, dns_sdlzlookup_t *lookup) {
a8e525
-	return (ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup));
a8e525
+	return (dlz_ldap_get_results(zone, NULL, NULL, AUTHORITY, dbdata, lookup));
a8e525
 }
a8e525
 
a8e525
 #if DLZ_DLOPEN_VERSION < 3
a8e525
@@ -874,7 +874,7 @@ dlz_findzonedb(void *dbdata, const char *name, dns_clientinfomethods_t *methods,
a8e525
 	UNUSED(methods);
a8e525
 	UNUSED(clientinfo);
a8e525
 #endif /* if DLZ_DLOPEN_VERSION >= 3 */
a8e525
-	return (ldap_get_results(name, NULL, NULL, FINDZONE, dbdata, NULL));
a8e525
+	return (dlz_ldap_get_results(name, NULL, NULL, FINDZONE, dbdata, NULL));
a8e525
 }
a8e525
 
a8e525
 #if DLZ_DLOPEN_VERSION == 1
a8e525
@@ -896,11 +896,11 @@ dlz_lookup(const char *zone, const char *name, void *dbdata,
a8e525
 #endif /* if DLZ_DLOPEN_VERSION >= 2 */
a8e525
 
a8e525
 	if (strcmp(name, "*") == 0) {
a8e525
-		result = ldap_get_results(zone, "~", NULL, LOOKUP, dbdata,
a8e525
-					  lookup);
a8e525
+		result = dlz_ldap_get_results(zone, "~", NULL, LOOKUP, dbdata,
a8e525
+					      lookup);
a8e525
 	} else {
a8e525
-		result = ldap_get_results(zone, name, NULL, LOOKUP, dbdata,
a8e525
-					  lookup);
a8e525
+		result = dlz_ldap_get_results(zone, name, NULL, LOOKUP, dbdata,
a8e525
+					      lookup);
a8e525
 	}
a8e525
 	return (result);
a8e525
 }
a8e525
@@ -1000,29 +1000,29 @@ dlz_create(const char *dlzname, unsigned int argc, char *argv[], void **dbdata,
a8e525
 	/* check that LDAP URL parameters make sense */
a8e525
 	switch (argc) {
a8e525
 	case 12:
a8e525
-		result = ldap_checkURL(ldap, argv[11], 0,
a8e525
+		result = dlz_ldap_checkURL(ldap, argv[11], 0,
a8e525
 				       "allow zone transfer");
a8e525
 		if (result != ISC_R_SUCCESS) {
a8e525
 			goto cleanup;
a8e525
 		}
a8e525
 	case 11:
a8e525
-		result = ldap_checkURL(ldap, argv[10], 3, "all nodes");
a8e525
+		result = dlz_ldap_checkURL(ldap, argv[10], 3, "all nodes");
a8e525
 		if (result != ISC_R_SUCCESS) {
a8e525
 			goto cleanup;
a8e525
 		}
a8e525
 	case 10:
a8e525
 		if (strlen(argv[9]) > 0) {
a8e525
-			result = ldap_checkURL(ldap, argv[9], 3, "authority");
a8e525
+			result = dlz_ldap_checkURL(ldap, argv[9], 3, "authority");
a8e525
 			if (result != ISC_R_SUCCESS) {
a8e525
 				goto cleanup;
a8e525
 			}
a8e525
 		}
a8e525
 	case 9:
a8e525
-		result = ldap_checkURL(ldap, argv[8], 3, "lookup");
a8e525
+		result = dlz_ldap_checkURL(ldap, argv[8], 3, "lookup");
a8e525
 		if (result != ISC_R_SUCCESS) {
a8e525
 			goto cleanup;
a8e525
 		}
a8e525
-		result = ldap_checkURL(ldap, argv[7], 0, "find zone");
a8e525
+		result = dlz_ldap_checkURL(ldap, argv[7], 0, "find zone");
a8e525
 		if (result != ISC_R_SUCCESS) {
a8e525
 			goto cleanup;
a8e525
 		}
a8e525
@@ -1199,7 +1199,7 @@ dlz_destroy(void *dbdata) {
a8e525
 #if PTHREADS
a8e525
 		/* cleanup the list of DBI's */
a8e525
 		if (db->db != NULL) {
a8e525
-			ldap_destroy_dblist((db_list_t *)(db->db));
a8e525
+			dlz_ldap_destroy_dblist((db_list_t *)(db->db));
a8e525
 		}
a8e525
 #else  /* PTHREADS */
a8e525
 		if (db->db->dbconn != NULL) {
a8e525
-- 
a8e525
2.31.1
a8e525