diff options
author | Tim Potter <tpot@samba.org> | 2001-08-21 03:05:27 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-08-21 03:05:27 +0000 |
commit | 4a273d209b8e588ccadb37bb316830bc251c5adf (patch) | |
tree | 8c74eb8e1f2c8788afb6963d77a5a0f7e0e3a975 /source3 | |
parent | 1b7fab220f7b30c7ddd73c00544902332ce8525d (diff) | |
download | samba-4a273d209b8e588ccadb37bb316830bc251c5adf.tar.gz samba-4a273d209b8e588ccadb37bb316830bc251c5adf.tar.bz2 samba-4a273d209b8e588ccadb37bb316830bc251c5adf.zip |
Added cli_lsa_open_policy2()
(This used to be commit afaafc3e5a2adef4736196aa5f4e6ca25a0571d2)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/cli_lsarpc.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/source3/libsmb/cli_lsarpc.c b/source3/libsmb/cli_lsarpc.c index e4b6683389..8cf0817420 100644 --- a/source3/libsmb/cli_lsarpc.c +++ b/source3/libsmb/cli_lsarpc.c @@ -89,6 +89,64 @@ uint32 cli_lsa_open_policy(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } +/* Open a LSA policy handle */ + +uint32 cli_lsa_open_policy2(struct cli_state *cli, TALLOC_CTX *mem_ctx, + BOOL sec_qos, uint32 des_access, POLICY_HND *pol) +{ + prs_struct qbuf, rbuf; + LSA_Q_OPEN_POL2 q; + LSA_R_OPEN_POL2 r; + LSA_SEC_QOS qos; + uint32 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); + + /* Initialise input parameters */ + + if (sec_qos) { + init_lsa_sec_qos(&qos, 2, 1, 0, des_access); + init_q_open_pol2(&q, cli->clnt_name_slash, 0, des_access, + &qos); + } else { + init_q_open_pol2(&q, cli->clnt_name_slash, 0, des_access, + NULL); + } + + /* Marshall data and send request */ + + if (!lsa_io_q_open_pol2("", &q, &qbuf, 0) || + !rpc_api_pipe_req(cli, LSA_OPENPOLICY2, &qbuf, &rbuf)) { + result = NT_STATUS_UNSUCCESSFUL; + goto done; + } + + /* Unmarshall response */ + + if (!lsa_io_r_open_pol2("", &r, &rbuf, 0)) { + result = NT_STATUS_UNSUCCESSFUL; + goto done; + } + + /* Return output parameters */ + + if ((result = r.status) == NT_STATUS_NOPROBLEMO) { + *pol = r.pol; + } + + done: + prs_mem_free(&qbuf); + prs_mem_free(&rbuf); + + return result; +} + /* Close a LSA policy handle */ uint32 cli_lsa_close(struct cli_state *cli, TALLOC_CTX *mem_ctx, |