[09/15] nsdbc: nsdb-list displays "(null)" for the NCE

Message ID 20111025164936.18584.81728.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Oct. 25, 2011, 4:49 p.m.
If no NCE is specified on the command line, the user wants the command
to hunt for any NCE on the NSDB.  However, nsdb-list displays this:

  $ ./nsdb-list
  NSDB: nsdb.nfs4bat.org:389, (null)
    FSN UUID: d3af69ba-f90e-11e0-9390-000c2979d1f3
      FSL UUID: 4c054068-f911-11e0-ac05-000c2979d1f3

The "(null)" is unhelpful.

In the future, it would be nice to display the NCE under which FSNs
were found.  That might be quite a bit of work, as it would require
bringing the loop that walks through the naming contexts out of the
library and adding it to the nsdb-list command.

So I'm going to put that off for now.

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

 src/nsdbc/nsdb-list.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/src/nsdbc/nsdb-list.c b/src/nsdbc/nsdb-list.c
index 1ac04b0..77f0567 100644
--- a/src/nsdbc/nsdb-list.c
+++ b/src/nsdbc/nsdb-list.c
@@ -251,7 +251,12 @@  main(int argc, char **argv)
 	retval = nsdb_list_s(host, nce, &fsns, &ldap_err);
 	switch (retval) {
 	case FEDFS_OK:
-		printf("NSDB: %s:%u, %s\n", nsdbname, nsdbport, nce);
+		if (nce == NULL)
+			printf("NSDB: %s:%u\n",
+				nsdbname, nsdbport);
+		else
+			printf("NSDB: %s:%u, %s\n",
+				nsdbname, nsdbport, nce);
 		for (i = 0; fsns[i] != NULL; i++)
 			nsdb_list_resolve_and_display_fsn(host, nce, fsns[i]);