int net_rap_share(int argc, const char **argv) { struct functable func[] = { {"DELETE", rap_share_delete}, {"CLOSE", rap_share_delete}, {"ADD", rap_share_add}, {NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (!(cli = net_make_ipc_connection(0))) return -1; if (opt_long_list_entries) { d_printf( "\nEnumerating shared resources (exports) on remote server:\n\n"\ "\nShare name Type Description\n"\ "---------- ---- -----------\n"); ret = cli_RNetShareEnum(cli, long_share_fn, NULL); } else { ret = cli_RNetShareEnum(cli, share_fn, NULL); } cli_shutdown(cli); return ret; } return net_run_function(argc, argv, func, net_rap_share_usage); }
static bool get_shares(char *server_name, struct user_auth_info *user_info) { struct cli_state *cli; if (!(cli = get_ipc_connect(server_name, NULL, user_info))) return False; if (get_rpc_shares(cli, add_name, &shares)) return True; if (!cli_RNetShareEnum(cli, add_name, &shares)) return False; return True; }
int net_rap_share(struct net_context *c, int argc, const char **argv) { struct functable func[] = { { "delete", rap_share_delete, NET_TRANSPORT_RAP, N_("Delete a share from server"), N_("net rap share delete\n" " Delete a share from server") }, { "close", rap_share_delete, NET_TRANSPORT_RAP, N_("Delete a share from server"), N_("net rap share close\n" " Delete a share from server\n" " Alias for net rap share delete") }, { "add", rap_share_add, NET_TRANSPORT_RAP, N_("Add a share to server"), N_("net rap share add\n" " Add a share to server") }, {NULL, NULL, 0, NULL, NULL} }; if (argc == 0) { struct cli_state *cli; int ret; if (c->display_usage) { d_printf(_("Usage:\n")); d_printf(_("net rap share\n" " List all shares on remote server\n")); net_display_usage_from_functable(func); return 0; } if (!NT_STATUS_IS_OK(net_make_ipc_connection(c, 0, &cli))) return -1; if (c->opt_long_list_entries) { d_printf(_( "\nEnumerating shared resources (exports) on remote server:\n\n" "\nShare name Type Description\n" "---------- ---- -----------\n")); ret = cli_RNetShareEnum(cli, long_share_fn, NULL); } else { ret = cli_RNetShareEnum(cli, share_fn, NULL); } cli_shutdown(cli); return ret; } return net_run_function(c, argc, argv, "net rap share", func); }