diff options
Diffstat (limited to 'source3/rpc_parse/parse_samr.c')
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 229 |
1 files changed, 0 insertions, 229 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 09804f14660..80f94988721 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -1257,235 +1257,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, } /******************************************************************* -inits a SAMR_Q_LOOKUP_NAMES structure. -********************************************************************/ - -NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u, - POLICY_HND *pol, uint32 flags, - uint32 num_names, const char **name) -{ - uint32 i; - - DEBUG(5, ("init_samr_q_lookup_names\n")); - - q_u->pol = *pol; - - q_u->num_names1 = num_names; - q_u->flags = flags; - q_u->ptr = 0; - q_u->num_names2 = num_names; - - if (num_names) { - if (!(q_u->hdr_name = TALLOC_ZERO_ARRAY(ctx, UNIHDR, num_names))) - return NT_STATUS_NO_MEMORY; - - if (!(q_u->uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_names))) - return NT_STATUS_NO_MEMORY; - } else { - q_u->hdr_name = NULL; - q_u->uni_name = NULL; - } - - for (i = 0; i < num_names; i++) { - init_unistr2(&q_u->uni_name[i], name[i], UNI_FLAGS_NONE); /* unicode string for machine account */ - init_uni_hdr(&q_u->hdr_name[i], &q_u->uni_name[i]); /* unicode header for user_name */ - } - - return NT_STATUS_OK; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_lookup_names(const char *desc, SAMR_Q_LOOKUP_NAMES * q_u, - prs_struct *ps, int depth) -{ - uint32 i; - - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_lookup_names"); - depth++; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(q_u); - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - - if(!prs_uint32("num_names1", ps, depth, &q_u->num_names1)) - return False; - if(!prs_uint32("flags ", ps, depth, &q_u->flags)) - return False; - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) - return False; - if(!prs_uint32("num_names2", ps, depth, &q_u->num_names2)) - return False; - - if (UNMARSHALLING(ps) && (q_u->num_names2 != 0)) { - q_u->hdr_name = PRS_ALLOC_MEM(ps, UNIHDR, q_u->num_names2); - q_u->uni_name = PRS_ALLOC_MEM(ps, UNISTR2, q_u->num_names2); - if (!q_u->hdr_name || !q_u->uni_name) - return False; - } - - for (i = 0; i < q_u->num_names2; i++) { - if(!smb_io_unihdr("", &q_u->hdr_name[i], ps, depth)) - return False; - } - - for (i = 0; i < q_u->num_names2; i++) { - if(!smb_io_unistr2("", &q_u->uni_name[i], q_u->hdr_name[i].buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* -inits a SAMR_R_LOOKUP_NAMES structure. -********************************************************************/ - -NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, - uint32 num_rids, - uint32 *rid, enum lsa_SidType *type, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_lookup_names\n")); - - if (NT_STATUS_IS_OK(status) && (num_rids != 0)) { - uint32 i; - - r_u->num_types1 = num_rids; - r_u->ptr_types = 1; - r_u->num_types2 = num_rids; - - r_u->num_rids1 = num_rids; - r_u->ptr_rids = 1; - r_u->num_rids2 = num_rids; - - if (!(r_u->rids = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids))) - return NT_STATUS_NO_MEMORY; - if (!(r_u->types = TALLOC_ZERO_ARRAY(ctx, uint32, num_rids))) - return NT_STATUS_NO_MEMORY; - - for (i = 0; i < num_rids; i++) { - r_u->rids[i] = rid[i]; - r_u->types[i] = type[i]; - } - } else { - - r_u->num_types1 = 0; - r_u->ptr_types = 0; - r_u->num_types2 = 0; - - r_u->num_rids1 = 0; - r_u->ptr_rids = 0; - r_u->num_rids2 = 0; - - r_u->rids = NULL; - r_u->types = NULL; - } - - r_u->status = status; - - return NT_STATUS_OK; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, - prs_struct *ps, int depth) -{ - uint32 i; - fstring tmp; - - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_lookup_names"); - depth++; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(r_u); - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_rids1", ps, depth, &r_u->num_rids1)) - return False; - if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids)) - return False; - - if (r_u->ptr_rids != 0) { - if(!prs_uint32("num_rids2", ps, depth, &r_u->num_rids2)) - return False; - - if (r_u->num_rids2 != r_u->num_rids1) { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps) && r_u->num_rids2) { - r_u->rids = PRS_ALLOC_MEM(ps, uint32, r_u->num_rids2); - - if (!r_u->rids) { - DEBUG(0, ("NULL rids in samr_io_r_lookup_names\n")); - return False; - } - } - - for (i = 0; i < r_u->num_rids2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "rid[%02d] ", i); - if(!prs_uint32(tmp, ps, depth, &r_u->rids[i])) - return False; - } - } - - if(!prs_uint32("num_types1", ps, depth, &r_u->num_types1)) - return False; - if(!prs_uint32("ptr_types ", ps, depth, &r_u->ptr_types)) - return False; - - if (r_u->ptr_types != 0) { - if(!prs_uint32("num_types2", ps, depth, &r_u->num_types2)) - return False; - - if (r_u->num_types2 != r_u->num_types1) { - /* RPC fault */ - return False; - } - - if (UNMARSHALLING(ps) && r_u->num_types2) { - r_u->types = PRS_ALLOC_MEM(ps, uint32, r_u->num_types2); - - if (!r_u->types) { - DEBUG(0, ("NULL types in samr_io_r_lookup_names\n")); - return False; - } - } - - for (i = 0; i < r_u->num_types2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "type[%02d] ", i); - if(!prs_uint32(tmp, ps, depth, &r_u->types[i])) - return False; - } - } - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ |