[PATCH] Improve rpcclient help

Tim Beale timbeale at catalyst.net.nz
Fri Jan 25 03:55:34 UTC 2019


Here's a small patch to try to improve the rpclient help. I had a
frustrating experience trying to use it for the first time...

Review appreciated. Thanks.

CI link: https://gitlab.com/catalyst-samba/samba/pipelines/44720746

-------------- next part --------------
From 395d8f8b724fb63eee7fd4bf2ba369fc3beee625 Mon Sep 17 00:00:00 2001
From: Tim Beale <timbeale at catalyst.net.nz>
Date: Wed, 23 Jan 2019 11:07:42 +1300
Subject: [PATCH] s3:rpclient: rpclient help is not very helpful

The help was not telling me that there was a mandatory 'server' argument
that I needed to specify. After trying several different combinations
of parameters, I eventually had to run the tool in gdb to work out why
it was complaining.

This is the output I was getting:

bin/rpcclient -U$USERNAME%$PASSWORD -I $SERVER_IP
Usage: rpcclient [OPTION...]
  -c, --command=COMMANDS                 Execute semicolon separated
cmds
  -I, --dest-ip=IP                       Specify destination IP address
  -p, --port=PORT                        Specify port number
...

New help output is:

Usage: rpcclient [OPTION...] <server>
Options:
  -c, --command=COMMANDS                 Execute semicolon separated
cmds
...

Signed-off-by: Tim Beale <timbeale at catalyst.net.nz>
---
 source3/rpcclient/rpcclient.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 9f95f1a..6cfacb1 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -982,6 +982,8 @@ out_free:
 	pc = poptGetContext("rpcclient", argc, const_argv,
 			    long_options, 0);
 
+	poptSetOtherOptionHelp(pc, "[OPTION...] <server>\nOptions:");
+
 	if (argc == 1) {
 		poptPrintHelp(pc, stderr, 0);
 		goto done;
-- 
2.7.4



More information about the samba-technical mailing list