From 351377a90e44d8011a697779d2e9e225427e5cbb Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 14 Jan 2008 15:47:42 +0100 Subject: Remove more redundant lsa parsing functions. Guenther (This used to be commit 99dd28da84c270f46535bd2ffa6bfef96d2e2eed) --- source3/rpc_parse/parse_lsa.c | 257 ------------------------------------------ 1 file changed, 257 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 4b087b7ca1..e4d5d15112 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -3636,263 +3636,6 @@ bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_stru return True; } -/******************************************************************* - Inits an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -void init_q_query_trusted_domain_info(LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q, - POLICY_HND *hnd, uint16 info_class) -{ - DEBUG(5, ("init_q_query_trusted_domain_info\n")); - - q->pol = *hnd; - q->info_class = info_class; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -bool lsa_io_q_query_trusted_domain_info(const char *desc, - LSA_Q_QUERY_TRUSTED_DOMAIN_INFO *q_q, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_trusted_domain_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_q->pol, ps, depth)) - return False; - - if(!prs_uint16("info_class", ps, depth, &q_q->info_class)) - return False; - - return True; -} - - -/******************************************************************* -********************************************************************/ - -static bool smb_io_lsa_data_buf_hdr(const char *desc, LSA_DATA_BUF_HDR *buf_hdr, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "smb_io_lsa_data_buf_hdr"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("length", ps, depth, &buf_hdr->length)) - return False; - - if(!prs_uint32("size", ps, depth, &buf_hdr->size)) - return False; - - if (!prs_uint32("data_ptr", ps, depth, &buf_hdr->data_ptr)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool smb_io_lsa_data_buf(const char *desc, LSA_DATA_BUF *buf, - prs_struct *ps, int depth, int length, int size) -{ - prs_debug(ps, depth, desc, "smb_io_lsa_data_buf"); - depth++; - - if ( UNMARSHALLING(ps) && length ) { - if ( !(buf->data = PRS_ALLOC_MEM( ps, uint8, length )) ) - return False; - } - - if (!prs_uint32("size", ps, depth, &buf->size)) - return False; - - if (!prs_uint32("offset", ps, depth, &buf->offset)) - return False; - - if (!prs_uint32("length", ps, depth, &buf->length)) - return False; - - if(!prs_uint8s(False, "data", ps, depth, buf->data, length)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_1(const char *desc, TRUSTED_DOMAIN_INFO_NAME *name, - prs_struct *ps, int depth) -{ - if (!smb_io_lsa_string("netbios_name", &name->netbios_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_3(const char *desc, TRUSTED_DOMAIN_INFO_POSIX_OFFSET *posix, - prs_struct *ps, int depth) -{ - if(!prs_uint32("posix_offset", ps, depth, &posix->posix_offset)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_4(const char *desc, TRUSTED_DOMAIN_INFO_PASSWORD *password, - prs_struct *ps, int depth) -{ - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_password", ps, depth, &password->ptr_password)) - return False; - - if(!prs_uint32("ptr_old_password", ps, depth, &password->ptr_old_password)) - return False; - - if (&password->ptr_password) { - - if (!smb_io_lsa_data_buf_hdr("password_hdr", &password->password_hdr, ps, depth)) - return False; - - if (!smb_io_lsa_data_buf("password", &password->password, ps, depth, - password->password_hdr.length, password->password_hdr.size)) - return False; - } - - if (&password->ptr_old_password) { - - if (!smb_io_lsa_data_buf_hdr("old_password_hdr", &password->old_password_hdr, ps, depth)) - return False; - - if (!smb_io_lsa_data_buf("old_password", &password->old_password, ps, depth, - password->old_password_hdr.length, password->old_password_hdr.size)) - return False; - } - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query_6(const char *desc, TRUSTED_DOMAIN_INFO_EX *info_ex, - prs_struct *ps, int depth) -{ - uint32 dom_sid_ptr; - - if (!smb_io_unihdr("domain_name_hdr", &info_ex->domain_name.hdr, ps, depth)) - return False; - - if (!smb_io_unihdr("netbios_name_hdr", &info_ex->netbios_name.hdr, ps, depth)) - return False; - - if (!prs_uint32("dom_sid_ptr", ps, depth, &dom_sid_ptr)) - return False; - - if (!prs_uint32("trust_direction", ps, depth, &info_ex->trust_direction)) - return False; - - if (!prs_uint32("trust_type", ps, depth, &info_ex->trust_type)) - return False; - - if (!prs_uint32("trust_attributes", ps, depth, &info_ex->trust_attributes)) - return False; - - if (!smb_io_unistr2("domain_name_unistring", &info_ex->domain_name.unistring, info_ex->domain_name.hdr.buffer, ps, depth)) - return False; - - if (!smb_io_unistr2("netbios_name_unistring", &info_ex->netbios_name.unistring, info_ex->netbios_name.hdr.buffer, ps, depth)) - return False; - - if (!smb_io_dom_sid2("sid", &info_ex->sid, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -static bool lsa_io_trustdom_query(const char *desc, prs_struct *ps, int depth, LSA_TRUSTED_DOMAIN_INFO *info) -{ - prs_debug(ps, depth, desc, "lsa_io_trustdom_query"); - depth++; - - if(!prs_uint16("info_class", ps, depth, &info->info_class)) - return False; - - if(!prs_align(ps)) - return False; - - switch (info->info_class) { - case 1: - if(!lsa_io_trustdom_query_1("name", &info->name, ps, depth)) - return False; - break; - case 3: - if(!lsa_io_trustdom_query_3("posix_offset", &info->posix_offset, ps, depth)) - return False; - break; - case 4: - if(!lsa_io_trustdom_query_4("password", &info->password, ps, depth)) - return False; - break; - case 6: - if(!lsa_io_trustdom_query_6("info_ex", &info->info_ex, ps, depth)) - return False; - break; - default: - DEBUG(0,("unsupported info-level: %d\n", info->info_class)); - return False; - } - - return True; -} - -/******************************************************************* - Reads or writes an LSA_R_QUERY_TRUSTED_DOMAIN_INFO structure. -********************************************************************/ - -bool lsa_io_r_query_trusted_domain_info(const char *desc, - LSA_R_QUERY_TRUSTED_DOMAIN_INFO *r_q, - prs_struct *ps, int depth) -{ - if (r_q == NULL) - return False; - - prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info"); - depth++; - - if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info, - sizeof(LSA_TRUSTED_DOMAIN_INFO), - (PRS_POINTER_CAST)lsa_io_trustdom_query) ) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_q->status)) - return False; - - return True; -} - /******************************************************************* Inits an LSA_Q_QUERY_DOM_INFO_POLICY structure. ********************************************************************/ -- cgit