could not initialize lsa pipe

David Wuertele dave-gnus at
Tue Oct 5 17:57:05 GMT 2004

I'm trying to use the libsmbclient RPC cli_srvsvc_net_share_enum().
>From following the implementation in the "net" executable, it appears
that I have to do something like this:

    nt_status = cli_full_connection (&cli, NULL, server_name, &server_ip, 0, 
                                     "IPC$", "IPC", username, workgroup, password, 
                                     Undefined, NULL);
    mem_ctx = talloc_init ("run_rpc_command");
  #ifdef WTF_IS_LSA
    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);
  #endif /* WTF_IS_LSA */
    cli_nt_session_open(cli, PI_SRVSVC);
    init_enum_hnd (&hnd, 0);
    cli_srvsvc_net_share_enum (cli, mem_ctx, 1, &ctr, preferred_len, &hnd);
    for (i = 0; i < ctr.num_entries; i++) {
          char sharename[MAX_BUFF_SIZE];
          SRV_SHARE_INFO_1 *info1 = &ctr.share.info1[i];
          rpcstr_pull_unistr2_fstring (netname, &info1->info_1_str.uni_netname);
          rpcstr_pull_unistr2_fstring (remark, &info1->info_1_str.uni_remark);

My question is about the section between the #ifdef WTF_IS_LSA and the
#endif.  The question is, WTF is LSA, and why does net initialize it?
Is this necessary to enumerate a server's shares?

More information about the samba-technical mailing list