From b857785c0e5ecb3486ba173d42124f6098e91e2a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 4 May 2006 19:20:56 +0000 Subject: r15443: Purely cosmetic reformat, no functional changes. Guenther (This used to be commit ef40428d935831bdb19111c933d20e381647f6f8) --- source3/rpc_parse/parse_samr.c | 349 +++++++++++++++++++++-------------------- 1 file changed, 175 insertions(+), 174 deletions(-) (limited to 'source3/rpc_parse') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 370e29ccad..3d74cf7853 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -495,31 +495,53 @@ BOOL samr_io_q_query_dom_info(const char *desc, SAMR_Q_QUERY_DOMAIN_INFO * q_u, return True; } - /******************************************************************* inits a structure. ********************************************************************/ -void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) +void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, + uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age) { - u_3->logout.low = nt_logout.low; - u_3->logout.high = nt_logout.high; + u_1->min_length_password = min_pass_len; + u_1->password_history = pass_hist; + + if (lp_check_password_script() && *lp_check_password_script()) { + password_properties |= DOMAIN_PASSWORD_COMPLEX; + } + u_1->password_properties = password_properties; + + /* password never expire */ + u_1->expire.high = nt_expire.high; + u_1->expire.low = nt_expire.low; + + /* can change the password now */ + u_1->min_passwordage.high = nt_min_age.high; + u_1->min_passwordage.low = nt_min_age.low; + } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, +static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, prs_struct *ps, int depth) { - if (u_3 == NULL) - return False; + if (u_1 == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_unk_info3"); + prs_debug(ps, depth, desc, "sam_io_unk_info1"); depth++; - if(!smb_io_time("logout", &u_3->logout, ps, depth)) + if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password)) + return False; + if(!prs_uint16("password_history", ps, depth, &u_1->password_history)) + return False; + if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties)) + return False; + if(!smb_io_time("expire", &u_1->expire, ps, depth)) + return False; + if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth)) return False; return True; @@ -529,29 +551,79 @@ static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, inits a structure. ********************************************************************/ -void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) +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) { - init_unistr2(&u_6->uni_server, server, UNI_FLAGS_NONE); - init_uni_hdr(&u_6->hdr_server, &u_6->uni_server); + u_2->logout.low = nt_logout.low; + u_2->logout.high = nt_logout.high; + + u_2->seq_num.low = seq_num; + u_2->seq_num.high = 0x00000000; + + + 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_info6(const char *desc, SAM_UNK_INFO_6 * u_6, +static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, prs_struct *ps, int depth) { - if (u_6 == NULL) + if (u_2 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info6"); + prs_debug(ps, depth, desc, "sam_io_unk_info2"); depth++; - if(!smb_io_unihdr("hdr_server", &u_6->hdr_server, ps, 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; - if(!smb_io_unistr2("uni_server", &u_6->uni_server, u_6->hdr_server.buffer, ps, depth)) + /* 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; @@ -561,29 +633,26 @@ static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, inits a structure. ********************************************************************/ -void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment) +void init_unk_info3(SAM_UNK_INFO_3 *u_3, NTTIME nt_logout) { - init_unistr2(&u_4->uni_comment, comment, UNI_FLAGS_NONE); - init_uni_hdr(&u_4->hdr_comment, &u_4->uni_comment); + u_3->logout.low = nt_logout.low; + u_3->logout.high = nt_logout.high; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, +static BOOL sam_io_unk_info3(const char *desc, SAM_UNK_INFO_3 * u_3, prs_struct *ps, int depth) { - if (u_4 == NULL) + if (u_3 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info4"); + prs_debug(ps, depth, desc, "sam_io_unk_info3"); 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)) + if(!smb_io_time("logout", &u_3->logout, ps, depth)) return False; return True; @@ -593,25 +662,29 @@ static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, inits a structure. ********************************************************************/ -void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) +void init_unk_info4(SAM_UNK_INFO_4 * u_4,const char *comment) { - u_7->server_role = server_role; + 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_info7(const char *desc, SAM_UNK_INFO_7 * u_7, +static BOOL sam_io_unk_info4(const char *desc, SAM_UNK_INFO_4 * u_4, prs_struct *ps, int depth) { - if (u_7 == NULL) + if (u_4 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info7"); + prs_debug(ps, depth, desc, "sam_io_unk_info4"); depth++; - if(!prs_uint16("server_role", ps, depth, &u_7->server_role)) + 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; @@ -621,30 +694,29 @@ static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, inits a structure. ********************************************************************/ -void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num) +void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) { - unix_to_nt_time(&u_8->domain_create_time, 0); - u_8->seq_num.low = seq_num; - u_8->seq_num.high = 0x0000; + 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_info8(const char *desc, SAM_UNK_INFO_8 * u_8, +static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, prs_struct *ps, int depth) { - if (u_8 == NULL) + if (u_5 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info8"); + prs_debug(ps, depth, desc, "sam_io_unk_info5"); depth++; - if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num)) + if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth)) return False; - if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth)) + if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth)) return False; return True; @@ -654,25 +726,29 @@ static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, inits a structure. ********************************************************************/ -void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown) +void init_unk_info6(SAM_UNK_INFO_6 * u_6, const char *server) { - u_9->unknown = unknown; + 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_info9(const char *desc, SAM_UNK_INFO_9 * u_9, +static BOOL sam_io_unk_info6(const char *desc, SAM_UNK_INFO_6 * u_6, prs_struct *ps, int depth) { - if (u_9 == NULL) + if (u_6 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info9"); + prs_debug(ps, depth, desc, "sam_io_unk_info6"); depth++; - if (!prs_uint32("unknown", ps, depth, &u_9->unknown)) + 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; @@ -682,34 +758,25 @@ static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, inits a structure. ********************************************************************/ -void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout) +void init_unk_info7(SAM_UNK_INFO_7 * u_7, uint32 server_role) { - u_12->duration.low = nt_lock_duration.low; - u_12->duration.high = nt_lock_duration.high; - u_12->reset_count.low = nt_reset_time.low; - u_12->reset_count.high = nt_reset_time.high; - - u_12->bad_attempt_lockout = lockout; + u_7->server_role = server_role; } /******************************************************************* 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) +static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, + prs_struct *ps, int depth) { - if (u_12 == NULL) + if (u_7 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info12"); + prs_debug(ps, depth, desc, "sam_io_unk_info7"); 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)) + if(!prs_uint16("server_role", ps, depth, &u_7->server_role)) return False; return True; @@ -719,29 +786,30 @@ static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, inits a structure. ********************************************************************/ -void init_unk_info5(SAM_UNK_INFO_5 * u_5,const char *domain) +void init_unk_info8(SAM_UNK_INFO_8 * u_8, uint32 seq_num) { - init_unistr2(&u_5->uni_domain, domain, UNI_FLAGS_NONE); - init_uni_hdr(&u_5->hdr_domain, &u_5->uni_domain); + unix_to_nt_time(&u_8->domain_create_time, 0); + u_8->seq_num.low = seq_num; + u_8->seq_num.high = 0x0000; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, +static BOOL sam_io_unk_info8(const char *desc, SAM_UNK_INFO_8 * u_8, prs_struct *ps, int depth) { - if (u_5 == NULL) + if (u_8 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info5"); + prs_debug(ps, depth, desc, "sam_io_unk_info8"); depth++; - if(!smb_io_unihdr("hdr_domain", &u_5->hdr_domain, ps, depth)) + if (!prs_uint64("seq_num", ps, depth, &u_8->seq_num)) return False; - if(!smb_io_unistr2("uni_domain", &u_5->uni_domain, u_5->hdr_domain.buffer, ps, depth)) + if(!smb_io_time("domain_create_time", &u_8->domain_create_time, ps, depth)) return False; return True; @@ -751,41 +819,27 @@ static BOOL sam_io_unk_info5(const char *desc, SAM_UNK_INFO_5 * u_5, inits a structure. ********************************************************************/ -void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num) +void init_unk_info9(SAM_UNK_INFO_9 * u_9, uint32 unknown) { - unix_to_nt_time(&u_13->domain_create_time, 0); - u_13->seq_num.low = seq_num; - u_13->seq_num.high = 0x0000; - u_13->unknown1 = 0; - u_13->unknown2 = 0; + u_9->unknown = unknown; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, +static BOOL sam_io_unk_info9(const char *desc, SAM_UNK_INFO_9 * u_9, prs_struct *ps, int depth) { - if (u_13 == NULL) + if (u_9 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info13"); + prs_debug(ps, depth, desc, "sam_io_unk_info9"); 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)) + if (!prs_uint32("unknown", ps, depth, &u_9->unknown)) return False; - - return True; } @@ -793,79 +847,34 @@ static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, 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) +void init_unk_info12(SAM_UNK_INFO_12 * u_12, NTTIME nt_lock_duration, NTTIME nt_reset_time, uint16 lockout) { - u_2->logout.low = nt_logout.low; - u_2->logout.high = nt_logout.high; - - u_2->seq_num.low = seq_num; - u_2->seq_num.high = 0x00000000; - - - 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; + u_12->duration.low = nt_lock_duration.low; + u_12->duration.high = nt_lock_duration.high; + u_12->reset_count.low = nt_reset_time.low; + u_12->reset_count.high = nt_reset_time.high; - 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); + u_12->bad_attempt_lockout = lockout; } /******************************************************************* 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) +static BOOL sam_io_unk_info12(const char *desc, SAM_UNK_INFO_12 * u_12, + prs_struct *ps, int depth) { - if (u_2 == NULL) + if (u_12 == NULL) return False; - prs_debug(ps, depth, desc, "sam_io_unk_info2"); + prs_debug(ps, depth, desc, "sam_io_unk_info12"); 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)) + if(!smb_io_time("duration", &u_12->duration, ps, depth)) return False; - if(!smb_io_unistr2("uni_domain", &u_2->uni_domain, u_2->hdr_domain.buffer, ps, depth)) + if(!smb_io_time("reset_count", &u_12->reset_count, ps, depth)) return False; - if(!smb_io_unistr2("uni_server", &u_2->uni_server, u_2->hdr_server.buffer, ps, depth)) + if(!prs_uint16("bad_attempt_lockout", ps, depth, &u_12->bad_attempt_lockout)) return False; return True; @@ -875,45 +884,37 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, inits a structure. ********************************************************************/ -void init_unk_info1(SAM_UNK_INFO_1 *u_1, uint16 min_pass_len, uint16 pass_hist, - uint32 password_properties, NTTIME nt_expire, NTTIME nt_min_age) +void init_unk_info13(SAM_UNK_INFO_13 * u_13, uint32 seq_num) { - u_1->min_length_password = min_pass_len; - u_1->password_history = pass_hist; - u_1->password_properties = password_properties; - - /* password never expire */ - u_1->expire.high = nt_expire.high; - u_1->expire.low = nt_expire.low; - - /* can change the password now */ - u_1->min_passwordage.high = nt_min_age.high; - u_1->min_passwordage.low = nt_min_age.low; - + unix_to_nt_time(&u_13->domain_create_time, 0); + u_13->seq_num.low = seq_num; + u_13->seq_num.high = 0x0000; + u_13->unknown1 = 0; + u_13->unknown2 = 0; } /******************************************************************* reads or writes a structure. ********************************************************************/ -static BOOL sam_io_unk_info1(const char *desc, SAM_UNK_INFO_1 * u_1, +static BOOL sam_io_unk_info13(const char *desc, SAM_UNK_INFO_13 * u_13, prs_struct *ps, int depth) { - if (u_1 == NULL) - return False; + if (u_13 == NULL) + return False; - prs_debug(ps, depth, desc, "sam_io_unk_info1"); + prs_debug(ps, depth, desc, "sam_io_unk_info13"); depth++; - if(!prs_uint16("min_length_password", ps, depth, &u_1->min_length_password)) - return False; - if(!prs_uint16("password_history", ps, depth, &u_1->password_history)) + if (!prs_uint64("seq_num", ps, depth, &u_13->seq_num)) return False; - if(!prs_uint32("password_properties", ps, depth, &u_1->password_properties)) + + if(!smb_io_time("domain_create_time", &u_13->domain_create_time, ps, depth)) return False; - if(!smb_io_time("expire", &u_1->expire, ps, depth)) + + if (!prs_uint32("unknown1", ps, depth, &u_13->unknown1)) return False; - if(!smb_io_time("min_passwordage", &u_1->min_passwordage, ps, depth)) + if (!prs_uint32("unknown2", ps, depth, &u_13->unknown2)) return False; return True; -- cgit