Patchwork [03/11] libnsdb: Remove nsdb_parse_reference()

login
register
mail settings
Submitter Chuck Lever
Date Dec. 14, 2012, 10:37 p.m.
Message ID <20121214223744.22243.51582.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/206577/
State Accepted
Headers show

Comments

Chuck Lever - Dec. 14, 2012, 10:37 p.m.
Browsing LDAP-related RFCs suggests that LDAP referrals are
communicated only in LDAP_RES_SEARCH_RESULT messages, not via
LDAP_RES_SEARCH_REFERENCE messages.  I doubt we will ever see a
SEARCH_REFERENCE message.

As a clean up, remove nsdb_parse_reference().
LDAP_RES_SEARCH_RESULT is now handled as an unsupported message
type.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 src/libnsdb/administrator.c |    6 ------
 src/libnsdb/fileserver.c    |   16 ----------------
 src/libnsdb/ldap.c          |   44 -------------------------------------------
 src/libnsdb/nsdb-internal.h |    2 --
 4 files changed, 0 insertions(+), 68 deletions(-)

Patch

diff --git a/src/libnsdb/administrator.c b/src/libnsdb/administrator.c
index aa4aad3..0565caa 100644
--- a/src/libnsdb/administrator.c
+++ b/src/libnsdb/administrator.c
@@ -470,9 +470,6 @@  again:
 			retval = nsdb_parse_delete_fsn_fsls_entry_s(ld, message,
 								ldap_err);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld, message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
@@ -1654,9 +1651,6 @@  again:
 			retval = nsdb_parse_delete_nsdb_fsns_entry_s(ld, message,
 								ldap_err);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld, message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
diff --git a/src/libnsdb/fileserver.c b/src/libnsdb/fileserver.c
index d4519d6..cdceb37 100644
--- a/src/libnsdb/fileserver.c
+++ b/src/libnsdb/fileserver.c
@@ -439,9 +439,6 @@  nsdb_get_ncedn_s(nsdb_t host, const char *naming_context, char **dn,
 		case LDAP_RES_SEARCH_ENTRY:
 			retval = nsdb_parse_ncedn_entry(ld, message, &tmp);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld, message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
@@ -627,10 +624,6 @@  nsdb_get_naming_contexts_s(nsdb_t host, char ***contexts,
 			retval = nsdb_parse_naming_contexts_entry(ld,
 							message, &tmp);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld,
-							message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
@@ -1087,9 +1080,6 @@  nsdb_resolve_fsn_find_entry_s(LDAP *ld, const char *nce, const char *fsn_uuid,
 			retval = nsdb_resolve_fsn_parse_entry(ld,
 							message, &tmp);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld, message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
@@ -1400,9 +1390,6 @@  nsdb_get_fsn_find_entry_s(LDAP *ld, const char *nce, const char *fsn_uuid,
 		case LDAP_RES_SEARCH_ENTRY:
 			retval = nsdb_get_fsn_parse_entry(ld, message, &tmp);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld, message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
@@ -1659,9 +1646,6 @@  nsdb_list_find_entries_s(LDAP *ld, const char *nce, char ***fsns,
 		case LDAP_RES_SEARCH_ENTRY:
 			retval = nsdb_parse_fsn_entry(ld, message, &tmp);
 			break;
-		case LDAP_RES_SEARCH_REFERENCE:
-			retval = nsdb_parse_reference(ld, message, ldap_err);
-			break;
 		case LDAP_RES_SEARCH_RESULT:
 			retval = nsdb_parse_result(ld, message, NULL, ldap_err);
 			break;
diff --git a/src/libnsdb/ldap.c b/src/libnsdb/ldap.c
index 0abbdd2..d1170d2 100644
--- a/src/libnsdb/ldap.c
+++ b/src/libnsdb/ldap.c
@@ -766,50 +766,6 @@  nsdb_delete_attribute_all_s(LDAP *ld, const char *dn,
 }
 
 /**
- * Handle an LDAP referral message
- *
- * @param ld an initialized LDAP server descriptor
- * @param reference an LDAP_RES_SEARCH_REFERENCE message
- * @param ldap_err OUT: possibly an LDAP error code
- * @return a FedFsStatus code
- *
- * @todo
- *	Implement LDAP referral handling
- */
-FedFsStatus
-nsdb_parse_reference(LDAP *ld, LDAPMessage *reference,
-		unsigned int *ldap_err)
-{
-	char **referrals = NULL;
-	int i, rc;
-
-	if (ld == NULL || reference == NULL || ldap_err == NULL) {
-		xlog(L_ERROR, "%s: Invalid parameter", __func__);
-		return FEDFS_ERR_INVAL;
-	}
-
-	xlog(L_ERROR, "%s: Received referral from NSDB", __func__);
-
-	rc = ldap_parse_reference(ld, reference, &referrals, NULL, 0);
-	if (rc != LDAP_SUCCESS) {
-		xlog(D_GENERAL, "%s: Failed to parse result: %s",
-			__func__, ldap_err2string(rc));
-		*ldap_err = rc;
-		return FEDFS_ERR_NSDB_LDAP_VAL;
-	}
-
-	if (referrals != NULL) {
-		for (i = 0; referrals[i] != NULL; i++)
-			xlog(L_ERROR, "%s: Search reference: %s\n",
-				__func__, referrals[i]);
-		ber_memvfree((void **)referrals);
-	}
-
-	/* Haven't implemented LDAP referral support yet */
-	return FEDFS_ERR_NSDB_LDAP_REFERRAL_NOTFOLLOWED;
-}
-
-/**
  * Duplicate an array of referral URIs
  *
  * @param refs an array of NUL-terminated C strings containing LDAP URIs
diff --git a/src/libnsdb/nsdb-internal.h b/src/libnsdb/nsdb-internal.h
index c2283ed..55b146f 100644
--- a/src/libnsdb/nsdb-internal.h
+++ b/src/libnsdb/nsdb-internal.h
@@ -99,8 +99,6 @@  FedFsStatus	 nsdb_delete_attribute_s(LDAP *ld, const char *dn,
 FedFsStatus	 nsdb_delete_attribute_all_s(LDAP *ld, const char *dn,
 				const char *attribute,
 				unsigned int *ldap_err);
-FedFsStatus	 nsdb_parse_reference(LDAP *ld, LDAPMessage *reference,
-				unsigned int *ldap_err);
 FedFsStatus	 nsdb_parse_result(LDAP *ld, LDAPMessage *result,
 				char ***referrals, unsigned int *ldap_err);
 _Bool		 nsdb_compare_dns(LDAPDN dn1, LDAPDN dn2);