@@ -918,7 +918,7 @@ again:
case FEDFS_RESOLVE_NONE:
break;
case FEDFS_RESOLVE_NSDB:
- result.status = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+ result.status = nsdb_open_nsdb(host, NULL, NULL);
if (result.status != FEDFS_OK)
break;
@@ -244,8 +244,7 @@ FedFsStatus nsdb_delete_nsdb(const char *hostname,
* Connect an nsdb_t object to the server it represents
*/
FedFsStatus nsdb_open_nsdb(nsdb_t host, const char *binddn,
- const char *passwd,
- unsigned int *ldap_err);
+ const char *passwd);
/**
* Finish a previously opened connection
@@ -2038,9 +2038,11 @@ nsdb_ping_s(const char *hostname, const unsigned short port,
if (retval != FEDFS_OK)
return retval;
- retval = nsdb_open_nsdb(host, NULL, NULL, ldap_err);
- if (retval != FEDFS_OK)
+ retval = nsdb_open_nsdb(host, NULL, NULL);
+ if (retval != FEDFS_OK) {
+ *ldap_err = (unsigned int)nsdb_ldaperr(host);
goto out_free;
+ }
retval = nsdb_ping_nsdb_s(host, ldap_err);
nsdb_close_nsdb(host);
@@ -1505,7 +1505,6 @@ nsdb_delete_nsdb(const char *hostname, const unsigned short port)
* @param host an initialized nsdb_t object
* @param binddn NUL-terminated UTF-8 C string containing DN to which to bind
* @param passwd NUL-terminated UTF-8 C string containing bind password
- * @param ldap_err OUT: possibly an LDAP error code
* @return a FedFsStatus code
*
* This function may ask for a password on stdin if "binddn" is
@@ -1514,13 +1513,13 @@ nsdb_delete_nsdb(const char *hostname, const unsigned short port)
* When false is returned, the nsdb_t object remains closed.
*/
FedFsStatus
-nsdb_open_nsdb(nsdb_t host, const char *binddn, const char *passwd,
- unsigned int *ldap_err)
+nsdb_open_nsdb(nsdb_t host, const char *binddn, const char *passwd)
{
FedFsStatus retval;
LDAP *ld;
- retval = nsdb_open(host->fn_hostname, host->fn_port, &ld, ldap_err);
+ retval = nsdb_open(host->fn_hostname, host->fn_port, &ld,
+ &host->fn_ldaperr);
if (retval != FEDFS_OK)
return retval;
@@ -1528,7 +1527,8 @@ nsdb_open_nsdb(nsdb_t host, const char *binddn, const char *passwd,
case FEDFS_SEC_NONE:
break;
case FEDFS_SEC_TLS:
- retval = nsdb_start_tls(ld, nsdb_certfile(host), ldap_err);
+ retval = nsdb_start_tls(ld, nsdb_certfile(host),
+ &host->fn_ldaperr);
if (retval != FEDFS_OK)
goto out_unbind;
break;
@@ -1539,7 +1539,7 @@ nsdb_open_nsdb(nsdb_t host, const char *binddn, const char *passwd,
goto out_unbind;
}
- retval = nsdb_bind(ld, binddn, passwd, ldap_err);
+ retval = nsdb_bind(ld, binddn, passwd, &host->fn_ldaperr);
if (retval != FEDFS_OK)
goto out_unbind;
@@ -559,7 +559,6 @@ nfsref_add_nfs_fedfs(const char *junct_path, char **argv, int optind)
{
char *binddn, *nsdbname, *nce;
unsigned short nsdbport;
- unsigned int ldap_err;
FedFsStatus retval;
nsdb_t host = NULL;
int status = EXIT_FAILURE;
@@ -600,7 +599,7 @@ nfsref_add_nfs_fedfs(const char *junct_path, char **argv, int optind)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -616,7 +615,7 @@ nfsref_add_nfs_fedfs(const char *junct_path, char **argv, int optind)
"NSDB %s:%u", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
xlog(L_ERROR, "Incorrect password for DN %s",
binddn);
@@ -624,7 +623,7 @@ nfsref_add_nfs_fedfs(const char *junct_path, char **argv, int optind)
default:
xlog(L_ERROR, "Failed to bind to NSDB %s:%u: %s",
nsdbname, nsdbport,
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -353,7 +353,7 @@ nfsref_lookup_resolve_fsn(const char *fsn_uuid, nsdb_t host)
__func__, fsn_uuid, nsdb_hostname(host), nsdb_port(host));
again:
- retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, NULL, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -368,7 +368,7 @@ again:
case FEDFS_ERR_NSDB_LDAP_VAL:
xlog(L_ERROR, "Failed to bind to NSDB %s:%u: %s",
nsdb_hostname(host), nsdb_port(host),
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
return status;
default:
xlog(L_ERROR, "Failed to open NSDB %s:%u: %s",
@@ -136,7 +136,7 @@ nfsref_remove_delete_fsn(const char *junct_path)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -152,7 +152,7 @@ nfsref_remove_delete_fsn(const char *junct_path)
"to NSDB %s:%u", nsdb_hostname(host), nsdb_port(host));
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
xlog(L_ERROR, "Incorrect password for DN %s",
binddn);
@@ -160,7 +160,7 @@ nfsref_remove_delete_fsn(const char *junct_path)
default:
xlog(L_ERROR, "Failed to bind to NSDB %s:%u: %s",
nsdb_hostname(host), nsdb_port(host),
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -244,7 +244,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -260,14 +260,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -248,7 +248,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -264,14 +264,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -224,7 +224,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -240,14 +240,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -206,7 +206,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -222,14 +222,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -208,7 +208,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -224,14 +224,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -181,7 +181,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -197,14 +197,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -201,7 +201,7 @@ main(int argc, char **argv)
goto out_free;
}
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -217,14 +217,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -361,7 +361,7 @@ main(int argc, char **argv)
}
again:
- retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, NULL, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -375,7 +375,7 @@ again:
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
goto out_free;
default:
fprintf(stderr, "Failed to open NSDB %s:%u: %s\n",
@@ -166,7 +166,7 @@ main(int argc, char **argv)
goto out;
}
- retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, NULL, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -180,7 +180,7 @@ main(int argc, char **argv)
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
goto out_free;
default:
fprintf(stderr, "Failed to open NSDB %s:%u: %s\n",
@@ -176,7 +176,7 @@ main(int argc, char **argv)
if (binddn == NULL)
binddn = (char *)nsdb_default_binddn(host);
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -192,14 +192,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -335,7 +335,7 @@ main(int argc, char **argv)
}
again:
- retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, NULL, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -349,7 +349,7 @@ again:
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
goto out_free;
default:
fprintf(stderr, "Failed to open NSDB %s:%u: %s\n",
@@ -176,7 +176,7 @@ main(int argc, char **argv)
if (binddn == NULL)
binddn = (char *)nsdb_default_binddn(host);
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -192,14 +192,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -217,7 +217,7 @@ main(int argc, char **argv)
if (nce == NULL)
nce = (char *)nsdb_default_nce(host);
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -233,14 +233,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -184,7 +184,7 @@ main(int argc, char **argv)
if (binddn == NULL)
binddn = (char *)nsdb_default_binddn(host);
- retval = nsdb_open_nsdb(host, binddn, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, binddn, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -200,14 +200,14 @@ main(int argc, char **argv)
"to NSDB %s:%u\n", nsdbname, nsdbport);
goto out_free;
case FEDFS_ERR_NSDB_LDAP_VAL:
- switch (ldap_err) {
+ switch (nsdb_ldaperr(host)) {
case LDAP_INVALID_CREDENTIALS:
fprintf(stderr, "Incorrect password for DN %s\n",
binddn);
break;
default:
fprintf(stderr, "Failed to bind to NSDB %s:%u: %s\n",
- nsdbname, nsdbport, ldap_err2string(ldap_err));
+ nsdbname, nsdbport, nsdb_ldaperr2string(host));
}
goto out_free;
default:
@@ -395,7 +395,7 @@ nfs_jp_resolve_fsn(const char *fsn_uuid, nsdb_t host,
int fsn_ttl;
again:
- retval = nsdb_open_nsdb(host, NULL, NULL, &ldap_err);
+ retval = nsdb_open_nsdb(host, NULL, NULL);
switch (retval) {
case FEDFS_OK:
break;
@@ -410,7 +410,7 @@ again:
case FEDFS_ERR_NSDB_LDAP_VAL:
nfs_jp_debug("%s: Failed to bind to NSDB %s:%u: %s\n",
nsdb_hostname(host), nsdb_port(host),
- ldap_err2string(ldap_err));
+ nsdb_ldaperr2string(host));
return JP_NSDBLOCAL;
default:
nfs_jp_debug("%s: Failed to open NSDB %s:%u: %s\n",
Simplify nsdb_open_nsdb() by removing the *ldaperr argument. Instead, the ldaperr value can be extracted with the new nsdb_ldaperr() function when it is needed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- src/fedfsd/svc.c | 2 +- src/include/nsdb.h | 3 +-- src/libnsdb/fileserver.c | 6 ++++-- src/libnsdb/nsdb.c | 12 ++++++------ src/nfsref/add.c | 7 +++---- src/nfsref/lookup.c | 4 ++-- src/nfsref/remove.c | 6 +++--- src/nsdbc/nsdb-annotate.c | 6 +++--- src/nsdbc/nsdb-create-fsl.c | 6 +++--- src/nsdbc/nsdb-create-fsn.c | 6 +++--- src/nsdbc/nsdb-delete-fsl.c | 6 +++--- src/nsdbc/nsdb-delete-fsn.c | 6 +++--- src/nsdbc/nsdb-delete-nsdb.c | 6 +++--- src/nsdbc/nsdb-describe.c | 6 +++--- src/nsdbc/nsdb-list.c | 4 ++-- src/nsdbc/nsdb-nces.c | 4 ++-- src/nsdbc/nsdb-remove-nci.c | 6 +++--- src/nsdbc/nsdb-resolve-fsn.c | 4 ++-- src/nsdbc/nsdb-simple-nce.c | 6 +++--- src/nsdbc/nsdb-update-fsl.c | 6 +++--- src/nsdbc/nsdb-update-nci.c | 6 +++--- src/plug-ins/nfs-plugin.c | 4 ++-- 22 files changed, 61 insertions(+), 61 deletions(-)