summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-02-10 11:31:23 +0000
committerAndrew Tridgell <tridge@samba.org>2003-02-10 11:31:23 +0000
commit6c66e42d2ccf025f57e652f7ae689f8a3c2ada59 (patch)
tree56c892e5817256759b9470f7186fbb74c6601430 /source3/rpc_client
parentbaff308f169dc90449f55d207627135a44d14bbd (diff)
downloadsamba-6c66e42d2ccf025f57e652f7ae689f8a3c2ada59.tar.gz
samba-6c66e42d2ccf025f57e652f7ae689f8a3c2ada59.tar.bz2
samba-6c66e42d2ccf025f57e652f7ae689f8a3c2ada59.zip
added the 'lsaenumacctwithright' command to rpcclient. This allows you
to lookup what SIDs have a particular privilege (that is how privileges are stored). (This used to be commit 3ddb5fb0dd33992b7db54a661752551a3fefc0b4)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_lsarpc.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 3c7d0855f4..bb9f4e9384 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -1292,6 +1292,58 @@ done:
}
+/* list account SIDs that have the specified right */
+
+NTSTATUS cli_lsa_enum_account_with_right(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol, const char *right,
+ uint32 *count, DOM_SID **sids)
+{
+ prs_struct qbuf, rbuf;
+ LSA_Q_ENUM_ACCT_WITH_RIGHT q;
+ LSA_R_ENUM_ACCT_WITH_RIGHT r;
+ NTSTATUS result;
+
+ ZERO_STRUCT(q);
+
+ /* 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_enum_acct_with_right(&q, pol, right);
+
+ if (!lsa_io_q_enum_acct_with_right("", &q, &qbuf, 0) ||
+ !rpc_api_pipe_req(cli, LSA_ENUMACCTWITHRIGHT, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!lsa_io_r_enum_acct_with_right("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ *count = r.count;
+
+ if (!NT_STATUS_IS_OK(result = r.status)) {
+ goto done;
+ }
+
+ if (*count) {
+ int i;
+ (*sids) = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID) * (*count));
+ for (i=0; i<*count; i++) {
+ sid_copy(&(*sids)[i], &r.sids.sids[i].sid.sid);
+ }
+ }
+done:
+
+ return result;
+}
+
+
#if 0
/** An example of how to use the routines in this file. Fetch a DOMAIN