3 * Unix SMB/Netbios implementation.
5 * RPC Pipe client / server routines
6 * Copyright (C) Andrew Tridgell 1992-1997,
7 * Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
8 * Copyright (C) Paul Ashton 1997.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 extern int DEBUGLEVEL;
32 /*******************************************************************
33 reads or writes a UTIME type.
34 ********************************************************************/
35 static void smb_io_utime(char *desc, UTIME *t, prs_struct *ps, int depth)
37 if (t == NULL) return;
39 prs_debug(ps, depth, desc, "smb_io_utime");
44 prs_uint32 ("time", ps, depth, &(t->time));
47 /*******************************************************************
48 reads or writes an NTTIME structure.
49 ********************************************************************/
50 void smb_io_time(char *desc, NTTIME *nttime, prs_struct *ps, int depth)
52 if (nttime == NULL) return;
54 prs_debug(ps, depth, desc, "smb_io_time");
59 prs_uint32("low ", ps, depth, &(nttime->low )); /* low part */
60 prs_uint32("high", ps, depth, &(nttime->high)); /* high part */
63 /*******************************************************************
64 reads or writes a LOOKUP_LEVEL structure.
65 ********************************************************************/
66 void smb_io_lookup_level(char *desc, LOOKUP_LEVEL *level, prs_struct *ps, int depth)
68 if (level == NULL) return;
70 prs_debug(ps, depth, desc, "smb_io_lookup_level");
74 prs_uint16("value", ps, depth, &(level->value));
78 /*******************************************************************
79 gets an enumeration handle from an ENUM_HND structure.
80 ********************************************************************/
81 uint32 get_enum_hnd(ENUM_HND *enh)
83 return (enh && enh->ptr_hnd != 0) ? enh->handle : 0;
86 /*******************************************************************
87 makes an ENUM_HND structure.
88 ********************************************************************/
89 void make_enum_hnd(ENUM_HND *enh, uint32 hnd)
91 if (enh == NULL) return;
93 DEBUG(5,("smb_io_enum_hnd\n"));
95 enh->ptr_hnd = (hnd != 0) ? 1 : 0;
99 /*******************************************************************
100 reads or writes an ENUM_HND structure.
101 ********************************************************************/
102 void smb_io_enum_hnd(char *desc, ENUM_HND *hnd, prs_struct *ps, int depth)
104 if (hnd == NULL) return;
106 prs_debug(ps, depth, desc, "smb_io_enum_hnd");
111 prs_uint32("ptr_hnd", ps, depth, &(hnd->ptr_hnd)); /* pointer */
112 if (hnd->ptr_hnd != 0)
114 prs_uint32("handle ", ps, depth, &(hnd->handle )); /* enum handle */
118 /*******************************************************************
119 reads or writes a DOM_SID structure.
120 ********************************************************************/
121 void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth)
125 if (sid == NULL) return;
127 prs_debug(ps, depth, desc, "smb_io_dom_sid");
132 prs_uint8 ("sid_rev_num", ps, depth, &(sid->sid_rev_num));
133 prs_uint8 ("num_auths ", ps, depth, &(sid->num_auths));
135 for (i = 0; i < 6; i++)
138 slprintf(tmp, sizeof(tmp) - 1, "id_auth[%d] ", i);
139 prs_uint8 (tmp, ps, depth, &(sid->id_auth[i]));
142 /* oops! XXXX should really issue a warning here... */
143 if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS;
145 prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths);
148 /*******************************************************************
149 creates a DOM_SID structure.
151 BIG NOTE: this function only does SIDS where the identauth is not >= 2^32
152 identauth >= 2^32 can be detected because it will be specified in hex
154 ********************************************************************/
155 void make_dom_sid(DOM_SID *sid, char *str_sid)
161 if (sid == NULL) return;
165 DEBUG(4,("netlogon domain SID: none\n"));
166 sid->sid_rev_num = 0;
171 pstrcpy(domsid, str_sid);
173 DEBUG(4,("make_dom_sid %d SID: %s\n", __LINE__, domsid));
175 /* assume, but should check, that domsid starts "S-" */
176 p = strtok(domsid+2,"-");
177 sid->sid_rev_num = atoi(p);
179 /* identauth in decimal should be < 2^32 */
180 /* identauth in hex should be >= 2^32 */
181 identauth = atoi(strtok(0,"-"));
183 DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num));
184 DEBUG(4,("netlogon %s ia %d\n", p, identauth));
188 sid->id_auth[2] = (identauth & 0xff000000) >> 24;
189 sid->id_auth[3] = (identauth & 0x00ff0000) >> 16;
190 sid->id_auth[4] = (identauth & 0x0000ff00) >> 8;
191 sid->id_auth[5] = (identauth & 0x000000ff);
195 while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS)
197 sid->sub_auths[sid->num_auths++] = atoi(p);
200 DEBUG(4,("make_dom_sid: %d SID: %s\n", __LINE__, domsid));
202 /*******************************************************************
203 creates a DOM_SID2 structure.
204 ********************************************************************/
205 void make_dom_sid2(DOM_SID2 *sid2, DOM_SID *sid)
208 sid2->num_auths = sid2->sid.num_auths;
211 /*******************************************************************
212 reads or writes a DOM_SID2 structure.
213 ********************************************************************/
214 void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth)
216 if (sid == NULL) return;
218 prs_debug(ps, depth, desc, "smb_io_dom_sid2");
223 prs_uint32("num_auths", ps, depth, &(sid->num_auths));
225 smb_io_dom_sid("sid", &(sid->sid), ps, depth);
228 /*******************************************************************
229 creates a STRHDR structure.
230 ********************************************************************/
231 void make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer)
233 hdr->str_max_len = max_len;
234 hdr->str_str_len = len;
235 hdr->buffer = buffer;
238 /*******************************************************************
239 reads or writes a STRHDR structure.
240 ********************************************************************/
241 void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth)
243 if (hdr == NULL) return;
245 prs_debug(ps, depth, desc, "smb_io_strhdr");
250 prs_uint16("str_str_len", ps, depth, &(hdr->str_str_len));
251 prs_uint16("str_max_len", ps, depth, &(hdr->str_max_len));
252 prs_uint32("buffer ", ps, depth, &(hdr->buffer ));
254 /* oops! XXXX maybe issue a warning that this is happening... */
255 if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN;
256 if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN;
259 /*******************************************************************
260 creates a UNIHDR structure.
261 ********************************************************************/
262 void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer)
264 hdr->uni_max_len = 2 * max_len;
265 hdr->uni_str_len = 2 * len;
266 hdr->buffer = buffer;
269 /*******************************************************************
270 reads or writes a UNIHDR structure.
271 ********************************************************************/
272 void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth)
274 if (hdr == NULL) return;
276 prs_debug(ps, depth, desc, "smb_io_unihdr");
281 prs_uint16("uni_str_len", ps, depth, &(hdr->uni_str_len));
282 prs_uint16("uni_max_len", ps, depth, &(hdr->uni_max_len));
283 prs_uint32("buffer ", ps, depth, &(hdr->buffer ));
285 /* oops! XXXX maybe issue a warning that this is happening... */
286 if (hdr->uni_max_len > MAX_UNISTRLEN) hdr->uni_max_len = MAX_UNISTRLEN;
287 if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN;
290 /*******************************************************************
291 creates a UNIHDR2 structure.
292 ********************************************************************/
293 void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate)
295 make_uni_hdr(&(hdr->unihdr), max_len, len, terminate);
296 hdr->buffer = len > 0 ? 1 : 0;
299 /*******************************************************************
300 reads or writes a UNIHDR2 structure.
301 ********************************************************************/
302 void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth)
304 if (hdr2 == NULL) return;
306 prs_debug(ps, depth, desc, "smb_io_unihdr2");
311 smb_io_unihdr("hdr", &(hdr2->unihdr), ps, depth);
312 prs_uint32("buffer", ps, depth, &(hdr2->buffer));
315 /*******************************************************************
316 creates a UNISTR structure.
317 ********************************************************************/
318 void make_unistr(UNISTR *str, char *buf)
320 /* store the string (null-terminated copy) */
321 struni2(str->buffer, buf);
324 /*******************************************************************
325 reads or writes a UNISTR structure.
326 XXXX NOTE: UNISTR structures NEED to be null-terminated.
327 ********************************************************************/
328 void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth)
330 if (uni == NULL) return;
332 prs_debug(ps, depth, desc, "smb_io_unistr");
336 prs_unistr("unistr", ps, depth, uni);
339 /*******************************************************************
340 creates a UNINOTSTR2 structure.
341 ********************************************************************/
342 void make_uninotstr2(UNINOTSTR2 *str, char *buf, int len)
344 /* set up string lengths. add one if string is not null-terminated */
345 str->uni_max_len = (len+1)*2;
347 str->uni_buf_len = (len+1)*2;
349 /* store the string (null-terminated copy) */
350 struni2(str->buffer, buf);
353 /*******************************************************************
354 reads or writes a UNINOTSTR2 structure.
355 XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
356 the uni_str_len member tells you how long the string is;
357 the uni_max_len member tells you how large the buffer is.
358 ********************************************************************/
359 void smb_io_uninotstr2(char *desc, UNINOTSTR2 *uni2, uint32 buffer, prs_struct *ps, int depth)
361 if (uni2 == NULL) return;
365 prs_debug(ps, depth, desc, "smb_io_uninotstr2");
370 prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len));
371 prs_uint32("undoc ", ps, depth, &(uni2->undoc ));
372 prs_uint32("uni_buf_len", ps, depth, &(uni2->uni_buf_len));
374 /* oops! XXXX maybe issue a warning that this is happening... */
375 if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN;
376 if (uni2->uni_buf_len > MAX_UNISTRLEN) uni2->uni_buf_len = MAX_UNISTRLEN;
378 /* buffer advanced by indicated length of string
379 NOT by searching for null-termination */
380 prs_uninotstr2(True, "buffer ", ps, depth, uni2);
384 prs_debug(ps, depth, desc, "smb_io_uninotstr2 - NULL");
386 bzero(uni2, sizeof(*uni2));
390 /*******************************************************************
391 creates a UNISTR2 structure: sets up the buffer, too
392 ********************************************************************/
393 void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf)
398 make_unistr2(str, buf, strlen(buf)+1);
403 make_unistr2(str, "", 0);
407 /*******************************************************************
408 copies a UNISTR2 structure.
409 ********************************************************************/
410 void copy_unistr2(UNISTR2 *str, UNISTR2 *from)
412 /* set up string lengths. add one if string is not null-terminated */
413 str->uni_max_len = from->uni_max_len;
414 str->undoc = from->undoc;
415 str->uni_str_len = from->uni_str_len;
417 /* copy the string */
418 memcpy(str->buffer, from->buffer, sizeof(from->buffer));
421 /*******************************************************************
422 creates a STRING2 structure.
423 ********************************************************************/
424 void make_string2(STRING2 *str, char *buf, int len)
426 /* set up string lengths. */
427 str->str_max_len = len;
429 str->str_str_len = len;
431 /* store the string */
433 memcpy(str->buffer, buf, len);
436 /*******************************************************************
437 reads or writes a STRING2 structure.
438 XXXX NOTE: STRING2 structures need NOT be null-terminated.
439 the str_str_len member tells you how long the string is;
440 the str_max_len member tells you how large the buffer is.
441 ********************************************************************/
442 void smb_io_string2(char *desc, STRING2 *str2, uint32 buffer, prs_struct *ps, int depth)
444 if (str2 == NULL) return;
448 prs_debug(ps, depth, desc, "smb_io_string2");
453 prs_uint32("str_max_len", ps, depth, &(str2->str_max_len));
454 prs_uint32("undoc ", ps, depth, &(str2->undoc ));
455 prs_uint32("str_str_len", ps, depth, &(str2->str_str_len));
457 /* oops! XXXX maybe issue a warning that this is happening... */
458 if (str2->str_max_len > MAX_STRINGLEN) str2->str_max_len = MAX_STRINGLEN;
459 if (str2->str_str_len > MAX_STRINGLEN) str2->str_str_len = MAX_STRINGLEN;
461 /* buffer advanced by indicated length of string
462 NOT by searching for null-termination */
463 prs_string2(True, "buffer ", ps, depth, str2);
467 prs_debug(ps, depth, desc, "smb_io_string2 - NULL");
469 bzero(str2, sizeof(*str2));
473 /*******************************************************************
474 creates a UNISTR2 structure.
475 ********************************************************************/
476 void make_unistr2(UNISTR2 *str, char *buf, int len)
480 /* set up string lengths. */
481 str->uni_max_len = len;
483 str->uni_str_len = len;
485 /* store the string (null-terminated 8 bit chars into 16 bit chars) */
486 struni2(str->buffer, buf);
489 /*******************************************************************
490 reads or writes a UNISTR2 structure.
491 XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
492 the uni_str_len member tells you how long the string is;
493 the uni_max_len member tells you how large the buffer is.
494 ********************************************************************/
495 void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth)
497 if (uni2 == NULL) return;
501 prs_debug(ps, depth, desc, "smb_io_unistr2");
506 prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len));
507 prs_uint32("undoc ", ps, depth, &(uni2->undoc ));
508 prs_uint32("uni_str_len", ps, depth, &(uni2->uni_str_len));
510 /* oops! XXXX maybe issue a warning that this is happening... */
511 if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN;
512 if (uni2->uni_str_len > MAX_UNISTRLEN) uni2->uni_str_len = MAX_UNISTRLEN;
514 /* buffer advanced by indicated length of string
515 NOT by searching for null-termination */
516 prs_unistr2(True, "buffer ", ps, depth, uni2);
520 prs_debug(ps, depth, desc, "smb_io_unistr2 - NULL");
522 bzero(uni2, sizeof(*uni2));
526 /*******************************************************************
527 creates a DOM_RID2 structure.
528 ********************************************************************/
529 void make_dom_rid2(DOM_RID2 *rid2, uint32 rid)
537 /*******************************************************************
538 reads or writes a DOM_RID2 structure.
539 ********************************************************************/
540 void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth)
542 if (rid2 == NULL) return;
544 prs_debug(ps, depth, desc, "smb_io_dom_rid2");
549 /* should be value 5, so enforce it */
552 /* should be value 5, so enforce it */
555 prs_uint32("type ", ps, depth, &(rid2->type));
556 prs_uint32("undoc ", ps, depth, &(rid2->undoc ));
557 prs_uint32("rid ", ps, depth, &(rid2->rid ));
558 prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx ));
561 /*******************************************************************
562 creates a DOM_RID3 structure.
563 ********************************************************************/
564 void make_dom_rid3(DOM_RID3 *rid3, uint32 rid)
568 rid3->ptr_type = 0x1; /* non-zero, basically. */
572 /*******************************************************************
573 reads or writes a DOM_RID3 structure.
574 ********************************************************************/
575 void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth)
577 if (rid3 == NULL) return;
579 prs_debug(ps, depth, desc, "smb_io_dom_rid3");
584 prs_uint32("rid ", ps, depth, &(rid3->rid ));
585 prs_uint32("type1 ", ps, depth, &(rid3->type1 ));
586 prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type));
587 prs_uint32("type2 ", ps, depth, &(rid3->type2 ));
590 /*******************************************************************
591 creates a DOM_RID4 structure.
592 ********************************************************************/
593 void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid)
595 rid4->unknown = unknown;
601 /*******************************************************************
602 makes a DOM_CLNT_SRV structure.
603 ********************************************************************/
604 static void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name)
606 if (log == NULL) return;
608 DEBUG(5,("make_clnt_srv: %d\n", __LINE__));
610 if (logon_srv != NULL)
612 log->undoc_buffer = 1;
613 make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1);
617 log->undoc_buffer = 0;
620 if (comp_name != NULL)
622 log->undoc_buffer2 = 1;
623 make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1);
627 log->undoc_buffer2 = 0;
631 /*******************************************************************
632 reads or writes a DOM_CLNT_SRV structure.
633 ********************************************************************/
634 static void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth)
636 if (log == NULL) return;
638 prs_debug(ps, depth, desc, "smb_io_clnt_srv");
643 prs_uint32("undoc_buffer ", ps, depth, &(log->undoc_buffer ));
644 if (log->undoc_buffer != 0)
646 smb_io_unistr2("unistr2", &(log->uni_logon_srv), log->undoc_buffer, ps, depth);
651 prs_uint32("undoc_buffer2", ps, depth, &(log->undoc_buffer2));
652 if (log->undoc_buffer2 != 0)
654 smb_io_unistr2("unistr2", &(log->uni_comp_name), log->undoc_buffer2, ps, depth);
658 /*******************************************************************
659 makes a DOM_LOG_INFO structure.
660 ********************************************************************/
661 void make_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name,
662 uint16 sec_chan, char *comp_name)
664 if (log == NULL) return;
666 DEBUG(5,("make_log_info %d\n", __LINE__));
668 log->undoc_buffer = 1;
670 make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv)+1);
671 make_unistr2(&(log->uni_acct_name), acct_name, strlen(acct_name)+1);
673 log->sec_chan = sec_chan;
675 make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name)+1);
678 /*******************************************************************
679 reads or writes a DOM_LOG_INFO structure.
680 ********************************************************************/
681 void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth)
683 if (log == NULL) return;
685 prs_debug(ps, depth, desc, "smb_io_log_info");
690 prs_uint32("undoc_buffer", ps, depth, &(log->undoc_buffer));
692 smb_io_unistr2("unistr2", &(log->uni_logon_srv), True, ps, depth);
693 smb_io_unistr2("unistr2", &(log->uni_acct_name), True, ps, depth);
695 prs_uint16("sec_chan", ps, depth, &(log->sec_chan));
697 smb_io_unistr2("unistr2", &(log->uni_comp_name), True, ps, depth);
700 /*******************************************************************
701 reads or writes a DOM_CHAL structure.
702 ********************************************************************/
703 void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth)
705 if (chal == NULL) return;
707 prs_debug(ps, depth, desc, "smb_io_chal");
712 prs_uint8s (False, "data", ps, depth, chal->data, 8);
715 /*******************************************************************
716 reads or writes a DOM_CRED structure.
717 ********************************************************************/
718 void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth)
720 if (cred == NULL) return;
722 prs_debug(ps, depth, desc, "smb_io_cred");
727 smb_io_chal ("", &(cred->challenge), ps, depth);
728 smb_io_utime("", &(cred->timestamp), ps, depth);
731 /*******************************************************************
732 makes a DOM_CLNT_INFO2 structure.
733 ********************************************************************/
734 void make_clnt_info2(DOM_CLNT_INFO2 *clnt,
735 char *logon_srv, char *comp_name,
738 if (clnt == NULL) return;
740 DEBUG(5,("make_clnt_info: %d\n", __LINE__));
742 make_clnt_srv(&(clnt->login), logon_srv, comp_name);
744 if (clnt_cred != NULL)
747 memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred));
755 /*******************************************************************
756 reads or writes a DOM_CLNT_INFO2 structure.
757 ********************************************************************/
758 void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth)
760 if (clnt == NULL) return;
762 prs_debug(ps, depth, desc, "smb_io_clnt_info2");
767 smb_io_clnt_srv("", &(clnt->login), ps, depth);
771 prs_uint32("ptr_cred", ps, depth, &(clnt->ptr_cred));
772 smb_io_cred ("", &(clnt->cred ), ps, depth);
775 /*******************************************************************
776 makes a DOM_CLNT_INFO structure.
777 ********************************************************************/
778 void make_clnt_info(DOM_CLNT_INFO *clnt,
779 char *logon_srv, char *acct_name,
780 uint16 sec_chan, char *comp_name,
783 if (clnt == NULL || cred == NULL) return;
785 DEBUG(5,("make_clnt_info\n"));
787 make_log_info(&(clnt->login), logon_srv, acct_name, sec_chan, comp_name);
788 memcpy(&(clnt->cred), cred, sizeof(clnt->cred));
791 /*******************************************************************
792 reads or writes a DOM_CLNT_INFO structure.
793 ********************************************************************/
794 void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth)
796 if (clnt == NULL) return;
798 prs_debug(ps, depth, desc, "smb_io_clnt_info");
803 smb_io_log_info("", &(clnt->login), ps, depth);
804 smb_io_cred ("", &(clnt->cred ), ps, depth);
807 /*******************************************************************
808 makes a DOM_LOGON_ID structure.
809 ********************************************************************/
810 void make_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high)
812 if (log == NULL) return;
814 DEBUG(5,("make_logon_id: %d\n", __LINE__));
816 log->low = log_id_low;
817 log->high = log_id_high;
820 /*******************************************************************
821 reads or writes a DOM_LOGON_ID structure.
822 ********************************************************************/
823 void smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth)
825 if (log == NULL) return;
827 prs_debug(ps, depth, desc, "smb_io_logon_id");
832 prs_uint32("low ", ps, depth, &(log->low ));
833 prs_uint32("high", ps, depth, &(log->high));
836 /*******************************************************************
837 makes an OWF_INFO structure.
838 ********************************************************************/
839 void make_owf_info(OWF_INFO *hash, uint8 data[16])
841 if (hash == NULL) return;
843 DEBUG(5,("make_owf_info: %d\n", __LINE__));
847 memcpy(hash->data, data, sizeof(hash->data));
851 bzero(hash->data, sizeof(hash->data));
855 /*******************************************************************
856 reads or writes an OWF_INFO structure.
857 ********************************************************************/
858 void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth)
860 if (hash == NULL) return;
862 prs_debug(ps, depth, desc, "smb_io_owf_info");
867 prs_uint8s (False, "data", ps, depth, hash->data, 16);
870 /*******************************************************************
871 reads or writes a DOM_GID structure.
872 ********************************************************************/
873 void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth)
875 if (gid == NULL) return;
877 prs_debug(ps, depth, desc, "smb_io_gid");
882 prs_uint32("g_rid", ps, depth, &(gid->g_rid));
883 prs_uint32("attr ", ps, depth, &(gid->attr ));
886 /*******************************************************************
887 reads or writes an POLICY_HND structure.
888 ********************************************************************/
889 void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth)
891 if (pol == NULL) return;
893 prs_debug(ps, depth, desc, "smb_io_pol_hnd");
898 prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE);
901 /*******************************************************************
902 reads or writes a dom query structure.
903 ********************************************************************/
904 static void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth)
906 if (d_q == NULL) return;
908 prs_debug(ps, depth, desc, "smb_io_dom_query");
913 prs_uint16("uni_dom_max_len", ps, depth, &(d_q->uni_dom_max_len)); /* domain name string length * 2 */
914 prs_uint16("uni_dom_str_len", ps, depth, &(d_q->uni_dom_str_len)); /* domain name string length * 2 */
916 prs_uint32("buffer_dom_name", ps, depth, &(d_q->buffer_dom_name)); /* undocumented domain name string buffer pointer */
917 prs_uint32("buffer_dom_sid ", ps, depth, &(d_q->buffer_dom_sid )); /* undocumented domain SID string buffer pointer */
919 smb_io_unistr2("unistr2", &(d_q->uni_domain_name), d_q->buffer_dom_name, ps, depth); /* domain name (unicode string) */
921 if (d_q->buffer_dom_sid != 0)
923 smb_io_dom_sid2("", &(d_q->dom_sid), ps, depth); /* domain SID */
927 bzero(&(d_q->dom_sid), sizeof(d_q->dom_sid));
931 /*******************************************************************
932 reads or writes a dom query structure.
933 ********************************************************************/
934 void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth)
936 smb_io_dom_query("", d_q, ps, depth);
939 /*******************************************************************
940 reads or writes a dom query structure.
941 ********************************************************************/
942 void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth)
944 smb_io_dom_query("", d_q, ps, depth);
948 /*******************************************************************
949 reads or writes a DOM_NAME structure.
950 ********************************************************************/
951 void smb_io_dom_name(char *desc, DOM_NAME *name, prs_struct *ps, int depth)
953 if (name == NULL) return;
955 prs_debug(ps, depth, desc, "smb_io_dom_name");
960 prs_uint32("uni_str_len", ps, depth, &(name->uni_str_len));
962 /* don't know if len is specified by uni_str_len member... */
963 /* assume unicode string is unicode-null-terminated, instead */
965 smb_io_unistr("", &(name->str), ps, depth);