diff options
author | Tim Potter <tpot@samba.org> | 2003-04-04 00:52:42 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2003-04-04 00:52:42 +0000 |
commit | 0bcc0c343f9ca1616026fb3ee7dae8bd9615ccf9 (patch) | |
tree | e64cd31f88a40ed69ac1aadf02b7f7218570a22e /source3/rpc_client | |
parent | e23cfba7f946d33cd9391e84ac8f6447e36335d0 (diff) | |
download | samba-0bcc0c343f9ca1616026fb3ee7dae8bd9615ccf9.tar.gz samba-0bcc0c343f9ca1616026fb3ee7dae8bd9615ccf9.tar.bz2 samba-0bcc0c343f9ca1616026fb3ee7dae8bd9615ccf9.zip |
SAMR lookupdomain rpc client patches from amber palekar <amber@nu3.net>
(This used to be commit 67bc6bccc22e22e2a6e5cae7c57a1b2b53f49dfd)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_samr.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index c451ee2e42..9d0b48796c 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -1464,3 +1464,49 @@ NTSTATUS cli_samr_get_dom_pwinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx, return result; } + +/* Lookup Domain Name */ + +NTSTATUS cli_samr_lookup_domain(struct cli_state *cli, TALLOC_CTX *mem_ctx, + POLICY_HND *user_pol, char *domain_name, + DOM_SID *sid) +{ + prs_struct qbuf, rbuf; + SAMR_Q_LOOKUP_DOMAIN q; + SAMR_R_LOOKUP_DOMAIN r; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + 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_samr_q_lookup_domain(&q, user_pol, domain_name); + + if (!samr_io_q_lookup_domain("", &q, &qbuf, 0) || + !rpc_api_pipe_req(cli, SAMR_LOOKUP_DOMAIN, &qbuf, &rbuf)) + goto done; + + /* Unmarshall response */ + + if (!samr_io_r_lookup_domain("", &r, &rbuf, 0)) + goto done; + + /* Return output parameters */ + + result = r.status; + + if (NT_STATUS_IS_OK(result)) + sid_copy(sid, &r.dom_sid.sid); + + done: + prs_mem_free(&qbuf); + prs_mem_free(&rbuf); + + return result; +} |