[fedfs-utils] [PATCH 1/6] nsdbc: Exit with FEDFS_ERR_INVAL if default settings don't exist

Chuck Lever chuck.lever at oracle.com
Fri Jan 20 13:21:31 PST 2012


Commit afc64d55 changed the NSDB client commands to exit with a FedFS
status code.

One case that was missed was when the commands can't find the value of
the LDAP bind DN or NCE from the command line, from environment
variables, nor from the local NSDB connection parameter database.  In
this case, the commands were exiting with FEDFS_OK.

Change these commands to instead exit with FEDFS_ERR_INVAL (an invalid
parameter was provided) in this case.

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

 src/nsdbc/nsdb-annotate.c    |    1 +
 src/nsdbc/nsdb-create-fsl.c  |    1 +
 src/nsdbc/nsdb-create-fsn.c  |    1 +
 src/nsdbc/nsdb-delete-fsl.c  |    1 +
 src/nsdbc/nsdb-delete-fsn.c  |    1 +
 src/nsdbc/nsdb-delete-nsdb.c |    1 +
 src/nsdbc/nsdb-describe.c    |    1 +
 src/nsdbc/nsdb-update-fsl.c  |    1 +
 8 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/nsdbc/nsdb-annotate.c b/src/nsdbc/nsdb-annotate.c
index 5247204..f875721 100644
--- a/src/nsdbc/nsdb-annotate.c
+++ b/src/nsdbc/nsdb-annotate.c
@@ -246,6 +246,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-create-fsl.c b/src/nsdbc/nsdb-create-fsl.c
index 1e2ee59..7f9ad1e 100644
--- a/src/nsdbc/nsdb-create-fsl.c
+++ b/src/nsdbc/nsdb-create-fsl.c
@@ -238,6 +238,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-create-fsn.c b/src/nsdbc/nsdb-create-fsn.c
index 90aef0c..e46f0b5 100644
--- a/src/nsdbc/nsdb-create-fsn.c
+++ b/src/nsdbc/nsdb-create-fsn.c
@@ -198,6 +198,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-delete-fsl.c b/src/nsdbc/nsdb-delete-fsl.c
index 5fc191e..cd9e189 100644
--- a/src/nsdbc/nsdb-delete-fsl.c
+++ b/src/nsdbc/nsdb-delete-fsl.c
@@ -202,6 +202,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-delete-fsn.c b/src/nsdbc/nsdb-delete-fsn.c
index fcd6c20..8fc5c7d 100644
--- a/src/nsdbc/nsdb-delete-fsn.c
+++ b/src/nsdbc/nsdb-delete-fsn.c
@@ -204,6 +204,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-delete-nsdb.c b/src/nsdbc/nsdb-delete-nsdb.c
index 9214443..f86941b 100644
--- a/src/nsdbc/nsdb-delete-nsdb.c
+++ b/src/nsdbc/nsdb-delete-nsdb.c
@@ -183,6 +183,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-describe.c b/src/nsdbc/nsdb-describe.c
index 2915f3b..a513e37 100644
--- a/src/nsdbc/nsdb-describe.c
+++ b/src/nsdbc/nsdb-describe.c
@@ -203,6 +203,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {
diff --git a/src/nsdbc/nsdb-update-fsl.c b/src/nsdbc/nsdb-update-fsl.c
index e025a15..185435d 100644
--- a/src/nsdbc/nsdb-update-fsl.c
+++ b/src/nsdbc/nsdb-update-fsl.c
@@ -217,6 +217,7 @@ main(int argc, char **argv)
 			nsdb_display_fedfsstatus(retval));
 		goto out;
 	}
+	retval = FEDFS_ERR_INVAL;
 	if (binddn == NULL)
 		binddn = (char *)nsdb_default_binddn(host);
 	if (binddn == NULL) {




More information about the fedfs-utils-devel mailing list