From 9aba116607c0b85a371c3556a6483bc662c769a3 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Dec 2004 16:58:43 +0000 Subject: r4331: Implement SAMR query_dom_info-call info-level 8 server- and client-side, based on samba4-idl. This saves us an enormous amount of totally unnecessary ldap-traffic when several hundreds of winbind-daemons query a Samba3 DC just to get the fake SAM-sequence-number (time(NULL)) by enumerating all users, all groups and all aliases when query-dom-info level 2 is used. Note that we apparently never get the sequence number right (we parse a uint32, although it's a uint64, at least in samba4 idl). For the time being, I would propose to stay with that behaviour. Guenther (This used to be commit f9ab15a986626581000d4b93961184c501f36b93) --- source3/rpc_parse/parse_samr.c | 47 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse/parse_samr.c') diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index a674b89ab6..5b211f8349 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -588,6 +588,40 @@ static BOOL sam_io_unk_info7(const char *desc, SAM_UNK_INFO_7 * u_7, 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.low = seq_num; + u_8->seq_num.high = 0x0000; +} + +/******************************************************************* +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. ********************************************************************/ @@ -668,8 +702,9 @@ void init_unk_info2(SAM_UNK_INFO_2 * u_2, u_2->unknown_0 = 0x00000000; u_2->unknown_1 = 0x80000000; - u_2->seq_num = seq_num; - u_2->unknown_3 = 0x00000000; + u_2->seq_num.low = seq_num; + u_2->seq_num.high = 0x00000000; + u_2->unknown_4 = 0x00000001; u_2->unknown_5 = 0x00000003; @@ -716,9 +751,7 @@ static BOOL sam_io_unk_info2(const char *desc, SAM_UNK_INFO_2 * u_2, pointer is referring to */ - if(!prs_uint32("seq_num ", ps, depth, &u_2->seq_num)) /* 0x0000 0099 or 0x1000 0000 */ - return False; - if(!prs_uint32("unknown_3 ", ps, depth, &u_2->unknown_3)) /* 0x0000 0000 */ + 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 */ @@ -843,6 +876,10 @@ BOOL samr_io_r_query_dom_info(const char *desc, SAMR_R_QUERY_DOMAIN_INFO * r_u, if(!sam_io_unk_info12("unk_inf12", &r_u->ctr->info.inf12, 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; -- cgit