summaryrefslogtreecommitdiffstats
path: root/source/rpcclient/cmd_srvsvc.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/rpcclient/cmd_srvsvc.c')
-rw-r--r--source/rpcclient/cmd_srvsvc.c141
1 files changed, 6 insertions, 135 deletions
diff --git a/source/rpcclient/cmd_srvsvc.c b/source/rpcclient/cmd_srvsvc.c
index 8d416f8db01..d6c1fd544f3 100644
--- a/source/rpcclient/cmd_srvsvc.c
+++ b/source/rpcclient/cmd_srvsvc.c
@@ -4,7 +4,7 @@
Copyright (C) Andrew Tridgell 1992-1999
Copyright (C) Luke Kenneth Casson Leighton 1996 - 1999
- Copyright (C) Tim Potter 2000,2002
+ Copyright (C) Tim Potter 2000
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -142,8 +142,8 @@ static void display_srv_info_101(SRV_INFO_101 *sv101)
fstring name;
fstring comment;
- unistr2_to_ascii(name, &sv101->uni_name, sizeof(name) - 1);
- unistr2_to_ascii(comment, &sv101->uni_comment, sizeof(comment) - 1);
+ unistr2_to_unix(name, &sv101->uni_name, sizeof(name) - 1);
+ unistr2_to_unix(comment, &sv101->uni_comment, sizeof(comment) - 1);
display_server(name, sv101->srv_type, comment);
@@ -160,9 +160,9 @@ static void display_srv_info_102(SRV_INFO_102 *sv102)
fstring comment;
fstring usr_path;
- unistr2_to_ascii(name, &sv102->uni_name, sizeof(name) - 1);
- unistr2_to_ascii(comment, &sv102->uni_comment, sizeof(comment) - 1);
- unistr2_to_ascii(usr_path, &sv102->uni_usr_path, sizeof(usr_path) - 1);
+ unistr2_to_unix(name, &sv102->uni_name, sizeof(name) - 1);
+ unistr2_to_unix(comment, &sv102->uni_comment, sizeof(comment) - 1);
+ unistr2_to_unix(usr_path, &sv102->uni_usr_path, sizeof(usr_path) - 1);
display_server(name, sv102->srv_type, comment);
@@ -221,132 +221,6 @@ static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli,
return result;
}
-static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
-{
- fstring netname = "", remark = "";
-
- rpcstr_pull_unistr2_fstring(netname, &info1->info_1_str.uni_netname);
- rpcstr_pull_unistr2_fstring(remark, &info1->info_1_str.uni_remark);
-
- printf("netname: %s\n", netname);
- printf("\tremark:\t%s\n", remark);
-}
-
-static void display_share_info_2(SRV_SHARE_INFO_2 *info2)
-{
- fstring netname = "", remark = "", path = "", passwd = "";
-
- rpcstr_pull_unistr2_fstring(netname, &info2->info_2_str.uni_netname);
- rpcstr_pull_unistr2_fstring(remark, &info2->info_2_str.uni_remark);
- rpcstr_pull_unistr2_fstring(path, &info2->info_2_str.uni_path);
- rpcstr_pull_unistr2_fstring(passwd, &info2->info_2_str.uni_passwd);
-
- printf("netname: %s\n", netname);
- printf("\tremark:\t%s\n", remark);
- printf("\tpath:\t%s\n", path);
- printf("\tpassword:\t%s\n", passwd);
-}
-
-static NTSTATUS cmd_srvsvc_net_share_enum(struct cli_state *cli,
- TALLOC_CTX *mem_ctx,
- int argc, char **argv)
-{
- uint32 info_level = 2;
- SRV_SHARE_INFO_CTR ctr;
- WERROR result;
- ENUM_HND hnd;
- uint32 preferred_len = 0xffffffff, i;
-
- if (argc > 2) {
- printf("Usage: %s [infolevel]\n", argv[0]);
- return NT_STATUS_OK;
- }
-
- if (argc == 2)
- info_level = atoi(argv[1]);
-
- init_enum_hnd(&hnd, 0);
-
- result = cli_srvsvc_net_share_enum(
- cli, mem_ctx, info_level, &ctr, preferred_len, &hnd);
-
- if (!W_ERROR_IS_OK(result) || !ctr.num_entries)
- goto done;
-
- /* Display results */
-
- switch (info_level) {
- case 1:
- for (i = 0; i < ctr.num_entries; i++)
- display_share_info_1(&ctr.share.info1[i]);
- break;
- case 2:
- for (i = 0; i < ctr.num_entries; i++)
- display_share_info_2(&ctr.share.info2[i]);
- break;
- default:
- printf("unsupported info level %d\n", info_level);
- break;
- }
-
- done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
-}
-
-static NTSTATUS cmd_srvsvc_net_remote_tod(struct cli_state *cli,
- TALLOC_CTX *mem_ctx,
- int argc, char **argv)
-{
- TIME_OF_DAY_INFO tod;
- WERROR result;
-
- if (argc > 1) {
- printf("Usage: %s\n", argv[0]);
- return NT_STATUS_OK;
- }
-
- result = cli_srvsvc_net_remote_tod(
- cli, mem_ctx, cli->srv_name_slash, &tod);
-
- if (!W_ERROR_IS_OK(result))
- goto done;
-
- done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
-}
-
-static NTSTATUS cmd_srvsvc_net_file_enum(struct cli_state *cli,
- TALLOC_CTX *mem_ctx,
- int argc, char **argv)
-{
- uint32 info_level = 3;
- SRV_FILE_INFO_CTR ctr;
- WERROR result;
- ENUM_HND hnd;
- uint32 preferred_len = 0;
-
- if (argc > 2) {
- printf("Usage: %s [infolevel]\n", argv[0]);
- return NT_STATUS_OK;
- }
-
- if (argc == 2)
- info_level = atoi(argv[1]);
-
- init_enum_hnd(&hnd, 0);
-
- ZERO_STRUCT(ctr);
-
- result = cli_srvsvc_net_file_enum(
- cli, mem_ctx, info_level, NULL, &ctr, preferred_len, &hnd);
-
- if (!W_ERROR_IS_OK(result))
- goto done;
-
- done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
-}
-
/* List of commands exported by this module */
struct cmd_set srvsvc_commands[] = {
@@ -354,9 +228,6 @@ struct cmd_set srvsvc_commands[] = {
{ "SRVSVC" },
{ "srvinfo", cmd_srvsvc_srv_query_info, PIPE_SRVSVC, "Server query info", "" },
- { "netshareenum", cmd_srvsvc_net_share_enum, PIPE_SRVSVC, "Enumerate shares", "" },
- { "netfileenum", cmd_srvsvc_net_file_enum, PIPE_SRVSVC, "Enumerate open files", "" },
- { "netremotetod", cmd_srvsvc_net_remote_tod, PIPE_SRVSVC, "Fetch remote time of day", "" },
{ NULL }
};