diff options
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 42 | ||||
-rw-r--r-- | source3/rpc_client/cli_samr.c | 990 |
2 files changed, 0 insertions, 1032 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 286cc210e2..7019e7f6f2 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -1151,48 +1151,6 @@ NTSTATUS rpccli_lsa_lookup_priv_value(struct rpc_pipe_client *cli, TALLOC_CTX *m return result; } -/** Query LSA security object */ - -NTSTATUS rpccli_lsa_query_secobj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 sec_info, - SEC_DESC_BUF **psdb) -{ - prs_struct qbuf, rbuf; - LSA_Q_QUERY_SEC_OBJ q; - LSA_R_QUERY_SEC_OBJ r; - NTSTATUS result; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_q_query_sec_obj(&q, pol, sec_info); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_QUERYSECOBJ, - q, r, - qbuf, rbuf, - lsa_io_q_query_sec_obj, - lsa_io_r_query_sec_obj, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - /* Return output parameters */ - - if (psdb) - *psdb = r.buf; - - done: - - return result; -} - - /* Enumerate account rights This is similar to enum_privileges but takes a SID directly, avoiding the open_account call. */ diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 2fb3768866..4765e529be 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -22,302 +22,6 @@ #include "includes.h" -/* Connect to SAMR database */ - -NTSTATUS rpccli_samr_connect(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint32 access_mask, POLICY_HND *connect_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_CONNECT q; - SAMR_R_CONNECT r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_connect to %s\n", cli->cli->desthost)); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_connect(&q, cli->cli->desthost, access_mask); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CONNECT, - q, r, - qbuf, rbuf, - samr_io_q_connect, - samr_io_r_connect, - NT_STATUS_UNSUCCESSFUL); - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *connect_pol = r.connect_pol; -#ifdef __INSURE__ - connect_pol->marker = malloc(1); -#endif - } - - return result; -} - -/* Connect to SAMR database */ - -NTSTATUS rpccli_samr_connect4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - uint32 access_mask, POLICY_HND *connect_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_CONNECT4 q; - SAMR_R_CONNECT4 r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_connect4(&q, cli->cli->desthost, access_mask); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CONNECT4, - q, r, - qbuf, rbuf, - samr_io_q_connect4, - samr_io_r_connect4, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *connect_pol = r.connect_pol; -#ifdef __INSURE__ - connect_pol->marker = malloc(1); -#endif - } - - return result; -} - -/* Open handle on a domain */ - -NTSTATUS rpccli_samr_open_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *connect_pol, uint32 access_mask, - const DOM_SID *domain_sid, - POLICY_HND *domain_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_OPEN_DOMAIN q; - SAMR_R_OPEN_DOMAIN r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_open_domain with sid %s\n", - sid_string_dbg(domain_sid) )); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_open_domain(&q, connect_pol, access_mask, domain_sid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_DOMAIN, - q, r, - qbuf, rbuf, - samr_io_q_open_domain, - samr_io_r_open_domain, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *domain_pol = r.domain_pol; -#ifdef __INSURE__ - domain_pol->marker = malloc(1); -#endif - } - - return result; -} - -NTSTATUS rpccli_samr_open_user(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, uint32 access_mask, - uint32 user_rid, POLICY_HND *user_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_OPEN_USER q; - SAMR_R_OPEN_USER r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_open_user with rid 0x%x\n", user_rid )); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_open_user(&q, domain_pol, access_mask, user_rid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_USER, - q, r, - qbuf, rbuf, - samr_io_q_open_user, - samr_io_r_open_user, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *user_pol = r.user_pol; -#ifdef __INSURE__ - user_pol->marker = malloc(1); -#endif - } - - return result; -} - -/* Open handle on a group */ - -NTSTATUS rpccli_samr_open_group(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, uint32 access_mask, - uint32 group_rid, POLICY_HND *group_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_OPEN_GROUP q; - SAMR_R_OPEN_GROUP r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_open_group with rid 0x%x\n", group_rid )); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_open_group(&q, domain_pol, access_mask, group_rid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_GROUP, - q, r, - qbuf, rbuf, - samr_io_q_open_group, - samr_io_r_open_group, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *group_pol = r.pol; -#ifdef __INSURE__ - group_pol->marker = malloc(1); -#endif - } - - return result; -} - -/* Create domain group */ - -NTSTATUS rpccli_samr_create_dom_group(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, - const char *group_name, - uint32 access_mask, POLICY_HND *group_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_CREATE_DOM_GROUP q; - SAMR_R_CREATE_DOM_GROUP r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_create_dom_group\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_create_dom_group(&q, domain_pol, group_name, access_mask); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CREATE_DOM_GROUP, - q, r, - qbuf, rbuf, - samr_io_q_create_dom_group, - samr_io_r_create_dom_group, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) - *group_pol = r.pol; - - return result; -} - -/* Add a domain group member */ - -NTSTATUS rpccli_samr_add_groupmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *group_pol, uint32 rid) -{ - prs_struct qbuf, rbuf; - SAMR_Q_ADD_GROUPMEM q; - SAMR_R_ADD_GROUPMEM r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_add_groupmem\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_add_groupmem(&q, group_pol, rid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_ADD_GROUPMEM, - q, r, - qbuf, rbuf, - samr_io_q_add_groupmem, - samr_io_r_add_groupmem, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - -/* Delete a domain group member */ - -NTSTATUS rpccli_samr_del_groupmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *group_pol, uint32 rid) -{ - prs_struct qbuf, rbuf; - SAMR_Q_DEL_GROUPMEM q; - SAMR_R_DEL_GROUPMEM r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_del_groupmem\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_del_groupmem(&q, group_pol, rid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DEL_GROUPMEM, - q, r, - qbuf, rbuf, - samr_io_q_del_groupmem, - samr_io_r_del_groupmem, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - /* Query user info */ NTSTATUS rpccli_samr_query_userinfo(struct rpc_pipe_client *cli, @@ -496,97 +200,6 @@ NTSTATUS rpccli_samr_set_aliasinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return result; } -/* Query user aliases */ - -NTSTATUS rpccli_samr_query_useraliases(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *dom_pol, uint32 num_sids, - DOM_SID2 *sid, - uint32 *num_aliases, uint32 **als_rids) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_USERALIASES q; - SAMR_R_QUERY_USERALIASES r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - int i; - uint32 *sid_ptrs; - - DEBUG(10,("cli_samr_query_useraliases\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - if (num_sids) { - sid_ptrs = TALLOC_ARRAY(mem_ctx, uint32, num_sids); - if (sid_ptrs == NULL) - return NT_STATUS_NO_MEMORY; - } else { - sid_ptrs = NULL; - } - - for (i=0; i<num_sids; i++) - sid_ptrs[i] = 1; - - /* Marshall data and send request */ - - init_samr_q_query_useraliases(&q, dom_pol, num_sids, sid_ptrs, sid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_USERALIASES, - q, r, - qbuf, rbuf, - samr_io_q_query_useraliases, - samr_io_r_query_useraliases, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *num_aliases = r.num_entries; - *als_rids = r.rid; - } - - return result; -} - -/* Query user groups */ - -NTSTATUS rpccli_samr_query_groupmem(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *group_pol, uint32 *num_mem, - uint32 **rid, uint32 **attr) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_GROUPMEM q; - SAMR_R_QUERY_GROUPMEM r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_query_groupmem\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_query_groupmem(&q, group_pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_GROUPMEM, - q, r, - qbuf, rbuf, - samr_io_q_query_groupmem, - samr_io_r_query_groupmem, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *num_mem = r.num_entries; - *rid = r.rid; - *attr = r.attr; - } - - return result; -} - /** * Enumerate domain users * @@ -814,200 +427,6 @@ NTSTATUS rpccli_samr_enum_als_groups(struct rpc_pipe_client *cli, return result; } -/* Query alias members */ - -NTSTATUS rpccli_samr_query_aliasmem(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *alias_pol, uint32 *num_mem, - DOM_SID **sids) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_ALIASMEM q; - SAMR_R_QUERY_ALIASMEM r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint32 i; - - DEBUG(10,("cli_samr_query_aliasmem\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_query_aliasmem(&q, alias_pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_ALIASMEM, - q, r, - qbuf, rbuf, - samr_io_q_query_aliasmem, - samr_io_r_query_aliasmem, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (!NT_STATUS_IS_OK(result = r.status)) { - goto done; - } - - *num_mem = r.num_sids; - - if (*num_mem == 0) { - *sids = NULL; - result = NT_STATUS_OK; - goto done; - } - - if (!(*sids = TALLOC_ARRAY(mem_ctx, DOM_SID, *num_mem))) { - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - - for (i = 0; i < *num_mem; i++) { - (*sids)[i] = r.sid[i].sid; - } - - done: - return result; -} - -/* Open handle on an alias */ - -NTSTATUS rpccli_samr_open_alias(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, uint32 access_mask, - uint32 alias_rid, POLICY_HND *alias_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_OPEN_ALIAS q; - SAMR_R_OPEN_ALIAS r; - NTSTATUS result; - - DEBUG(10,("cli_samr_open_alias with rid 0x%x\n", alias_rid)); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_open_alias(&q, domain_pol, access_mask, alias_rid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_OPEN_ALIAS, - q, r, - qbuf, rbuf, - samr_io_q_open_alias, - samr_io_r_open_alias, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *alias_pol = r.pol; -#ifdef __INSURE__ - alias_pol->marker = malloc(1); -#endif - } - - return result; -} - -/* Create an alias */ - -NTSTATUS rpccli_samr_create_dom_alias(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, const char *name, - POLICY_HND *alias_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_CREATE_DOM_ALIAS q; - SAMR_R_CREATE_DOM_ALIAS r; - NTSTATUS result; - - DEBUG(10,("cli_samr_create_dom_alias named %s\n", name)); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_create_dom_alias(&q, domain_pol, name); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CREATE_DOM_ALIAS, - q, r, - qbuf, rbuf, - samr_io_q_create_dom_alias, - samr_io_r_create_dom_alias, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { - *alias_pol = r.alias_pol; - } - - return result; -} - -/* Add an alias member */ - -NTSTATUS rpccli_samr_add_aliasmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *alias_pol, DOM_SID *member) -{ - prs_struct qbuf, rbuf; - SAMR_Q_ADD_ALIASMEM q; - SAMR_R_ADD_ALIASMEM r; - NTSTATUS result; - - DEBUG(10,("cli_samr_add_aliasmem")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_add_aliasmem(&q, alias_pol, member); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_ADD_ALIASMEM, - q, r, - qbuf, rbuf, - samr_io_q_add_aliasmem, - samr_io_r_add_aliasmem, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - return result; -} - -/* Delete an alias member */ - -NTSTATUS rpccli_samr_del_aliasmem(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *alias_pol, DOM_SID *member) -{ - prs_struct qbuf, rbuf; - SAMR_Q_DEL_ALIASMEM q; - SAMR_R_DEL_ALIASMEM r; - NTSTATUS result; - - DEBUG(10,("cli_samr_del_aliasmem")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_del_aliasmem(&q, alias_pol, member); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DEL_ALIASMEM, - q, r, - qbuf, rbuf, - samr_io_q_del_aliasmem, - samr_io_r_del_aliasmem, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - return result; -} - /* Query alias info */ NTSTATUS rpccli_samr_query_alias_info(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -1048,130 +467,6 @@ NTSTATUS rpccli_samr_query_alias_info(struct rpc_pipe_client *cli, TALLOC_CTX *m return result; } -/* Query domain info */ - -NTSTATUS rpccli_samr_query_dom_info(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, - uint16 switch_value, - SAM_UNK_CTR *ctr) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_DOMAIN_INFO q; - SAMR_R_QUERY_DOMAIN_INFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_query_dom_info\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_query_domain_info(&q, domain_pol, switch_value); - - r.ctr = ctr; - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_DOMAIN_INFO, - q, r, - qbuf, rbuf, - samr_io_q_query_domain_info, - samr_io_r_query_domain_info, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (!NT_STATUS_IS_OK(result = r.status)) { - goto done; - } - - done: - - return result; -} - -/* Query domain info2 */ - -NTSTATUS rpccli_samr_query_dom_info2(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, - uint16 switch_value, - SAM_UNK_CTR *ctr) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_DOMAIN_INFO2 q; - SAMR_R_QUERY_DOMAIN_INFO2 r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_query_dom_info2\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_query_domain_info2(&q, domain_pol, switch_value); - - r.ctr = ctr; - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_DOMAIN_INFO2, - q, r, - qbuf, rbuf, - samr_io_q_query_domain_info2, - samr_io_r_query_domain_info2, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (!NT_STATUS_IS_OK(result = r.status)) { - goto done; - } - - done: - - return result; -} - -/* Set domain info */ - -NTSTATUS rpccli_samr_set_domain_info(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, - uint16 switch_value, - SAM_UNK_CTR *ctr) -{ - prs_struct qbuf, rbuf; - SAMR_Q_SET_DOMAIN_INFO q; - SAMR_R_SET_DOMAIN_INFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_set_domain_info\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_set_domain_info(&q, domain_pol, switch_value, ctr); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_SET_DOMAIN_INFO, - q, r, - qbuf, rbuf, - samr_io_q_set_domain_info, - samr_io_r_set_domain_info, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (!NT_STATUS_IS_OK(result = r.status)) { - goto done; - } - - done: - - return result; -} - /* User change password */ NTSTATUS rpccli_samr_chgpasswd_user(struct rpc_pipe_client *cli, @@ -1601,51 +896,6 @@ NTSTATUS rpccli_samr_lookup_names(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return result; } -/* Create a domain user */ - -NTSTATUS rpccli_samr_create_dom_user(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, const char *acct_name, - uint32 acb_info, uint32 acct_flags, - POLICY_HND *user_pol, uint32 *rid) -{ - prs_struct qbuf, rbuf; - SAMR_Q_CREATE_USER q; - SAMR_R_CREATE_USER r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_create_dom_user %s\n", acct_name)); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_create_user(&q, domain_pol, acct_name, acb_info, acct_flags); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CREATE_USER, - q, r, - qbuf, rbuf, - samr_io_q_create_user, - samr_io_r_create_user, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (!NT_STATUS_IS_OK(result = r.status)) { - goto done; - } - - if (user_pol) - *user_pol = r.user_pol; - - if (rid) - *rid = r.user_rid; - - done: - - return result; -} - /* Set userinfo */ NTSTATUS rpccli_samr_set_userinfo(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -1739,243 +989,3 @@ NTSTATUS rpccli_samr_set_userinfo2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return result; } - -/* Delete domain group */ - -NTSTATUS rpccli_samr_delete_dom_group(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *group_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_DELETE_DOM_GROUP q; - SAMR_R_DELETE_DOM_GROUP r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_delete_dom_group\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_delete_dom_group(&q, group_pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DELETE_DOM_GROUP, - q, r, - qbuf, rbuf, - samr_io_q_delete_dom_group, - samr_io_r_delete_dom_group, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - -/* Delete domain alias */ - -NTSTATUS rpccli_samr_delete_dom_alias(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *alias_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_DELETE_DOM_ALIAS q; - SAMR_R_DELETE_DOM_ALIAS r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_delete_dom_alias\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_delete_dom_alias(&q, alias_pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DELETE_DOM_ALIAS, - q, r, - qbuf, rbuf, - samr_io_q_delete_dom_alias, - samr_io_r_delete_dom_alias, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - -/* Delete domain user */ - -NTSTATUS rpccli_samr_delete_dom_user(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_DELETE_DOM_USER q; - SAMR_R_DELETE_DOM_USER r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_delete_dom_user\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_delete_dom_user(&q, user_pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_DELETE_DOM_USER, - q, r, - qbuf, rbuf, - samr_io_q_delete_dom_user, - samr_io_r_delete_dom_user, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - -/* Remove foreign SID */ - -NTSTATUS rpccli_samr_remove_sid_foreign_domain(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol, - DOM_SID *sid) -{ - prs_struct qbuf, rbuf; - SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN q; - SAMR_R_REMOVE_SID_FOREIGN_DOMAIN r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_remove_sid_foreign_domain\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_remove_sid_foreign_domain(&q, user_pol, sid); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_REMOVE_SID_FOREIGN_DOMAIN, - q, r, - qbuf, rbuf, - samr_io_q_remove_sid_foreign_domain, - samr_io_r_remove_sid_foreign_domain, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - -/* Query user security object */ - -NTSTATUS rpccli_samr_query_sec_obj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol, uint32 sec_info, - TALLOC_CTX *ctx, SEC_DESC_BUF **sec_desc_buf) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_SEC_OBJ q; - SAMR_R_QUERY_SEC_OBJ r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_query_sec_obj\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_query_sec_obj(&q, user_pol, sec_info); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_SEC_OBJECT, - q, r, - qbuf, rbuf, - samr_io_q_query_sec_obj, - samr_io_r_query_sec_obj, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - *sec_desc_buf=dup_sec_desc_buf(ctx, r.buf); - - return result; -} - -/* Set user security object */ - -NTSTATUS rpccli_samr_set_sec_obj(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *user_pol, uint32 sec_info, - SEC_DESC_BUF *sec_desc_buf) -{ - prs_struct qbuf, rbuf; - SAMR_Q_SET_SEC_OBJ q; - SAMR_R_SET_SEC_OBJ r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_set_sec_obj\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_set_sec_obj(&q, user_pol, sec_info, sec_desc_buf); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_SET_SEC_OBJECT, - q, r, - qbuf, rbuf, - samr_io_q_set_sec_obj, - samr_io_r_set_sec_obj, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - return result; -} - -/* Lookup Domain Name */ - -NTSTATUS rpccli_samr_lookup_domain(struct rpc_pipe_client *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; - - DEBUG(10,("cli_samr_lookup_domain\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_lookup_domain(&q, user_pol, domain_name); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_LOOKUP_DOMAIN, - q, r, - qbuf, rbuf, - samr_io_q_lookup_domain, - samr_io_r_lookup_domain, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (NT_STATUS_IS_OK(result)) - sid_copy(sid, &r.dom_sid.sid); - - return result; -} |