summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-01-29 02:24:12 +0000
committerJeremy Allison <jra@samba.org>2003-01-29 02:24:12 +0000
commit438b5c92d4b993efe9bc195851fcb52f49e919fc (patch)
tree0e7312c7daf47328f7b320b4d48d3b48861f992a /source3/rpc_client
parent734c6d8a513272c6e65ba60c62e21080c4339b8d (diff)
downloadsamba-438b5c92d4b993efe9bc195851fcb52f49e919fc.tar.gz
samba-438b5c92d4b993efe9bc195851fcb52f49e919fc.tar.bz2
samba-438b5c92d4b993efe9bc195851fcb52f49e919fc.zip
Merge tridge's client priv code from HEAD.
Jeremy (This used to be commit 49739be1e2f047fa2cc2fd42eadb190a82114485)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_lsarpc.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index d9d05299cb..84b5aa725a 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -1206,11 +1206,13 @@ done:
return result;
}
+
+
/* add account rights to an account. */
NTSTATUS cli_lsa_add_account_rights(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol, DOM_SID sid,
- uint32 count, const char **privs_name)
+ POLICY_HND *pol, DOM_SID sid,
+ uint32 count, const char **privs_name)
{
prs_struct qbuf, rbuf;
LSA_Q_ADD_ACCT_RIGHTS q;
@@ -1227,7 +1229,7 @@ NTSTATUS cli_lsa_add_account_rights(struct cli_state *cli, TALLOC_CTX *mem_ctx,
init_q_add_acct_rights(&q, pol, &sid, count, privs_name);
if (!lsa_io_q_add_acct_rights("", &q, &qbuf, 0) ||
- !rpc_api_pipe_req(cli, LSA_ADDACCTRIGHTS, &qbuf, &rbuf)) {
+ !rpc_api_pipe_req(cli, LSA_ADDACCTRIGHTS, &qbuf, &rbuf)) {
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
@@ -1239,14 +1241,57 @@ NTSTATUS cli_lsa_add_account_rights(struct cli_state *cli, TALLOC_CTX *mem_ctx,
goto done;
}
- if (!NT_STATUS_IS_OK(result = r.status))
+ if (!NT_STATUS_IS_OK(result = r.status)) {
+ goto done;
+ }
+done:
+
+ return result;
+}
+
+
+/* remove account rights for an account. */
+
+NTSTATUS cli_lsa_remove_account_rights(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol, DOM_SID sid, BOOL removeall,
+ uint32 count, const char **privs_name)
+{
+ prs_struct qbuf, rbuf;
+ LSA_Q_REMOVE_ACCT_RIGHTS q;
+ LSA_R_REMOVE_ACCT_RIGHTS 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_remove_acct_rights(&q, pol, &sid, removeall?1:0, count, privs_name);
+
+ if (!lsa_io_q_remove_acct_rights("", &q, &qbuf, 0) ||
+ !rpc_api_pipe_req(cli, LSA_REMOVEACCTRIGHTS, &qbuf, &rbuf)) {
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
+ }
+
+ /* Unmarshall response */
+
+ if (!lsa_io_r_remove_acct_rights("", &r, &rbuf, 0)) {
+ result = NT_STATUS_UNSUCCESSFUL;
goto done;
+ }
+ if (!NT_STATUS_IS_OK(result = r.status)) {
+ goto done;
+ }
done:
return result;
}
+
#if 0
/** An example of how to use the routines in this file. Fetch a DOMAIN