[fedfs-utils] [PATCH 14/17] libnsdb: Remove *ldaperr argument from NSDB 5.1.* API
Chuck Lever
chuck.lever at oracle.com
Thu Jan 2 12:28:54 PST 2014
Simplify the libnsdb API by removing the *ldaperr argument from
the NSDB 5.1.* functions. When it is needed, the ldaperr value can
be extracted with the new nsdb_ldaperr() function.
Signed-off-by: Chuck Lever <chuck.lever at oracle.com>
---
src/include/nsdb.h | 15 +-
src/libnsdb/administrator.c | 267 +++++++++++++++++++------------------------
src/nfsref/add.c | 14 +-
src/nfsref/remove.c | 7 -
src/nsdbc/nsdb-create-fsl.c | 7 -
src/nsdbc/nsdb-create-fsn.c | 8 +
src/nsdbc/nsdb-delete-fsl.c | 7 -
src/nsdbc/nsdb-delete-fsn.c | 7 -
src/nsdbc/nsdb-update-fsl.c | 8 -
9 files changed, 145 insertions(+), 195 deletions(-)
diff --git a/src/include/nsdb.h b/src/include/nsdb.h
index bad3e83..4636f1f 100644
--- a/src/include/nsdb.h
+++ b/src/include/nsdb.h
@@ -296,29 +296,25 @@ void nsdb_env(char **nsdbname, unsigned short *nsdbport,
*/
FedFsStatus nsdb_create_fsn_s(nsdb_t host, const char *nce,
const char *fsn_uuid,
- const unsigned int ttl,
- unsigned int *ldap_err);
+ const unsigned int ttl);
/**
* Delete an FSN (5.1.2)
*/
FedFsStatus nsdb_delete_fsn_s(nsdb_t host, const char *nce,
- const char *fsn_uuid, _Bool leave_fsn,
- unsigned int *ldap_err);
+ const char *fsn_uuid, _Bool leave_fsn);
/**
* Create one or more FSLs (5.1.3)
*/
FedFsStatus nsdb_create_fsls_s(nsdb_t host, const char *nce,
- struct fedfs_fsl *fsls,
- unsigned int *ldap_err);
+ struct fedfs_fsl *fsls);
/**
* Delete an FSL (5.1.4)
*/
FedFsStatus nsdb_delete_fsl_s(nsdb_t host, const char *nce,
- const char *fsl_uuid,
- unsigned int *ldap_err);
+ const char *fsl_uuid);
/**
* Update an FSL (5.1.5)
@@ -326,8 +322,7 @@ FedFsStatus nsdb_delete_fsl_s(nsdb_t host, const char *nce,
FedFsStatus nsdb_update_fsl_s(nsdb_t host, const char *nce,
const char *fsl_uuid,
const char *attribute,
- const void *value,
- unsigned int *ldap_err);
+ const void *value);
/**
** NSDB administrative operations defined by this implementation
diff --git a/src/libnsdb/administrator.c b/src/libnsdb/administrator.c
index c813afa..86d85cf 100644
--- a/src/libnsdb/administrator.c
+++ b/src/libnsdb/administrator.c
@@ -52,7 +52,7 @@
* Invoke ldap_search_ext_s(3), requesting no attributes
*
* @param func NUL-terminated C string containing name of calling function
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param base NUL-terminated C string containing search base
* @param scope LDAP scope
* @param filter NUL-terminated C string containing search filter
@@ -61,10 +61,11 @@
*
*/
static int
-__nsdb_search_nsdb_none_s(const char *func, LDAP *ld, const char *base,
+__nsdb_search_nsdb_none_s(const char *func, nsdb_t host, const char *base,
int scope, char *filter, LDAPMessage **response)
{
static char *attrs[] = { LDAP_NO_ATTRS, NULL };
+ LDAP *ld = host->fn_ldap;
char *uri;
if (ldap_get_option(ld, LDAP_OPT_URI, &uri) == LDAP_OPT_SUCCESS) {
@@ -84,24 +85,25 @@ __nsdb_search_nsdb_none_s(const char *func, LDAP *ld, const char *base,
/**
* Hide the __func__ argument at call sites
*/
-#define nsdb_search_nsdb_none_s(ld, base, scope, filter, response) \
- __nsdb_search_nsdb_none_s(__func__, ld, base, scope, filter, response)
+#define nsdb_search_nsdb_none_s(host, base, scope, filter, response) \
+ __nsdb_search_nsdb_none_s(__func__, host, base, scope, filter, response)
/**
* Invoke ldap_search_ext_s(3), requesting no attributes, no filter
*
* @param func NUL-terminated C string containing name of calling function
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param base NUL-terminated C string containing search base
* @param response OUT: list of LDAP responses
* @return an LDAP result code
*
*/
static int
-__nsdb_search_nsdb_nofilter_s(const char *func, LDAP *ld, const char *base,
+__nsdb_search_nsdb_nofilter_s(const char *func, nsdb_t host, const char *base,
LDAPMessage **response)
{
static char *attrs[] = { LDAP_NO_ATTRS, NULL };
+ LDAP *ld = host->fn_ldap;
char *uri;
if (ldap_get_option(ld, LDAP_OPT_URI, &uri) == LDAP_OPT_SUCCESS) {
@@ -121,8 +123,8 @@ __nsdb_search_nsdb_nofilter_s(const char *func, LDAP *ld, const char *base,
/**
* Hide the __func__ argument at call sites
*/
-#define nsdb_search_nsdb_nofilter_s(ld, base, response) \
- __nsdb_search_nsdb_nofilter_s(__func__, ld, base, response)
+#define nsdb_search_nsdb_nofilter_s(host, base, response) \
+ __nsdb_search_nsdb_nofilter_s(__func__, host, base, response)
/**
* Modify a FedFS-related record on an NSDB
@@ -199,11 +201,10 @@ nsdb_construct_fsn_dn(const char *nce, const char *fsn_uuid)
/**
* Add a new FSN entry under "nce"
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsn_uuid a NUL-terminated C string containing FSN UUID
* @param ttl number of seconds fileservers may cache this FSN
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* LDIF equivalent:
@@ -218,16 +219,15 @@ nsdb_construct_fsn_dn(const char *nce, const char *fsn_uuid)
@endverbatim
*/
static FedFsStatus
-nsdb_create_fsn_add_entry(LDAP *ld, const char *nce,
- const char *fsn_uuid, const unsigned int ttl,
- unsigned int *ldap_err)
+nsdb_create_fsn_add_entry(nsdb_t host, const char *nce,
+ const char *fsn_uuid, const unsigned int ttl)
{
char *ocvals[2], *uuidvals[2], *ttlvals[2];
LDAPMod *attrs[5];
LDAPMod attr[4];
char ttlbuf[16];
- int i, rc;
char *dn;
+ int i;
for (i = 0; i < 4; i++)
attrs[i] = &attr[i];
@@ -247,12 +247,12 @@ nsdb_create_fsn_add_entry(LDAP *ld, const char *nce,
if (dn == NULL)
return FEDFS_ERR_SVRFAULT;
- rc = ldap_add_ext_s(ld, dn, attrs, NULL, NULL);
+ host->fn_ldaperr = ldap_add_ext_s(host->fn_ldap, dn,
+ attrs, NULL, NULL);
ber_memfree(dn);
- if (rc != LDAP_SUCCESS) {
+ if (host->fn_ldaperr != LDAP_SUCCESS) {
xlog(L_ERROR, "Failed to add new FSN entry: %s",
- ldap_err2string(rc));
- *ldap_err = rc;
+ ldap_err2string(host->fn_ldaperr));
return FEDFS_ERR_NSDB_LDAP_VAL;
}
@@ -267,12 +267,11 @@ nsdb_create_fsn_add_entry(LDAP *ld, const char *nce,
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsn_uuid a NUL-terminated C string containing FSN UUID
* @param ttl number of seconds fileservers may cache this FSN
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*/
FedFsStatus
nsdb_create_fsn_s(nsdb_t host, const char *nce, const char *fsn_uuid,
- const unsigned int ttl, unsigned int *ldap_err)
+ const unsigned int ttl)
{
if (host == NULL) {
xlog(L_ERROR, "%s: Invalid host parameter", __func__);
@@ -284,35 +283,34 @@ nsdb_create_fsn_s(nsdb_t host, const char *nce, const char *fsn_uuid,
return FEDFS_ERR_INVAL;
}
- if (nce == NULL || fsn_uuid == NULL || ldap_err == NULL) {
+ if (nce == NULL || fsn_uuid == NULL) {
xlog(L_ERROR, "%s: Invalid parameter", __func__);
return FEDFS_ERR_INVAL;
}
- return nsdb_create_fsn_add_entry(host->fn_ldap, nce, fsn_uuid,
- ttl, ldap_err);
+ return nsdb_create_fsn_add_entry(host, nce, fsn_uuid, ttl);
}
/**
* Discover the DN for an FSN record
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsn_uuid a NUL-terminated C string containing FSL UUID
* @param dn OUT: a NUL-terminated C string containing DN of FSL record
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* Caller must free "dn" with ber_memfree(3).
*/
static FedFsStatus
-nsdb_search_fsn_dn_s(LDAP *ld, const char *nce, const char *fsn_uuid,
- char **dn, unsigned int *ldap_err)
+nsdb_search_fsn_dn_s(nsdb_t host, const char *nce, const char *fsn_uuid,
+ char **dn)
{
+ LDAP *ld = host->fn_ldap;
LDAPMessage *response;
- int len, rc, entries;
FedFsStatus retval;
char filter[128];
+ int len, entries;
/* watch out for buffer overflow */
len = snprintf(filter, sizeof(filter),
@@ -322,9 +320,9 @@ nsdb_search_fsn_dn_s(LDAP *ld, const char *nce, const char *fsn_uuid,
return FEDFS_ERR_INVAL;
}
- rc = nsdb_search_nsdb_none_s(ld, nce, LDAP_SCOPE_ONELEVEL,
+ host->fn_ldaperr = nsdb_search_nsdb_none_s(host, nce, LDAP_SCOPE_ONELEVEL,
filter, &response);
- switch (rc) {
+ switch (host->fn_ldaperr) {
case LDAP_SUCCESS:
break;
case LDAP_NO_SUCH_OBJECT:
@@ -333,8 +331,7 @@ nsdb_search_fsn_dn_s(LDAP *ld, const char *nce, const char *fsn_uuid,
return FEDFS_ERR_NSDB_NOFSN;
default:
xlog(D_GENERAL, "%s: LDAP search failed: %s",
- __func__, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, ldap_err2string(host->fn_ldaperr));
return FEDFS_ERR_NSDB_LDAP_VAL;
}
if (response == NULL) {
@@ -359,10 +356,9 @@ nsdb_search_fsn_dn_s(LDAP *ld, const char *nce, const char *fsn_uuid,
*dn = ldap_get_dn(ld, response);
if (*dn == NULL) {
- ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
+ ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &host->fn_ldap);
xlog(D_GENERAL, "%s: Failed to parse DN: %s",
- __func__, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, ldap_err2string(host->fn_ldaperr));
retval = FEDFS_ERR_NSDB_LDAP_VAL;
goto out;
}
@@ -377,38 +373,34 @@ out:
/**
* Delete one FSL child
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param entry an LDAP_RES_SEARCH_ENTRY message
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*/
static FedFsStatus
-nsdb_parse_delete_fsn_fsls_entry_s(LDAP *ld, LDAPMessage *entry,
- unsigned int *ldap_err)
+nsdb_parse_delete_fsn_fsls_entry_s(nsdb_t host, LDAPMessage *entry)
{
+ LDAP *ld = host->fn_ldap;
char *dn;
- int rc;
dn = ldap_get_dn(ld, entry);
if (dn == NULL) {
- ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
+ ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &host->fn_ldaperr);
xlog(D_GENERAL, "%s: Failed to parse entry: %s",
- __func__, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, ldap_err2string(host->fn_ldaperr));
return FEDFS_ERR_NSDB_LDAP_VAL;
}
xlog(D_CALL, "%s: deleting %s", __func__, dn);
- rc = ldap_delete_ext_s(ld, dn, NULL, NULL);
- if (rc != LDAP_SUCCESS) {
+ host->fn_ldaperr = ldap_delete_ext_s(ld, dn, NULL, NULL);
+ if (host->fn_ldaperr != LDAP_SUCCESS) {
xlog(D_GENERAL, "%s: Failed to delete FSL entry %s: %s",
- __func__, dn, ldap_err2string(rc));
+ __func__, dn, ldap_err2string(host->fn_ldaperr));
ber_memfree(dn);
- switch (rc) {
+ switch (host->fn_ldaperr) {
case LDAP_NO_SUCH_OBJECT:
return FEDFS_ERR_NSDB_NOFSL;
default:
- *ldap_err = rc;
return FEDFS_ERR_NSDB_LDAP_VAL;
}
}
@@ -422,23 +414,23 @@ nsdb_parse_delete_fsn_fsls_entry_s(LDAP *ld, LDAPMessage *entry,
/**
* Delete all existing FSL entries under "fsn_uuid"
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param dn a NUL-terminated C string containing DN of FSN entry
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*/
static FedFsStatus
-nsdb_delete_fsn_fsls_s(LDAP *ld, const char *dn, unsigned int *ldap_err)
+nsdb_delete_fsn_fsls_s(nsdb_t host, const char *dn)
{
LDAPMessage *message, *response;
+ LDAP *ld = host->fn_ldap;
FedFsStatus retval;
- int entries, rc;
+ int entries;
xlog(D_CALL, "%s: searching for children of %s", __func__, dn);
again:
- rc = nsdb_search_nsdb_nofilter_s(ld, dn, &response);
- switch (rc) {
+ host->fn_ldaperr = nsdb_search_nsdb_nofilter_s(host, dn, &response);
+ switch (host->fn_ldaperr) {
case LDAP_SUCCESS:
case LDAP_SIZELIMIT_EXCEEDED:
break;
@@ -448,8 +440,7 @@ again:
return FEDFS_OK;
default:
xlog(D_GENERAL, "%s: Failed to retrieve entries for %s: %s",
- __func__, dn, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, dn, ldap_err2string(host->fn_ldaperr));
return FEDFS_ERR_NSDB_LDAP_VAL;
}
if (response == NULL) {
@@ -472,11 +463,12 @@ again:
message = ldap_next_message(ld, message)) {
switch (ldap_msgtype(message)) {
case LDAP_RES_SEARCH_ENTRY:
- retval = nsdb_parse_delete_fsn_fsls_entry_s(ld, message,
- ldap_err);
+ retval = nsdb_parse_delete_fsn_fsls_entry_s(host,
+ message);
break;
case LDAP_RES_SEARCH_RESULT:
- retval = nsdb_parse_result(ld, message, NULL, ldap_err);
+ retval = nsdb_parse_result(ld, message, NULL,
+ &host->fn_ldaperr);
break;
default:
xlog(L_ERROR, "%s: Unrecognized LDAP message type",
@@ -487,7 +479,8 @@ again:
out:
ldap_msgfree(response);
- if (rc == LDAP_SIZELIMIT_EXCEEDED && retval == FEDFS_OK)
+ if (host->fn_ldaperr == LDAP_SIZELIMIT_EXCEEDED &&
+ retval == FEDFS_OK)
goto again;
return retval;
}
@@ -495,9 +488,8 @@ out:
/**
* Delete an existing FSN entry under "nce"
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param dn a NUL-terminated C string containing DN of entry to remove
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* LDIF equivalent:
@@ -509,15 +501,13 @@ out:
@endverbatim
*/
static FedFsStatus
-nsdb_delete_fsn_entry_s(LDAP *ld, const char *dn, unsigned int *ldap_err)
+nsdb_delete_fsn_entry_s(nsdb_t host, const char *dn)
{
- int rc;
-
- rc = ldap_delete_ext_s(ld, dn, NULL, NULL);
- if (rc != LDAP_SUCCESS) {
+ host->fn_ldaperr = ldap_delete_ext_s(host->fn_ldap, dn, NULL, NULL);
+ if (host->fn_ldaperr != LDAP_SUCCESS) {
xlog(D_GENERAL, "%s: Failed to delete FSN entry %s: %s",
- __func__, dn, ldap_err2string(rc));
- switch (rc) {
+ __func__, dn, ldap_err2string(host->fn_ldaperr));
+ switch (host->fn_ldaperr) {
case LDAP_NO_SUCH_OBJECT:
return FEDFS_ERR_NSDB_NOFSN;
case LDAP_NOT_ALLOWED_ON_NONLEAF:
@@ -525,7 +515,6 @@ nsdb_delete_fsn_entry_s(LDAP *ld, const char *dn, unsigned int *ldap_err)
/* XXX: spec provides no error code for this case */
return FEDFS_ERR_NSDB_NOFSL;
default:
- *ldap_err = rc;
return FEDFS_ERR_NSDB_LDAP_VAL;
}
}
@@ -542,12 +531,11 @@ nsdb_delete_fsn_entry_s(LDAP *ld, const char *dn, unsigned int *ldap_err)
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsn_uuid a NUL-terminated C string containing FSN UUID
* @param leave_fsn if true, delete FSL children only
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*/
FedFsStatus
nsdb_delete_fsn_s(nsdb_t host, const char *nce, const char *fsn_uuid,
- _Bool leave_fsn, unsigned int *ldap_err)
+ _Bool leave_fsn)
{
FedFsStatus retval;
char *dn;
@@ -562,22 +550,21 @@ nsdb_delete_fsn_s(nsdb_t host, const char *nce, const char *fsn_uuid,
return FEDFS_ERR_INVAL;
}
- if (nce == NULL || fsn_uuid == NULL || ldap_err == NULL) {
+ if (nce == NULL || fsn_uuid == NULL) {
xlog(L_ERROR, "%s: Invalid parameter", __func__);
return FEDFS_ERR_INVAL;
}
- retval = nsdb_search_fsn_dn_s(host->fn_ldap, nce, fsn_uuid,
- &dn, ldap_err);
+ retval = nsdb_search_fsn_dn_s(host, nce, fsn_uuid, &dn);
if (retval != FEDFS_OK)
return retval;
- retval = nsdb_delete_fsn_fsls_s(host->fn_ldap, dn, ldap_err);
+ retval = nsdb_delete_fsn_fsls_s(host, dn);
if (retval != FEDFS_OK)
goto out;
if (!leave_fsn)
- retval = nsdb_delete_fsn_entry_s(host->fn_ldap, dn, ldap_err);
+ retval = nsdb_delete_fsn_entry_s(host, dn);
out:
ber_memfree(dn);
@@ -705,10 +692,9 @@ static const char *nsdb_ldap_false = "FALSE";
/**
* Add a new NFS FSN entry under "nce"
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsl an initialized struct fedfs_fsl of type FEDFS_NFS_FSL
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* The new entry is set up as an NFSv4.0 FSL, and can be subsequently modified
@@ -752,8 +738,8 @@ static const char *nsdb_ldap_false = "FALSE";
@endverbatim
*/
static FedFsStatus
-nsdb_create_nfs_fsl_entry_s(LDAP *ld, const char *nce, struct fedfs_fsl *fsl,
- unsigned int *ldap_err)
+nsdb_create_nfs_fsl_entry_s(nsdb_t host, const char *nce,
+ struct fedfs_fsl *fsl)
{
struct fedfs_nfs_fsl *nfsfsl = &fsl->fl_u.fl_nfsfsl;
char *ocvals[3], *fsluuidvals[2], *fsnuuidvals[2];
@@ -780,8 +766,8 @@ nsdb_create_nfs_fsl_entry_s(LDAP *ld, const char *nce, struct fedfs_fsl *fsl,
FedFsStatus retval;
LDAPMod *attrs[30];
LDAPMod attr[29];
- int i, rc;
char *dn;
+ int i;
for (i = 0; i < 30; i++)
attrs[i] = &attr[i];
@@ -861,12 +847,12 @@ nsdb_create_nfs_fsl_entry_s(LDAP *ld, const char *nce, struct fedfs_fsl *fsl,
goto out;
}
- rc = ldap_add_ext_s(ld, dn, attrs, NULL, NULL);
+ host->fn_ldaperr = ldap_add_ext_s(host->fn_ldap, dn,
+ attrs, NULL, NULL);
ber_memfree(dn);
- if (rc != LDAP_SUCCESS) {
+ if (host->fn_ldaperr != LDAP_SUCCESS) {
xlog(D_GENERAL, "%s: Failed to add new FSL entry: %s\n",
- __func__, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, ldap_err2string(host->fn_ldaperr));
retval = FEDFS_ERR_NSDB_LDAP_VAL;
goto out;
}
@@ -886,15 +872,13 @@ out:
* @param host an initialized and bound nsdb_t object
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsls a list of one or more initialized struct fedfs_fsls
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* If creating one of the FSLs fails, we attempt to clean up by
* deleting the FSLs that have already been created.
*/
FedFsStatus
-nsdb_create_fsls_s(nsdb_t host, const char *nce, struct fedfs_fsl *fsls,
- unsigned int *ldap_err)
+nsdb_create_fsls_s(nsdb_t host, const char *nce, struct fedfs_fsl *fsls)
{
struct fedfs_fsl *fsl, *progress;
FedFsStatus retval;
@@ -919,8 +903,7 @@ nsdb_create_fsls_s(nsdb_t host, const char *nce, struct fedfs_fsl *fsls,
progress = fsl, fsl = fsl->fl_next) {
switch (fsl->fl_type) {
case FEDFS_NFS_FSL:
- retval = nsdb_create_nfs_fsl_entry_s(host->fn_ldap, nce,
- fsl, ldap_err);
+ retval = nsdb_create_nfs_fsl_entry_s(host, nce, fsl);
break;
default:
xlog(D_GENERAL, "%s: Unrecognized FSL type", __func__);
@@ -935,10 +918,8 @@ nsdb_create_fsls_s(nsdb_t host, const char *nce, struct fedfs_fsl *fsls,
out_delete:
if (progress != NULL) {
for (fsl = fsls; fsl != NULL; fsl = fsl->fl_next) {
- unsigned int dummy_ldap_err;
FedFsStatus status;
- status = nsdb_delete_fsl_s(host, nce, fsl->fl_fsluuid,
- &dummy_ldap_err);
+ status = nsdb_delete_fsl_s(host, nce, fsl->fl_fsluuid);
if (status != FEDFS_OK)
xlog(D_GENERAL, "%s: Recovery deletion of %s failed",
__func__, fsl->fl_fsluuid);
@@ -952,23 +933,23 @@ out_delete:
/**
* Discover the DN for an FSL record
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsl_uuid a NUL-terminated C string containing FSL UUID
* @param dn OUT: a NUL-terminated C string containing DN of FSL record
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* Caller must free "dn" with ber_memfree(3).
*/
static FedFsStatus
-nsdb_search_fsl_dn_s(LDAP *ld, const char *nce, const char *fsl_uuid,
- char **dn, unsigned int *ldap_err)
+nsdb_search_fsl_dn_s(nsdb_t host, const char *nce, const char *fsl_uuid,
+ char **dn)
{
+ LDAP *ld = host->fn_ldap;
LDAPMessage *response;
- int len, rc, entries;
FedFsStatus retval;
char filter[128];
+ int len, entries;
/* watch out for buffer overflow */
len = snprintf(filter, sizeof(filter),
@@ -978,9 +959,9 @@ nsdb_search_fsl_dn_s(LDAP *ld, const char *nce, const char *fsl_uuid,
return FEDFS_ERR_INVAL;
}
- rc = nsdb_search_nsdb_none_s(ld, nce, LDAP_SCOPE_SUBTREE,
- filter, &response);
- switch (rc) {
+ host->fn_ldaperr = nsdb_search_nsdb_none_s(host, nce, LDAP_SCOPE_SUBTREE,
+ filter, &response);
+ switch (host->fn_ldaperr) {
case LDAP_SUCCESS:
break;
case LDAP_NO_SUCH_OBJECT:
@@ -989,8 +970,7 @@ nsdb_search_fsl_dn_s(LDAP *ld, const char *nce, const char *fsl_uuid,
return FEDFS_ERR_NSDB_NOFSL;
default:
xlog(D_GENERAL, "%s: LDAP search failed: %s",
- __func__, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, ldap_err2string(host->fn_ldaperr));
return FEDFS_ERR_NSDB_LDAP_VAL;
}
if (response == NULL) {
@@ -1015,10 +995,9 @@ nsdb_search_fsl_dn_s(LDAP *ld, const char *nce, const char *fsl_uuid,
*dn = ldap_get_dn(ld, response);
if (*dn == NULL) {
- ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &rc);
+ ldap_get_option(ld, LDAP_OPT_RESULT_CODE, &host->fn_ldaperr);
xlog(D_GENERAL, "%s: Failed to parse DN: %s",
- __func__, ldap_err2string(rc));
- *ldap_err = rc;
+ __func__, ldap_err2string(host->fn_ldaperr));
retval = FEDFS_ERR_NSDB_LDAP_VAL;
goto out;
}
@@ -1033,9 +1012,8 @@ out:
/**
* Delete an existing FSL entry
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param dn a NUL-terminated C string containing DN of FSL record to delete
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* LDIF equivalent:
@@ -1047,19 +1025,16 @@ out:
@endverbatim
*/
static FedFsStatus
-nsdb_delete_fsl_entry_s(LDAP *ld, const char *dn, unsigned int *ldap_err)
+nsdb_delete_fsl_entry_s(nsdb_t host, const char *dn)
{
- int rc;
-
- rc = ldap_delete_ext_s(ld, dn, NULL, NULL);
- if (rc != LDAP_SUCCESS) {
+ host->fn_ldaperr = ldap_delete_ext_s(host->fn_ldap, dn, NULL, NULL);
+ if (host->fn_ldaperr != LDAP_SUCCESS) {
xlog(D_GENERAL, "%s: Failed to delete FSL entry %s: %s",
- __func__, dn, ldap_err2string(rc));
- switch (rc) {
+ __func__, dn, ldap_err2string(host->fn_ldaperr));
+ switch (host->fn_ldaperr) {
case LDAP_NO_SUCH_OBJECT:
return FEDFS_ERR_NSDB_NOFSL;
default:
- *ldap_err = rc;
return FEDFS_ERR_NSDB_LDAP_VAL;
}
}
@@ -1075,12 +1050,10 @@ nsdb_delete_fsl_entry_s(LDAP *ld, const char *dn, unsigned int *ldap_err)
* @param host an initialized and bound nsdb_t object
* @param nce a NUL-terminated C string containing DN of NSDB container entry
* @param fsl_uuid a NUL-terminated C string containing FSL UUID
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*/
FedFsStatus
-nsdb_delete_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid,
- unsigned int *ldap_err)
+nsdb_delete_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid)
{
FedFsStatus retval;
char *dn;
@@ -1095,17 +1068,16 @@ nsdb_delete_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid,
return FEDFS_ERR_INVAL;
}
- if (nce == NULL || fsl_uuid == NULL || ldap_err == NULL) {
+ if (nce == NULL || fsl_uuid == NULL) {
xlog(L_ERROR, "%s: Invalid parameter", __func__);
return FEDFS_ERR_INVAL;
}
- retval = nsdb_search_fsl_dn_s(host->fn_ldap, nce, fsl_uuid,
- &dn, ldap_err);
+ retval = nsdb_search_fsl_dn_s(host, nce, fsl_uuid, &dn);
if (retval != FEDFS_OK)
return retval;
- retval = nsdb_delete_fsl_entry_s(host->fn_ldap, dn, ldap_err);
+ retval = nsdb_delete_fsl_entry_s(host, dn);
ber_memfree(dn);
return retval;
}
@@ -1113,10 +1085,9 @@ nsdb_delete_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid,
/**
* Delete an attribute from entry "dn"
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param dn a NUL-terminated C string containing DN of NSDB container entry
* @param attribute a NUL-terminated C string containing the name of an attribute to remove
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* The LDAP server will prevent removing required attributes.
@@ -1131,12 +1102,13 @@ nsdb_delete_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid,
@endverbatim
*/
static FedFsStatus
-nsdb_update_fsl_remove_attribute_s(LDAP *ld, const char *dn,
- const char *attribute, unsigned int *ldap_err)
+nsdb_update_fsl_remove_attribute_s(nsdb_t host, const char *dn,
+ const char *attribute)
{
FedFsStatus retval;
- retval = nsdb_delete_attribute_all_s(ld, dn, attribute, ldap_err);
+ retval = nsdb_delete_attribute_all_s(host->fn_ldap, dn, attribute,
+ &host->fn_ldaperr);
if (retval != FEDFS_OK)
return retval;
@@ -1148,11 +1120,10 @@ nsdb_update_fsl_remove_attribute_s(LDAP *ld, const char *dn,
/**
* Add a new or replace an existing attribute in "dn"
*
- * @param ld an initialized LDAP server descriptor
+ * @param host an initialized and bound nsdb_t object
* @param dn a NUL-terminated C string containing DN of NSDB container entry
* @param attribute a NUL-terminated C string containing the name of an attribute to modify
* @param value a NUL-terminated C string containing the new value
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* The LDAP server will prevent schema violations (invalid values or
@@ -1170,9 +1141,8 @@ nsdb_update_fsl_remove_attribute_s(LDAP *ld, const char *dn,
@endverbatim
*/
static FedFsStatus
-nsdb_update_fsl_update_attribute_s(LDAP *ld, const char *dn,
- const char *attribute, const void *value,
- unsigned int *ldap_err)
+nsdb_update_fsl_update_attribute_s(nsdb_t host, const char *dn,
+ const char *attribute, const void *value)
{
struct berval newval;
FedFsStatus retval;
@@ -1182,8 +1152,8 @@ nsdb_update_fsl_update_attribute_s(LDAP *ld, const char *dn,
if (value != NULL)
newval.bv_len = (ber_len_t)strlen(value);
- retval = nsdb_modify_attribute_s(ld, dn, attribute,
- &newval, ldap_err);
+ retval = nsdb_modify_attribute_s(host->fn_ldap, dn, attribute,
+ &newval, &host->fn_ldaperr);
if (retval != FEDFS_OK)
return retval;
@@ -1200,7 +1170,6 @@ nsdb_update_fsl_update_attribute_s(LDAP *ld, const char *dn,
* @param fsl_uuid a NUL-terminated C string containing FSL UUID
* @param attribute a NUL-terminated C string containing the name of an attribute to modify
* @param value a NUL-terminated C string containing the new value
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* If caller did not provide an NCE, discover one by querying the NSDB.
@@ -1210,8 +1179,7 @@ nsdb_update_fsl_update_attribute_s(LDAP *ld, const char *dn,
*/
FedFsStatus
nsdb_update_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid,
- const char *attribute, const void *value,
- unsigned int *ldap_err)
+ const char *attribute, const void *value)
{
FedFsStatus retval;
char *dn;
@@ -1226,24 +1194,21 @@ nsdb_update_fsl_s(nsdb_t host, const char *nce, const char *fsl_uuid,
return FEDFS_ERR_INVAL;
}
- if (nce == NULL || fsl_uuid == NULL ||
- attribute == NULL || ldap_err == NULL) {
+ if (nce == NULL || fsl_uuid == NULL || attribute == NULL) {
xlog(L_ERROR, "%s: Invalid parameter", __func__);
return FEDFS_ERR_INVAL;
}
- retval = nsdb_search_fsl_dn_s(host->fn_ldap, nce, fsl_uuid,
- &dn, ldap_err);
+ retval = nsdb_search_fsl_dn_s(host, nce, fsl_uuid, &dn);
if (retval != FEDFS_OK)
return retval;
if (value == NULL)
- retval = nsdb_update_fsl_remove_attribute_s(host->fn_ldap,
- dn, attribute, ldap_err);
+ retval = nsdb_update_fsl_remove_attribute_s(host, dn,
+ attribute);
else
- retval = nsdb_update_fsl_update_attribute_s(host->fn_ldap,
- dn, attribute,
- value, ldap_err);
+ retval = nsdb_update_fsl_update_attribute_s(host, dn,
+ attribute, value);
ber_memfree(dn);
return retval;
}
@@ -1658,11 +1623,11 @@ nsdb_parse_delete_nsdb_fsns_entry_s(nsdb_t host, LDAPMessage *entry)
return FEDFS_ERR_NSDB_LDAP_VAL;
}
- retval = nsdb_delete_fsn_fsls_s(host->fn_ldap, dn, &host->fn_ldaperr);
+ retval = nsdb_delete_fsn_fsls_s(host, dn);
if (retval != FEDFS_OK)
goto out;
- retval = nsdb_delete_fsn_entry_s(ld, dn, &host->fn_ldaperr);
+ retval = nsdb_delete_fsn_entry_s(host, dn);
out:
ber_memfree(dn);
@@ -1687,7 +1652,7 @@ nsdb_delete_nsdb_fsns_s(nsdb_t host, const char *nce)
xlog(D_CALL, "%s: searching for children of %s", __func__, nce);
again:
- host->fn_ldaperr = nsdb_search_nsdb_nofilter_s(ld, nce, &response);
+ host->fn_ldaperr = nsdb_search_nsdb_nofilter_s(host, nce, &response);
switch (host->fn_ldaperr) {
case LDAP_SUCCESS:
case LDAP_SIZELIMIT_EXCEEDED:
diff --git a/src/nfsref/add.c b/src/nfsref/add.c
index 4d527da..7999e0f 100644
--- a/src/nfsref/add.c
+++ b/src/nfsref/add.c
@@ -261,7 +261,6 @@ nfsref_add_nfs_basic(const char *junct_path, char **argv, int optind)
static FedFsStatus
nfsref_add_create_fedfs_fsn(nsdb_t host, const char *nce, char **fsn_uuid)
{
- unsigned int ldap_err;
FedFsStatus retval;
char *fsnuuid;
uuid_t uu;
@@ -274,8 +273,7 @@ nfsref_add_create_fedfs_fsn(nsdb_t host, const char *nce, char **fsn_uuid)
uuid_generate_random(uu);
uuid_unparse(uu, fsnuuid);
- retval = nsdb_create_fsn_s(host, nce, fsnuuid,
- FSN_DEFAULT_TTL, &ldap_err);
+ retval = nsdb_create_fsn_s(host, nce, fsnuuid, FSN_DEFAULT_TTL);
switch (retval) {
case FEDFS_OK:
xlog(D_GENERAL, "%s: Successfully created FSN record "
@@ -287,7 +285,7 @@ nfsref_add_create_fedfs_fsn(nsdb_t host, const char *nce, char **fsn_uuid)
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
xlog(L_ERROR, "Failed to create FSN: %s",
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
break;
default:
xlog(L_ERROR, "Failed to create FSN: %s",
@@ -437,10 +435,9 @@ static FedFsStatus
nfsref_add_create_fsls(const char *junct_path, nsdb_t host, const char *nce,
const char *fsn_uuid, struct fedfs_fsl *fsls)
{
- unsigned int ldap_err;
FedFsStatus retval;
- retval = nsdb_create_fsls_s(host, nce, fsls, &ldap_err);
+ retval = nsdb_create_fsls_s(host, nce, fsls);
switch (retval) {
case FEDFS_OK:
break;
@@ -449,7 +446,7 @@ nfsref_add_create_fsls(const char *junct_path, nsdb_t host, const char *nce,
return retval;
case FEDFS_ERR_NSDB_LDAP_VAL:
xlog(L_ERROR, "Failed to create FSL records: %s\n",
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
return retval;
default:
xlog(D_GENERAL, "%s: Failed to create FSL records: %s\n",
@@ -535,8 +532,7 @@ nfsref_add_nfs_fedfs_junction(const char *junct_path, char **argv, int optind,
retval = nfsref_add_create_fedfs_junction(junct_path, argv, optind,
host, nce, fsn_uuid);
if (retval != FEDFS_OK) {
- unsigned int ldap_err;
- nsdb_delete_fsn_s(host, nce, fsn_uuid, false, &ldap_err);
+ nsdb_delete_fsn_s(host, nce, fsn_uuid, false);
free(fsn_uuid);
return EXIT_FAILURE;
}
diff --git a/src/nfsref/remove.c b/src/nfsref/remove.c
index aa8249e..162a04c 100644
--- a/src/nfsref/remove.c
+++ b/src/nfsref/remove.c
@@ -101,7 +101,6 @@ static FedFsStatus
nfsref_remove_delete_fsn(const char *junct_path)
{
char *fsn_uuid = NULL;
- unsigned int ldap_err;
char *binddn, *nce;
FedFsStatus retval;
nsdb_t host;
@@ -170,7 +169,7 @@ nfsref_remove_delete_fsn(const char *junct_path)
goto out_free;
}
- retval = nsdb_delete_fsn_s(host, nce, fsn_uuid, false, &ldap_err);
+ retval = nsdb_delete_fsn_s(host, nce, fsn_uuid, false);
switch (retval) {
case FEDFS_OK:
printf("Successfully deleted FSL records for FSN %s under %s\n",
@@ -191,7 +190,7 @@ nfsref_remove_delete_fsn(const char *junct_path)
xlog(L_ERROR, "FSN %s still has FSL entries", fsn_uuid);
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_REFERRAL:
xlog(L_ERROR, "Encountered LDAP referral on %s:%u",
nsdb_hostname(host), nsdb_port(host));
@@ -206,7 +205,7 @@ nfsref_remove_delete_fsn(const char *junct_path)
break;
default:
xlog(L_ERROR, "Failed to delete FSN %s: %s",
- fsn_uuid, ldap_err2string(ldap_err));
+ fsn_uuid, ldap_err2string(nsdb_ldaperr(host)));
}
break;
default:
diff --git a/src/nsdbc/nsdb-create-fsl.c b/src/nsdbc/nsdb-create-fsl.c
index a538eb1..cf39f46 100644
--- a/src/nsdbc/nsdb-create-fsl.c
+++ b/src/nsdbc/nsdb-create-fsl.c
@@ -109,7 +109,6 @@ main(int argc, char **argv)
char *progname, *binddn, *nsdbname;
unsigned short nsdbport, serverport;
struct fedfs_fsl *fsl;
- unsigned int ldap_err;
FedFsStatus retval;
nsdb_t host;
int arg;
@@ -281,7 +280,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_create_fsls_s(host, nce, fsl, &ldap_err);
+ retval = nsdb_create_fsls_s(host, nce, fsl);
switch (retval) {
case FEDFS_OK:
printf("Successfully created FSL record for %s under %s\n",
@@ -295,7 +294,7 @@ main(int argc, char **argv)
fprintf(stderr, "NCE %s does not exist\n", nce);
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_REFERRAL:
fprintf(stderr, "Encountered LDAP referral on %s:%u\n",
nsdbname, nsdbport);
@@ -306,7 +305,7 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "Failed to create FSL %s: %s\n",
- fsl_uuid, ldap_err2string(ldap_err));
+ fsl_uuid, nsdb_ldaperr2string(host));
}
break;
default:
diff --git a/src/nsdbc/nsdb-create-fsn.c b/src/nsdbc/nsdb-create-fsn.c
index 8c99b26..870984d 100644
--- a/src/nsdbc/nsdb-create-fsn.c
+++ b/src/nsdbc/nsdb-create-fsn.c
@@ -110,10 +110,10 @@ main(int argc, char **argv)
{
char *progname, *binddn, *nsdbname, *endptr;
unsigned short nsdbport;
- unsigned int ttl, ldap_err;
char *nce, *fsn_uuid;
FedFsStatus retval;
unsigned long tmp;
+ unsigned int ttl;
nsdb_t host;
int arg;
@@ -257,7 +257,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_create_fsn_s(host, nce, fsn_uuid, ttl, &ldap_err);
+ retval = nsdb_create_fsn_s(host, nce, fsn_uuid, ttl);
switch (retval) {
case FEDFS_OK:
printf("Successfully created FSN record for %s under %s\n",
@@ -271,7 +271,7 @@ main(int argc, char **argv)
fprintf(stderr, "NCE %s does not exist\n", nce);
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_REFERRAL:
fprintf(stderr, "Encountered LDAP referral on %s:%u\n",
nsdbname, nsdbport);
@@ -282,7 +282,7 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "Failed to create FSN: %s\n",
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
}
break;
default:
diff --git a/src/nsdbc/nsdb-delete-fsl.c b/src/nsdbc/nsdb-delete-fsl.c
index 5e19e8d..ce33919 100644
--- a/src/nsdbc/nsdb-delete-fsl.c
+++ b/src/nsdbc/nsdb-delete-fsl.c
@@ -108,7 +108,6 @@ main(int argc, char **argv)
char *progname, *binddn, *nsdbname;
char *nce, *fsl_uuid;
unsigned short nsdbport;
- unsigned int ldap_err;
FedFsStatus retval;
nsdb_t host;
int arg;
@@ -239,7 +238,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_delete_fsl_s(host, nce, fsl_uuid, &ldap_err);
+ retval = nsdb_delete_fsl_s(host, nce, fsl_uuid);
switch (retval) {
case FEDFS_OK:
printf("Successfully deleted FSL record for %s under %s\n",
@@ -257,7 +256,7 @@ main(int argc, char **argv)
nsdbname, nsdbport, fsl_uuid);
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_REFERRAL:
fprintf(stderr, "Encountered LDAP referral on %s:%u\n",
nsdbname, nsdbport);
@@ -268,7 +267,7 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "Failed to delete FSL %s: %s\n",
- fsl_uuid, ldap_err2string(ldap_err));
+ fsl_uuid, nsdb_ldaperr2string(host));
}
break;
default:
diff --git a/src/nsdbc/nsdb-delete-fsn.c b/src/nsdbc/nsdb-delete-fsn.c
index 42073e8..789216e 100644
--- a/src/nsdbc/nsdb-delete-fsn.c
+++ b/src/nsdbc/nsdb-delete-fsn.c
@@ -104,7 +104,6 @@ main(int argc, char **argv)
{
char *progname, *binddn, *nsdbname;
unsigned short nsdbport;
- unsigned int ldap_err;
char *nce, *fsn_uuid;
FedFsStatus retval;
_Bool leave_fsn;
@@ -241,7 +240,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_delete_fsn_s(host, nce, fsn_uuid, leave_fsn, &ldap_err);
+ retval = nsdb_delete_fsn_s(host, nce, fsn_uuid, leave_fsn);
switch (retval) {
case FEDFS_OK:
if (leave_fsn)
@@ -266,7 +265,7 @@ main(int argc, char **argv)
fprintf(stderr, "FSN %s still has FSL entries\n", fsn_uuid);
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_REFERRAL:
fprintf(stderr, "Encountered LDAP referral on %s:%u\n",
nsdbname, nsdbport);
@@ -281,7 +280,7 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "Failed to delete FSN %s: %s\n",
- fsn_uuid, ldap_err2string(ldap_err));
+ fsn_uuid, nsdb_ldaperr2string(host));
}
break;
default:
diff --git a/src/nsdbc/nsdb-update-fsl.c b/src/nsdbc/nsdb-update-fsl.c
index 17514c2..fb7cfcc 100644
--- a/src/nsdbc/nsdb-update-fsl.c
+++ b/src/nsdbc/nsdb-update-fsl.c
@@ -110,7 +110,6 @@ main(int argc, char **argv)
char *progname, *binddn, *nsdbname;
char *nce, *fsl_uuid, *attribute, *value;
unsigned short nsdbport;
- unsigned int ldap_err;
FedFsStatus retval;
nsdb_t host;
int arg;
@@ -250,8 +249,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_update_fsl_s(host, nce, fsl_uuid, attribute,
- value, &ldap_err);
+ retval = nsdb_update_fsl_s(host, nce, fsl_uuid, attribute, value);
switch (retval) {
case FEDFS_OK:
printf("Successfully updated FSL record for %s under %s\n",
@@ -265,7 +263,7 @@ main(int argc, char **argv)
fprintf(stderr, "NCE %s does not exist\n", nce);
break;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_REFERRAL:
fprintf(stderr, "Encountered LDAP referral on %s:%u\n",
nsdbname, nsdbport);
@@ -276,7 +274,7 @@ main(int argc, char **argv)
break;
default:
fprintf(stderr, "Failed to update FSL %s: %s\n",
- fsl_uuid, ldap_err2string(ldap_err));
+ fsl_uuid, nsdb_ldaperr2string(host));
}
break;
default:
More information about the fedfs-utils-devel
mailing list