diff options
author | Jeremy Allison <jra@samba.org> | 2004-07-21 01:32:09 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:52:14 -0500 |
commit | c8137eeea40c0b9f5526fd0c9cfd5843a572a8a0 (patch) | |
tree | fda29783e57321e07c3824278ccf417c7b063ac7 | |
parent | 1fca1fd8d7b9e12c6d4a3c2ad2e69a27aa65a9e1 (diff) | |
download | samba-c8137eeea40c0b9f5526fd0c9cfd5843a572a8a0.tar.gz samba-c8137eeea40c0b9f5526fd0c9cfd5843a572a8a0.tar.bz2 samba-c8137eeea40c0b9f5526fd0c9cfd5843a572a8a0.zip |
r1553: Good patch from Guenther Deschner <gd@sernet.de> to display share ACL
entries from rpcclient.
Jeremy.
(This used to be commit bd64f0c08143545a8613688402f769a713227557)
-rw-r--r-- | source3/rpc_client/cli_srvsvc.c | 36 | ||||
-rw-r--r-- | source3/rpcclient/cmd_srvsvc.c | 23 |
2 files changed, 59 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_srvsvc.c b/source3/rpc_client/cli_srvsvc.c index 555703cf4d..68eb17074f 100644 --- a/source3/rpc_client/cli_srvsvc.c +++ b/source3/rpc_client/cli_srvsvc.c @@ -181,6 +181,42 @@ WERROR cli_srvsvc_net_share_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, init_unistr2(&info2->info_2_str.uni_passwd, s, UNI_STR_TERMINATE); } break; + /* adding info-level 502 here */ + case 502: + ctr->share.info502 = (SRV_SHARE_INFO_502 *)talloc( + mem_ctx, sizeof(SRV_SHARE_INFO_502) * ctr->num_entries); + + memset(ctr->share.info502, 0, sizeof(SRV_SHARE_INFO_502)); + + for (i = 0; i < ctr->num_entries; i++) { + SRV_SHARE_INFO_502 *info502 = &ctr->share.info502[i]; + char *s; + + /* Copy pointer crap */ + memcpy(&info502->info_502, &r.ctr.share.info502[i].info_502, + sizeof(SH_INFO_502)); + + /* Duplicate strings */ + + s = unistr2_tdup(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_netname); + if (s) + init_unistr2(&info502->info_502_str.uni_netname, s, UNI_STR_TERMINATE); + + s = unistr2_tdup(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_remark); + if (s) + init_unistr2(&info502->info_502_str.uni_remark, s, UNI_STR_TERMINATE); + + s = unistr2_tdup(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_path); + if (s) + init_unistr2(&info502->info_502_str.uni_path, s, UNI_STR_TERMINATE); + + s = unistr2_tdup(mem_ctx, &r.ctr.share.info502[i].info_502_str.uni_passwd); + if (s) + init_unistr2(&info502->info_502_str.uni_passwd, s, UNI_STR_TERMINATE); + + info502->info_502_str.sd = dup_sec_desc(mem_ctx, r.ctr.share.info502[i].info_502_str.sd); + } + break; } done: prs_mem_free(&qbuf); diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c index 3e569f51ce..6e295a50fa 100644 --- a/source3/rpcclient/cmd_srvsvc.c +++ b/source3/rpcclient/cmd_srvsvc.c @@ -246,6 +246,25 @@ static void display_share_info_2(SRV_SHARE_INFO_2 *info2) printf("\tpassword:\t%s\n", passwd); } +static void display_share_info_502(SRV_SHARE_INFO_502 *info502) +{ + fstring netname = "", remark = "", path = "", passwd = ""; + + rpcstr_pull_unistr2_fstring(netname, &info502->info_502_str.uni_netname); + rpcstr_pull_unistr2_fstring(remark, &info502->info_502_str.uni_remark); + rpcstr_pull_unistr2_fstring(path, &info502->info_502_str.uni_path); + rpcstr_pull_unistr2_fstring(passwd, &info502->info_502_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); + + if (info502->info_502_str.sd) + display_sec_desc(info502->info_502_str.sd); + +} + static WERROR cmd_srvsvc_net_share_enum(struct cli_state *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) @@ -283,6 +302,10 @@ static WERROR cmd_srvsvc_net_share_enum(struct cli_state *cli, for (i = 0; i < ctr.num_entries; i++) display_share_info_2(&ctr.share.info2[i]); break; + case 502: + for (i = 0; i < ctr.num_entries; i++) + display_share_info_502(&ctr.share.info502[i]); + break; default: printf("unsupported info level %d\n", info_level); break; |