easy way to use libsmbclient to determine access rights?
David Wuertele
dave-gnus at bfnet.com
Wed Sep 22 20:13:32 GMT 2004
I've got an application that uses libsmbclient to enumerate shares.
It basically does the following:
cli_full_connection (&cli, NULL, server_name, &server_ip, 0,
"IPC$", "IPC", username, workgroup, password,
CLI_FULL_CONNECTION_ANNONYMOUS_FALLBACK,
Undefined, NULL);
mem_ctx = talloc_init ("run_rpc_command")
cli_nt_session_open (cli, PI_LSARPC)
cli_lsa_open_policy (cli, mem_ctx, False, SEC_RIGHTS_MAXIMUM_ALLOWED, &pol);
cli_lsa_query_info_policy (cli, mem_ctx, &pol, info_class, &domain_name, &domain_sid);
cli_lsa_close (cli, mem_ctx, &pol);
cli_nt_session_close (cli);
cli_nt_session_open(cli, PI_SRVSVC)
init_enum_hnd (&hnd, 0);
result = cli_srvsvc_net_share_enum (cli, mem_ctx, 1, &ctr, preferred_len, &hnd);
for (i = 0; i < ctr.num_entries; i++) {
rpcstr_pull_unistr2_fstring (netname, &info1->info_1_str.uni_netname);
rpcstr_pull_unistr2_fstring (remark, &info1->info_1_str.uni_remark);
}
Recently I've discovered that it doesn't matter what username or
password I use, even password-protected shares are enumerated by this
method.
Is there a way with libsmbclient, and preferably with the data I've
already initialized above, to discover whether a given username and
password is permitted to mount any given of these shares?
Thanks,
Dave
More information about the samba-technical
mailing list