2 * Unix SMB/CIFS implementation.
3 * RPC Pipe client / server routines
4 * Copyright (C) Andrew Tridgell 1992-1997,
5 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
6 * Copyright (C) Paul Ashton 1997.
7 * Copyright (C) Jean François Micouleau 2002.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 #define DBGC_CLASS DBGC_RPC_PARSE
29 /*******************************************************************
30 Reads or writes a structure.
31 ********************************************************************/
33 static BOOL
net_io_neg_flags(char *desc
, NEG_FLAGS
*neg
, prs_struct
*ps
, int depth
)
38 prs_debug(ps
, depth
, desc
, "net_io_neg_flags");
44 if(!prs_uint32("neg_flags", ps
, depth
, &neg
->neg_flags
))
50 /*******************************************************************
51 Inits a NETLOGON_INFO_3 structure.
52 ********************************************************************/
54 static void init_netinfo_3(NETLOGON_INFO_3
*info
, uint32 flags
, uint32 logon_attempts
)
57 info
->logon_attempts
= logon_attempts
;
58 info
->reserved_1
= 0x0;
59 info
->reserved_2
= 0x0;
60 info
->reserved_3
= 0x0;
61 info
->reserved_4
= 0x0;
62 info
->reserved_5
= 0x0;
65 /*******************************************************************
66 Reads or writes a NETLOGON_INFO_3 structure.
67 ********************************************************************/
69 static BOOL
net_io_netinfo_3(char *desc
, NETLOGON_INFO_3
*info
, prs_struct
*ps
, int depth
)
74 prs_debug(ps
, depth
, desc
, "net_io_netinfo_3");
80 if(!prs_uint32("flags ", ps
, depth
, &info
->flags
))
82 if(!prs_uint32("logon_attempts", ps
, depth
, &info
->logon_attempts
))
84 if(!prs_uint32("reserved_1 ", ps
, depth
, &info
->reserved_1
))
86 if(!prs_uint32("reserved_2 ", ps
, depth
, &info
->reserved_2
))
88 if(!prs_uint32("reserved_3 ", ps
, depth
, &info
->reserved_3
))
90 if(!prs_uint32("reserved_4 ", ps
, depth
, &info
->reserved_4
))
92 if(!prs_uint32("reserved_5 ", ps
, depth
, &info
->reserved_5
))
99 /*******************************************************************
100 Inits a NETLOGON_INFO_1 structure.
101 ********************************************************************/
103 static void init_netinfo_1(NETLOGON_INFO_1
*info
, uint32 flags
, uint32 pdc_status
)
106 info
->pdc_status
= pdc_status
;
109 /*******************************************************************
110 Reads or writes a NETLOGON_INFO_1 structure.
111 ********************************************************************/
113 static BOOL
net_io_netinfo_1(char *desc
, NETLOGON_INFO_1
*info
, prs_struct
*ps
, int depth
)
118 prs_debug(ps
, depth
, desc
, "net_io_netinfo_1");
124 if(!prs_uint32("flags ", ps
, depth
, &info
->flags
))
126 if(!prs_uint32("pdc_status", ps
, depth
, &info
->pdc_status
))
132 /*******************************************************************
133 Inits a NETLOGON_INFO_2 structure.
134 ********************************************************************/
136 static void init_netinfo_2(NETLOGON_INFO_2
*info
, uint32 flags
, uint32 pdc_status
,
137 uint32 tc_status
, char *trusted_dc_name
)
139 int len_dc_name
= strlen(trusted_dc_name
);
141 info
->pdc_status
= pdc_status
;
142 info
->ptr_trusted_dc_name
= 1;
143 info
->tc_status
= tc_status
;
145 if (trusted_dc_name
!= NULL
)
146 init_unistr2(&info
->uni_trusted_dc_name
, trusted_dc_name
, len_dc_name
+1);
148 init_unistr2(&info
->uni_trusted_dc_name
, "", 1);
151 /*******************************************************************
152 Reads or writes a NETLOGON_INFO_2 structure.
153 ********************************************************************/
155 static BOOL
net_io_netinfo_2(char *desc
, NETLOGON_INFO_2
*info
, prs_struct
*ps
, int depth
)
160 prs_debug(ps
, depth
, desc
, "net_io_netinfo_2");
166 if(!prs_uint32("flags ", ps
, depth
, &info
->flags
))
168 if(!prs_uint32("pdc_status ", ps
, depth
, &info
->pdc_status
))
170 if(!prs_uint32("ptr_trusted_dc_name", ps
, depth
, &info
->ptr_trusted_dc_name
))
172 if(!prs_uint32("tc_status ", ps
, depth
, &info
->tc_status
))
175 if (info
->ptr_trusted_dc_name
!= 0) {
176 if(!smb_io_unistr2("unistr2", &info
->uni_trusted_dc_name
, info
->ptr_trusted_dc_name
, ps
, depth
))
186 /*******************************************************************
187 Reads or writes an NET_Q_LOGON_CTRL2 structure.
188 ********************************************************************/
190 BOOL
net_io_q_logon_ctrl2(char *desc
, NET_Q_LOGON_CTRL2
*q_l
, prs_struct
*ps
, int depth
)
195 prs_debug(ps
, depth
, desc
, "net_io_q_logon_ctrl2");
201 if(!prs_uint32("ptr ", ps
, depth
, &q_l
->ptr
))
204 if(!smb_io_unistr2 ("", &q_l
->uni_server_name
, q_l
->ptr
, ps
, depth
))
210 if(!prs_uint32("function_code", ps
, depth
, &q_l
->function_code
))
212 if(!prs_uint32("query_level ", ps
, depth
, &q_l
->query_level
))
214 if(!prs_uint32("switch_value ", ps
, depth
, &q_l
->switch_value
))
220 /*******************************************************************
221 Inits an NET_Q_LOGON_CTRL2 structure.
222 ********************************************************************/
224 void init_net_q_logon_ctrl2(NET_Q_LOGON_CTRL2
*q_l
, char *srv_name
,
227 DEBUG(5,("init_q_logon_ctrl2\n"));
229 q_l
->function_code
= 0x01;
230 q_l
->query_level
= query_level
;
231 q_l
->switch_value
= 0x01;
233 init_unistr2(&q_l
->uni_server_name
, srv_name
, strlen(srv_name
) + 1);
236 /*******************************************************************
237 Inits an NET_R_LOGON_CTRL2 structure.
238 ********************************************************************/
240 void init_net_r_logon_ctrl2(NET_R_LOGON_CTRL2
*r_l
, uint32 query_level
,
241 uint32 flags
, uint32 pdc_status
,
242 uint32 logon_attempts
, uint32 tc_status
,
243 char *trusted_domain_name
)
245 DEBUG(5,("init_r_logon_ctrl2\n"));
247 r_l
->switch_value
= query_level
; /* should only be 0x1 */
249 switch (query_level
) {
251 r_l
->ptr
= 1; /* undocumented pointer */
252 init_netinfo_1(&r_l
->logon
.info1
, flags
, pdc_status
);
253 r_l
->status
= NT_STATUS_OK
;
256 r_l
->ptr
= 1; /* undocumented pointer */
257 init_netinfo_2(&r_l
->logon
.info2
, flags
, pdc_status
,
258 tc_status
, trusted_domain_name
);
259 r_l
->status
= NT_STATUS_OK
;
262 r_l
->ptr
= 1; /* undocumented pointer */
263 init_netinfo_3(&r_l
->logon
.info3
, flags
, logon_attempts
);
264 r_l
->status
= NT_STATUS_OK
;
267 DEBUG(2,("init_r_logon_ctrl2: unsupported switch value %d\n",
269 r_l
->ptr
= 0; /* undocumented pointer */
271 /* take a guess at an error code... */
272 r_l
->status
= NT_STATUS_INVALID_INFO_CLASS
;
277 /*******************************************************************
278 Reads or writes an NET_R_LOGON_CTRL2 structure.
279 ********************************************************************/
281 BOOL
net_io_r_logon_ctrl2(char *desc
, NET_R_LOGON_CTRL2
*r_l
, prs_struct
*ps
, int depth
)
286 prs_debug(ps
, depth
, desc
, "net_io_r_logon_ctrl2");
289 if(!prs_uint32("switch_value ", ps
, depth
, &r_l
->switch_value
))
291 if(!prs_uint32("ptr ", ps
, depth
, &r_l
->ptr
))
295 switch (r_l
->switch_value
) {
297 if(!net_io_netinfo_1("", &r_l
->logon
.info1
, ps
, depth
))
301 if(!net_io_netinfo_2("", &r_l
->logon
.info2
, ps
, depth
))
305 if(!net_io_netinfo_3("", &r_l
->logon
.info3
, ps
, depth
))
309 DEBUG(2,("net_io_r_logon_ctrl2: unsupported switch value %d\n",
315 if(!prs_ntstatus("status ", ps
, depth
, &r_l
->status
))
321 /*******************************************************************
322 Reads or writes an NET_Q_LOGON_CTRL structure.
323 ********************************************************************/
325 BOOL
net_io_q_logon_ctrl(char *desc
, NET_Q_LOGON_CTRL
*q_l
, prs_struct
*ps
,
328 prs_debug(ps
, depth
, desc
, "net_io_q_logon_ctrl");
334 if(!prs_uint32("ptr ", ps
, depth
, &q_l
->ptr
))
337 if(!smb_io_unistr2 ("", &q_l
->uni_server_name
, q_l
->ptr
, ps
, depth
))
343 if(!prs_uint32("function_code", ps
, depth
, &q_l
->function_code
))
345 if(!prs_uint32("query_level ", ps
, depth
, &q_l
->query_level
))
351 /*******************************************************************
352 Inits an NET_Q_LOGON_CTRL structure.
353 ********************************************************************/
355 void init_net_q_logon_ctrl(NET_Q_LOGON_CTRL
*q_l
, char *srv_name
,
358 DEBUG(5,("init_q_logon_ctrl\n"));
360 q_l
->function_code
= 0x01; /* ??? */
361 q_l
->query_level
= query_level
;
363 init_unistr2(&q_l
->uni_server_name
, srv_name
, strlen(srv_name
) + 1);
366 /*******************************************************************
367 Inits an NET_R_LOGON_CTRL structure.
368 ********************************************************************/
370 void init_net_r_logon_ctrl(NET_R_LOGON_CTRL
*r_l
, uint32 query_level
,
371 uint32 flags
, uint32 pdc_status
)
373 DEBUG(5,("init_r_logon_ctrl\n"));
375 r_l
->switch_value
= query_level
; /* should only be 0x1 */
377 switch (query_level
) {
379 r_l
->ptr
= 1; /* undocumented pointer */
380 init_netinfo_1(&r_l
->logon
.info1
, flags
, pdc_status
);
381 r_l
->status
= NT_STATUS_OK
;
384 DEBUG(2,("init_r_logon_ctrl: unsupported switch value %d\n",
386 r_l
->ptr
= 0; /* undocumented pointer */
388 /* take a guess at an error code... */
389 r_l
->status
= NT_STATUS_INVALID_INFO_CLASS
;
394 /*******************************************************************
395 Reads or writes an NET_R_LOGON_CTRL structure.
396 ********************************************************************/
398 BOOL
net_io_r_logon_ctrl(char *desc
, NET_R_LOGON_CTRL
*r_l
, prs_struct
*ps
,
401 prs_debug(ps
, depth
, desc
, "net_io_r_logon_ctrl");
404 if(!prs_uint32("switch_value ", ps
, depth
, &r_l
->switch_value
))
406 if(!prs_uint32("ptr ", ps
, depth
, &r_l
->ptr
))
410 switch (r_l
->switch_value
) {
412 if(!net_io_netinfo_1("", &r_l
->logon
.info1
, ps
, depth
))
416 DEBUG(2,("net_io_r_logon_ctrl: unsupported switch value %d\n",
422 if(!prs_ntstatus("status ", ps
, depth
, &r_l
->status
))
428 /*******************************************************************
429 Inits an NET_R_TRUST_DOM_LIST structure.
430 ********************************************************************/
432 void init_r_trust_dom(NET_R_TRUST_DOM_LIST
*r_t
,
433 uint32 num_doms
, char *dom_name
)
437 DEBUG(5,("init_r_trust_dom\n"));
439 for (i
= 0; i
< MAX_TRUST_DOMS
; i
++) {
440 r_t
->uni_trust_dom_name
[i
].uni_str_len
= 0;
441 r_t
->uni_trust_dom_name
[i
].uni_max_len
= 0;
443 if (num_doms
> MAX_TRUST_DOMS
)
444 num_doms
= MAX_TRUST_DOMS
;
446 for (i
= 0; i
< num_doms
; i
++) {
448 fstrcpy(domain_name
, dom_name
);
449 strupper(domain_name
);
450 init_unistr2(&r_t
->uni_trust_dom_name
[i
], domain_name
, strlen(domain_name
)+1);
451 /* the use of UNISTR2 here is non-standard. */
452 r_t
->uni_trust_dom_name
[i
].undoc
= 0x1;
455 r_t
->status
= NT_STATUS_OK
;
458 /*******************************************************************
459 Reads or writes an NET_R_TRUST_DOM_LIST structure.
460 ********************************************************************/
462 BOOL
net_io_r_trust_dom(char *desc
, NET_R_TRUST_DOM_LIST
*r_t
, prs_struct
*ps
, int depth
)
469 prs_debug(ps
, depth
, desc
, "net_io_r_trust_dom");
472 /* temporary code to give a valid response */
474 if(!prs_uint32("status", ps
, depth
, &value
))
478 if(!prs_uint32("status", ps
, depth
, &value
))
481 if(!prs_uint32("status", ps
, depth
, &value
))
485 if(!prs_uint32("status", ps
, depth
, &value
))
489 if(!prs_uint32("status", ps
, depth
, &value
))
492 /* old non working code */
496 for (i
= 0; i
< MAX_TRUST_DOMS
; i
++) {
497 if (r_t
->uni_trust_dom_name
[i
].uni_str_len
== 0)
499 if(!smb_io_unistr2("", &r_t
->uni_trust_dom_name
[i
], True
, ps
, depth
))
503 if(!prs_ntstatus("status", ps
, depth
, &r_t
->status
))
510 /*******************************************************************
511 Reads or writes an NET_Q_TRUST_DOM_LIST structure.
512 ********************************************************************/
514 BOOL
net_io_q_trust_dom(char *desc
, NET_Q_TRUST_DOM_LIST
*q_l
, prs_struct
*ps
, int depth
)
519 prs_debug(ps
, depth
, desc
, "net_io_q_trust_dom");
522 if(!prs_uint32("ptr ", ps
, depth
, &q_l
->ptr
))
524 if(!smb_io_unistr2 ("", &q_l
->uni_server_name
, q_l
->ptr
, ps
, depth
))
530 /*******************************************************************
531 Inits an NET_Q_REQ_CHAL structure.
532 ********************************************************************/
534 void init_q_req_chal(NET_Q_REQ_CHAL
*q_c
,
535 const char *logon_srv
, const char *logon_clnt
,
538 DEBUG(5,("init_q_req_chal: %d\n", __LINE__
));
540 q_c
->undoc_buffer
= 1; /* don't know what this buffer is */
542 init_unistr2(&q_c
->uni_logon_srv
, logon_srv
, strlen(logon_srv
)+1);
543 init_unistr2(&q_c
->uni_logon_clnt
, logon_clnt
, strlen(logon_clnt
)+1);
545 memcpy(q_c
->clnt_chal
.data
, clnt_chal
->data
, sizeof(clnt_chal
->data
));
547 DEBUG(5,("init_q_req_chal: %d\n", __LINE__
));
550 /*******************************************************************
551 Reads or writes an NET_Q_REQ_CHAL structure.
552 ********************************************************************/
554 BOOL
net_io_q_req_chal(char *desc
, NET_Q_REQ_CHAL
*q_c
, prs_struct
*ps
, int depth
)
559 prs_debug(ps
, depth
, desc
, "net_io_q_req_chal");
565 if(!prs_uint32("undoc_buffer", ps
, depth
, &q_c
->undoc_buffer
))
568 if(!smb_io_unistr2("", &q_c
->uni_logon_srv
, True
, ps
, depth
)) /* logon server unicode string */
570 if(!smb_io_unistr2("", &q_c
->uni_logon_clnt
, True
, ps
, depth
)) /* logon client unicode string */
573 if(!smb_io_chal("", &q_c
->clnt_chal
, ps
, depth
))
579 /*******************************************************************
580 Reads or writes a structure.
581 ********************************************************************/
583 BOOL
net_io_r_req_chal(char *desc
, NET_R_REQ_CHAL
*r_c
, prs_struct
*ps
, int depth
)
588 prs_debug(ps
, depth
, desc
, "net_io_r_req_chal");
594 if(!smb_io_chal("", &r_c
->srv_chal
, ps
, depth
)) /* server challenge */
597 if(!prs_ntstatus("status", ps
, depth
, &r_c
->status
))
604 /*******************************************************************
605 Reads or writes a structure.
606 ********************************************************************/
608 BOOL
net_io_q_auth(char *desc
, NET_Q_AUTH
*q_a
, prs_struct
*ps
, int depth
)
613 prs_debug(ps
, depth
, desc
, "net_io_q_auth");
619 if(!smb_io_log_info ("", &q_a
->clnt_id
, ps
, depth
)) /* client identification info */
621 if(!smb_io_chal("", &q_a
->clnt_chal
, ps
, depth
))
627 /*******************************************************************
628 Reads or writes a structure.
629 ********************************************************************/
631 BOOL
net_io_r_auth(char *desc
, NET_R_AUTH
*r_a
, prs_struct
*ps
, int depth
)
636 prs_debug(ps
, depth
, desc
, "net_io_r_auth");
642 if(!smb_io_chal("", &r_a
->srv_chal
, ps
, depth
)) /* server challenge */
645 if(!prs_ntstatus("status", ps
, depth
, &r_a
->status
))
651 /*******************************************************************
652 Inits a NET_Q_AUTH_2 struct.
653 ********************************************************************/
655 void init_q_auth_2(NET_Q_AUTH_2
*q_a
,
656 const char *logon_srv
, const char *acct_name
, uint16 sec_chan
, const char *comp_name
,
657 DOM_CHAL
*clnt_chal
, uint32 clnt_flgs
)
659 DEBUG(5,("init_q_auth_2: %d\n", __LINE__
));
661 init_log_info(&q_a
->clnt_id
, logon_srv
, acct_name
, sec_chan
, comp_name
);
662 memcpy(q_a
->clnt_chal
.data
, clnt_chal
->data
, sizeof(clnt_chal
->data
));
663 q_a
->clnt_flgs
.neg_flags
= clnt_flgs
;
665 DEBUG(5,("init_q_auth_2: %d\n", __LINE__
));
668 /*******************************************************************
669 Reads or writes a structure.
670 ********************************************************************/
672 BOOL
net_io_q_auth_2(char *desc
, NET_Q_AUTH_2
*q_a
, prs_struct
*ps
, int depth
)
677 prs_debug(ps
, depth
, desc
, "net_io_q_auth_2");
683 if(!smb_io_log_info ("", &q_a
->clnt_id
, ps
, depth
)) /* client identification info */
685 if(!smb_io_chal("", &q_a
->clnt_chal
, ps
, depth
))
687 if(!net_io_neg_flags("", &q_a
->clnt_flgs
, ps
, depth
))
693 /*******************************************************************
694 Reads or writes a structure.
695 ********************************************************************/
697 BOOL
net_io_r_auth_2(char *desc
, NET_R_AUTH_2
*r_a
, prs_struct
*ps
, int depth
)
702 prs_debug(ps
, depth
, desc
, "net_io_r_auth_2");
708 if(!smb_io_chal("", &r_a
->srv_chal
, ps
, depth
)) /* server challenge */
710 if(!net_io_neg_flags("", &r_a
->srv_flgs
, ps
, depth
))
713 if(!prs_ntstatus("status", ps
, depth
, &r_a
->status
))
719 /*******************************************************************
720 Inits a NET_Q_AUTH_3 struct.
721 ********************************************************************/
723 void init_q_auth_3(NET_Q_AUTH_3
*q_a
,
724 const char *logon_srv
, const char *acct_name
, uint16 sec_chan
, const char *comp_name
,
725 DOM_CHAL
*clnt_chal
, uint32 clnt_flgs
)
727 DEBUG(5,("init_q_auth_3: %d\n", __LINE__
));
729 init_log_info(&q_a
->clnt_id
, logon_srv
, acct_name
, sec_chan
, comp_name
);
730 memcpy(q_a
->clnt_chal
.data
, clnt_chal
->data
, sizeof(clnt_chal
->data
));
731 q_a
->clnt_flgs
.neg_flags
= clnt_flgs
;
733 DEBUG(5,("init_q_auth_3: %d\n", __LINE__
));
736 /*******************************************************************
737 Reads or writes a structure.
738 ********************************************************************/
740 BOOL
net_io_q_auth_3(char *desc
, NET_Q_AUTH_3
*q_a
, prs_struct
*ps
, int depth
)
745 prs_debug(ps
, depth
, desc
, "net_io_q_auth_3");
751 if(!smb_io_log_info ("", &q_a
->clnt_id
, ps
, depth
)) /* client identification info */
753 if(!smb_io_chal("", &q_a
->clnt_chal
, ps
, depth
))
755 if(!net_io_neg_flags("", &q_a
->clnt_flgs
, ps
, depth
))
761 /*******************************************************************
762 Reads or writes a structure.
763 ********************************************************************/
765 BOOL
net_io_r_auth_3(char *desc
, NET_R_AUTH_3
*r_a
, prs_struct
*ps
, int depth
)
770 prs_debug(ps
, depth
, desc
, "net_io_r_auth_3");
776 if(!smb_io_chal("srv_chal", &r_a
->srv_chal
, ps
, depth
)) /* server challenge */
778 if(!net_io_neg_flags("srv_flgs", &r_a
->srv_flgs
, ps
, depth
))
780 if (!prs_uint32("unknown", ps
, depth
, &r_a
->unknown
))
783 if(!prs_ntstatus("status", ps
, depth
, &r_a
->status
))
790 /*******************************************************************
791 Inits a NET_Q_SRV_PWSET.
792 ********************************************************************/
794 void init_q_srv_pwset(NET_Q_SRV_PWSET
*q_s
, char *logon_srv
, char *sess_key
, char *acct_name
,
795 uint16 sec_chan
, char *comp_name
, DOM_CRED
*cred
, uchar hashed_mach_pwd
[16])
797 unsigned char nt_cypher
[16];
799 DEBUG(5,("init_q_srv_pwset\n"));
801 /* Process the new password. */
802 cred_hash3( nt_cypher
, hashed_mach_pwd
, sess_key
, 1);
804 init_clnt_info(&q_s
->clnt_id
, logon_srv
, acct_name
, sec_chan
, comp_name
, cred
);
806 memcpy(q_s
->pwd
, nt_cypher
, sizeof(q_s
->pwd
));
809 /*******************************************************************
810 Reads or writes a structure.
811 ********************************************************************/
813 BOOL
net_io_q_srv_pwset(char *desc
, NET_Q_SRV_PWSET
*q_s
, prs_struct
*ps
, int depth
)
818 prs_debug(ps
, depth
, desc
, "net_io_q_srv_pwset");
824 if(!smb_io_clnt_info("", &q_s
->clnt_id
, ps
, depth
)) /* client identification/authentication info */
826 if(!prs_uint8s (False
, "pwd", ps
, depth
, q_s
->pwd
, 16)) /* new password - undocumented */
832 /*******************************************************************
833 Reads or writes a structure.
834 ********************************************************************/
836 BOOL
net_io_r_srv_pwset(char *desc
, NET_R_SRV_PWSET
*r_s
, prs_struct
*ps
, int depth
)
841 prs_debug(ps
, depth
, desc
, "net_io_r_srv_pwset");
847 if(!smb_io_cred("", &r_s
->srv_cred
, ps
, depth
)) /* server challenge */
850 if(!prs_ntstatus("status", ps
, depth
, &r_s
->status
))
856 /*************************************************************************
857 Init DOM_SID2 array from a string containing multiple sids
858 *************************************************************************/
860 static int init_dom_sid2s(TALLOC_CTX
*ctx
, char *sids_str
, DOM_SID2
**ppsids
)
866 DEBUG(4,("init_dom_sid2s: %s\n", sids_str
? sids_str
:""));
874 /* Count the number of SIDs. */
875 for (count
= 0, ptr
= sids_str
;
876 next_token(&ptr
, s2
, NULL
, sizeof(s2
)); count
++)
879 /* Now allocate space for them. */
880 *ppsids
= (DOM_SID2
*)talloc_zero(ctx
, count
* sizeof(DOM_SID2
));
886 for (number
= 0, ptr
= sids_str
;
887 next_token(&ptr
, s2
, NULL
, sizeof(s2
)); number
++) {
889 string_to_sid(&tmpsid
, s2
);
890 init_dom_sid2(&sids
[number
], &tmpsid
);
897 /*******************************************************************
898 Inits a NET_ID_INFO_1 structure.
899 ********************************************************************/
901 void init_id_info1(NET_ID_INFO_1
*id
, char *domain_name
,
902 uint32 param_ctrl
, uint32 log_id_low
, uint32 log_id_high
,
903 char *user_name
, char *wksta_name
,
905 unsigned char lm_cypher
[16], unsigned char nt_cypher
[16])
907 int len_domain_name
= strlen(domain_name
);
908 int len_user_name
= strlen(user_name
);
909 int len_wksta_name
= strlen(wksta_name
);
911 unsigned char lm_owf
[16];
912 unsigned char nt_owf
[16];
914 DEBUG(5,("init_id_info1: %d\n", __LINE__
));
916 id
->ptr_id_info1
= 1;
918 init_uni_hdr(&id
->hdr_domain_name
, len_domain_name
);
920 id
->param_ctrl
= param_ctrl
;
921 init_logon_id(&id
->logon_id
, log_id_low
, log_id_high
);
923 init_uni_hdr(&id
->hdr_user_name
, len_user_name
);
924 init_uni_hdr(&id
->hdr_wksta_name
, len_wksta_name
);
926 if (lm_cypher
&& nt_cypher
) {
927 unsigned char key
[16];
928 #ifdef DEBUG_PASSWORD
929 DEBUG(100,("lm cypher:"));
930 dump_data(100, (char *)lm_cypher
, 16);
932 DEBUG(100,("nt cypher:"));
933 dump_data(100, (char *)nt_cypher
, 16);
937 memcpy(key
, sess_key
, 8);
939 memcpy(lm_owf
, lm_cypher
, 16);
940 SamOEMhash(lm_owf
, key
, 16);
941 memcpy(nt_owf
, nt_cypher
, 16);
942 SamOEMhash(nt_owf
, key
, 16);
944 #ifdef DEBUG_PASSWORD
945 DEBUG(100,("encrypt of lm owf password:"));
946 dump_data(100, (char *)lm_owf
, 16);
948 DEBUG(100,("encrypt of nt owf password:"));
949 dump_data(100, (char *)nt_owf
, 16);
951 /* set up pointers to cypher blocks */
956 init_owf_info(&id
->lm_owf
, lm_cypher
);
957 init_owf_info(&id
->nt_owf
, nt_cypher
);
959 init_unistr2(&id
->uni_domain_name
, domain_name
, len_domain_name
);
960 init_unistr2(&id
->uni_user_name
, user_name
, len_user_name
);
961 init_unistr2(&id
->uni_wksta_name
, wksta_name
, len_wksta_name
);
964 /*******************************************************************
965 Reads or writes an NET_ID_INFO_1 structure.
966 ********************************************************************/
968 static BOOL
net_io_id_info1(char *desc
, NET_ID_INFO_1
*id
, prs_struct
*ps
, int depth
)
973 prs_debug(ps
, depth
, desc
, "net_io_id_info1");
979 if(!prs_uint32("ptr_id_info1", ps
, depth
, &id
->ptr_id_info1
))
982 if (id
->ptr_id_info1
!= 0) {
983 if(!smb_io_unihdr("unihdr", &id
->hdr_domain_name
, ps
, depth
))
986 if(!prs_uint32("param_ctrl", ps
, depth
, &id
->param_ctrl
))
988 if(!smb_io_logon_id("", &id
->logon_id
, ps
, depth
))
991 if(!smb_io_unihdr("unihdr", &id
->hdr_user_name
, ps
, depth
))
993 if(!smb_io_unihdr("unihdr", &id
->hdr_wksta_name
, ps
, depth
))
996 if(!smb_io_owf_info("", &id
->lm_owf
, ps
, depth
))
998 if(!smb_io_owf_info("", &id
->nt_owf
, ps
, depth
))
1001 if(!smb_io_unistr2("unistr2", &id
->uni_domain_name
,
1002 id
->hdr_domain_name
.buffer
, ps
, depth
))
1004 if(!smb_io_unistr2("unistr2", &id
->uni_user_name
,
1005 id
->hdr_user_name
.buffer
, ps
, depth
))
1007 if(!smb_io_unistr2("unistr2", &id
->uni_wksta_name
,
1008 id
->hdr_wksta_name
.buffer
, ps
, depth
))
1015 /*******************************************************************
1016 Inits a NET_ID_INFO_2 structure.
1018 This is a network logon packet. The log_id parameters
1019 are what an NT server would generate for LUID once the
1020 user is logged on. I don't think we care about them.
1022 Note that this has no access to the NT and LM hashed passwords,
1023 so it forwards the challenge, and the NT and LM responses (24
1024 bytes each) over the secure channel to the Domain controller
1025 for it to say yea or nay. This is the preferred method of
1026 checking for a logon as it doesn't export the password
1027 hashes to anyone who has compromised the secure channel. JRA.
1028 ********************************************************************/
1030 void init_id_info2(NET_ID_INFO_2
* id
, const char *domain_name
,
1032 uint32 log_id_low
, uint32 log_id_high
,
1033 const char *user_name
, const char *wksta_name
,
1034 const uchar lm_challenge
[8],
1035 const uchar
* lm_chal_resp
, int lm_chal_resp_len
,
1036 const uchar
* nt_chal_resp
, int nt_chal_resp_len
)
1038 int len_domain_name
= strlen(domain_name
);
1039 int len_user_name
= strlen(user_name
);
1040 int len_wksta_name
= strlen(wksta_name
);
1041 unsigned char lm_owf
[24];
1042 unsigned char nt_owf
[128];
1044 DEBUG(5,("init_id_info2: %d\n", __LINE__
));
1046 id
->ptr_id_info2
= 1;
1048 init_uni_hdr(&id
->hdr_domain_name
, len_domain_name
);
1050 id
->param_ctrl
= param_ctrl
;
1051 init_logon_id(&id
->logon_id
, log_id_low
, log_id_high
);
1053 init_uni_hdr(&id
->hdr_user_name
, len_user_name
);
1054 init_uni_hdr(&id
->hdr_wksta_name
, len_wksta_name
);
1057 /* oops. can only send what-ever-it-is direct */
1058 memcpy(nt_owf
, nt_chal_resp
, MIN(sizeof(nt_owf
), nt_chal_resp_len
));
1059 nt_chal_resp
= nt_owf
;
1062 /* oops. can only send what-ever-it-is direct */
1063 memcpy(lm_owf
, lm_chal_resp
, MIN(sizeof(lm_owf
), lm_chal_resp_len
));
1064 lm_chal_resp
= lm_owf
;
1067 memcpy(id
->lm_chal
, lm_challenge
, sizeof(id
->lm_chal
));
1068 init_str_hdr(&id
->hdr_nt_chal_resp
, nt_chal_resp_len
, nt_chal_resp_len
, (nt_chal_resp
!= NULL
) ? 1 : 0);
1069 init_str_hdr(&id
->hdr_lm_chal_resp
, lm_chal_resp_len
, lm_chal_resp_len
, (lm_chal_resp
!= NULL
) ? 1 : 0);
1071 init_unistr2(&id
->uni_domain_name
, domain_name
, len_domain_name
);
1072 init_unistr2(&id
->uni_user_name
, user_name
, len_user_name
);
1073 init_unistr2(&id
->uni_wksta_name
, wksta_name
, len_wksta_name
);
1075 init_string2(&id
->nt_chal_resp
, (const char *)nt_chal_resp
, nt_chal_resp_len
, nt_chal_resp_len
);
1076 init_string2(&id
->lm_chal_resp
, (const char *)lm_chal_resp
, lm_chal_resp_len
, lm_chal_resp_len
);
1080 /*******************************************************************
1081 Reads or writes an NET_ID_INFO_2 structure.
1082 ********************************************************************/
1084 static BOOL
net_io_id_info2(char *desc
, NET_ID_INFO_2
*id
, prs_struct
*ps
, int depth
)
1089 prs_debug(ps
, depth
, desc
, "net_io_id_info2");
1095 if(!prs_uint32("ptr_id_info2", ps
, depth
, &id
->ptr_id_info2
))
1098 if (id
->ptr_id_info2
!= 0) {
1099 if(!smb_io_unihdr("unihdr", &id
->hdr_domain_name
, ps
, depth
))
1102 if(!prs_uint32("param_ctrl", ps
, depth
, &id
->param_ctrl
))
1104 if(!smb_io_logon_id("", &id
->logon_id
, ps
, depth
))
1107 if(!smb_io_unihdr("unihdr", &id
->hdr_user_name
, ps
, depth
))
1109 if(!smb_io_unihdr("unihdr", &id
->hdr_wksta_name
, ps
, depth
))
1112 if(!prs_uint8s (False
, "lm_chal", ps
, depth
, id
->lm_chal
, 8)) /* lm 8 byte challenge */
1115 if(!smb_io_strhdr("hdr_nt_chal_resp", &id
->hdr_nt_chal_resp
, ps
, depth
))
1117 if(!smb_io_strhdr("hdr_lm_chal_resp", &id
->hdr_lm_chal_resp
, ps
, depth
))
1120 if(!smb_io_unistr2("uni_domain_name", &id
->uni_domain_name
,
1121 id
->hdr_domain_name
.buffer
, ps
, depth
))
1123 if(!smb_io_unistr2("uni_user_name ", &id
->uni_user_name
,
1124 id
->hdr_user_name
.buffer
, ps
, depth
))
1126 if(!smb_io_unistr2("uni_wksta_name ", &id
->uni_wksta_name
,
1127 id
->hdr_wksta_name
.buffer
, ps
, depth
))
1129 if(!smb_io_string2("nt_chal_resp", &id
->nt_chal_resp
,
1130 id
->hdr_nt_chal_resp
.buffer
, ps
, depth
))
1132 if(!smb_io_string2("lm_chal_resp", &id
->lm_chal_resp
,
1133 id
->hdr_lm_chal_resp
.buffer
, ps
, depth
))
1141 /*******************************************************************
1142 Inits a DOM_SAM_INFO structure.
1143 ********************************************************************/
1145 void init_sam_info(DOM_SAM_INFO
*sam
,
1146 char *logon_srv
, char *comp_name
, DOM_CRED
*clnt_cred
,
1147 DOM_CRED
*rtn_cred
, uint16 logon_level
,
1148 NET_ID_INFO_CTR
*ctr
)
1150 DEBUG(5,("init_sam_info: %d\n", __LINE__
));
1152 init_clnt_info2(&sam
->client
, logon_srv
, comp_name
, clnt_cred
);
1154 if (rtn_cred
!= NULL
) {
1155 sam
->ptr_rtn_cred
= 1;
1156 memcpy(&sam
->rtn_cred
, rtn_cred
, sizeof(sam
->rtn_cred
));
1158 sam
->ptr_rtn_cred
= 0;
1161 sam
->logon_level
= logon_level
;
1165 /*******************************************************************
1166 Reads or writes a DOM_SAM_INFO structure.
1167 ********************************************************************/
1169 static BOOL
net_io_id_info_ctr(char *desc
, NET_ID_INFO_CTR
**pp_ctr
, prs_struct
*ps
, int depth
)
1171 NET_ID_INFO_CTR
*ctr
= *pp_ctr
;
1173 prs_debug(ps
, depth
, desc
, "smb_io_sam_info");
1176 if (UNMARSHALLING(ps
)) {
1177 ctr
= *pp_ctr
= (NET_ID_INFO_CTR
*)prs_alloc_mem(ps
, sizeof(NET_ID_INFO_CTR
));
1185 /* don't 4-byte align here! */
1187 if(!prs_uint16("switch_value ", ps
, depth
, &ctr
->switch_value
))
1190 switch (ctr
->switch_value
) {
1192 if(!net_io_id_info1("", &ctr
->auth
.id1
, ps
, depth
))
1196 if(!net_io_id_info2("", &ctr
->auth
.id2
, ps
, depth
))
1201 DEBUG(4,("smb_io_sam_info: unknown switch_value!\n"));
1208 /*******************************************************************
1209 Reads or writes a DOM_SAM_INFO structure.
1210 ********************************************************************/
1212 static BOOL
smb_io_sam_info(char *desc
, DOM_SAM_INFO
*sam
, prs_struct
*ps
, int depth
)
1217 prs_debug(ps
, depth
, desc
, "smb_io_sam_info");
1223 if(!smb_io_clnt_info2("", &sam
->client
, ps
, depth
))
1226 if(!prs_uint32("ptr_rtn_cred ", ps
, depth
, &sam
->ptr_rtn_cred
))
1228 if(!smb_io_cred("", &sam
->rtn_cred
, ps
, depth
))
1231 if(!prs_uint16("logon_level ", ps
, depth
, &sam
->logon_level
))
1234 if (sam
->logon_level
!= 0) {
1235 if(!net_io_id_info_ctr("logon_info", &sam
->ctr
, ps
, depth
))
1242 /*************************************************************************
1243 Inits a NET_USER_INFO_3 structure.
1245 This is a network logon reply packet, and contains much information about
1246 the user. This information is passed as a (very long) paramater list
1247 to avoid having to link in the PASSDB code to every program that deals
1249 *************************************************************************/
1251 void init_net_user_info3(TALLOC_CTX
*ctx
, NET_USER_INFO_3
*usr
,
1255 const char* user_name
,
1256 const char* full_name
,
1257 const char* home_dir
,
1258 const char* dir_drive
,
1259 const char* logon_script
,
1260 const char* profile_path
,
1262 time_t unix_logon_time
,
1263 time_t unix_logoff_time
,
1264 time_t unix_kickoff_time
,
1265 time_t unix_pass_last_set_time
,
1266 time_t unix_pass_can_change_time
,
1267 time_t unix_pass_must_change_time
,
1269 uint16 logon_count
, uint16 bad_pw_count
,
1270 uint32 num_groups
, const DOM_GID
*gids
,
1271 uint32 user_flgs
, uchar
*sess_key
,
1272 const char *logon_srv
, const char *logon_dom
,
1273 const DOM_SID
*dom_sid
, char *other_sids
)
1275 /* only cope with one "other" sid, right now. */
1276 /* need to count the number of space-delimited sids */
1278 int num_other_sids
= 0;
1280 NTTIME logon_time
, logoff_time
, kickoff_time
,
1281 pass_last_set_time
, pass_can_change_time
,
1282 pass_must_change_time
;
1284 int len_user_name
, len_full_name
, len_home_dir
,
1285 len_dir_drive
, len_logon_script
, len_profile_path
;
1287 int len_logon_srv
= strlen(logon_srv
);
1288 int len_logon_dom
= strlen(logon_dom
);
1290 len_user_name
= strlen(user_name
);
1291 len_full_name
= strlen(full_name
);
1292 len_home_dir
= strlen(home_dir
);
1293 len_dir_drive
= strlen(dir_drive
);
1294 len_logon_script
= strlen(logon_script
);
1295 len_profile_path
= strlen(profile_path
);
1300 usr
->ptr_user_info
= 1; /* yes, we're bothering to put USER_INFO data here */
1303 /* Create NTTIME structs */
1304 unix_to_nt_time (&logon_time
, unix_logon_time
);
1305 unix_to_nt_time (&logoff_time
, unix_logoff_time
);
1306 unix_to_nt_time (&kickoff_time
, unix_kickoff_time
);
1307 unix_to_nt_time (&pass_last_set_time
, unix_pass_last_set_time
);
1308 unix_to_nt_time (&pass_can_change_time
, unix_pass_can_change_time
);
1309 unix_to_nt_time (&pass_must_change_time
, unix_pass_must_change_time
);
1311 usr
->logon_time
= logon_time
;
1312 usr
->logoff_time
= logoff_time
;
1313 usr
->kickoff_time
= kickoff_time
;
1314 usr
->pass_last_set_time
= pass_last_set_time
;
1315 usr
->pass_can_change_time
= pass_can_change_time
;
1316 usr
->pass_must_change_time
= pass_must_change_time
;
1318 init_uni_hdr(&usr
->hdr_user_name
, len_user_name
);
1319 init_uni_hdr(&usr
->hdr_full_name
, len_full_name
);
1320 init_uni_hdr(&usr
->hdr_logon_script
, len_logon_script
);
1321 init_uni_hdr(&usr
->hdr_profile_path
, len_profile_path
);
1322 init_uni_hdr(&usr
->hdr_home_dir
, len_home_dir
);
1323 init_uni_hdr(&usr
->hdr_dir_drive
, len_dir_drive
);
1325 usr
->logon_count
= logon_count
;
1326 usr
->bad_pw_count
= bad_pw_count
;
1328 usr
->user_rid
= user_rid
;
1329 usr
->group_rid
= group_rid
;
1330 usr
->num_groups
= num_groups
;
1332 usr
->buffer_groups
= 1; /* indicates fill in groups, below, even if there are none */
1333 usr
->user_flgs
= user_flgs
;
1335 if (sess_key
!= NULL
)
1336 memcpy(usr
->user_sess_key
, sess_key
, sizeof(usr
->user_sess_key
));
1338 memset((char *)usr
->user_sess_key
, '\0', sizeof(usr
->user_sess_key
));
1340 init_uni_hdr(&usr
->hdr_logon_srv
, len_logon_srv
);
1341 init_uni_hdr(&usr
->hdr_logon_dom
, len_logon_dom
);
1343 usr
->buffer_dom_id
= dom_sid
? 1 : 0; /* yes, we're bothering to put a domain SID in */
1345 memset((char *)usr
->padding
, '\0', sizeof(usr
->padding
));
1347 num_other_sids
= init_dom_sid2s(ctx
, other_sids
, &usr
->other_sids
);
1349 usr
->num_other_sids
= num_other_sids
;
1350 usr
->buffer_other_sids
= (num_other_sids
!= 0) ? 1 : 0;
1352 init_unistr2(&usr
->uni_user_name
, user_name
, len_user_name
);
1353 init_unistr2(&usr
->uni_full_name
, full_name
, len_full_name
);
1354 init_unistr2(&usr
->uni_logon_script
, logon_script
, len_logon_script
);
1355 init_unistr2(&usr
->uni_profile_path
, profile_path
, len_profile_path
);
1356 init_unistr2(&usr
->uni_home_dir
, home_dir
, len_home_dir
);
1357 init_unistr2(&usr
->uni_dir_drive
, dir_drive
, len_dir_drive
);
1359 usr
->num_groups2
= num_groups
;
1361 usr
->gids
= (DOM_GID
*)talloc_zero(ctx
,sizeof(DOM_GID
) * (num_groups
));
1362 if (usr
->gids
== NULL
&& num_groups
>0)
1365 for (i
= 0; i
< num_groups
; i
++)
1366 usr
->gids
[i
] = gids
[i
];
1368 init_unistr2(&usr
->uni_logon_srv
, logon_srv
, len_logon_srv
);
1369 init_unistr2(&usr
->uni_logon_dom
, logon_dom
, len_logon_dom
);
1371 init_dom_sid2(&usr
->dom_sid
, dom_sid
);
1372 /* "other" sids are set up above */
1375 /*******************************************************************
1376 This code has been modified to cope with a NET_USER_INFO_2 - which is
1377 exactly the same as a NET_USER_INFO_3, minus the other sids parameters.
1378 We use validation level to determine if we're marshalling a info 2 or
1379 INFO_3 - be we always return an INFO_3. Based on code donated by Marc
1380 Jacobsen at HP. JRA.
1381 ********************************************************************/
1383 BOOL
net_io_user_info3(const char *desc
, NET_USER_INFO_3
*usr
, prs_struct
*ps
,
1384 int depth
, uint16 validation_level
)
1391 prs_debug(ps
, depth
, desc
, "net_io_user_info3");
1394 if (UNMARSHALLING(ps
))
1400 if(!prs_uint32("ptr_user_info ", ps
, depth
, &usr
->ptr_user_info
))
1403 if (usr
->ptr_user_info
== 0)
1406 if(!smb_io_time("logon time", &usr
->logon_time
, ps
, depth
)) /* logon time */
1408 if(!smb_io_time("logoff time", &usr
->logoff_time
, ps
, depth
)) /* logoff time */
1410 if(!smb_io_time("kickoff time", &usr
->kickoff_time
, ps
, depth
)) /* kickoff time */
1412 if(!smb_io_time("last set time", &usr
->pass_last_set_time
, ps
, depth
)) /* password last set time */
1414 if(!smb_io_time("can change time", &usr
->pass_can_change_time
, ps
, depth
)) /* password can change time */
1416 if(!smb_io_time("must change time", &usr
->pass_must_change_time
, ps
, depth
)) /* password must change time */
1419 if(!smb_io_unihdr("hdr_user_name", &usr
->hdr_user_name
, ps
, depth
)) /* username unicode string header */
1421 if(!smb_io_unihdr("hdr_full_name", &usr
->hdr_full_name
, ps
, depth
)) /* user's full name unicode string header */
1423 if(!smb_io_unihdr("hdr_logon_script", &usr
->hdr_logon_script
, ps
, depth
)) /* logon script unicode string header */
1425 if(!smb_io_unihdr("hdr_profile_path", &usr
->hdr_profile_path
, ps
, depth
)) /* profile path unicode string header */
1427 if(!smb_io_unihdr("hdr_home_dir", &usr
->hdr_home_dir
, ps
, depth
)) /* home directory unicode string header */
1429 if(!smb_io_unihdr("hdr_dir_drive", &usr
->hdr_dir_drive
, ps
, depth
)) /* home directory drive unicode string header */
1432 if(!prs_uint16("logon_count ", ps
, depth
, &usr
->logon_count
)) /* logon count */
1434 if(!prs_uint16("bad_pw_count ", ps
, depth
, &usr
->bad_pw_count
)) /* bad password count */
1437 if(!prs_uint32("user_rid ", ps
, depth
, &usr
->user_rid
)) /* User RID */
1439 if(!prs_uint32("group_rid ", ps
, depth
, &usr
->group_rid
)) /* Group RID */
1441 if(!prs_uint32("num_groups ", ps
, depth
, &usr
->num_groups
)) /* num groups */
1443 if(!prs_uint32("buffer_groups ", ps
, depth
, &usr
->buffer_groups
)) /* undocumented buffer pointer to groups. */
1445 if(!prs_uint32("user_flgs ", ps
, depth
, &usr
->user_flgs
)) /* user flags */
1448 if(!prs_uint8s(False
, "user_sess_key", ps
, depth
, usr
->user_sess_key
, 16)) /* unused user session key */
1451 if(!smb_io_unihdr("hdr_logon_srv", &usr
->hdr_logon_srv
, ps
, depth
)) /* logon server unicode string header */
1453 if(!smb_io_unihdr("hdr_logon_dom", &usr
->hdr_logon_dom
, ps
, depth
)) /* logon domain unicode string header */
1456 if(!prs_uint32("buffer_dom_id ", ps
, depth
, &usr
->buffer_dom_id
)) /* undocumented logon domain id pointer */
1458 if(!prs_uint8s (False
, "padding ", ps
, depth
, usr
->padding
, 40)) /* unused padding bytes? */
1461 if (validation_level
== 3) {
1462 if(!prs_uint32("num_other_sids", ps
, depth
, &usr
->num_other_sids
)) /* 0 - num_sids */
1464 if(!prs_uint32("buffer_other_sids", ps
, depth
, &usr
->buffer_other_sids
)) /* NULL - undocumented pointer to SIDs. */
1467 if (UNMARSHALLING(ps
)) {
1468 usr
->num_other_sids
= 0;
1469 usr
->buffer_other_sids
= 0;
1473 if(!smb_io_unistr2("uni_user_name", &usr
->uni_user_name
, usr
->hdr_user_name
.buffer
, ps
, depth
)) /* username unicode string */
1475 if(!smb_io_unistr2("uni_full_name", &usr
->uni_full_name
, usr
->hdr_full_name
.buffer
, ps
, depth
)) /* user's full name unicode string */
1477 if(!smb_io_unistr2("uni_logon_script", &usr
->uni_logon_script
, usr
->hdr_logon_script
.buffer
, ps
, depth
)) /* logon script unicode string */
1479 if(!smb_io_unistr2("uni_profile_path", &usr
->uni_profile_path
, usr
->hdr_profile_path
.buffer
, ps
, depth
)) /* profile path unicode string */
1481 if(!smb_io_unistr2("uni_home_dir", &usr
->uni_home_dir
, usr
->hdr_home_dir
.buffer
, ps
, depth
)) /* home directory unicode string */
1483 if(!smb_io_unistr2("uni_dir_drive", &usr
->uni_dir_drive
, usr
->hdr_dir_drive
.buffer
, ps
, depth
)) /* home directory drive unicode string */
1488 if(!prs_uint32("num_groups2 ", ps
, depth
, &usr
->num_groups2
)) /* num groups */
1491 if (UNMARSHALLING(ps
) && usr
->num_groups2
> 0) {
1492 usr
->gids
= (DOM_GID
*)prs_alloc_mem(ps
, sizeof(DOM_GID
)*usr
->num_groups2
);
1493 if (usr
->gids
== NULL
)
1497 for (i
= 0; i
< usr
->num_groups2
; i
++) {
1498 if(!smb_io_gid("", &usr
->gids
[i
], ps
, depth
)) /* group info */
1502 if(!smb_io_unistr2("uni_logon_srv", &usr
->uni_logon_srv
, usr
->hdr_logon_srv
.buffer
, ps
, depth
)) /* logon server unicode string */
1504 if(!smb_io_unistr2("uni_logon_dom", &usr
->uni_logon_dom
, usr
->hdr_logon_srv
.buffer
, ps
, depth
)) /* logon domain unicode string */
1507 if(!smb_io_dom_sid2("", &usr
->dom_sid
, ps
, depth
)) /* domain SID */
1510 if (usr
->num_other_sids
) {
1512 if (UNMARSHALLING(ps
)) {
1513 usr
->other_sids
= (DOM_SID2
*)prs_alloc_mem(ps
, sizeof(DOM_SID2
)*usr
->num_other_sids
);
1514 if (usr
->other_sids
== NULL
)
1518 if(!prs_uint32("num_other_groups", ps
, depth
, &usr
->num_other_groups
))
1521 if (UNMARSHALLING(ps
) && usr
->num_other_groups
> 0) {
1522 usr
->other_gids
= (DOM_GID
*)prs_alloc_mem(ps
, sizeof(DOM_GID
)*usr
->num_other_groups
);
1523 if (usr
->other_gids
== NULL
)
1527 for (i
= 0; i
< usr
->num_other_groups
; i
++) {
1528 if(!smb_io_gid("", &usr
->other_gids
[i
], ps
, depth
)) /* other GIDs */
1531 for (i
= 0; i
< usr
->num_other_sids
; i
++) {
1532 if(!smb_io_dom_sid2("", &usr
->other_sids
[i
], ps
, depth
)) /* other domain SIDs */
1540 /*******************************************************************
1541 Reads or writes a structure.
1542 ********************************************************************/
1544 BOOL
net_io_q_sam_logon(char *desc
, NET_Q_SAM_LOGON
*q_l
, prs_struct
*ps
, int depth
)
1549 prs_debug(ps
, depth
, desc
, "net_io_q_sam_logon");
1555 if(!smb_io_sam_info("", &q_l
->sam_id
, ps
, depth
))
1558 if(!prs_uint16("validation_level", ps
, depth
, &q_l
->validation_level
))
1564 /*******************************************************************
1565 Reads or writes a structure.
1566 ********************************************************************/
1568 BOOL
net_io_r_sam_logon(char *desc
, NET_R_SAM_LOGON
*r_l
, prs_struct
*ps
, int depth
)
1573 prs_debug(ps
, depth
, desc
, "net_io_r_sam_logon");
1576 if(!prs_uint32("buffer_creds", ps
, depth
, &r_l
->buffer_creds
)) /* undocumented buffer pointer */
1578 if(!smb_io_cred("", &r_l
->srv_creds
, ps
, depth
)) /* server credentials. server time stamp appears to be ignored. */
1581 if(!prs_uint16("switch_value", ps
, depth
, &r_l
->switch_value
))
1586 #if 1 /* W2k always needs this - even for bad passwd. JRA */
1587 if(!net_io_user_info3("", r_l
->user
, ps
, depth
, r_l
->switch_value
))
1590 if (r_l
->switch_value
!= 0) {
1591 if(!net_io_user_info3("", r_l
->user
, ps
, depth
, r_l
->switch_value
))
1596 if(!prs_uint32("auth_resp ", ps
, depth
, &r_l
->auth_resp
)) /* 1 - Authoritative response; 0 - Non-Auth? */
1599 if(!prs_ntstatus("status ", ps
, depth
, &r_l
->status
))
1608 /*******************************************************************
1609 Reads or writes a structure.
1610 ********************************************************************/
1612 BOOL
net_io_q_sam_logoff(char *desc
, NET_Q_SAM_LOGOFF
*q_l
, prs_struct
*ps
, int depth
)
1617 prs_debug(ps
, depth
, desc
, "net_io_q_sam_logoff");
1623 if(!smb_io_sam_info("", &q_l
->sam_id
, ps
, depth
)) /* domain SID */
1629 /*******************************************************************
1630 Reads or writes a structure.
1631 ********************************************************************/
1633 BOOL
net_io_r_sam_logoff(char *desc
, NET_R_SAM_LOGOFF
*r_l
, prs_struct
*ps
, int depth
)
1638 prs_debug(ps
, depth
, desc
, "net_io_r_sam_logoff");
1644 if(!prs_uint32("buffer_creds", ps
, depth
, &r_l
->buffer_creds
)) /* undocumented buffer pointer */
1646 if(!smb_io_cred("", &r_l
->srv_creds
, ps
, depth
)) /* server credentials. server time stamp appears to be ignored. */
1649 if(!prs_ntstatus("status ", ps
, depth
, &r_l
->status
))
1655 /*******************************************************************
1656 makes a NET_Q_SAM_SYNC structure.
1657 ********************************************************************/
1658 BOOL
init_net_q_sam_sync(NET_Q_SAM_SYNC
* q_s
, const char *srv_name
,
1659 const char *cli_name
, DOM_CRED
*cli_creds
,
1660 DOM_CRED
*ret_creds
, uint32 database_id
,
1663 DEBUG(5, ("init_q_sam_sync\n"));
1665 init_unistr2(&q_s
->uni_srv_name
, srv_name
, strlen(srv_name
) + 1);
1666 init_unistr2(&q_s
->uni_cli_name
, cli_name
, strlen(cli_name
) + 1);
1669 memcpy(&q_s
->cli_creds
, cli_creds
, sizeof(q_s
->cli_creds
));
1672 memcpy(&q_s
->ret_creds
, ret_creds
, sizeof(q_s
->ret_creds
));
1674 memset(&q_s
->ret_creds
, 0, sizeof(q_s
->ret_creds
));
1676 q_s
->database_id
= database_id
;
1677 q_s
->restart_state
= 0;
1678 q_s
->sync_context
= next_rid
;
1679 q_s
->max_size
= 0xffff;
1684 /*******************************************************************
1685 reads or writes a structure.
1686 ********************************************************************/
1687 BOOL
net_io_q_sam_sync(char *desc
, NET_Q_SAM_SYNC
* q_s
, prs_struct
*ps
,
1690 prs_debug(ps
, depth
, desc
, "net_io_q_sam_sync");
1693 if (!smb_io_unistr2("", &q_s
->uni_srv_name
, True
, ps
, depth
))
1695 if (!smb_io_unistr2("", &q_s
->uni_cli_name
, True
, ps
, depth
))
1698 if (!smb_io_cred("", &q_s
->cli_creds
, ps
, depth
))
1700 if (!smb_io_cred("", &q_s
->ret_creds
, ps
, depth
))
1703 if (!prs_uint32("database_id ", ps
, depth
, &q_s
->database_id
))
1705 if (!prs_uint32("restart_state", ps
, depth
, &q_s
->restart_state
))
1707 if (!prs_uint32("sync_context ", ps
, depth
, &q_s
->sync_context
))
1710 if (!prs_uint32("max_size", ps
, depth
, &q_s
->max_size
))
1716 /*******************************************************************
1717 reads or writes a structure.
1718 ********************************************************************/
1719 static BOOL
net_io_sam_delta_hdr(char *desc
, SAM_DELTA_HDR
* delta
,
1720 prs_struct
*ps
, int depth
)
1722 prs_debug(ps
, depth
, desc
, "net_io_sam_delta_hdr");
1725 if (!prs_uint16("type", ps
, depth
, &delta
->type
))
1727 if (!prs_uint16("type2", ps
, depth
, &delta
->type2
))
1729 if (!prs_uint32("target_rid", ps
, depth
, &delta
->target_rid
))
1732 if (!prs_uint32("type3", ps
, depth
, &delta
->type3
))
1735 /* Not sure why we need this but it seems to be necessary to get
1736 sam deltas working. */
1738 if (delta
->type
!= 0x16) {
1739 if (!prs_uint32("ptr_delta", ps
, depth
, &delta
->ptr_delta
))
1746 /*******************************************************************
1747 reads or writes a structure.
1748 ********************************************************************/
1749 static BOOL
net_io_sam_delta_mod_count(char *desc
, SAM_DELTA_MOD_COUNT
*info
,
1750 prs_struct
*ps
, int depth
)
1752 prs_debug(ps
, depth
, desc
, "net_io_sam_delta_stamp");
1755 if (!prs_uint32("seqnum", ps
, depth
, &info
->seqnum
))
1757 if (!prs_uint32("dom_mod_count_ptr", ps
, depth
,
1758 &info
->dom_mod_count_ptr
))
1761 if (info
->dom_mod_count_ptr
) {
1762 if (!prs_uint64("dom_mod_count", ps
, depth
,
1763 &info
->dom_mod_count
))
1770 /*******************************************************************
1771 reads or writes a structure.
1772 ********************************************************************/
1773 static BOOL
net_io_sam_domain_info(char *desc
, SAM_DOMAIN_INFO
* info
,
1774 prs_struct
*ps
, int depth
)
1776 prs_debug(ps
, depth
, desc
, "net_io_sam_domain_info");
1779 if (!smb_io_unihdr("hdr_dom_name", &info
->hdr_dom_name
, ps
, depth
))
1781 if (!smb_io_unihdr("hdr_oem_info", &info
->hdr_oem_info
, ps
, depth
))
1784 if (!prs_uint64("force_logoff", ps
, depth
, &info
->force_logoff
))
1786 if (!prs_uint16("min_pwd_len", ps
, depth
, &info
->min_pwd_len
))
1788 if (!prs_uint16("pwd_history_len", ps
, depth
, &info
->pwd_history_len
))
1790 if (!prs_uint64("max_pwd_age", ps
, depth
, &info
->max_pwd_age
))
1792 if (!prs_uint64("min_pwd_age", ps
, depth
, &info
->min_pwd_age
))
1794 if (!prs_uint64("dom_mod_count", ps
, depth
, &info
->dom_mod_count
))
1796 if (!smb_io_time("creation_time", &info
->creation_time
, ps
, depth
))
1799 if (!smb_io_bufhdr2("hdr_sec_desc", &info
->hdr_sec_desc
, ps
, depth
))
1801 if (!smb_io_unihdr("hdr_unknown", &info
->hdr_unknown
, ps
, depth
))
1804 if (ps
->data_offset
+ 40 > ps
->buffer_size
)
1806 ps
->data_offset
+= 40;
1808 if (!smb_io_unistr2("uni_dom_name", &info
->uni_dom_name
,
1809 info
->hdr_dom_name
.buffer
, ps
, depth
))
1811 if (!smb_io_unistr2("buf_oem_info", &info
->buf_oem_info
,
1812 info
->hdr_oem_info
.buffer
, ps
, depth
))
1815 if (!smb_io_buffer4("buf_sec_desc", &info
->buf_sec_desc
,
1816 info
->hdr_sec_desc
.buffer
, ps
, depth
))
1818 if (!smb_io_unistr2("buf_unknown", &info
->buf_unknown
,
1819 info
->hdr_unknown
.buffer
, ps
, depth
))
1825 /*******************************************************************
1826 reads or writes a structure.
1827 ********************************************************************/
1828 static BOOL
net_io_sam_group_info(char *desc
, SAM_GROUP_INFO
* info
,
1829 prs_struct
*ps
, int depth
)
1831 prs_debug(ps
, depth
, desc
, "net_io_sam_group_info");
1834 if (!smb_io_unihdr("hdr_grp_name", &info
->hdr_grp_name
, ps
, depth
))
1836 if (!smb_io_gid("gid", &info
->gid
, ps
, depth
))
1838 if (!smb_io_unihdr("hdr_grp_desc", &info
->hdr_grp_desc
, ps
, depth
))
1840 if (!smb_io_bufhdr2("hdr_sec_desc", &info
->hdr_sec_desc
, ps
, depth
))
1843 if (ps
->data_offset
+ 48 > ps
->buffer_size
)
1845 ps
->data_offset
+= 48;
1847 if (!smb_io_unistr2("uni_grp_name", &info
->uni_grp_name
,
1848 info
->hdr_grp_name
.buffer
, ps
, depth
))
1850 if (!smb_io_unistr2("uni_grp_desc", &info
->uni_grp_desc
,
1851 info
->hdr_grp_desc
.buffer
, ps
, depth
))
1853 if (!smb_io_buffer4("buf_sec_desc", &info
->buf_sec_desc
,
1854 info
->hdr_sec_desc
.buffer
, ps
, depth
))
1860 /*******************************************************************
1861 reads or writes a structure.
1862 ********************************************************************/
1863 static BOOL
net_io_sam_passwd_info(char *desc
, SAM_PWD
* pwd
,
1864 prs_struct
*ps
, int depth
)
1866 prs_debug(ps
, depth
, desc
, "net_io_sam_passwd_info");
1869 if (!prs_uint32("unk_0 ", ps
, depth
, &pwd
->unk_0
))
1872 if (!smb_io_unihdr("hdr_lm_pwd", &pwd
->hdr_lm_pwd
, ps
, depth
))
1874 if (!prs_uint8s(False
, "buf_lm_pwd", ps
, depth
, pwd
->buf_lm_pwd
, 16))
1877 if (!smb_io_unihdr("hdr_nt_pwd", &pwd
->hdr_nt_pwd
, ps
, depth
))
1879 if (!prs_uint8s(False
, "buf_nt_pwd", ps
, depth
, pwd
->buf_nt_pwd
, 16))
1882 if (!smb_io_unihdr("", &pwd
->hdr_empty_lm
, ps
, depth
))
1884 if (!smb_io_unihdr("", &pwd
->hdr_empty_nt
, ps
, depth
))
1890 /*******************************************************************
1891 makes a SAM_ACCOUNT_INFO structure.
1892 ********************************************************************/
1893 BOOL
make_sam_account_info(SAM_ACCOUNT_INFO
* info
,
1894 const UNISTR2
*user_name
,
1895 const UNISTR2
*full_name
,
1896 uint32 user_rid
, uint32 group_rid
,
1897 const UNISTR2
*home_dir
,
1898 const UNISTR2
*dir_drive
,
1899 const UNISTR2
*log_scr
,
1900 const UNISTR2
*desc
,
1902 const UNISTR2
*prof_path
,
1903 const UNISTR2
*wkstas
,
1904 const UNISTR2
*unk_str
, const UNISTR2
*mung_dial
)
1906 int len_user_name
= user_name
!= NULL
? user_name
->uni_str_len
: 0;
1907 int len_full_name
= full_name
!= NULL
? full_name
->uni_str_len
: 0;
1908 int len_home_dir
= home_dir
!= NULL
? home_dir
->uni_str_len
: 0;
1909 int len_dir_drive
= dir_drive
!= NULL
? dir_drive
->uni_str_len
: 0;
1910 int len_logon_script
= log_scr
!= NULL
? log_scr
->uni_str_len
: 0;
1911 int len_profile_path
= prof_path
!= NULL
? prof_path
->uni_str_len
: 0;
1912 int len_description
= desc
!= NULL
? desc
->uni_str_len
: 0;
1913 int len_workstations
= wkstas
!= NULL
? wkstas
->uni_str_len
: 0;
1914 int len_unknown_str
= unk_str
!= NULL
? unk_str
->uni_str_len
: 0;
1915 int len_munged_dial
= mung_dial
!= NULL
? mung_dial
->uni_str_len
: 0;
1917 DEBUG(5, ("make_sam_account_info\n"));
1919 make_uni_hdr(&info
->hdr_acct_name
, len_user_name
);
1920 make_uni_hdr(&info
->hdr_full_name
, len_full_name
);
1921 make_uni_hdr(&info
->hdr_home_dir
, len_home_dir
);
1922 make_uni_hdr(&info
->hdr_dir_drive
, len_dir_drive
);
1923 make_uni_hdr(&info
->hdr_logon_script
, len_logon_script
);
1924 make_uni_hdr(&info
->hdr_profile
, len_profile_path
);
1925 make_uni_hdr(&info
->hdr_acct_desc
, len_description
);
1926 make_uni_hdr(&info
->hdr_workstations
, len_workstations
);
1927 make_uni_hdr(&info
->hdr_comment
, len_unknown_str
);
1928 make_uni_hdr(&info
->hdr_parameters
, len_munged_dial
);
1931 make_bufhdr2(&info
->hdr_sec_desc
, 0, 0, 0);
1933 info
->user_rid
= user_rid
;
1934 info
->group_rid
= group_rid
;
1936 init_nt_time(&info
->logon_time
);
1937 init_nt_time(&info
->logoff_time
);
1938 init_nt_time(&info
->pwd_last_set_time
);
1939 init_nt_time(&info
->acct_expiry_time
);
1941 info
->logon_divs
= 0xA8;
1942 info
->ptr_logon_hrs
= 0; /* Don't care right now */
1944 info
->bad_pwd_count
= 0;
1945 info
->logon_count
= 0;
1946 info
->acb_info
= acb_info
;
1947 info
->nt_pwd_present
= 0;
1948 info
->lm_pwd_present
= 0;
1949 info
->pwd_expired
= 0;
1953 info
->unknown1
= 0x4EC;
1956 copy_unistr2(&info
->uni_acct_name
, user_name
);
1957 copy_unistr2(&info
->uni_full_name
, full_name
);
1958 copy_unistr2(&info
->uni_home_dir
, home_dir
);
1959 copy_unistr2(&info
->uni_dir_drive
, dir_drive
);
1960 copy_unistr2(&info
->uni_logon_script
, log_scr
);
1961 copy_unistr2(&info
->uni_profile
, prof_path
);
1962 copy_unistr2(&info
->uni_acct_desc
, desc
);
1963 copy_unistr2(&info
->uni_workstations
, wkstas
);
1964 copy_unistr2(&info
->uni_comment
, unk_str
);
1965 copy_unistr2(&info
->uni_parameters
, mung_dial
);
1970 /*******************************************************************
1971 reads or writes a structure.
1972 ********************************************************************/
1973 static BOOL
net_io_sam_account_info(char *desc
, uint8 sess_key
[16],
1974 SAM_ACCOUNT_INFO
* info
, prs_struct
*ps
,
1977 BUFHDR2 hdr_priv_data
;
1980 prs_debug(ps
, depth
, desc
, "net_io_sam_account_info");
1983 if (!smb_io_unihdr("hdr_acct_name", &info
->hdr_acct_name
, ps
, depth
))
1985 if (!smb_io_unihdr("hdr_full_name", &info
->hdr_full_name
, ps
, depth
))
1988 if (!prs_uint32("user_rid ", ps
, depth
, &info
->user_rid
))
1990 if (!prs_uint32("group_rid", ps
, depth
, &info
->group_rid
))
1993 if (!smb_io_unihdr("hdr_home_dir ", &info
->hdr_home_dir
, ps
, depth
))
1995 if (!smb_io_unihdr("hdr_dir_drive", &info
->hdr_dir_drive
, ps
, depth
))
1997 if (!smb_io_unihdr("hdr_logon_script", &info
->hdr_logon_script
, ps
,
2001 if (!smb_io_unihdr("hdr_acct_desc", &info
->hdr_acct_desc
, ps
, depth
))
2003 if (!smb_io_unihdr("hdr_workstations", &info
->hdr_workstations
, ps
,
2007 if (!smb_io_time("logon_time", &info
->logon_time
, ps
, depth
))
2009 if (!smb_io_time("logoff_time", &info
->logoff_time
, ps
, depth
))
2012 if (!prs_uint32("logon_divs ", ps
, depth
, &info
->logon_divs
))
2014 if (!prs_uint32("ptr_logon_hrs", ps
, depth
, &info
->ptr_logon_hrs
))
2017 if (!prs_uint16("bad_pwd_count", ps
, depth
, &info
->bad_pwd_count
))
2019 if (!prs_uint16("logon_count", ps
, depth
, &info
->logon_count
))
2021 if (!smb_io_time("pwd_last_set_time", &info
->pwd_last_set_time
, ps
,
2024 if (!smb_io_time("acct_expiry_time", &info
->acct_expiry_time
, ps
,
2028 if (!prs_uint32("acb_info", ps
, depth
, &info
->acb_info
))
2030 if (!prs_uint8s(False
, "nt_pwd", ps
, depth
, info
->nt_pwd
, 16))
2032 if (!prs_uint8s(False
, "lm_pwd", ps
, depth
, info
->lm_pwd
, 16))
2034 if (!prs_uint8("lm_pwd_present", ps
, depth
, &info
->lm_pwd_present
))
2036 if (!prs_uint8("nt_pwd_present", ps
, depth
, &info
->nt_pwd_present
))
2038 if (!prs_uint8("pwd_expired", ps
, depth
, &info
->pwd_expired
))
2041 if (!smb_io_unihdr("hdr_comment", &info
->hdr_comment
, ps
, depth
))
2043 if (!smb_io_unihdr("hdr_parameters", &info
->hdr_parameters
, ps
,
2046 if (!prs_uint16("country", ps
, depth
, &info
->country
))
2048 if (!prs_uint16("codepage", ps
, depth
, &info
->codepage
))
2051 if (!smb_io_bufhdr2("hdr_priv_data", &hdr_priv_data
, ps
, depth
))
2053 if (!smb_io_bufhdr2("hdr_sec_desc", &info
->hdr_sec_desc
, ps
, depth
))
2055 if (!smb_io_unihdr("hdr_profile", &info
->hdr_profile
, ps
, depth
))
2058 for (i
= 0; i
< 3; i
++)
2060 if (!smb_io_unihdr("hdr_reserved", &info
->hdr_reserved
[i
],
2065 for (i
= 0; i
< 4; i
++)
2067 if (!prs_uint32("dw_reserved", ps
, depth
,
2068 &info
->dw_reserved
[i
]))
2072 if (!smb_io_unistr2("uni_acct_name", &info
->uni_acct_name
,
2073 info
->hdr_acct_name
.buffer
, ps
, depth
))
2076 if (!smb_io_unistr2("uni_full_name", &info
->uni_full_name
,
2077 info
->hdr_full_name
.buffer
, ps
, depth
))
2080 if (!smb_io_unistr2("uni_home_dir ", &info
->uni_home_dir
,
2081 info
->hdr_home_dir
.buffer
, ps
, depth
))
2084 if (!smb_io_unistr2("uni_dir_drive", &info
->uni_dir_drive
,
2085 info
->hdr_dir_drive
.buffer
, ps
, depth
))
2088 if (!smb_io_unistr2("uni_logon_script", &info
->uni_logon_script
,
2089 info
->hdr_logon_script
.buffer
, ps
, depth
))
2092 if (!smb_io_unistr2("uni_acct_desc", &info
->uni_acct_desc
,
2093 info
->hdr_acct_desc
.buffer
, ps
, depth
))
2096 if (!smb_io_unistr2("uni_workstations", &info
->uni_workstations
,
2097 info
->hdr_workstations
.buffer
, ps
, depth
))
2101 if (!prs_uint32("unknown1", ps
, depth
, &info
->unknown1
))
2103 if (!prs_uint32("unknown2", ps
, depth
, &info
->unknown2
))
2106 if (!smb_io_buffer4("buf_logon_hrs", &info
->buf_logon_hrs
,
2107 info
->ptr_logon_hrs
, ps
, depth
))
2110 if (!smb_io_unistr2("uni_comment", &info
->uni_comment
,
2111 info
->hdr_comment
.buffer
, ps
, depth
))
2114 if (!smb_io_unistr2("uni_parameters", &info
->uni_parameters
,
2115 info
->hdr_parameters
.buffer
, ps
, depth
))
2118 if (hdr_priv_data
.buffer
!= 0)
2122 if (!prs_uint32("pwd_len", ps
, depth
, &len
))
2124 old_offset
= ps
->data_offset
;
2130 if (!prs_hash1(ps
, ps
->data_offset
, sess_key
))
2133 if (!net_io_sam_passwd_info("pass", &info
->pass
,
2140 if (!prs_hash1(ps
, old_offset
, sess_key
))
2144 if (old_offset
+ len
> ps
->buffer_size
)
2146 ps
->data_offset
= old_offset
+ len
;
2148 if (!smb_io_buffer4("buf_sec_desc", &info
->buf_sec_desc
,
2149 info
->hdr_sec_desc
.buffer
, ps
, depth
))
2152 if (!smb_io_unistr2("uni_profile", &info
->uni_profile
,
2153 info
->hdr_profile
.buffer
, ps
, depth
))
2161 /*******************************************************************
2162 reads or writes a structure.
2163 ********************************************************************/
2164 static BOOL
net_io_sam_group_mem_info(char *desc
, SAM_GROUP_MEM_INFO
* info
,
2165 prs_struct
*ps
, int depth
)
2170 prs_debug(ps
, depth
, desc
, "net_io_sam_group_mem_info");
2174 if (!prs_uint32("ptr_rids ", ps
, depth
, &info
->ptr_rids
))
2176 if (!prs_uint32("ptr_attribs", ps
, depth
, &info
->ptr_attribs
))
2178 if (!prs_uint32("num_members", ps
, depth
, &info
->num_members
))
2181 if (ps
->data_offset
+ 16 > ps
->buffer_size
)
2183 ps
->data_offset
+= 16;
2185 if (info
->ptr_rids
!= 0)
2187 if (!prs_uint32("num_members2", ps
, depth
,
2188 &info
->num_members2
))
2191 if (info
->num_members2
!= info
->num_members
)
2197 info
->rids
= talloc(ps
->mem_ctx
, sizeof(uint32
) *
2198 info
->num_members2
);
2200 if (info
->rids
== NULL
) {
2201 DEBUG(0, ("out of memory allocating %d rids\n",
2202 info
->num_members2
));
2206 for (i
= 0; i
< info
->num_members2
; i
++)
2208 slprintf(tmp
, sizeof(tmp
) - 1, "rids[%02d]", i
);
2209 if (!prs_uint32(tmp
, ps
, depth
, &info
->rids
[i
]))
2214 if (info
->ptr_attribs
!= 0)
2216 if (!prs_uint32("num_members3", ps
, depth
,
2217 &info
->num_members3
))
2219 if (info
->num_members3
!= info
->num_members
)
2225 info
->attribs
= talloc(ps
->mem_ctx
, sizeof(uint32
) *
2226 info
->num_members3
);
2228 if (info
->attribs
== NULL
) {
2229 DEBUG(0, ("out of memory allocating %d attribs\n",
2230 info
->num_members3
));
2234 for (i
= 0; i
< info
->num_members3
; i
++)
2236 slprintf(tmp
, sizeof(tmp
) - 1, "attribs[%02d]", i
);
2237 if (!prs_uint32(tmp
, ps
, depth
, &info
->attribs
[i
]))
2245 /*******************************************************************
2246 reads or writes a structure.
2247 ********************************************************************/
2248 static BOOL
net_io_sam_alias_info(char *desc
, SAM_ALIAS_INFO
* info
,
2249 prs_struct
*ps
, int depth
)
2251 prs_debug(ps
, depth
, desc
, "net_io_sam_alias_info");
2254 if (!smb_io_unihdr("hdr_als_name", &info
->hdr_als_name
, ps
, depth
))
2256 if (!prs_uint32("als_rid", ps
, depth
, &info
->als_rid
))
2258 if (!smb_io_bufhdr2("hdr_sec_desc", &info
->hdr_sec_desc
, ps
, depth
))
2260 if (!smb_io_unihdr("hdr_als_desc", &info
->hdr_als_desc
, ps
, depth
))
2263 if (ps
->data_offset
+ 40 > ps
->buffer_size
)
2265 ps
->data_offset
+= 40;
2267 if (!smb_io_unistr2("uni_als_name", &info
->uni_als_name
,
2268 info
->hdr_als_name
.buffer
, ps
, depth
))
2270 if (!smb_io_buffer4("buf_sec_desc", &info
->buf_sec_desc
,
2271 info
->hdr_sec_desc
.buffer
, ps
, depth
))
2273 if (!smb_io_unistr2("uni_als_desc", &info
->uni_als_desc
,
2274 info
->hdr_als_name
.buffer
, ps
, depth
))
2280 /*******************************************************************
2281 reads or writes a structure.
2282 ********************************************************************/
2283 static BOOL
net_io_sam_alias_mem_info(char *desc
, SAM_ALIAS_MEM_INFO
* info
,
2284 prs_struct
*ps
, int depth
)
2289 prs_debug(ps
, depth
, desc
, "net_io_sam_alias_mem_info");
2293 if (!prs_uint32("num_members", ps
, depth
, &info
->num_members
))
2295 if (!prs_uint32("ptr_members", ps
, depth
, &info
->ptr_members
))
2298 if (info
->ptr_members
!= 0)
2300 if (ps
->data_offset
+ 16 > ps
->buffer_size
)
2302 ps
->data_offset
+= 16;
2304 if (!prs_uint32("num_sids", ps
, depth
, &info
->num_sids
))
2306 if (info
->num_sids
!= info
->num_members
)
2312 info
->ptr_sids
= talloc(ps
->mem_ctx
, sizeof(uint32
) *
2315 if (info
->ptr_sids
== NULL
) {
2316 DEBUG(0, ("out of memory allocating %d ptr_sids\n",
2321 for (i
= 0; i
< info
->num_sids
; i
++)
2323 slprintf(tmp
, sizeof(tmp
) - 1, "ptr_sids[%02d]", i
);
2324 if (!prs_uint32(tmp
, ps
, depth
, &info
->ptr_sids
[i
]))
2328 info
->sids
= talloc(ps
->mem_ctx
, sizeof(DOM_SID2
) *
2331 if (info
->sids
== NULL
) {
2332 DEBUG(0, ("error allocating %d sids\n",
2337 for (i
= 0; i
< info
->num_sids
; i
++)
2339 if (info
->ptr_sids
[i
] != 0)
2341 slprintf(tmp
, sizeof(tmp
) - 1, "sids[%02d]",
2343 if (!smb_io_dom_sid2(tmp
, &info
->sids
[i
],
2353 /*******************************************************************
2354 reads or writes a structure.
2355 ********************************************************************/
2356 static BOOL
net_io_sam_policy_info(char *desc
, SAM_DELTA_POLICY
*info
,
2357 prs_struct
*ps
, int depth
)
2360 prs_debug(ps
, depth
, desc
, "net_io_sam_policy_info");
2366 if (!prs_uint32("max_log_size", ps
, depth
, &info
->max_log_size
))
2368 if (!prs_uint64("audit_retention_period", ps
, depth
,
2369 &info
->audit_retention_period
))
2371 if (!prs_uint32("auditing_mode", ps
, depth
, &info
->auditing_mode
))
2373 if (!prs_uint32("num_events", ps
, depth
, &info
->num_events
))
2375 if (!prs_uint32("ptr_events", ps
, depth
, &info
->ptr_events
))
2378 if (!smb_io_unihdr("hdr_dom_name", &info
->hdr_dom_name
, ps
, depth
))
2381 if (!prs_uint32("sid_ptr", ps
, depth
, &info
->sid_ptr
))
2384 if (!prs_uint32("paged_pool_limit", ps
, depth
, &info
->paged_pool_limit
))
2386 if (!prs_uint32("non_paged_pool_limit", ps
, depth
,
2387 &info
->non_paged_pool_limit
))
2389 if (!prs_uint32("min_workset_size", ps
, depth
, &info
->min_workset_size
))
2391 if (!prs_uint32("max_workset_size", ps
, depth
, &info
->max_workset_size
))
2393 if (!prs_uint32("page_file_limit", ps
, depth
, &info
->page_file_limit
))
2395 if (!prs_uint64("time_limit", ps
, depth
, &info
->time_limit
))
2397 if (!smb_io_time("modify_time", &info
->modify_time
, ps
, depth
))
2399 if (!smb_io_time("create_time", &info
->create_time
, ps
, depth
))
2401 if (!smb_io_bufhdr2("hdr_sec_desc", &info
->hdr_sec_desc
, ps
, depth
))
2404 for (i
=0; i
<4; i
++) {
2406 if (!smb_io_unihdr("dummy", &dummy
, ps
, depth
))
2410 for (i
=0; i
<4; i
++) {
2412 if (!prs_uint32("reserved", ps
, depth
, &reserved
))
2416 if (!prs_uint32("num_event_audit_options", ps
, depth
,
2417 &info
->num_event_audit_options
))
2420 for (i
=0; i
<info
->num_event_audit_options
; i
++)
2421 if (!prs_uint32("event_audit_option", ps
, depth
,
2422 &info
->event_audit_option
))
2425 if (!smb_io_unistr2("domain_name", &info
->domain_name
, True
, ps
, depth
))
2428 if(!smb_io_dom_sid2("domain_sid", &info
->domain_sid
, ps
, depth
))
2431 if (!smb_io_buffer4("buf_sec_desc", &info
->buf_sec_desc
,
2432 info
->hdr_sec_desc
.buffer
, ps
, depth
))
2439 /*******************************************************************
2440 reads or writes a structure.
2441 ********************************************************************/
2442 static BOOL
net_io_sam_trustdoms_info(char *desc
, SAM_DELTA_TRUSTDOMS
*info
,
2443 prs_struct
*ps
, int depth
)
2447 prs_debug(ps
, depth
, desc
, "net_io_sam_trustdoms_info");
2453 if(!prs_uint32("buf_size", ps
, depth
, &info
->buf_size
))
2456 if(!sec_io_desc("sec_desc", &info
->sec_desc
, ps
, depth
))
2459 if(!smb_io_dom_sid2("sid", &info
->sid
, ps
, depth
))
2462 if(!smb_io_unihdr("hdr_domain", &info
->hdr_domain
, ps
, depth
))
2465 if(!prs_uint32("unknown0", ps
, depth
, &info
->unknown0
))
2467 if(!prs_uint32("unknown1", ps
, depth
, &info
->unknown1
))
2469 if(!prs_uint32("unknown2", ps
, depth
, &info
->unknown2
))
2472 if(!prs_uint32("buf_size2", ps
, depth
, &info
->buf_size2
))
2474 if(!prs_uint32("ptr", ps
, depth
, &info
->ptr
))
2477 for (i
=0; i
<12; i
++)
2478 if(!prs_uint32("unknown3", ps
, depth
, &info
->unknown3
))
2481 if (!smb_io_unistr2("domain", &info
->domain
, True
, ps
, depth
))
2487 /*******************************************************************
2488 reads or writes a structure.
2489 ********************************************************************/
2490 static BOOL
net_io_sam_secret_info(char *desc
, SAM_DELTA_SECRET
*info
,
2491 prs_struct
*ps
, int depth
)
2495 prs_debug(ps
, depth
, desc
, "net_io_sam_secret_info");
2501 if(!prs_uint32("buf_size", ps
, depth
, &info
->buf_size
))
2504 if(!sec_io_desc("sec_desc", &info
->sec_desc
, ps
, depth
))
2507 if (!smb_io_unistr2("secret", &info
->secret
, True
, ps
, depth
))
2513 if(!prs_uint32("count1", ps
, depth
, &info
->count1
))
2515 if(!prs_uint32("count2", ps
, depth
, &info
->count2
))
2517 if(!prs_uint32("ptr", ps
, depth
, &info
->ptr
))
2521 if(!smb_io_time("time1", &info
->time1
, ps
, depth
)) /* logon time */
2523 if(!prs_uint32("count3", ps
, depth
, &info
->count3
))
2525 if(!prs_uint32("count4", ps
, depth
, &info
->count4
))
2527 if(!prs_uint32("ptr2", ps
, depth
, &info
->ptr2
))
2529 if(!smb_io_time("time2", &info
->time2
, ps
, depth
)) /* logon time */
2531 if(!prs_uint32("unknow1", ps
, depth
, &info
->unknow1
))
2535 if(!prs_uint32("buf_size2", ps
, depth
, &info
->buf_size2
))
2537 if(!prs_uint32("ptr3", ps
, depth
, &info
->ptr3
))
2540 if(!prs_uint32("unknow2", ps
, depth
, &info
->unknow2
))
2543 if(!prs_uint32("chal_len", ps
, depth
, &info
->chal_len
))
2545 if(!prs_uint32("reserved1", ps
, depth
, &info
->reserved1
))
2547 if(!prs_uint32("chal_len2", ps
, depth
, &info
->chal_len2
))
2550 if(!prs_uint8s (False
, "chal", ps
, depth
, info
->chal
, info
->chal_len2
))
2553 if(!prs_uint32("key_len", ps
, depth
, &info
->key_len
))
2555 if(!prs_uint32("reserved2", ps
, depth
, &info
->reserved2
))
2557 if(!prs_uint32("key_len2", ps
, depth
, &info
->key_len2
))
2560 if(!prs_uint8s (False
, "key", ps
, depth
, info
->key
, info
->key_len2
))
2564 if(!prs_uint32("buf_size3", ps
, depth
, &info
->buf_size3
))
2567 if(!sec_io_desc("sec_desc2", &info
->sec_desc2
, ps
, depth
))
2574 /*******************************************************************
2575 reads or writes a structure.
2576 ********************************************************************/
2577 static BOOL
net_io_sam_privs_info(char *desc
, SAM_DELTA_PRIVS
*info
,
2578 prs_struct
*ps
, int depth
)
2582 prs_debug(ps
, depth
, desc
, "net_io_sam_privs_info");
2588 if(!smb_io_dom_sid2("sid", &info
->sid
, ps
, depth
))
2591 if(!prs_uint32("priv_count", ps
, depth
, &info
->priv_count
))
2593 if(!prs_uint32("priv_control", ps
, depth
, &info
->priv_control
))
2596 if(!prs_uint32("priv_attr_ptr", ps
, depth
, &info
->priv_attr_ptr
))
2598 if(!prs_uint32("priv_name_ptr", ps
, depth
, &info
->priv_name_ptr
))
2601 if (!prs_uint32("paged_pool_limit", ps
, depth
, &info
->paged_pool_limit
))
2603 if (!prs_uint32("non_paged_pool_limit", ps
, depth
,
2604 &info
->non_paged_pool_limit
))
2606 if (!prs_uint32("min_workset_size", ps
, depth
, &info
->min_workset_size
))
2608 if (!prs_uint32("max_workset_size", ps
, depth
, &info
->max_workset_size
))
2610 if (!prs_uint32("page_file_limit", ps
, depth
, &info
->page_file_limit
))
2612 if (!prs_uint64("time_limit", ps
, depth
, &info
->time_limit
))
2614 if (!prs_uint32("system_flags", ps
, depth
, &info
->system_flags
))
2616 if (!smb_io_bufhdr2("hdr_sec_desc", &info
->hdr_sec_desc
, ps
, depth
))
2619 for (i
=0; i
<4; i
++) {
2621 if (!smb_io_unihdr("dummy", &dummy
, ps
, depth
))
2625 for (i
=0; i
<4; i
++) {
2627 if (!prs_uint32("reserved", ps
, depth
, &reserved
))
2631 if(!prs_uint32("attribute_count", ps
, depth
, &info
->attribute_count
))
2634 info
->attributes
= talloc(ps
->mem_ctx
, sizeof(uint32
) * info
->attribute_count
);
2636 for (i
=0; i
<info
->attribute_count
; i
++)
2637 if(!prs_uint32("attributes", ps
, depth
, &info
->attributes
[i
]))
2640 if(!prs_uint32("privlist_count", ps
, depth
, &info
->privlist_count
))
2643 info
->hdr_privslist
= talloc(ps
->mem_ctx
, sizeof(UNIHDR
) * info
->privlist_count
);
2644 info
->uni_privslist
= talloc(ps
->mem_ctx
, sizeof(UNISTR2
) * info
->privlist_count
);
2646 for (i
=0; i
<info
->privlist_count
; i
++)
2647 if(!smb_io_unihdr("hdr_privslist", &info
->hdr_privslist
[i
], ps
, depth
))
2650 for (i
=0; i
<info
->privlist_count
; i
++)
2651 if (!smb_io_unistr2("uni_privslist", &info
->uni_privslist
[i
], True
, ps
, depth
))
2654 if (!smb_io_buffer4("buf_sec_desc", &info
->buf_sec_desc
,
2655 info
->hdr_sec_desc
.buffer
, ps
, depth
))
2661 /*******************************************************************
2662 reads or writes a structure.
2663 ********************************************************************/
2664 static BOOL
net_io_sam_delta_ctr(char *desc
, uint8 sess_key
[16],
2665 SAM_DELTA_CTR
* delta
, uint16 type
,
2666 prs_struct
*ps
, int depth
)
2668 prs_debug(ps
, depth
, desc
, "net_io_sam_delta_ctr");
2672 /* Seen in sam deltas */
2673 case SAM_DELTA_MODIFIED_COUNT
:
2674 if (!net_io_sam_delta_mod_count("", &delta
->mod_count
, ps
, depth
))
2678 case SAM_DELTA_DOMAIN_INFO
:
2679 if (!net_io_sam_domain_info("", &delta
->domain_info
, ps
, depth
))
2683 case SAM_DELTA_GROUP_INFO
:
2684 if (!net_io_sam_group_info("", &delta
->group_info
, ps
, depth
))
2688 case SAM_DELTA_ACCOUNT_INFO
:
2689 if (!net_io_sam_account_info("", sess_key
, &delta
->account_info
, ps
, depth
))
2693 case SAM_DELTA_GROUP_MEM
:
2694 if (!net_io_sam_group_mem_info("", &delta
->grp_mem_info
, ps
, depth
))
2698 case SAM_DELTA_ALIAS_INFO
:
2699 if (!net_io_sam_alias_info("", &delta
->alias_info
, ps
, depth
))
2703 case SAM_DELTA_POLICY_INFO
:
2704 if (!net_io_sam_policy_info("", &delta
->policy_info
, ps
, depth
))
2708 case SAM_DELTA_ALIAS_MEM
:
2709 if (!net_io_sam_alias_mem_info("", &delta
->als_mem_info
, ps
, depth
))
2713 case SAM_DELTA_PRIVS_INFO
:
2714 if (!net_io_sam_privs_info("", &delta
->privs_info
, ps
, depth
))
2718 case SAM_DELTA_TRUST_DOMS
:
2719 if (!net_io_sam_trustdoms_info("", &delta
->trustdoms_info
, ps
, depth
))
2723 case SAM_DELTA_SECRET_INFO
:
2724 if (!net_io_sam_secret_info("", &delta
->secret_info
, ps
, depth
))
2728 /* These guys are not implemented yet */
2730 case SAM_DELTA_RENAME_GROUP
:
2731 case SAM_DELTA_RENAME_USER
:
2732 case SAM_DELTA_RENAME_ALIAS
:
2733 case SAM_DELTA_DELETE_GROUP
:
2734 case SAM_DELTA_DELETE_USER
:
2736 DEBUG(0, ("Replication error: Unknown delta type 0x%x\n", type
));
2743 /*******************************************************************
2744 reads or writes a structure.
2745 ********************************************************************/
2746 BOOL
net_io_r_sam_sync(char *desc
, uint8 sess_key
[16],
2747 NET_R_SAM_SYNC
* r_s
, prs_struct
*ps
, int depth
)
2751 prs_debug(ps
, depth
, desc
, "net_io_r_sam_sync");
2754 if (!smb_io_cred("srv_creds", &r_s
->srv_creds
, ps
, depth
))
2756 if (!prs_uint32("sync_context", ps
, depth
, &r_s
->sync_context
))
2759 if (!prs_uint32("ptr_deltas", ps
, depth
, &r_s
->ptr_deltas
))
2761 if (r_s
->ptr_deltas
!= 0)
2763 if (!prs_uint32("num_deltas ", ps
, depth
, &r_s
->num_deltas
))
2765 if (!prs_uint32("ptr_deltas2", ps
, depth
, &r_s
->ptr_deltas2
))
2767 if (r_s
->ptr_deltas2
!= 0)
2769 if (!prs_uint32("num_deltas2", ps
, depth
,
2773 if (r_s
->num_deltas2
!= r_s
->num_deltas
)
2779 if (r_s
->num_deltas2
> 0) {
2780 r_s
->hdr_deltas
= (SAM_DELTA_HDR
*)
2781 talloc(ps
->mem_ctx
, r_s
->num_deltas2
*
2782 sizeof(SAM_DELTA_HDR
));
2784 if (r_s
->hdr_deltas
== NULL
) {
2785 DEBUG(0, ("error tallocating memory "
2786 "for %d delta headers\n",
2792 for (i
= 0; i
< r_s
->num_deltas2
; i
++)
2794 if (!net_io_sam_delta_hdr("",
2795 &r_s
->hdr_deltas
[i
],
2800 if (r_s
->num_deltas2
> 0) {
2801 r_s
->deltas
= (SAM_DELTA_CTR
*)
2802 talloc(ps
->mem_ctx
, r_s
->num_deltas2
*
2803 sizeof(SAM_DELTA_CTR
));
2805 if (r_s
->deltas
== NULL
) {
2806 DEBUG(0, ("error tallocating memory "
2813 for (i
= 0; i
< r_s
->num_deltas2
; i
++)
2815 if (!net_io_sam_delta_ctr(
2816 "", sess_key
, &r_s
->deltas
[i
],
2817 r_s
->hdr_deltas
[i
].type3
,
2819 DEBUG(0, ("hmm, failed on i=%d\n", i
));
2827 if (!prs_ntstatus("status", ps
, depth
, &(r_s
->status
)))
2833 /*******************************************************************
2834 makes a NET_Q_SAM_DELTAS structure.
2835 ********************************************************************/
2836 BOOL
init_net_q_sam_deltas(NET_Q_SAM_DELTAS
*q_s
, const char *srv_name
,
2837 const char *cli_name
, DOM_CRED
*cli_creds
,
2838 uint32 database_id
, UINT64_S dom_mod_count
)
2840 DEBUG(5, ("init_net_q_sam_deltas\n"));
2842 init_unistr2(&q_s
->uni_srv_name
, srv_name
, strlen(srv_name
) + 1);
2843 init_unistr2(&q_s
->uni_cli_name
, cli_name
, strlen(cli_name
) + 1);
2845 memcpy(&q_s
->cli_creds
, cli_creds
, sizeof(q_s
->cli_creds
));
2846 memset(&q_s
->ret_creds
, 0, sizeof(q_s
->ret_creds
));
2848 q_s
->database_id
= database_id
;
2849 q_s
->dom_mod_count
.low
= dom_mod_count
.low
;
2850 q_s
->dom_mod_count
.high
= dom_mod_count
.high
;
2851 q_s
->max_size
= 0xffff;
2856 /*******************************************************************
2857 reads or writes a structure.
2858 ********************************************************************/
2859 BOOL
net_io_q_sam_deltas(char *desc
, NET_Q_SAM_DELTAS
*q_s
, prs_struct
*ps
,
2862 prs_debug(ps
, depth
, desc
, "net_io_q_sam_deltas");
2865 if (!smb_io_unistr2("", &q_s
->uni_srv_name
, True
, ps
, depth
))
2867 if (!smb_io_unistr2("", &q_s
->uni_cli_name
, True
, ps
, depth
))
2870 if (!smb_io_cred("", &q_s
->cli_creds
, ps
, depth
))
2872 if (!smb_io_cred("", &q_s
->ret_creds
, ps
, depth
))
2875 if (!prs_uint32("database_id ", ps
, depth
, &q_s
->database_id
))
2877 if (!prs_uint64("dom_mod_count", ps
, depth
, &q_s
->dom_mod_count
))
2879 if (!prs_uint32("max_size", ps
, depth
, &q_s
->max_size
))
2885 /*******************************************************************
2886 reads or writes a structure.
2887 ********************************************************************/
2888 BOOL
net_io_r_sam_deltas(char *desc
, uint8 sess_key
[16],
2889 NET_R_SAM_DELTAS
*r_s
, prs_struct
*ps
, int depth
)
2893 prs_debug(ps
, depth
, desc
, "net_io_r_sam_deltas");
2896 if (!smb_io_cred("srv_creds", &r_s
->srv_creds
, ps
, depth
))
2898 if (!prs_uint64("dom_mod_count", ps
, depth
, &r_s
->dom_mod_count
))
2901 if (!prs_uint32("ptr_deltas", ps
, depth
, &r_s
->ptr_deltas
))
2903 if (!prs_uint32("num_deltas", ps
, depth
, &r_s
->num_deltas
))
2905 if (!prs_uint32("ptr_deltas2", ps
, depth
, &r_s
->num_deltas2
))
2908 if (r_s
->num_deltas2
!= 0)
2910 if (!prs_uint32("num_deltas2 ", ps
, depth
, &r_s
->num_deltas2
))
2913 if (r_s
->ptr_deltas
!= 0)
2915 if (r_s
->num_deltas
> 0) {
2916 r_s
->hdr_deltas
= (SAM_DELTA_HDR
*)
2917 talloc(ps
->mem_ctx
, r_s
->num_deltas
*
2918 sizeof(SAM_DELTA_HDR
));
2919 if (r_s
->hdr_deltas
== NULL
) {
2920 DEBUG(0, ("error tallocating memory "
2921 "for %d delta headers\n",
2927 for (i
= 0; i
< r_s
->num_deltas
; i
++)
2929 net_io_sam_delta_hdr("", &r_s
->hdr_deltas
[i
],
2933 if (r_s
->num_deltas
> 0) {
2934 r_s
->deltas
= (SAM_DELTA_CTR
*)
2935 talloc(ps
->mem_ctx
, r_s
->num_deltas
*
2936 sizeof(SAM_DELTA_CTR
));
2938 if (r_s
->deltas
== NULL
) {
2939 DEBUG(0, ("error tallocating memory "
2946 for (i
= 0; i
< r_s
->num_deltas
; i
++)
2948 if (!net_io_sam_delta_ctr(
2951 r_s
->hdr_deltas
[i
].type2
,
2960 if (!prs_ntstatus("status", ps
, depth
, &r_s
->status
))