130
static BOOL get_rpc_shares(struct cli_state *cli,
131
void (*fn)(const char *, uint32, const char *, void *),
135
struct rpc_pipe_client *pipe_hnd;
139
SRV_SHARE_INFO_CTR ctr;
142
mem_ctx = talloc_new(NULL);
143
if (mem_ctx == NULL) {
144
DEBUG(0, ("talloc_new failed\n"));
148
init_enum_hnd(&enum_hnd, 0);
150
pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &status);
152
if (pipe_hnd == NULL) {
153
DEBUG(10, ("Could not connect to srvsvc pipe: %s\n",
155
TALLOC_FREE(mem_ctx);
159
werr = rpccli_srvsvc_net_share_enum(pipe_hnd, mem_ctx, 1, &ctr,
160
0xffffffff, &enum_hnd);
162
if (!W_ERROR_IS_OK(werr)) {
163
TALLOC_FREE(mem_ctx);
164
cli_rpc_pipe_close(pipe_hnd);
168
for (i=0; i<ctr.num_entries; i++) {
169
SRV_SHARE_INFO_1 *info = &ctr.share.info1[i];
170
char *name, *comment;
171
name = rpcstr_pull_unistr2_talloc(
172
mem_ctx, &info->info_1_str.uni_netname);
173
comment = rpcstr_pull_unistr2_talloc(
174
mem_ctx, &info->info_1_str.uni_remark);
175
fn(name, info->info_1.type, comment, state);
178
TALLOC_FREE(mem_ctx);
179
cli_rpc_pipe_close(pipe_hnd);
130
184
static BOOL get_shares(char *server_name, struct user_auth_info *user_info)
132
186
struct cli_state *cli;
134
188
if (!(cli = get_ipc_connect(server_name, NULL, user_info)))
191
if (get_rpc_shares(cli, add_name, &shares))
137
194
if (!cli_RNetShareEnum(cli, add_name, &shares))
216
273
while(poptGetNextOpt(pc) != -1);
217
274
poptFreeContext(pc);
219
lp_load(dyn_CONFIGFILE,True,False,False);
276
lp_load(dyn_CONFIGFILE,True,False,False,True);
220
277
load_interfaces();
222
279
/* Parse command line args */