[PATCH] net share: Fix trancating sharename problem (Re: [PATCH]
Remove odd trailing spaces from 'net share' output)
SATOH Fumiyasu
fumiya at miraclelinux.com
Mon Feb 9 11:14:46 GMT 2004
Hi again,
Firstly, please discard the previous patch. I'm sorry.
The following patch fixes problems that `net share` truncates
sharename in output if sharename is more than 12 byte length,
and `net rap sahre --long` doubled output.
Please apply this patch to Samba 3.0.x tree.
Index: source/utils/net_rap.c
===================================================================
RCS file: /work/cvs/samba/source/utils/net_rap.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 net_rap.c
--- source/utils/net_rap.c 23 Oct 2003 03:53:56 -0000 1.1.1.1
+++ source/utils/net_rap.c 9 Feb 2004 10:43:42 -0000
@@ -153,14 +153,14 @@ int net_rap_share_usage(int argc, const
static void long_share_fn(const char *share_name, uint32 type,
const char *comment, void *state)
{
- d_printf("%-12.12s %-8.8s %-50.50s\n",
+ d_printf("%-12s %-8.8s %-50s\n",
share_name, share_type[type], comment);
}
static void share_fn(const char *share_name, uint32 type,
const char *comment, void *state)
{
- d_printf("%-12.12s\n", share_name);
+ d_printf("%s\n", share_name);
}
static int rap_share_delete(int argc, const char **argv)
@@ -240,8 +240,9 @@ int net_rap_share(int argc, const char *
"\nShare name Type Description\n"\
"---------- ---- -----------\n");
ret = cli_RNetShareEnum(cli, long_share_fn, NULL);
+ } else {
+ ret = cli_RNetShareEnum(cli, share_fn, NULL);
}
- ret = cli_RNetShareEnum(cli, share_fn, NULL);
cli_shutdown(cli);
return ret;
}
Index: source/utils/net_rpc.c
===================================================================
RCS file: /work/cvs/samba/source/utils/net_rpc.c,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 net_rpc.c
--- source/utils/net_rpc.c 16 Dec 2003 01:11:39 -0000 1.1.1.2
+++ source/utils/net_rpc.c 9 Feb 2004 10:43:42 -0000
@@ -1341,10 +1341,10 @@ static void display_share_info_1(SRV_SHA
rpcstr_pull_unistr2_fstring(remark, &info1->info_1_str.uni_remark);
if (opt_long_list_entries) {
- d_printf("%-12.12s %-8.8s %-50.50s\n",
+ d_printf("%-12s %-8.8s %-50s\n",
netname, share_type[info1->info_1.type], remark);
} else {
- d_printf("%-12.12s\n", netname);
+ d_printf("%s\n", netname);
}
}
At Mon, 09 Feb 2004 17:53:20 +0900,
SATOH Fumiyasu wrote:
> This is a patch for Samba 3.0.1 to remove odd trailing space(s)
> from 'net share (without --long option)' output if sharename
> length is less than 12byte, and to fix doubled output problem in
> 'net rap share --long' output.
>
> Please apply this patch to Samba 3.0.x tree. Questions?
>
> --
> -- Name: SATOH Fumiyasu -- Home: http://www.sfo.jp (in Japanese only)
> -- Mail: fumiya at net-thrust.com, samba.gr.jp, namazu.org or ...
>
> Index: source/utils/net_rap.c
> ===================================================================
> RCS file: /work/cvs/samba/source/utils/net_rap.c,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 net_rap.c
> --- source/utils/net_rap.c 23 Oct 2003 03:53:56 -0000 1.1.1.1
> +++ source/utils/net_rap.c 9 Feb 2004 08:32:28 -0000
> @@ -160,7 +160,7 @@ static void long_share_fn(const char *sh
> static void share_fn(const char *share_name, uint32 type,
> const char *comment, void *state)
> {
> - d_printf("%-12.12s\n", share_name);
> + d_printf("%s\n", share_name);
> }
>
> static int rap_share_delete(int argc, const char **argv)
> @@ -240,8 +240,9 @@ int net_rap_share(int argc, const char *
> "\nShare name Type Description\n"\
> "---------- ---- -----------\n");
> ret = cli_RNetShareEnum(cli, long_share_fn, NULL);
> + } else {
> + ret = cli_RNetShareEnum(cli, share_fn, NULL);
> }
> - ret = cli_RNetShareEnum(cli, share_fn, NULL);
> cli_shutdown(cli);
> return ret;
> }
> Index: source/utils/net_rpc.c
> ===================================================================
> RCS file: /work/cvs/samba/source/utils/net_rpc.c,v
> retrieving revision 1.1.1.2
> diff -u -p -r1.1.1.2 net_rpc.c
> --- source/utils/net_rpc.c 16 Dec 2003 01:11:39 -0000 1.1.1.2
> +++ source/utils/net_rpc.c 9 Feb 2004 08:32:28 -0000
> @@ -1344,7 +1344,7 @@ static void display_share_info_1(SRV_SHA
> d_printf("%-12.12s %-8.8s %-50.50s\n",
> netname, share_type[info1->info_1.type], remark);
> } else {
> - d_printf("%-12.12s\n", netname);
> + d_printf("%s\n", netname);
> }
>
> }
>
--
-- Name: SATOH Fumiyasu -- Home: http://www.sfo.jp (in Japanese only)
-- Mail: fumiya at net-thrust.com, samba.gr.jp, namazu.org or ...
More information about the samba-technical
mailing list