diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_eventlog.c | 200 | ||||
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 91 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 2948 |
3 files changed, 77 insertions, 3162 deletions
diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 70226bca15..2ff217eb9e 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -25,154 +25,6 @@ /******************************************************************** ********************************************************************/ -bool prs_ev_open_unknown0( const char *desc, prs_struct *ps, int depth, EVENTLOG_OPEN_UNKNOWN0 *u ) -{ - if ( !u ) - return False; - - if ( !prs_uint16("", ps, depth, &u->unknown1) ) - return False; - if ( !prs_uint16("", ps, depth, &u->unknown2) ) - return False; - - return True; -} - -/******************************************************************** -********************************************************************/ - -bool eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u, - prs_struct *ps, int depth) -{ - if(q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_q_open_eventlog"); - depth++; - - if(!prs_align(ps)) - return False; - - if ( !prs_pointer("", ps, depth, (void*)&q_u->unknown0, sizeof(EVENTLOG_OPEN_UNKNOWN0), (PRS_POINTER_CAST)prs_ev_open_unknown0)) - return False; - - if ( !prs_unistr4("logname", ps, depth, &q_u->logname) ) - return False; - if ( !prs_align(ps) ) - return False; - - if ( !prs_unistr4("servername", ps, depth, &q_u->servername) ) - return False; - if ( !prs_align(ps) ) - return False; - - if ( !prs_uint32("unknown1", ps, depth, &q_u->unknown1) ) - return False; - if ( !prs_uint32("unknown2", ps, depth, &q_u->unknown2) ) - return False; - - return True; -} - -bool eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u, - prs_struct *ps, int depth) -{ - if(r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_r_open_eventlog"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth))) - return False; - - if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) - return False; - - return True; -} - -bool eventlog_io_q_get_num_records(const char *desc, EVENTLOG_Q_GET_NUM_RECORDS *q_u, - prs_struct *ps, int depth) -{ - if(q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_q_get_num_records"); - depth++; - - if(!(prs_align(ps))) - return False; - - if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth))) - return False; - - return True; -} - -bool eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS *r_u, - prs_struct *ps, int depth) -{ - if(r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_r_get_num_records"); - depth++; - - if(!(prs_align(ps))) - return False; - - if(!(prs_uint32("num records", ps, depth, &(r_u->num_records)))) - return False; - - if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) - return False; - - return True; -} - -bool eventlog_io_q_get_oldest_entry(const char *desc, EVENTLOG_Q_GET_OLDEST_ENTRY *q_u, - prs_struct *ps, int depth) -{ - if(q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_q_get_oldest_entry"); - depth++; - - if(!(prs_align(ps))) - return False; - - if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth))) - return False; - - return True; -} - -bool eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTRY *r_u, - prs_struct *ps, int depth) -{ - if(r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_r_get_oldest_entry"); - depth++; - - if(!(prs_align(ps))) - return False; - - if(!(prs_uint32("oldest entry", ps, depth, &(r_u->oldest_entry)))) - return False; - - if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) - return False; - - return True; -} - bool eventlog_io_q_read_eventlog(const char *desc, EVENTLOG_Q_READ_EVENTLOG *q_u, prs_struct *ps, int depth) { @@ -339,55 +191,3 @@ bool eventlog_io_r_read_eventlog(const char *desc, return True; } - -/** The windows client seems to be doing something funny with the file name - A call like - ClearEventLog(handle, "backup_file") - on the client side will result in the backup file name looking like this on the - server side: - \??\${CWD of client}\backup_file - If an absolute path gets specified, such as - ClearEventLog(handle, "C:\\temp\\backup_file") - then it is still mangled by the client into this: - \??\C:\temp\backup_file - when it is on the wire. - I'm not sure where the \?? is coming from, or why the ${CWD} of the client process - would be added in given that the backup file gets written on the server side. */ - -bool eventlog_io_q_clear_eventlog(const char *desc, EVENTLOG_Q_CLEAR_EVENTLOG *q_u, - prs_struct *ps, int depth) -{ - if(q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_q_clear_eventlog"); - depth++; - - if(!prs_align(ps)) - return False; - if(!(smb_io_pol_hnd("log handle", &(q_u->handle), ps, depth))) - return False; - - if ( !prs_unistr4("backupfile", ps, depth, &q_u->backupfile) ) - return False; - - return True; - -} - -bool eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r_u, - prs_struct *ps, int depth) -{ - if(r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "eventlog_io_r_clear_eventlog"); - depth++; - - if(!prs_align(ps)) - return False; - if(!(prs_ntstatus("status code", ps, depth, &r_u->status))) - return False; - - return True; -} diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index 1bddfba28e..daf4806392 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -419,66 +419,6 @@ bool lsa_io_r_open_pol2(const char *desc, LSA_R_OPEN_POL2 *out, prs_struct *ps, } /******************************************************************* -makes an LSA_Q_QUERY_SEC_OBJ structure. -********************************************************************/ - -void init_q_query_sec_obj(LSA_Q_QUERY_SEC_OBJ *in, const POLICY_HND *hnd, - uint32 sec_info) -{ - DEBUG(5, ("init_q_query_sec_obj\n")); - - in->pol = *hnd; - in->sec_info = sec_info; - - return; -} - -/******************************************************************* - Reads or writes an LSA_Q_QUERY_SEC_OBJ structure. -********************************************************************/ - -bool lsa_io_q_query_sec_obj(const char *desc, LSA_Q_QUERY_SEC_OBJ *in, - prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_query_sec_obj"); - depth++; - - if (!smb_io_pol_hnd("", &in->pol, ps, depth)) - return False; - - if (!prs_uint32("sec_info", ps, depth, &in->sec_info)) - return False; - - return True; -} - -/******************************************************************* - Reads or writes a LSA_R_QUERY_SEC_OBJ structure. -********************************************************************/ - -bool lsa_io_r_query_sec_obj(const char *desc, LSA_R_QUERY_SEC_OBJ *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_query_sec_obj"); - depth++; - - if (!prs_align(ps)) - return False; - - if (!prs_uint32("ptr", ps, depth, &out->ptr)) - return False; - - if (out->ptr != 0) { - if (!sec_io_desc_buf("sec", &out->buf, ps, depth)) - return False; - } - - if (!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} - -/******************************************************************* Inits an LSA_Q_QUERY_INFO structure. ********************************************************************/ @@ -3266,34 +3206,3 @@ bool lsa_io_r_remove_acct_rights(const char *desc, LSA_R_REMOVE_ACCT_RIGHTS *out return True; } - -/******************************************************************* -********************************************************************/ - -bool lsa_io_q_delete_object(const char *desc, LSA_Q_DELETE_OBJECT *in, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_q_delete_object"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("", &in->handle, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -********************************************************************/ - -bool lsa_io_r_delete_object(const char *desc, LSA_R_DELETE_OBJECT *out, prs_struct *ps, int depth) -{ - prs_debug(ps, depth, desc, "lsa_io_r_delete_object"); - depth++; - - if(!prs_ntstatus("status", ps, depth, &out->status)) - return False; - - return True; -} diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 37f9ba05d6..1c2cf57b89 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -29,414 +29,146 @@ #define DBGC_CLASS DBGC_RPC_PARSE /******************************************************************* -inits a SAMR_Q_LOOKUP_DOMAIN structure. + inits a structure. ********************************************************************/ -void init_samr_q_lookup_domain(SAMR_Q_LOOKUP_DOMAIN * q_u, - POLICY_HND *pol, char *dom_name) +static void init_lsa_String(struct lsa_String *name, const char *s) { - DEBUG(5, ("init_samr_q_lookup_domain\n")); - - q_u->connect_pol = *pol; - - init_unistr2(&q_u->uni_domain, dom_name, UNI_FLAGS_NONE); - init_uni_hdr(&q_u->hdr_domain, &q_u->uni_domain); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ -bool samr_io_q_lookup_domain(const char *desc, SAMR_Q_LOOKUP_DOMAIN * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_lookup_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("connect_pol", &q_u->connect_pol, ps, depth)) - return False; - - if(!smb_io_unihdr("hdr_domain", &q_u->hdr_domain, ps, depth)) - return False; - - if(!smb_io_unistr2("uni_domain", &q_u->uni_domain, q_u->hdr_domain.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_LOOKUP_DOMAIN structure. -********************************************************************/ - -void init_samr_r_lookup_domain(SAMR_R_LOOKUP_DOMAIN * r_u, - DOM_SID *dom_sid, NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_lookup_domain\n")); - - r_u->status = status; - r_u->ptr_sid = 0; - if (NT_STATUS_IS_OK(status)) { - r_u->ptr_sid = 1; - init_dom_sid2(&r_u->dom_sid, dom_sid); - } -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_lookup_domain(const char *desc, SAMR_R_LOOKUP_DOMAIN * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_lookup_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr", ps, depth, &r_u->ptr_sid)) - return False; - - if (r_u->ptr_sid != 0) { - if(!smb_io_dom_sid2("sid", &r_u->dom_sid, ps, depth)) - return False; - if(!prs_align(ps)) - return False; - } - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_remove_sid_foreign_domain(SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, POLICY_HND *dom_pol, DOM_SID *sid) -{ - DEBUG(5, ("samr_init_samr_q_remove_sid_foreign_domain\n")); - - q_u->dom_pol = *dom_pol; - init_dom_sid2(&q_u->sid, sid); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_remove_sid_foreign_domain(const char *desc, SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_remove_sid_foreign_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth)) - return False; - - if(!smb_io_dom_sid2("sid", &q_u->sid, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_remove_sid_foreign_domain(const char *desc, SAMR_R_REMOVE_SID_FOREIGN_DOMAIN * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_remove_sid_foreign_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_open_domain(SAMR_Q_OPEN_DOMAIN * q_u, - POLICY_HND *pol, uint32 flags, - const DOM_SID *sid) -{ - DEBUG(5, ("samr_init_samr_q_open_domain\n")); - - q_u->pol = *pol; - q_u->flags = flags; - init_dom_sid2(&q_u->dom_sid, sid); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_open_domain(const char *desc, SAMR_Q_OPEN_DOMAIN * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_open_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - - if(!prs_uint32("flags", ps, depth, &q_u->flags)) - return False; - - if(!smb_io_dom_sid2("sid", &q_u->dom_sid, ps, depth)) - return False; - - return True; + name->string = s; } /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -bool samr_io_r_open_domain(const char *desc, SAMR_R_OPEN_DOMAIN * r_u, - prs_struct *ps, int depth) +void init_samr_DomInfo1(struct samr_DomInfo1 *r, + uint16_t min_password_length, + uint16_t password_history_length, + uint32_t password_properties, + int64_t max_password_age, + int64_t min_password_age) { - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_open_domain"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &r_u->domain_pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; + r->min_password_length = min_password_length; + r->password_history_length = password_history_length; + r->password_properties = password_properties; + r->max_password_age = max_password_age; + r->min_password_age = min_password_age; } /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -void init_samr_q_get_usrdom_pwinfo(SAMR_Q_GET_USRDOM_PWINFO * q_u, - POLICY_HND *user_pol) +void init_samr_DomInfo2(struct samr_DomInfo2 *r, + NTTIME force_logoff_time, + const char *comment, + const char *domain_name, + const char *primary, + uint64_t sequence_num, + uint32_t unknown2, + enum samr_Role role, + uint32_t unknown3, + uint32_t num_users, + uint32_t num_groups, + uint32_t num_aliases) { - DEBUG(5, ("samr_init_samr_q_get_usrdom_pwinfo\n")); - - q_u->user_pol = *user_pol; + r->force_logoff_time = force_logoff_time; + init_lsa_String(&r->comment, comment); + init_lsa_String(&r->domain_name, domain_name); + init_lsa_String(&r->primary, primary); + r->sequence_num = sequence_num; + r->unknown2 = unknown2; + r->role = role; + r->unknown3 = unknown3; + r->num_users = num_users; + r->num_groups = num_groups; + r->num_aliases = num_aliases; } /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -bool samr_io_q_get_usrdom_pwinfo(const char *desc, SAMR_Q_GET_USRDOM_PWINFO * q_u, - prs_struct *ps, int depth) +void init_samr_DomInfo3(struct samr_DomInfo3 *r, + NTTIME force_logoff_time) { - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_get_usrdom_pwinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - return smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth); + r->force_logoff_time = force_logoff_time; } /******************************************************************* - Init. + inits a structure. ********************************************************************/ -void init_samr_r_get_usrdom_pwinfo(SAMR_R_GET_USRDOM_PWINFO *r_u, NTSTATUS status) +void init_samr_DomInfo4(struct samr_DomInfo4 *r, + const char *comment) { - DEBUG(5, ("init_samr_r_get_usrdom_pwinfo\n")); - - r_u->min_pwd_length = 0x0000; - - /* - * used to be - * r_u->unknown_1 = 0x0015; - * but for trusts. - */ - r_u->unknown_1 = 0x01D1; - r_u->unknown_1 = 0x0015; - - r_u->password_properties = 0x00000000; - - r_u->status = status; + init_lsa_String(&r->comment, comment); } /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -bool samr_io_r_get_usrdom_pwinfo(const char *desc, SAMR_R_GET_USRDOM_PWINFO * r_u, - prs_struct *ps, int depth) +void init_samr_DomInfo5(struct samr_DomInfo5 *r, + const char *domain_name) { - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_get_usrdom_pwinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length)) - return False; - if(!prs_uint16("unknown_1", ps, depth, &r_u->unknown_1)) - return False; - if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties)) - return False; - - if(!prs_ntstatus("status ", ps, depth, &r_u->status)) - return False; - - return True; + init_lsa_String(&r->domain_name, domain_name); } - /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -bool samr_io_q_set_sec_obj(const char *desc, SAMR_Q_SET_SEC_OBJ * q_u, - prs_struct *ps, int depth) +void init_samr_DomInfo6(struct samr_DomInfo6 *r, + const char *primary) { - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_set_sec_obj"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - - if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) - return False; - - if(!sec_io_desc_buf("sec_desc", &q_u->buf, ps, depth)) - return False; - - return True; + init_lsa_String(&r->primary, primary); } - /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -void init_samr_q_query_sec_obj(SAMR_Q_QUERY_SEC_OBJ * q_u, - POLICY_HND *user_pol, uint32 sec_info) +void init_samr_DomInfo7(struct samr_DomInfo7 *r, + enum samr_Role role) { - DEBUG(5, ("samr_init_samr_q_query_sec_obj\n")); - - q_u->user_pol = *user_pol; - q_u->sec_info = sec_info; + r->role = role; } - /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -bool samr_io_q_query_sec_obj(const char *desc, SAMR_Q_QUERY_SEC_OBJ * q_u, - prs_struct *ps, int depth) +void init_samr_DomInfo8(struct samr_DomInfo8 *r, + uint64_t sequence_num, + NTTIME domain_create_time) { - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_sec_obj"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) - return False; - - if(!prs_uint32("sec_info", ps, depth, &q_u->sec_info)) - return False; - - return True; + r->sequence_num = sequence_num; + r->domain_create_time = domain_create_time; } /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -void init_samr_q_query_domain_info(SAMR_Q_QUERY_DOMAIN_INFO * q_u, - POLICY_HND *domain_pol, uint16 switch_value) +void init_samr_DomInfo9(struct samr_DomInfo9 *r, + uint32_t unknown) { - DEBUG(5, ("samr_init_samr_q_query_domain_info\n")); - - q_u->domain_pol = *domain_pol; - q_u->switch_value = switch_value; + r->unknown = unknown; } /******************************************************************* -reads or writes a structure. + inits a structure. ********************************************************************/ -bool samr_io_q_query_domain_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, - prs_struct *ps, int depth) +void init_samr_DomInfo12(struct samr_DomInfo12 *r, + uint64_t lockout_duration, + uint64_t lockout_window, + uint16_t lockout_threshold) { - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_domain_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) - return False; - - return True; + r->lockout_duration = lockout_duration; + r->lockout_window = lockout_window; + r->lockout_threshold = lockout_threshold; } /******************************************************************* @@ -490,546 +222,6 @@ static bool sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, } /******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info2(SAM_UNK_INFO_2 * u_2, - const char *comment, const char *domain, const char *server, - uint32 seq_num, uint32 num_users, uint32 num_groups, uint32 num_alias, NTTIME nt_logout, uint32 server_role) -{ - u_2->logout = nt_logout; - - u_2->seq_num = seq_num; - - - u_2->unknown_4 = 0x00000001; - u_2->server_role = server_role; - u_2->unknown_6 = 0x00000001; - u_2->num_domain_usrs = num_users; - u_2->num_domain_grps = num_groups; - u_2->num_local_grps = num_alias; - - init_unistr2(&u_2->uni_comment, comment, UNI_FLAGS_NONE); - init_uni_hdr(&u_2->hdr_comment, &u_2->uni_comment); - init_unistr2(&u_2->uni_domain, domain, UNI_FLAGS_NONE); - init_uni_hdr(&u_2->hdr_domain, &u_2->uni_domain); - init_unistr2(&u_2->uni_server, server, UNI_FLAGS_NONE); - init_uni_hdr(&u_2->hdr_server, &u_2->uni_server); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, - prs_struct *ps, int depth) -{ - if (u_2 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info2"); - depth++; - - if(!smb_io_time("logout", &u_2->logout, ps, depth)) - return False; - if(!smb_io_unihdr("hdr_comment", &u_2->hdr_comment, ps, depth)) - return False; - if(!smb_io_unihdr("hdr_domain", &u_2->hdr_domain, ps, depth)) - return False; - if(!smb_io_unihdr("hdr_server", &u_2->hdr_server, ps, depth)) - return False; - - /* put all the data in here, at the moment, including what the above - pointer is referring to - */ - - if(!prs_uint64("seq_num ", ps, depth, &u_2->seq_num)) - return False; - - if(!prs_uint32("unknown_4 ", ps, depth, &u_2->unknown_4)) /* 0x0000 0001 */ - return False; - if(!prs_uint32("server_role ", ps, depth, &u_2->server_role)) - return False; - if(!prs_uint32("unknown_6 ", ps, depth, &u_2->unknown_6)) /* 0x0000 0001 */ - return False; - if(!prs_uint32("num_domain_usrs ", ps, depth, &u_2->num_domain_usrs)) - return False; - if(!prs_uint32("num_domain_grps", ps, depth, &u_2->num_domain_grps)) - return False; - if(!prs_uint32("num_local_grps", ps, depth, &u_2->num_local_grps)) - return False; - - if(!smb_io_unistr2("uni_comment", &u_2->uni_comment, u_2->hdr_comment.buffer, ps, depth)) - return False; - if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) - return False; - if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) -{ - u_3->logout = nt_logout; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, - prs_struct *ps, int depth) -{ - if (u_3 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info3"); - depth++; - - if(!smb_io_time("logout", &u_3->logout, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment) -{ - init_unistr2(&u_4->uni_comment, comment, UNI_FLAGS_NONE); - init_uni_hdr(&u_4->hdr_comment, &u_4->uni_comment); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, - prs_struct *ps, int depth) -{ - if (u_4 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info4"); - depth++; - - if(!smb_io_unihdr("hdr_comment", &u_4->hdr_comment, ps, depth)) - return False; - - if(!smb_io_unistr2("uni_comment", &u_4->uni_comment, u_4->hdr_comment.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) -{ - init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE); - init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, - prs_struct *ps, int depth) -{ - if (u_5 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info5"); - depth++; - - if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth)) - return False; - - if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) -{ - init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE); - init_uni_hdr(&u_6->hdr_server, &u_6->uni_server); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, - prs_struct *ps, int depth) -{ - if (u_6 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info6"); - depth++; - - if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, depth)) - return False; - - if(!smb_io_unistr2("uni_server", &u_6->uni_server, u_6->hdr_server.buffer, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) -{ - u_7->server_role = server_role; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, - prs_struct *ps, int depth) -{ - if (u_7 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info7"); - depth++; - - if(!prs_uint16("server_role", ps, depth, &u_7->server_role)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num) -{ - unix_to_nt_time(&u_8->domain_create_time, 0); - u_8->seq_num = seq_num; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, - prs_struct *ps, int depth) -{ - if (u_8 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info8"); - depth++; - - if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num)) - return False; - - if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown) -{ - u_9->unknown = unknown; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, - prs_struct *ps, int depth) -{ - if (u_9 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info9"); - depth++; - - if (!prs_uint32("unknown", ps, depth, &u_9->unknown)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout) -{ - u_12->duration = nt_lock_duration; - u_12->reset_count = nt_reset_time; - - u_12->bad_attempt_lockout = lockout; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, - prs_struct *ps, int depth) -{ - if (u_12 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info12"); - depth++; - - if(!smb_io_time("duration", &u_12->duration, ps, depth)) - return False; - if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth)) - return False; - if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout)) - return False; - - return True; -} - -/******************************************************************* -inits a structure. -********************************************************************/ - -void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num) -{ - unix_to_nt_time(&u_13->domain_create_time, 0); - u_13->seq_num = seq_num; - u_13->unknown1 = 0; - u_13->unknown2 = 0; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, - prs_struct *ps, int depth) -{ - if (u_13 == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_unk_info13"); - depth++; - - if (!prs_uint64("seq_num", ps, depth, &u_13->seq_num)) - return False; - - if(!smb_io_time("domain_create_time", &u_13->domain_create_time, ps, depth)) - return False; - - if (!prs_uint32("unknown1", ps, depth, &u_13->unknown1)) - return False; - if (!prs_uint32("unknown2", ps, depth, &u_13->unknown2)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_DOMAIN_INFO structure. -********************************************************************/ - -void init_samr_r_query_domain_info(SAMR_R_QUERY_DOMAIN_INFO * r_u, - uint16 switch_value, SAM_UNK_CTR * ctr, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_query_domain_info\n")); - - r_u->ptr_0 = 0; - r_u->switch_value = 0; - r_u->status = status; /* return status */ - - if (NT_STATUS_IS_OK(status)) { - r_u->switch_value = switch_value; - r_u->ptr_0 = 1; - r_u->ctr = ctr; - } -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_query_domain_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_domain_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) - return False; - - if (r_u->ptr_0 != 0 && r_u->ctr != NULL) { - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; - - switch (r_u->switch_value) { - case 0x0d: - if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth)) - return False; - break; - case 0x0c: - if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth)) - return False; - break; - case 0x09: - if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth)) - return False; - break; - case 0x08: - if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth)) - return False; - break; - case 0x07: - if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth)) - return False; - break; - case 0x06: - if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth)) - return False; - break; - case 0x05: - if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth)) - return False; - break; - case 0x04: - if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth)) - return False; - break; - case 0x03: - if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth)) - return False; - break; - case 0x02: - if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth)) - return False; - break; - case 0x01: - if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth)) - return False; - break; - default: - DEBUG(0, ("samr_io_r_query_domain_info: unknown switch level 0x%x\n", - r_u->switch_value)); - r_u->status = NT_STATUS_INVALID_INFO_CLASS; - return False; - } - } - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_set_sec_obj(SAMR_Q_SET_SEC_OBJ * q_u, - POLICY_HND *pol, uint32 sec_info, SEC_DESC_BUF *buf) -{ - DEBUG(5, ("samr_init_samr_q_set_sec_obj\n")); - - q_u->pol = *pol; - q_u->sec_info = sec_info; - q_u->buf = buf; -} - - -/******************************************************************* -reads or writes a SAMR_R_SET_SEC_OBJ structure. -********************************************************************/ - -bool samr_io_r_set_sec_obj(const char *desc, SAMR_R_SET_SEC_OBJ * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_set_sec_obj"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a SAMR_R_QUERY_SEC_OBJ structure. -********************************************************************/ - -bool samr_io_r_query_sec_obj(const char *desc, SAMR_R_QUERY_SEC_OBJ * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_sec_obj"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) - return False; - if (r_u->ptr != 0) { - if(!sec_io_desc_buf("sec", &r_u->buf, ps, depth)) - return False; - } - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* reads or writes a SAM_STR1 structure. ********************************************************************/ @@ -2117,73 +1309,6 @@ bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, } /******************************************************************* -inits a SAMR_Q_OPEN_GROUP structure. -********************************************************************/ - -void init_samr_q_open_group(SAMR_Q_OPEN_GROUP * q_c, - POLICY_HND *hnd, - uint32 access_mask, uint32 rid) -{ - DEBUG(5, ("init_samr_q_open_group\n")); - - q_c->domain_pol = *hnd; - q_c->access_mask = access_mask; - q_c->rid_group = rid; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_open_group(const char *desc, SAMR_Q_OPEN_GROUP * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_open_group"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - if(!prs_uint32("rid_group", ps, depth, &q_u->rid_group)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_open_group(const char *desc, SAMR_R_OPEN_GROUP * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_open_group"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a GROUP_INFO1 structure. ********************************************************************/ @@ -2463,290 +1588,6 @@ static bool samr_group_info_ctr(const char *desc, GROUP_INFO_CTR **ctr, } /******************************************************************* -inits a SAMR_Q_CREATE_DOM_GROUP structure. -********************************************************************/ - -void init_samr_q_create_dom_group(SAMR_Q_CREATE_DOM_GROUP * q_e, - POLICY_HND *pol, const char *acct_desc, - uint32 access_mask) -{ - DEBUG(5, ("init_samr_q_create_dom_group\n")); - - q_e->pol = *pol; - - init_unistr2(&q_e->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); - init_uni_hdr(&q_e->hdr_acct_desc, &q_e->uni_acct_desc); - - q_e->access_mask = access_mask; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_create_dom_group(const char *desc, SAMR_Q_CREATE_DOM_GROUP * q_e, - prs_struct *ps, int depth) -{ - if (q_e == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_create_dom_group"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - - if(!smb_io_unihdr("hdr_acct_desc", &q_e->hdr_acct_desc, ps, depth)) - return False; - if(!smb_io_unistr2("uni_acct_desc", &q_e->uni_acct_desc, - q_e->hdr_acct_desc.buffer, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("access", ps, depth, &q_e->access_mask)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_create_dom_group(const char *desc, SAMR_R_CREATE_DOM_GROUP * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_create_dom_group"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - - if(!prs_uint32("rid ", ps, depth, &r_u->rid)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_DELETE_DOM_GROUP structure. -********************************************************************/ - -void init_samr_q_delete_dom_group(SAMR_Q_DELETE_DOM_GROUP * q_c, - POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_delete_dom_group\n")); - - q_c->group_pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_delete_dom_group(const char *desc, SAMR_Q_DELETE_DOM_GROUP * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_delete_dom_group"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_delete_dom_group(const char *desc, SAMR_R_DELETE_DOM_GROUP * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_delete_dom_group"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_DEL_GROUPMEM structure. -********************************************************************/ - -void init_samr_q_del_groupmem(SAMR_Q_DEL_GROUPMEM * q_e, - POLICY_HND *pol, uint32 rid) -{ - DEBUG(5, ("init_samr_q_del_groupmem\n")); - - q_e->pol = *pol; - q_e->rid = rid; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_del_groupmem(const char *desc, SAMR_Q_DEL_GROUPMEM * q_e, - prs_struct *ps, int depth) -{ - if (q_e == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_del_groupmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - - if(!prs_uint32("rid", ps, depth, &q_e->rid)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_DEL_GROUPMEM structure. -********************************************************************/ - -void init_samr_r_del_groupmem(SAMR_R_DEL_GROUPMEM * r_u, POLICY_HND *pol, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_del_groupmem\n")); - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_del_groupmem(const char *desc, SAMR_R_DEL_GROUPMEM * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_del_groupmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_ADD_GROUPMEM structure. -********************************************************************/ - -void init_samr_q_add_groupmem(SAMR_Q_ADD_GROUPMEM * q_e, - POLICY_HND *pol, uint32 rid) -{ - DEBUG(5, ("init_samr_q_add_groupmem\n")); - - q_e->pol = *pol; - q_e->rid = rid; - q_e->unknown = 0x0005; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_add_groupmem(const char *desc, SAMR_Q_ADD_GROUPMEM * q_e, - prs_struct *ps, int depth) -{ - if (q_e == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_add_groupmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_e->pol, ps, depth)) - return False; - - if(!prs_uint32("rid ", ps, depth, &q_e->rid)) - return False; - if(!prs_uint32("unknown", ps, depth, &q_e->unknown)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_ADD_GROUPMEM structure. -********************************************************************/ - -void init_samr_r_add_groupmem(SAMR_R_ADD_GROUPMEM * r_u, POLICY_HND *pol, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_add_groupmem\n")); - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_add_groupmem(const char *desc, SAMR_R_ADD_GROUPMEM * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_add_groupmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a SAMR_Q_SET_GROUPINFO structure. ********************************************************************/ @@ -2903,139 +1744,6 @@ bool samr_io_r_query_groupinfo(const char *desc, SAMR_R_QUERY_GROUPINFO * r_u, } /******************************************************************* -inits a SAMR_Q_QUERY_GROUPMEM structure. -********************************************************************/ - -void init_samr_q_query_groupmem(SAMR_Q_QUERY_GROUPMEM * q_c, POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_query_groupmem\n")); - - q_c->group_pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_query_groupmem(const char *desc, SAMR_Q_QUERY_GROUPMEM * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_groupmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("group_pol", &q_u->group_pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_GROUPMEM structure. -********************************************************************/ - -void init_samr_r_query_groupmem(SAMR_R_QUERY_GROUPMEM * r_u, - uint32 num_entries, uint32 *rid, - uint32 *attr, NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_query_groupmem\n")); - - if (NT_STATUS_IS_OK(status)) { - r_u->ptr = 1; - r_u->num_entries = num_entries; - - r_u->ptr_attrs = attr != NULL ? 1 : 0; - r_u->ptr_rids = rid != NULL ? 1 : 0; - - r_u->num_rids = num_entries; - r_u->rid = rid; - - r_u->num_attrs = num_entries; - r_u->attr = attr; - } else { - r_u->ptr = 0; - r_u->num_entries = 0; - } - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_query_groupmem(const char *desc, SAMR_R_QUERY_GROUPMEM * r_u, - prs_struct *ps, int depth) -{ - uint32 i; - - if (r_u == NULL) - return False; - - if (UNMARSHALLING(ps)) - ZERO_STRUCTP(r_u); - - prs_debug(ps, depth, desc, "samr_io_r_query_groupmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) - return False; - if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries)) - return False; - - if (r_u->ptr != 0) { - if(!prs_uint32("ptr_rids ", ps, depth, &r_u->ptr_rids)) - return False; - if(!prs_uint32("ptr_attrs", ps, depth, &r_u->ptr_attrs)) - return False; - - if (r_u->ptr_rids != 0) { - if(!prs_uint32("num_rids", ps, depth, &r_u->num_rids)) - return False; - if (UNMARSHALLING(ps) && r_u->num_rids != 0) { - r_u->rid = PRS_ALLOC_MEM(ps,uint32,r_u->num_rids); - if (r_u->rid == NULL) - return False; - } - - for (i = 0; i < r_u->num_rids; i++) { - if(!prs_uint32("", ps, depth, &r_u->rid[i])) - return False; - } - } - - if (r_u->ptr_attrs != 0) { - if(!prs_uint32("num_attrs", ps, depth, &r_u->num_attrs)) - return False; - - if (UNMARSHALLING(ps) && r_u->num_attrs != 0) { - r_u->attr = PRS_ALLOC_MEM(ps,uint32,r_u->num_attrs); - if (r_u->attr == NULL) - return False; - } - - for (i = 0; i < r_u->num_attrs; i++) { - if(!prs_uint32("", ps, depth, &r_u->attr[i])) - return False; - } - } - } - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a SAMR_Q_QUERY_USERGROUPS structure. ********************************************************************/ @@ -3859,251 +2567,6 @@ bool samr_io_r_set_aliasinfo(const char *desc, SAMR_R_SET_ALIASINFO * r_u, } /******************************************************************* -inits a SAMR_Q_QUERY_USERALIASES structure. -********************************************************************/ - -void init_samr_q_query_useraliases(SAMR_Q_QUERY_USERALIASES * q_u, - POLICY_HND *hnd, - uint32 num_sids, - uint32 *ptr_sid, DOM_SID2 * sid) -{ - DEBUG(5, ("init_samr_q_query_useraliases\n")); - - q_u->pol = *hnd; - - q_u->num_sids1 = num_sids; - q_u->ptr = 1; - q_u->num_sids2 = num_sids; - - q_u->ptr_sid = ptr_sid; - q_u->sid = sid; -} - -/******************************************************************* -reads or writes a SAMR_Q_QUERY_USERALIASES structure. -********************************************************************/ - -bool samr_io_q_query_useraliases(const char *desc, SAMR_Q_QUERY_USERALIASES * q_u, - prs_struct *ps, int depth) -{ - fstring tmp; - uint32 i; - - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_useraliases"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &q_u->pol, ps, depth)) - return False; - - if(!prs_uint32("num_sids1", ps, depth, &q_u->num_sids1)) - return False; - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) - return False; - - if (q_u->ptr==0) - return True; - - if(!prs_uint32("num_sids2", ps, depth, &q_u->num_sids2)) - return False; - - if (UNMARSHALLING(ps) && (q_u->num_sids2 != 0)) { - q_u->ptr_sid = PRS_ALLOC_MEM(ps,uint32,q_u->num_sids2); - if (q_u->ptr_sid == NULL) - return False; - - q_u->sid = PRS_ALLOC_MEM(ps, DOM_SID2, q_u->num_sids2); - if (q_u->sid == NULL) - return False; - } - - for (i = 0; i < q_u->num_sids2; i++) { - slprintf(tmp, sizeof(tmp) - 1, "ptr[%02d]", i); - if(!prs_uint32(tmp, ps, depth, &q_u->ptr_sid[i])) - return False; - } - - for (i = 0; i < q_u->num_sids2; i++) { - if (q_u->ptr_sid[i] != 0) { - slprintf(tmp, sizeof(tmp) - 1, "sid[%02d]", i); - if(!smb_io_dom_sid2(tmp, &q_u->sid[i], ps, depth)) - return False; - } - } - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_USERALIASES structure. -********************************************************************/ - -void init_samr_r_query_useraliases(SAMR_R_QUERY_USERALIASES * r_u, - uint32 num_rids, uint32 *rid, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_query_useraliases\n")); - - if (NT_STATUS_IS_OK(status)) { - r_u->num_entries = num_rids; - r_u->ptr = 1; - r_u->num_entries2 = num_rids; - - r_u->rid = rid; - } else { - r_u->num_entries = 0; - r_u->ptr = 0; - r_u->num_entries2 = 0; - } - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_rids(const char *desc, uint32 *num_rids, uint32 **rid, - prs_struct *ps, int depth) -{ - fstring tmp; - uint32 i; - if (rid == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_rids"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_rids", ps, depth, num_rids)) - return False; - - if ((*num_rids) != 0) { - if (UNMARSHALLING(ps)) { - /* reading */ - (*rid) = PRS_ALLOC_MEM(ps,uint32, *num_rids); - } - if ((*rid) == NULL) - return False; - - for (i = 0; i < (*num_rids); i++) { - slprintf(tmp, sizeof(tmp) - 1, "rid[%02d]", i); - if(!prs_uint32(tmp, ps, depth, &((*rid)[i]))) - return False; - } - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_query_useraliases(const char *desc, SAMR_R_QUERY_USERALIASES * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_useraliases"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries", ps, depth, &r_u->num_entries)) - return False; - if(!prs_uint32("ptr ", ps, depth, &r_u->ptr)) - return False; - - if (r_u->ptr != 0) { - if(!samr_io_rids("rids", &r_u->num_entries2, &r_u->rid, ps, depth)) - return False; - } - - if(!prs_align(ps)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ - -void init_samr_q_open_alias(SAMR_Q_OPEN_ALIAS * q_u, POLICY_HND *pol, - uint32 access_mask, uint32 rid) -{ - DEBUG(5, ("init_samr_q_open_alias\n")); - - q_u->dom_pol = *pol; - q_u->access_mask = access_mask; - q_u->rid_alias = rid; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_open_alias(const char *desc, SAMR_Q_OPEN_ALIAS * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_open_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->dom_pol, ps, depth)) - return False; - - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - if(!prs_uint32("rid_alias", ps, depth, &q_u->rid_alias)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_open_alias(const char *desc, SAMR_R_OPEN_ALIAS * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_open_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a SAMR_Q_LOOKUP_RIDS structure. ********************************************************************/ @@ -4302,460 +2765,6 @@ bool samr_io_r_lookup_rids(const char *desc, SAMR_R_LOOKUP_RIDS * r_u, } /******************************************************************* -inits a SAMR_Q_OPEN_ALIAS structure. -********************************************************************/ - -void init_samr_q_delete_alias(SAMR_Q_DELETE_DOM_ALIAS * q_u, POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_delete_alias\n")); - - q_u->alias_pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_delete_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_delete_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_delete_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_delete_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_CREATE_DOM_ALIAS structure. -********************************************************************/ - -void init_samr_q_create_dom_alias(SAMR_Q_CREATE_DOM_ALIAS * q_u, - POLICY_HND *hnd, const char *acct_desc) -{ - DEBUG(5, ("init_samr_q_create_dom_alias\n")); - - q_u->dom_pol = *hnd; - - init_unistr2(&q_u->uni_acct_desc, acct_desc, UNI_FLAGS_NONE); - init_uni_hdr(&q_u->hdr_acct_desc, &q_u->uni_acct_desc); - - q_u->access_mask = MAXIMUM_ALLOWED_ACCESS; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_create_dom_alias(const char *desc, SAMR_Q_CREATE_DOM_ALIAS * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_create_dom_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("dom_pol", &q_u->dom_pol, ps, depth)) - return False; - - if(!smb_io_unihdr("hdr_acct_desc", &q_u->hdr_acct_desc, ps, depth)) - return False; - if(!smb_io_unistr2("uni_acct_desc", &q_u->uni_acct_desc, - q_u->hdr_acct_desc.buffer, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_create_dom_alias(const char *desc, SAMR_R_CREATE_DOM_ALIAS * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_create_dom_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("alias_pol", &r_u->alias_pol, ps, depth)) - return False; - - if(!prs_uint32("rid", ps, depth, &r_u->rid)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_ADD_ALIASMEM structure. -********************************************************************/ - -void init_samr_q_add_aliasmem(SAMR_Q_ADD_ALIASMEM * q_u, POLICY_HND *hnd, - DOM_SID *sid) -{ - DEBUG(5, ("init_samr_q_add_aliasmem\n")); - - q_u->alias_pol = *hnd; - init_dom_sid2(&q_u->sid, sid); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_add_aliasmem(const char *desc, SAMR_Q_ADD_ALIASMEM * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_add_aliasmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth)) - return False; - if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_add_aliasmem(const char *desc, SAMR_R_ADD_ALIASMEM * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_add_aliasmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_DEL_ALIASMEM structure. -********************************************************************/ - -void init_samr_q_del_aliasmem(SAMR_Q_DEL_ALIASMEM * q_u, POLICY_HND *hnd, - DOM_SID *sid) -{ - DEBUG(5, ("init_samr_q_del_aliasmem\n")); - - q_u->alias_pol = *hnd; - init_dom_sid2(&q_u->sid, sid); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_del_aliasmem(const char *desc, SAMR_Q_DEL_ALIASMEM * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_del_aliasmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth)) - return False; - if(!smb_io_dom_sid2("sid ", &q_u->sid, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_del_aliasmem(const char *desc, SAMR_R_DEL_ALIASMEM * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_del_aliasmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_DELETE_DOM_ALIAS structure. -********************************************************************/ - -void init_samr_q_delete_dom_alias(SAMR_Q_DELETE_DOM_ALIAS * q_c, - POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_delete_dom_alias\n")); - - q_c->alias_pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_delete_dom_alias(const char *desc, SAMR_Q_DELETE_DOM_ALIAS * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_delete_dom_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_DELETE_DOM_ALIAS structure. -********************************************************************/ - -void init_samr_r_delete_dom_alias(SAMR_R_DELETE_DOM_ALIAS * r_u, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_delete_dom_alias\n")); - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_delete_dom_alias(const char *desc, SAMR_R_DELETE_DOM_ALIAS * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_delete_dom_alias"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_QUERY_ALIASMEM structure. -********************************************************************/ - -void init_samr_q_query_aliasmem(SAMR_Q_QUERY_ALIASMEM * q_c, - POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_query_aliasmem\n")); - - q_c->alias_pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_query_aliasmem(const char *desc, SAMR_Q_QUERY_ALIASMEM * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_aliasmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("alias_pol", &q_u->alias_pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_ALIASMEM structure. -********************************************************************/ - -void init_samr_r_query_aliasmem(SAMR_R_QUERY_ALIASMEM * r_u, - uint32 num_sids, DOM_SID2 * sid, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_query_aliasmem\n")); - - if (NT_STATUS_IS_OK(status)) { - r_u->num_sids = num_sids; - r_u->ptr = (num_sids != 0) ? 1 : 0; - r_u->num_sids1 = num_sids; - - r_u->sid = sid; - } else { - r_u->ptr = 0; - r_u->num_sids = 0; - } - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_query_aliasmem(const char *desc, SAMR_R_QUERY_ALIASMEM * r_u, - prs_struct *ps, int depth) -{ - uint32 i; - - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_aliasmem"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_sids ", ps, depth, &r_u->num_sids)) - return False; - if(!prs_uint32("ptr", ps, depth, &r_u->ptr)) - return False; - - if (r_u->ptr != 0 && r_u->num_sids != 0) { - uint32 *ptr_sid = NULL; - - if(!prs_uint32("num_sids1", ps, depth, &r_u->num_sids1)) - return False; - - /* We must always use talloc here even when marshalling. */ - if (r_u->num_sids1) { - ptr_sid = TALLOC_ARRAY(ps->mem_ctx, uint32, r_u->num_sids1); - if (!ptr_sid) { - return False; - } - } else { - ptr_sid = NULL; - } - - for (i = 0; i < r_u->num_sids1; i++) { - ptr_sid[i] = 1; - if(!prs_uint32("ptr_sid", ps, depth, &ptr_sid[i])) - return False; - } - - if (UNMARSHALLING(ps)) { - if (r_u->num_sids1) { - r_u->sid = TALLOC_ARRAY(ps->mem_ctx, DOM_SID2, r_u->num_sids1); - if (!r_u->sid) { - return False; - } - } else { - r_u->sid = NULL; - } - } - - for (i = 0; i < r_u->num_sids1; i++) { - if (ptr_sid[i] != 0) { - if(!smb_io_dom_sid2("sid", &r_u->sid[i], ps, depth)) - return False; - } - } - } - - if(!prs_align(ps)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a SAMR_Q_LOOKUP_NAMES structure. ********************************************************************/ @@ -4985,215 +2994,6 @@ bool samr_io_r_lookup_names(const char *desc, SAMR_R_LOOKUP_NAMES * r_u, } /******************************************************************* -inits a SAMR_Q_DELETE_DOM_USER structure. -********************************************************************/ - -void init_samr_q_delete_dom_user(SAMR_Q_DELETE_DOM_USER * q_c, - POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_delete_dom_user\n")); - - q_c->user_pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_delete_dom_user(const char *desc, SAMR_Q_DELETE_DOM_USER * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_delete_dom_user"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("user_pol", &q_u->user_pol, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_delete_dom_user(const char *desc, SAMR_R_DELETE_DOM_USER * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_delete_dom_user"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_open_user(SAMR_Q_OPEN_USER * q_u, - POLICY_HND *pol, - uint32 access_mask, uint32 rid) -{ - DEBUG(5, ("samr_init_samr_q_open_user\n")); - - q_u->domain_pol = *pol; - q_u->access_mask = access_mask; - q_u->user_rid = rid; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_open_user(const char *desc, SAMR_Q_OPEN_USER * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_open_user"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - if(!prs_uint32("user_rid ", ps, depth, &q_u->user_rid)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_open_user(const char *desc, SAMR_R_OPEN_USER * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_open_user"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_create_user(SAMR_Q_CREATE_USER * q_u, - POLICY_HND *pol, - const char *name, - uint32 acb_info, uint32 acct_flags) -{ - DEBUG(5, ("samr_init_samr_q_create_user\n")); - - q_u->domain_pol = *pol; - - init_unistr2(&q_u->uni_name, name, UNI_FLAGS_NONE); - init_uni_hdr(&q_u->hdr_name, &q_u->uni_name); - - q_u->acb_info = acb_info; - q_u->acct_flags = acct_flags; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_create_user(const char *desc, SAMR_Q_CREATE_USER * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_create_user"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - - if(!smb_io_unihdr("hdr_name", &q_u->hdr_name, ps, depth)) - return False; - if(!smb_io_unistr2("uni_name", &q_u->uni_name, q_u->hdr_name.buffer, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("acb_info ", ps, depth, &q_u->acb_info)) - return False; - if(!prs_uint32("acct_flags", ps, depth, &q_u->acct_flags)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_create_user(const char *desc, SAMR_R_CREATE_USER * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_create_user"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("user_pol", &r_u->user_pol, ps, depth)) - return False; - - if(!prs_uint32("access_granted", ps, depth, &r_u->access_granted)) - return False; - if(!prs_uint32("user_rid ", ps, depth, &r_u->user_rid)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a SAMR_Q_QUERY_USERINFO structure. ********************************************************************/ @@ -6959,331 +4759,6 @@ bool samr_io_r_set_userinfo2(const char *desc, SAMR_R_SET_USERINFO2 * r_u, } /******************************************************************* -inits a SAMR_Q_CONNECT structure. -********************************************************************/ - -void init_samr_q_connect(SAMR_Q_CONNECT * q_u, - char *srv_name, uint32 access_mask) -{ - DEBUG(5, ("init_samr_q_connect\n")); - - /* make PDC server name \\server */ - q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE); - - /* example values: 0x0000 0002 */ - q_u->access_mask = access_mask; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_connect(const char *desc, SAMR_Q_CONNECT * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_connect"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_connect(const char *desc, SAMR_R_CONNECT * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_connect"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_CONNECT4 structure. -********************************************************************/ - -void init_samr_q_connect4(SAMR_Q_CONNECT4 * q_u, - char *srv_name, uint32 access_mask) -{ - DEBUG(5, ("init_samr_q_connect4\n")); - - /* make PDC server name \\server */ - q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE); - - /* Only value we've seen, possibly an address type ? */ - q_u->unk_0 = 2; - - /* example values: 0x0000 0002 */ - q_u->access_mask = access_mask; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_connect4(const char *desc, SAMR_Q_CONNECT4 * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_connect4"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("unk_0", ps, depth, &q_u->unk_0)) - return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_connect4(const char *desc, SAMR_R_CONNECT4 * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_connect4"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_CONNECT5 structure. -********************************************************************/ - -void init_samr_q_connect5(SAMR_Q_CONNECT5 * q_u, - char *srv_name, uint32 access_mask) -{ - DEBUG(5, ("init_samr_q_connect5\n")); - - /* make PDC server name \\server */ - q_u->ptr_srv_name = (srv_name != NULL && *srv_name) ? 1 : 0; - init_unistr2(&q_u->uni_srv_name, srv_name, UNI_STR_TERMINATE); - - /* example values: 0x0000 0002 */ - q_u->access_mask = access_mask; - - q_u->level = 1; - q_u->info1_unk1 = 3; - q_u->info1_unk2 = 0; -} - -/******************************************************************* -inits a SAMR_R_CONNECT5 structure. -********************************************************************/ - -void init_samr_r_connect5(SAMR_R_CONNECT5 * r_u, POLICY_HND *pol, NTSTATUS status) -{ - DEBUG(5, ("init_samr_q_connect5\n")); - - r_u->level = 1; - r_u->info1_unk1 = 3; - r_u->info1_unk2 = 0; - - r_u->connect_pol = *pol; - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_connect5(const char *desc, SAMR_Q_CONNECT5 * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_connect5"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_u->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->ptr_srv_name, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - - if(!prs_uint32("level", ps, depth, &q_u->level)) - return False; - if(!prs_uint32("level", ps, depth, &q_u->level)) - return False; - - if(!prs_uint32("info1_unk1", ps, depth, &q_u->info1_unk1)) - return False; - if(!prs_uint32("info1_unk2", ps, depth, &q_u->info1_unk2)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_connect5(const char *desc, SAMR_R_CONNECT5 * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_connect5"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("level", ps, depth, &r_u->level)) - return False; - if(!prs_uint32("level", ps, depth, &r_u->level)) - return False; - if(!prs_uint32("info1_unk1", ps, depth, &r_u->info1_unk1)) - return False; - if(!prs_uint32("info1_unk2", ps, depth, &r_u->info1_unk2)) - return False; - - if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_Q_CONNECT_ANON structure. -********************************************************************/ - -void init_samr_q_connect_anon(SAMR_Q_CONNECT_ANON * q_u) -{ - DEBUG(5, ("init_samr_q_connect_anon\n")); - - q_u->ptr = 1; - q_u->unknown_0 = 0x5c; /* server name (?!!) */ - q_u->access_mask = MAXIMUM_ALLOWED_ACCESS; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_connect_anon(const char *desc, SAMR_Q_CONNECT_ANON * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_connect_anon"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr ", ps, depth, &q_u->ptr)) - return False; - if (q_u->ptr) { - if(!prs_uint16("unknown_0", ps, depth, &q_u->unknown_0)) - return False; - } - if(!prs_align(ps)) - return False; - if(!prs_uint32("access_mask", ps, depth, &q_u->access_mask)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_connect_anon"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("connect_pol", &r_u->connect_pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ @@ -7660,272 +5135,3 @@ bool samr_io_r_chgpasswd_user3(const char *desc, SAMR_R_CHGPASSWD_USER3 *r_u, return True; } - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_query_domain_info2(SAMR_Q_QUERY_DOMAIN_INFO2 *q_u, - POLICY_HND *domain_pol, uint16 switch_value) -{ - DEBUG(5, ("init_samr_q_query_domain_info2\n")); - - q_u->domain_pol = *domain_pol; - q_u->switch_value = switch_value; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_query_domain_info2(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO2 *q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_domain_info2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) - return False; - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_DOMAIN_INFO structure. -********************************************************************/ - -void init_samr_r_query_domain_info2(SAMR_R_QUERY_DOMAIN_INFO2 * r_u, - uint16 switch_value, SAM_UNK_CTR * ctr, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_query_domain_info2\n")); - - r_u->ptr_0 = 0; - r_u->switch_value = 0; - r_u->status = status; /* return status */ - - if (NT_STATUS_IS_OK(status)) { - r_u->switch_value = switch_value; - r_u->ptr_0 = 1; - r_u->ctr = ctr; - } -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_query_domain_info2(const char *desc, SAMR_R_QUERY_DOMAIN_INFO2 * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_domain_info2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_0 ", ps, depth, &r_u->ptr_0)) - return False; - - if (r_u->ptr_0 != 0 && r_u->ctr != NULL) { - if(!prs_uint16("switch_value", ps, depth, &r_u->switch_value)) - return False; - if(!prs_align(ps)) - return False; - - switch (r_u->switch_value) { - case 0x0d: - if(!sam_io_unk_info13("unk_inf13", &r_u->ctr->info.inf13, ps, depth)) - return False; - break; - case 0x0c: - if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, ps, depth)) - return False; - break; - case 0x09: - if(!sam_io_unk_info9("unk_inf9",&r_u->ctr->info.inf9, ps,depth)) - return False; - break; - case 0x08: - if(!sam_io_unk_info8("unk_inf8",&r_u->ctr->info.inf8, ps,depth)) - return False; - break; - case 0x07: - if(!sam_io_unk_info7("unk_inf7",&r_u->ctr->info.inf7, ps,depth)) - return False; - break; - case 0x06: - if(!sam_io_unk_info6("unk_inf6",&r_u->ctr->info.inf6, ps,depth)) - return False; - break; - case 0x05: - if(!sam_io_unk_info5("unk_inf5",&r_u->ctr->info.inf5, ps,depth)) - return False; - break; - case 0x04: - if(!sam_io_unk_info4("unk_inf4",&r_u->ctr->info.inf4, ps,depth)) - return False; - break; - case 0x03: - if(!sam_io_unk_info3("unk_inf3",&r_u->ctr->info.inf3, ps,depth)) - return False; - break; - case 0x02: - if(!sam_io_unk_info2("unk_inf2",&r_u->ctr->info.inf2, ps,depth)) - return False; - break; - case 0x01: - if(!sam_io_unk_info1("unk_inf1",&r_u->ctr->info.inf1, ps,depth)) - return False; - break; - default: - DEBUG(0, ("samr_io_r_query_domain_info2: unknown switch level 0x%x\n", - r_u->switch_value)); - r_u->status = NT_STATUS_INVALID_INFO_CLASS; - return False; - } - } - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -void init_samr_q_set_domain_info(SAMR_Q_SET_DOMAIN_INFO *q_u, - POLICY_HND *domain_pol, uint16 switch_value, SAM_UNK_CTR *ctr) -{ - DEBUG(5, ("init_samr_q_set_domain_info\n")); - - q_u->domain_pol = *domain_pol; - q_u->switch_value0 = switch_value; - - q_u->switch_value = switch_value; - q_u->ctr = ctr; - -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_set_domain_info(const char *desc, SAMR_Q_SET_DOMAIN_INFO *q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_set_domain_info"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_u->domain_pol, ps, depth)) - return False; - - if(!prs_uint16("switch_value0", ps, depth, &q_u->switch_value0)) - return False; - - if(!prs_uint16("switch_value", ps, depth, &q_u->switch_value)) - return False; - - if(!prs_align(ps)) - return False; - - if (UNMARSHALLING(ps)) { - if ((q_u->ctr = PRS_ALLOC_MEM(ps, SAM_UNK_CTR, 1)) == NULL) - return False; - } - - switch (q_u->switch_value) { - - case 0x0c: - if(!sam_io_unk_info12("unk_inf12", &q_u->ctr->info.inf12, ps, depth)) - return False; - break; - case 0x07: - if(!sam_io_unk_info7("unk_inf7",&q_u->ctr->info.inf7, ps,depth)) - return False; - break; - case 0x06: - if(!sam_io_unk_info6("unk_inf6",&q_u->ctr->info.inf6, ps,depth)) - return False; - break; - case 0x05: - if(!sam_io_unk_info5("unk_inf5",&q_u->ctr->info.inf5, ps,depth)) - return False; - break; - case 0x03: - if(!sam_io_unk_info3("unk_inf3",&q_u->ctr->info.inf3, ps,depth)) - return False; - break; - case 0x02: - if(!sam_io_unk_info2("unk_inf2",&q_u->ctr->info.inf2, ps,depth)) - return False; - break; - case 0x01: - if(!sam_io_unk_info1("unk_inf1",&q_u->ctr->info.inf1, ps,depth)) - return False; - break; - default: - DEBUG(0, ("samr_io_r_samr_unknown_2e: unknown switch level 0x%x\n", - q_u->switch_value)); - return False; - } - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_DOMAIN_INFO structure. -********************************************************************/ - -void init_samr_r_set_domain_info(SAMR_R_SET_DOMAIN_INFO * r_u, NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_set_domain_info\n")); - - r_u->status = status; /* return status */ -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_set_domain_info(const char *desc, SAMR_R_SET_DOMAIN_INFO * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_samr_unknown_2e"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} |