| 1 | /*
|
|---|
| 2 | Unix SMB/CIFS implementation.
|
|---|
| 3 | RPC pipe client
|
|---|
| 4 |
|
|---|
| 5 | Copyright (C) Andrew Tridgell 1992-1999
|
|---|
| 6 | Copyright (C) Luke Kenneth Casson Leighton 1996 - 1999
|
|---|
| 7 | Copyright (C) Tim Potter 2000,2002
|
|---|
| 8 |
|
|---|
| 9 | This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | it under the terms of the GNU General Public License as published by
|
|---|
| 11 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 12 | (at your option) any later version.
|
|---|
| 13 |
|
|---|
| 14 | This program is distributed in the hope that it will be useful,
|
|---|
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | GNU General Public License for more details.
|
|---|
| 18 |
|
|---|
| 19 | You should have received a copy of the GNU General Public License
|
|---|
| 20 | along with this program; if not, write to the Free Software
|
|---|
| 21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|---|
| 22 | */
|
|---|
| 23 |
|
|---|
| 24 | #include "includes.h"
|
|---|
| 25 | #include "rpcclient.h"
|
|---|
| 26 |
|
|---|
| 27 | /* Display server query info */
|
|---|
| 28 |
|
|---|
| 29 | static char *get_server_type_str(uint32 type)
|
|---|
| 30 | {
|
|---|
| 31 | static fstring typestr;
|
|---|
| 32 | int i;
|
|---|
| 33 |
|
|---|
| 34 | if (type == SV_TYPE_ALL) {
|
|---|
| 35 | fstrcpy(typestr, "All");
|
|---|
| 36 | return typestr;
|
|---|
| 37 | }
|
|---|
| 38 |
|
|---|
| 39 | typestr[0] = 0;
|
|---|
| 40 |
|
|---|
| 41 | for (i = 0; i < 32; i++) {
|
|---|
| 42 | if (type & (1 << i)) {
|
|---|
| 43 | switch (1 << i) {
|
|---|
| 44 | case SV_TYPE_WORKSTATION:
|
|---|
| 45 | fstrcat(typestr, "Wk ");
|
|---|
| 46 | break;
|
|---|
| 47 | case SV_TYPE_SERVER:
|
|---|
| 48 | fstrcat(typestr, "Sv ");
|
|---|
| 49 | break;
|
|---|
| 50 | case SV_TYPE_SQLSERVER:
|
|---|
| 51 | fstrcat(typestr, "Sql ");
|
|---|
| 52 | break;
|
|---|
| 53 | case SV_TYPE_DOMAIN_CTRL:
|
|---|
| 54 | fstrcat(typestr, "PDC ");
|
|---|
| 55 | break;
|
|---|
| 56 | case SV_TYPE_DOMAIN_BAKCTRL:
|
|---|
| 57 | fstrcat(typestr, "BDC ");
|
|---|
| 58 | break;
|
|---|
| 59 | case SV_TYPE_TIME_SOURCE:
|
|---|
| 60 | fstrcat(typestr, "Tim ");
|
|---|
| 61 | break;
|
|---|
| 62 | case SV_TYPE_AFP:
|
|---|
| 63 | fstrcat(typestr, "AFP ");
|
|---|
| 64 | break;
|
|---|
| 65 | case SV_TYPE_NOVELL:
|
|---|
| 66 | fstrcat(typestr, "Nov ");
|
|---|
| 67 | break;
|
|---|
| 68 | case SV_TYPE_DOMAIN_MEMBER:
|
|---|
| 69 | fstrcat(typestr, "Dom ");
|
|---|
| 70 | break;
|
|---|
| 71 | case SV_TYPE_PRINTQ_SERVER:
|
|---|
| 72 | fstrcat(typestr, "PrQ ");
|
|---|
| 73 | break;
|
|---|
| 74 | case SV_TYPE_DIALIN_SERVER:
|
|---|
| 75 | fstrcat(typestr, "Din ");
|
|---|
| 76 | break;
|
|---|
| 77 | case SV_TYPE_SERVER_UNIX:
|
|---|
| 78 | fstrcat(typestr, "Unx ");
|
|---|
| 79 | break;
|
|---|
| 80 | case SV_TYPE_NT:
|
|---|
| 81 | fstrcat(typestr, "NT ");
|
|---|
| 82 | break;
|
|---|
| 83 | case SV_TYPE_WFW:
|
|---|
| 84 | fstrcat(typestr, "Wfw ");
|
|---|
| 85 | break;
|
|---|
| 86 | case SV_TYPE_SERVER_MFPN:
|
|---|
| 87 | fstrcat(typestr, "Mfp ");
|
|---|
| 88 | break;
|
|---|
| 89 | case SV_TYPE_SERVER_NT:
|
|---|
| 90 | fstrcat(typestr, "SNT ");
|
|---|
| 91 | break;
|
|---|
| 92 | case SV_TYPE_POTENTIAL_BROWSER:
|
|---|
| 93 | fstrcat(typestr, "PtB ");
|
|---|
| 94 | break;
|
|---|
| 95 | case SV_TYPE_BACKUP_BROWSER:
|
|---|
| 96 | fstrcat(typestr, "BMB ");
|
|---|
| 97 | break;
|
|---|
| 98 | case SV_TYPE_MASTER_BROWSER:
|
|---|
| 99 | fstrcat(typestr, "LMB ");
|
|---|
| 100 | break;
|
|---|
| 101 | case SV_TYPE_DOMAIN_MASTER:
|
|---|
| 102 | fstrcat(typestr, "DMB ");
|
|---|
| 103 | break;
|
|---|
| 104 | case SV_TYPE_SERVER_OSF:
|
|---|
| 105 | fstrcat(typestr, "OSF ");
|
|---|
| 106 | break;
|
|---|
| 107 | case SV_TYPE_SERVER_VMS:
|
|---|
| 108 | fstrcat(typestr, "VMS ");
|
|---|
| 109 | break;
|
|---|
| 110 | case SV_TYPE_WIN95_PLUS:
|
|---|
| 111 | fstrcat(typestr, "W95 ");
|
|---|
| 112 | break;
|
|---|
| 113 | case SV_TYPE_ALTERNATE_XPORT:
|
|---|
| 114 | fstrcat(typestr, "Xpt ");
|
|---|
| 115 | break;
|
|---|
| 116 | case SV_TYPE_LOCAL_LIST_ONLY:
|
|---|
| 117 | fstrcat(typestr, "Dom ");
|
|---|
| 118 | break;
|
|---|
| 119 | case SV_TYPE_DOMAIN_ENUM:
|
|---|
| 120 | fstrcat(typestr, "Loc ");
|
|---|
| 121 | break;
|
|---|
| 122 | }
|
|---|
| 123 | }
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | i = strlen(typestr) - 1;
|
|---|
| 127 |
|
|---|
| 128 | if (typestr[i] == ' ')
|
|---|
| 129 | typestr[i] = 0;
|
|---|
| 130 |
|
|---|
| 131 | return typestr;
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | static void display_server(char *sname, uint32 type, const char *comment)
|
|---|
| 135 | {
|
|---|
| 136 | printf("\t%-15.15s%-20s %s\n", sname, get_server_type_str(type),
|
|---|
| 137 | comment);
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | static void display_srv_info_101(SRV_INFO_101 *sv101)
|
|---|
| 141 | {
|
|---|
| 142 | fstring name;
|
|---|
| 143 | fstring comment;
|
|---|
| 144 |
|
|---|
| 145 | unistr2_to_ascii(name, &sv101->uni_name, sizeof(name) - 1);
|
|---|
| 146 | unistr2_to_ascii(comment, &sv101->uni_comment, sizeof(comment) - 1);
|
|---|
| 147 |
|
|---|
| 148 | display_server(name, sv101->srv_type, comment);
|
|---|
| 149 |
|
|---|
| 150 | printf("\tplatform_id :\t%d\n", sv101->platform_id);
|
|---|
| 151 | printf("\tos version :\t%d.%d\n", sv101->ver_major,
|
|---|
| 152 | sv101->ver_minor);
|
|---|
| 153 |
|
|---|
| 154 | printf("\tserver type :\t0x%x\n", sv101->srv_type);
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | static void display_srv_info_102(SRV_INFO_102 *sv102)
|
|---|
| 158 | {
|
|---|
| 159 | fstring name;
|
|---|
| 160 | fstring comment;
|
|---|
| 161 | fstring usr_path;
|
|---|
| 162 |
|
|---|
| 163 | unistr2_to_ascii(name, &sv102->uni_name, sizeof(name) - 1);
|
|---|
| 164 | unistr2_to_ascii(comment, &sv102->uni_comment, sizeof(comment) - 1);
|
|---|
| 165 | unistr2_to_ascii(usr_path, &sv102->uni_usr_path, sizeof(usr_path) - 1);
|
|---|
| 166 |
|
|---|
| 167 | display_server(name, sv102->srv_type, comment);
|
|---|
| 168 |
|
|---|
| 169 | printf("\tplatform_id :\t%d\n", sv102->platform_id);
|
|---|
| 170 | printf("\tos version :\t%d.%d\n", sv102->ver_major,
|
|---|
| 171 | sv102->ver_minor);
|
|---|
| 172 |
|
|---|
| 173 | printf("\tusers :\t%x\n", sv102->users);
|
|---|
| 174 | printf("\tdisc, hidden :\t%x, %x\n", sv102->disc, sv102->hidden);
|
|---|
| 175 | printf("\tannounce, delta :\t%d, %d\n", sv102->announce,
|
|---|
| 176 | sv102->ann_delta);
|
|---|
| 177 | printf("\tlicenses :\t%d\n", sv102->licenses);
|
|---|
| 178 | printf("\tuser path :\t%s\n", usr_path);
|
|---|
| 179 | }
|
|---|
| 180 |
|
|---|
| 181 | /* Server query info */
|
|---|
| 182 | static WERROR cmd_srvsvc_srv_query_info(struct rpc_pipe_client *cli,
|
|---|
| 183 | TALLOC_CTX *mem_ctx,
|
|---|
| 184 | int argc, const char **argv)
|
|---|
| 185 | {
|
|---|
| 186 | uint32 info_level = 101;
|
|---|
| 187 | SRV_INFO_CTR ctr;
|
|---|
| 188 | WERROR result;
|
|---|
| 189 |
|
|---|
| 190 | if (argc > 2) {
|
|---|
| 191 | printf("Usage: %s [infolevel]\n", argv[0]);
|
|---|
| 192 | return WERR_OK;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | if (argc == 2)
|
|---|
| 196 | info_level = atoi(argv[1]);
|
|---|
| 197 |
|
|---|
| 198 | result = rpccli_srvsvc_net_srv_get_info(cli, mem_ctx, info_level,
|
|---|
| 199 | &ctr);
|
|---|
| 200 |
|
|---|
| 201 | if (!W_ERROR_IS_OK(result)) {
|
|---|
| 202 | goto done;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | /* Display results */
|
|---|
| 206 |
|
|---|
| 207 | switch (info_level) {
|
|---|
| 208 | case 101:
|
|---|
| 209 | display_srv_info_101(&ctr.srv.sv101);
|
|---|
| 210 | break;
|
|---|
| 211 | case 102:
|
|---|
| 212 | display_srv_info_102(&ctr.srv.sv102);
|
|---|
| 213 | break;
|
|---|
| 214 | default:
|
|---|
| 215 | printf("unsupported info level %d\n", info_level);
|
|---|
| 216 | break;
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | done:
|
|---|
| 220 | return result;
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
|
|---|
| 224 | {
|
|---|
| 225 | fstring netname = "", remark = "";
|
|---|
| 226 |
|
|---|
| 227 | rpcstr_pull_unistr2_fstring(netname, &info1->info_1_str.uni_netname);
|
|---|
| 228 | rpcstr_pull_unistr2_fstring(remark, &info1->info_1_str.uni_remark);
|
|---|
| 229 |
|
|---|
| 230 | printf("netname: %s\n", netname);
|
|---|
| 231 | printf("\tremark:\t%s\n", remark);
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | static void display_share_info_2(SRV_SHARE_INFO_2 *info2)
|
|---|
| 235 | {
|
|---|
| 236 | fstring netname = "", remark = "", path = "", passwd = "";
|
|---|
| 237 |
|
|---|
| 238 | rpcstr_pull_unistr2_fstring(netname, &info2->info_2_str.uni_netname);
|
|---|
| 239 | rpcstr_pull_unistr2_fstring(remark, &info2->info_2_str.uni_remark);
|
|---|
| 240 | rpcstr_pull_unistr2_fstring(path, &info2->info_2_str.uni_path);
|
|---|
| 241 | rpcstr_pull_unistr2_fstring(passwd, &info2->info_2_str.uni_passwd);
|
|---|
| 242 |
|
|---|
| 243 | printf("netname: %s\n", netname);
|
|---|
| 244 | printf("\tremark:\t%s\n", remark);
|
|---|
| 245 | printf("\tpath:\t%s\n", path);
|
|---|
| 246 | printf("\tpassword:\t%s\n", passwd);
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | static void display_share_info_502(SRV_SHARE_INFO_502 *info502)
|
|---|
| 250 | {
|
|---|
| 251 | fstring netname = "", remark = "", path = "", passwd = "";
|
|---|
| 252 |
|
|---|
| 253 | rpcstr_pull_unistr2_fstring(netname, &info502->info_502_str.uni_netname);
|
|---|
| 254 | rpcstr_pull_unistr2_fstring(remark, &info502->info_502_str.uni_remark);
|
|---|
| 255 | rpcstr_pull_unistr2_fstring(path, &info502->info_502_str.uni_path);
|
|---|
| 256 | rpcstr_pull_unistr2_fstring(passwd, &info502->info_502_str.uni_passwd);
|
|---|
| 257 |
|
|---|
| 258 | printf("netname: %s\n", netname);
|
|---|
| 259 | printf("\tremark:\t%s\n", remark);
|
|---|
| 260 | printf("\tpath:\t%s\n", path);
|
|---|
| 261 | printf("\tpassword:\t%s\n", passwd);
|
|---|
| 262 |
|
|---|
| 263 | printf("\ttype:\t0x%x\n", info502->info_502.type);
|
|---|
| 264 | printf("\tperms:\t%d\n", info502->info_502.perms);
|
|---|
| 265 | printf("\tmax_uses:\t%d\n", info502->info_502.max_uses);
|
|---|
| 266 | printf("\tnum_uses:\t%d\n", info502->info_502.num_uses);
|
|---|
| 267 |
|
|---|
| 268 | if (info502->info_502_str.sd)
|
|---|
| 269 | display_sec_desc(info502->info_502_str.sd);
|
|---|
| 270 |
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | static WERROR cmd_srvsvc_net_share_enum(struct rpc_pipe_client *cli,
|
|---|
| 274 | TALLOC_CTX *mem_ctx,
|
|---|
| 275 | int argc, const char **argv)
|
|---|
| 276 | {
|
|---|
| 277 | uint32 info_level = 2;
|
|---|
| 278 | SRV_SHARE_INFO_CTR ctr;
|
|---|
| 279 | WERROR result;
|
|---|
| 280 | ENUM_HND hnd;
|
|---|
| 281 | uint32 preferred_len = 0xffffffff, i;
|
|---|
| 282 |
|
|---|
| 283 | if (argc > 2) {
|
|---|
| 284 | printf("Usage: %s [infolevel]\n", argv[0]);
|
|---|
| 285 | return WERR_OK;
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | if (argc == 2)
|
|---|
| 289 | info_level = atoi(argv[1]);
|
|---|
| 290 |
|
|---|
| 291 | init_enum_hnd(&hnd, 0);
|
|---|
| 292 |
|
|---|
| 293 | result = rpccli_srvsvc_net_share_enum(
|
|---|
| 294 | cli, mem_ctx, info_level, &ctr, preferred_len, &hnd);
|
|---|
| 295 |
|
|---|
| 296 | if (!W_ERROR_IS_OK(result) || !ctr.num_entries)
|
|---|
| 297 | goto done;
|
|---|
| 298 |
|
|---|
| 299 | /* Display results */
|
|---|
| 300 |
|
|---|
| 301 | switch (info_level) {
|
|---|
| 302 | case 1:
|
|---|
| 303 | for (i = 0; i < ctr.num_entries; i++)
|
|---|
| 304 | display_share_info_1(&ctr.share.info1[i]);
|
|---|
| 305 | break;
|
|---|
| 306 | case 2:
|
|---|
| 307 | for (i = 0; i < ctr.num_entries; i++)
|
|---|
| 308 | display_share_info_2(&ctr.share.info2[i]);
|
|---|
| 309 | break;
|
|---|
| 310 | case 502:
|
|---|
| 311 | for (i = 0; i < ctr.num_entries; i++)
|
|---|
| 312 | display_share_info_502(&ctr.share.info502[i]);
|
|---|
| 313 | break;
|
|---|
| 314 | default:
|
|---|
| 315 | printf("unsupported info level %d\n", info_level);
|
|---|
| 316 | break;
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | done:
|
|---|
| 320 | return result;
|
|---|
| 321 | }
|
|---|
| 322 |
|
|---|
| 323 | static WERROR cmd_srvsvc_net_share_get_info(struct rpc_pipe_client *cli,
|
|---|
| 324 | TALLOC_CTX *mem_ctx,
|
|---|
| 325 | int argc, const char **argv)
|
|---|
| 326 | {
|
|---|
| 327 | uint32 info_level = 502;
|
|---|
| 328 | SRV_SHARE_INFO info;
|
|---|
| 329 | WERROR result;
|
|---|
| 330 |
|
|---|
| 331 | if (argc > 3) {
|
|---|
| 332 | printf("Usage: %s [sharename] [infolevel]\n", argv[0]);
|
|---|
| 333 | return WERR_OK;
|
|---|
| 334 | }
|
|---|
| 335 |
|
|---|
| 336 | if (argc == 3)
|
|---|
| 337 | info_level = atoi(argv[2]);
|
|---|
| 338 |
|
|---|
| 339 | result = rpccli_srvsvc_net_share_get_info(cli, mem_ctx, argv[1], info_level, &info);
|
|---|
| 340 |
|
|---|
| 341 | if (!W_ERROR_IS_OK(result))
|
|---|
| 342 | goto done;
|
|---|
| 343 |
|
|---|
| 344 | /* Display results */
|
|---|
| 345 |
|
|---|
| 346 | switch (info_level) {
|
|---|
| 347 | case 1:
|
|---|
| 348 | display_share_info_1(&info.share.info1);
|
|---|
| 349 | break;
|
|---|
| 350 | case 2:
|
|---|
| 351 | display_share_info_2(&info.share.info2);
|
|---|
| 352 | break;
|
|---|
| 353 | case 502:
|
|---|
| 354 | display_share_info_502(&info.share.info502);
|
|---|
| 355 | break;
|
|---|
| 356 | default:
|
|---|
| 357 | printf("unsupported info level %d\n", info_level);
|
|---|
| 358 | break;
|
|---|
| 359 | }
|
|---|
| 360 |
|
|---|
| 361 | done:
|
|---|
| 362 | return result;
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 | static WERROR cmd_srvsvc_net_share_set_info(struct rpc_pipe_client *cli,
|
|---|
| 366 | TALLOC_CTX *mem_ctx,
|
|---|
| 367 | int argc, const char **argv)
|
|---|
| 368 | {
|
|---|
| 369 | uint32 info_level = 502;
|
|---|
| 370 | SRV_SHARE_INFO info_get;
|
|---|
| 371 | WERROR result;
|
|---|
| 372 |
|
|---|
| 373 | if (argc > 3) {
|
|---|
| 374 | printf("Usage: %s [sharename] [comment]\n", argv[0]);
|
|---|
| 375 | return WERR_OK;
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | /* retrieve share info */
|
|---|
| 379 | result = rpccli_srvsvc_net_share_get_info(cli, mem_ctx, argv[1], info_level, &info_get);
|
|---|
| 380 | if (!W_ERROR_IS_OK(result))
|
|---|
| 381 | goto done;
|
|---|
| 382 |
|
|---|
| 383 | info_get.switch_value = info_level;
|
|---|
| 384 | info_get.ptr_share_ctr = 1;
|
|---|
| 385 | init_unistr2(&(info_get.share.info502.info_502_str.uni_remark), argv[2], UNI_STR_TERMINATE);
|
|---|
| 386 |
|
|---|
| 387 | /* set share info */
|
|---|
| 388 | result = rpccli_srvsvc_net_share_set_info(cli, mem_ctx, argv[1], info_level, &info_get);
|
|---|
| 389 |
|
|---|
| 390 | if (!W_ERROR_IS_OK(result))
|
|---|
| 391 | goto done;
|
|---|
| 392 |
|
|---|
| 393 | /* re-retrieve share info and display */
|
|---|
| 394 | result = rpccli_srvsvc_net_share_get_info(cli, mem_ctx, argv[1], info_level, &info_get);
|
|---|
| 395 | if (!W_ERROR_IS_OK(result))
|
|---|
| 396 | goto done;
|
|---|
| 397 |
|
|---|
| 398 | display_share_info_502(&info_get.share.info502);
|
|---|
| 399 |
|
|---|
| 400 | done:
|
|---|
| 401 | return result;
|
|---|
| 402 | }
|
|---|
| 403 |
|
|---|
| 404 | static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli,
|
|---|
| 405 | TALLOC_CTX *mem_ctx,
|
|---|
| 406 | int argc, const char **argv)
|
|---|
| 407 | {
|
|---|
| 408 | TIME_OF_DAY_INFO tod;
|
|---|
| 409 | fstring srv_name_slash;
|
|---|
| 410 | WERROR result;
|
|---|
| 411 |
|
|---|
| 412 | if (argc > 1) {
|
|---|
| 413 | printf("Usage: %s\n", argv[0]);
|
|---|
| 414 | return WERR_OK;
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | fstr_sprintf(srv_name_slash, "\\\\%s", cli->cli->desthost);
|
|---|
| 418 | result = rpccli_srvsvc_net_remote_tod(
|
|---|
| 419 | cli, mem_ctx, srv_name_slash, &tod);
|
|---|
| 420 |
|
|---|
| 421 | if (!W_ERROR_IS_OK(result))
|
|---|
| 422 | goto done;
|
|---|
| 423 |
|
|---|
| 424 | done:
|
|---|
| 425 | return result;
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | static WERROR cmd_srvsvc_net_file_enum(struct rpc_pipe_client *cli,
|
|---|
| 429 | TALLOC_CTX *mem_ctx,
|
|---|
| 430 | int argc, const char **argv)
|
|---|
| 431 | {
|
|---|
| 432 | uint32 info_level = 3;
|
|---|
| 433 | SRV_FILE_INFO_CTR ctr;
|
|---|
| 434 | WERROR result;
|
|---|
| 435 | ENUM_HND hnd;
|
|---|
| 436 | uint32 preferred_len = 0xffff;
|
|---|
| 437 |
|
|---|
| 438 | if (argc > 2) {
|
|---|
| 439 | printf("Usage: %s [infolevel]\n", argv[0]);
|
|---|
| 440 | return WERR_OK;
|
|---|
| 441 | }
|
|---|
| 442 |
|
|---|
| 443 | if (argc == 2)
|
|---|
| 444 | info_level = atoi(argv[1]);
|
|---|
| 445 |
|
|---|
| 446 | init_enum_hnd(&hnd, 0);
|
|---|
| 447 |
|
|---|
| 448 | ZERO_STRUCT(ctr);
|
|---|
| 449 |
|
|---|
| 450 | result = rpccli_srvsvc_net_file_enum(
|
|---|
| 451 | cli, mem_ctx, info_level, NULL, &ctr, preferred_len, &hnd);
|
|---|
| 452 |
|
|---|
| 453 | if (!W_ERROR_IS_OK(result))
|
|---|
| 454 | goto done;
|
|---|
| 455 |
|
|---|
| 456 | done:
|
|---|
| 457 | return result;
|
|---|
| 458 | }
|
|---|
| 459 |
|
|---|
| 460 | /* List of commands exported by this module */
|
|---|
| 461 |
|
|---|
| 462 | struct cmd_set srvsvc_commands[] = {
|
|---|
| 463 |
|
|---|
| 464 | { "SRVSVC" },
|
|---|
| 465 |
|
|---|
| 466 | { "srvinfo", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_srv_query_info, PI_SRVSVC, NULL, "Server query info", "" },
|
|---|
| 467 | { "netshareenum",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum, PI_SRVSVC, NULL, "Enumerate shares", "" },
|
|---|
| 468 | { "netsharegetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_get_info, PI_SRVSVC, NULL, "Get Share Info", "" },
|
|---|
| 469 | { "netsharesetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_set_info, PI_SRVSVC, NULL, "Set Share Info", "" },
|
|---|
| 470 | { "netfileenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_enum, PI_SRVSVC, NULL, "Enumerate open files", "" },
|
|---|
| 471 | { "netremotetod",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_remote_tod, PI_SRVSVC, NULL, "Fetch remote time of day", "" },
|
|---|
| 472 |
|
|---|
| 473 | { NULL }
|
|---|
| 474 | };
|
|---|