Logo Search packages:      
Sourcecode: samba-doc-ja version File versions

NTSTATUS cli_lsa_query_info_policy ( struct cli_state *  cli,
TALLOC_CTX mem_ctx,
POLICY_HND *  pol,
uint16  info_class,
fstring  domain_name,
DOM_SID *  domain_sid 
)

Query info policy

Parameters:
domain_sid - returned remote server's domain sid

Definition at line 451 of file cli_lsarpc.c.

Referenced by fetch_domain_sid().

{
      prs_struct qbuf, rbuf;
      LSA_Q_QUERY_INFO q;
      LSA_R_QUERY_INFO r;
      NTSTATUS result;

      ZERO_STRUCT(q);
      ZERO_STRUCT(r);

      /* Initialise parse structures */

      prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL);
      prs_init(&rbuf, 0, mem_ctx, UNMARSHALL);

      /* Marshall data and send request */

      init_q_query(&q, pol, info_class);

      if (!lsa_io_q_query("", &q, &qbuf, 0) ||
          !rpc_api_pipe_req(cli, LSA_QUERYINFOPOLICY, &qbuf, &rbuf)) {
            result = NT_STATUS_UNSUCCESSFUL;
            goto done;
      }

      /* Unmarshall response */

      if (!lsa_io_r_query("", &r, &rbuf, 0)) {
            result = NT_STATUS_UNSUCCESSFUL;
            goto done;
      }

      if (!NT_STATUS_IS_OK(result = r.status)) {
            goto done;
      }

      /* Return output parameters */

      ZERO_STRUCTP(domain_sid);
      domain_name[0] = '\0';

      switch (info_class) {

      case 3:
            if (r.dom.id3.buffer_dom_name != 0) {
                  unistr2_to_dos(domain_name,
                               &r.dom.id3.
                               uni_domain_name,
                               sizeof (fstring) - 1);
            }

            if (r.dom.id3.buffer_dom_sid != 0) {
                  *domain_sid = r.dom.id3.dom_sid.sid;
            }

            break;

      case 5:
            
            if (r.dom.id5.buffer_dom_name != 0) {
                  unistr2_to_dos(domain_name, &r.dom.id5.
                               uni_domain_name,
                               sizeof (fstring) - 1);
            }
                  
            if (r.dom.id5.buffer_dom_sid != 0) {
                  *domain_sid = r.dom.id5.dom_sid.sid;
            }

            break;
            
      default:
            DEBUG(3, ("unknown info class %d\n", info_class));
            break;                  
      }
      
 done:
      prs_mem_free(&qbuf);
      prs_mem_free(&rbuf);

      return result;
}


Generated by  Doxygen 1.6.0   Back to index