diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/rpc_lsa.h | 29 | ||||
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 75 | ||||
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 133 |
3 files changed, 0 insertions, 237 deletions
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index 5cdcd21251..95faf2266f 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -546,35 +546,6 @@ typedef struct lsa_r_lookup_names4 NTSTATUS status; /* return code */ } LSA_R_LOOKUP_NAMES4; -typedef struct lsa_enum_priv_entry -{ - UNIHDR hdr_name; - uint32 luid_low; - uint32 luid_high; - UNISTR2 name; - -} LSA_PRIV_ENTRY; - -/* LSA_Q_ENUM_PRIVS - LSA enum privileges */ -typedef struct lsa_q_enum_privs -{ - POLICY_HND pol; /* policy handle */ - uint32 enum_context; - uint32 pref_max_length; -} LSA_Q_ENUM_PRIVS; - -typedef struct lsa_r_enum_privs -{ - uint32 enum_context; - uint32 count; - uint32 ptr; - uint32 count1; - - LSA_PRIV_ENTRY *privs; - - NTSTATUS status; -} LSA_R_ENUM_PRIVS; - /* LSA_Q_ENUM_ACCT_RIGHTS - LSA enum account rights */ typedef struct { diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 150d55d1c3..82611d3668 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -550,81 +550,6 @@ NTSTATUS rpccli_lsa_enum_trust_dom(struct rpc_pipe_client *cli, return out.status; } -/** Enumerate privileges*/ - -NTSTATUS rpccli_lsa_enum_privilege(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *pol, uint32 *enum_context, uint32 pref_max_length, - uint32 *count, char ***privs_name, uint32 **privs_high, uint32 **privs_low) -{ - prs_struct qbuf, rbuf; - LSA_Q_ENUM_PRIVS q; - LSA_R_ENUM_PRIVS r; - NTSTATUS result; - int i; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - init_q_enum_privs(&q, pol, *enum_context, pref_max_length); - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_ENUM_PRIVS, - q, r, - qbuf, rbuf, - lsa_io_q_enum_privs, - lsa_io_r_enum_privs, - NT_STATUS_UNSUCCESSFUL); - - result = r.status; - - if (!NT_STATUS_IS_OK(result)) { - goto done; - } - - /* Return output parameters */ - - *enum_context = r.enum_context; - *count = r.count; - - if (r.count) { - if (!((*privs_name = TALLOC_ARRAY(mem_ctx, char *, r.count)))) { - DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - - if (!((*privs_high = TALLOC_ARRAY(mem_ctx, uint32, r.count)))) { - DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - - if (!((*privs_low = TALLOC_ARRAY(mem_ctx, uint32, r.count)))) { - DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - } else { - *privs_name = NULL; - *privs_high = NULL; - *privs_low = NULL; - } - - for (i = 0; i < r.count; i++) { - fstring name; - - rpcstr_pull_unistr2_fstring( name, &r.privs[i].name); - - (*privs_name)[i] = talloc_strdup(mem_ctx, name); - - (*privs_high)[i] = r.privs[i].luid_high; - (*privs_low)[i] = r.privs[i].luid_low; - } - - done: - - return result; -} - /** Get privilege name */ NTSTATUS rpccli_lsa_get_dispname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 5f22a28082..7e9f8b4393 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -1615,139 +1615,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru return True; } -/******************************************************************* - Inits an LSA_Q_ENUM_PRIVS structure. -********************************************************************/ - -void init_q_enum_privs(LSA_Q_ENUM_PRIVS *in, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length) -{ - DEBUG(5, ("init_q_enum_privs\n")); - - memcpy(&in->pol, hnd, sizeof(in->pol)); - - in->enum_context = enum_context; - in->pref_max_length = pref_max_length; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -bool lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth) -{ - if (in == NULL) - return False; - - prs_debug(ps, depth, desc, "lsa_io_q_enum_privs"); - depth++; - - if (!smb_io_pol_hnd("", &in->pol, ps, depth)) - return False; - - if(!prs_uint32("enum_context ", ps, depth, &in->enum_context)) - return False; - if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -static bool lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth) -{ - uint32 i; - - if (entries == NULL) - return False; - - prs_debug(ps, depth, desc, "lsa_io_priv_entries"); - depth++; - - if(!prs_align(ps)) - return False; - - for (i = 0; i < count; i++) { - if (!smb_io_unihdr("", &entries[i].hdr_name, ps, depth)) - return False; - if(!prs_uint32("luid_low ", ps, depth, &entries[i].luid_low)) - return False; - if(!prs_uint32("luid_high", ps, depth, &entries[i].luid_high)) - return False; - } - - for (i = 0; i < count; i++) - if (!smb_io_unistr2("", &entries[i].name, entries[i].hdr_name.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits an LSA_R_ENUM_PRIVS structure. -********************************************************************/ - -void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *out, uint32 enum_context, - uint32 count, LSA_PRIV_ENTRY *entries) -{ - DEBUG(5, ("init_lsa_r_enum_privs\n")); - - out->enum_context=enum_context; - out->count=count; - - if (entries!=NULL) { - out->ptr=1; - out->count1=count; - out->privs=entries; - } else { - out->ptr=0; - out->count1=0; - out->privs=NULL; - } -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -bool lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth) -{ - if (out == NULL) - return False; - - prs_debug(ps, depth, desc, "lsa_io_r_enum_privs"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("enum_context", ps, depth, &out->enum_context)) - return False; - if(!prs_uint32("count", ps, depth, &out->count)) - return False; - if(!prs_uint32("ptr", ps, depth, &out->ptr)) - return False; - - if (out->ptr) { - if(!prs_uint32("count1", ps, depth, &out->count1)) - return False; - - if (UNMARSHALLING(ps) && out->count1) - if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1))) - return False; - - if (!lsa_io_priv_entries("", out->privs, out->count1, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, const char *name, uint16 lang_id, uint16 lang_id_sys) { memcpy(&trn->pol, hnd, sizeof(trn->pol)); |