Patchwork [1/6] nsdbc: Exit with FEDFS_ERR_INVAL if default settings don't exist

login
register
mail settings
Submitter Chuck Lever
Date Jan. 20, 2012, 9:21 p.m.
Message ID <20120120212131.13737.14542.stgit@degas.1015granger.net>
Download mbox | patch
Permalink /patch/137112/
State Accepted
Headers show

Comments

Chuck Lever - Jan. 20, 2012, 9:21 p.m.
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@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(-)

Patch

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) {