summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-03-11 14:39:32 +0000
committerGerald Carter <jerry@samba.org>2004-03-11 14:39:32 +0000
commit929b0b72d587eb1dc569c3b746fadedbdc74bc3b (patch)
tree1869b40f54bf59c6381cfe78157fecf5bf11687c /source3/client
parentf2efeca274ac493f6b619fad2c114cbf7c2fa718 (diff)
downloadsamba-929b0b72d587eb1dc569c3b746fadedbdc74bc3b.tar.gz
samba-929b0b72d587eb1dc569c3b746fadedbdc74bc3b.tar.bz2
samba-929b0b72d587eb1dc569c3b746fadedbdc74bc3b.zip
BUG 1088: patch from SATOH Fumiyasu <fumiya@miraclinux.com> -- use strchr_m() for query_host (smbclient -L)
(This used to be commit bc6992c4bffed043dd8ad58d721202091cd14cd3)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c48
1 files changed, 19 insertions, 29 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 3a189a13e7..2d640a5573 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -2846,27 +2846,6 @@ static int do_message_op(void)
}
-/**
- * Process "-L hostname" option.
- *
- * We don't actually do anything yet -- we just stash the name in a
- * global variable and do the query when all options have been read.
- **/
-
-static void remember_query_host(const char *arg,
- pstring query_host)
-{
- char *slash;
-
- while (*arg == '\\' || *arg == '/')
- arg++;
- pstrcpy(query_host, arg);
- if ((slash = strchr(query_host, '/'))
- || (slash = strchr(query_host, '\\'))) {
- *slash = 0;
- }
-}
-
/****************************************************************************
main program
****************************************************************************/
@@ -2961,7 +2940,7 @@ static void remember_query_host(const char *arg,
break;
case 'L':
- remember_query_host(poptGetOptArg(pc), query_host);
+ pstrcpy(query_host, poptGetOptArg(pc));
break;
case 't':
pstrcpy(term_code, poptGetOptArg(pc));
@@ -3069,14 +3048,25 @@ static void remember_query_host(const char *arg,
return do_tar_op(base_directory);
}
- if ((p=strchr_m(query_host,'#'))) {
- *p = 0;
- p++;
- sscanf(p, "%x", &name_type);
- }
-
if (*query_host) {
- return do_host_query(query_host);
+ char *qhost = query_host;
+ char *slash;
+
+ while (*qhost == '\\' || *qhost == '/')
+ qhost++;
+
+ if ((slash = strchr_m(qhost, '/'))
+ || (slash = strchr_m(qhost, '\\'))) {
+ *slash = 0;
+ }
+
+ if ((p=strchr_m(qhost, '#'))) {
+ *p = 0;
+ p++;
+ sscanf(p, "%x", &name_type);
+ }
+
+ return do_host_query(qhost);
}
if (message) {