[bug] invalid usage display of rpcclient
Samba-JP TAKAHASHI Motonobu
monyo at samba.gr.jp
Sat Jun 23 10:52:14 GMT 2001
Hello,
The following problem was found at Samba-JP,
% rpcclient foobar -h
foobar: invalid option -- h
Usage: foobar server [options]
~~~~~~ <-- this is an invalid string :-(
(snip)
Here is a patch to fix it for Samba 2.0.9/Samba 2.2.0
samba-2.0.9
---- Cut Here ----
diff -ur rpcclient/rpcclient.c.010621 rpcclient/rpcclient.c
--- rpcclient/rpcclient.c.010621 Thu Apr 12 19:45:56 2001
+++ rpcclient/rpcclient.c Thu Jun 21 12:58:59 2001
@@ -412,7 +412,9 @@
struct client_info cli_info;
pstring password; /* local copy only, if one is entered */
+ char *pname;
+ pname = argv[0];
out_hnd = stdout;
fstrcpy(debugf, argv[0]);
@@ -509,7 +511,7 @@
if (argc < 2)
{
- usage(argv[0]);
+ usage(pname);
exit(1);
}
@@ -526,7 +528,7 @@
if (count_chars(cli_info.service,'\\') < 3)
{
- usage(argv[0]);
+ usage(pname);
printf("\n%s: Not enough '\\' characters in service\n", cli_info.service);
exit(1);
}
@@ -662,7 +664,7 @@
case 'h':
{
- usage(argv[0]);
+ usage(pname);
exit(0);
break;
}
@@ -681,7 +683,7 @@
default:
{
- usage(argv[0]);
+ usage(pname);
exit(1);
break;
}
@@ -692,7 +694,7 @@
if (cli_action == CLIENT_NONE)
{
- usage(argv[0]);
+ usage(pname);
exit(1);
}
---- Cut Here ----
samba-2.2-HEAD
---- Cut Here ----
diff -urNP ../../samba-head/source/rpcclient/rpcclient.c ./rpcclient/rpcclient.c
--- ../../samba-head/source/rpcclient/rpcclient.c Sat Jun 9 06:51:00 2001
+++ ./rpcclient/rpcclient.c Thu Jun 21 13:00:38 2001
@@ -539,7 +539,9 @@
domain,
server;
struct cmd_set **cmd_set;
+ char *pname;
+ pname = argv[0];
charset_initialise();
setlinebuf(stdout);
@@ -547,7 +549,7 @@
/* Parse options */
if (argc < 2) {
- usage(argv[0]);
+ usage(pname);
return 0;
}
@@ -604,14 +606,14 @@
case 'h':
default:
- usage(argv[0]);
+ usage(pname);
exit(1);
}
}
/* the following functions are part of the Samba debugging
facilities. See lib/debug.c */
- setup_logging (argv[0], interactive);
+ setup_logging (pname, interactive);
if (!interactive)
reopen_logs();
---- Cut Here ----
-----
TAKAHASHI Motonobu mailto:monyo at samba.gr.jp
Samba Users Group Japan http://www.samba.gr.jp/
More information about the samba-technical
mailing list