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 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 creates a DOM_SID structure.
121 BIG NOTE: this function only does SIDS where the identauth is not >= 2^32
122 identauth >= 2^32 can be detected because it will be specified in hex
124 ********************************************************************/
125 void make_dom_sid(DOM_SID *sid, char *str_sid)
131 if (sid == NULL) return;
135 DEBUG(4,("netlogon domain SID: none\n"));
136 sid->sid_rev_num = 0;
141 pstrcpy(domsid, str_sid);
143 DEBUG(4,("make_dom_sid %d SID: %s\n", __LINE__, domsid));
145 /* assume, but should check, that domsid starts "S-" */
146 p = strtok(domsid+2,"-");
147 sid->sid_rev_num = atoi(p);
149 /* identauth in decimal should be < 2^32 */
150 /* identauth in hex should be >= 2^32 */
151 identauth = atoi(strtok(0,"-"));
153 DEBUG(4,("netlogon rev %d\n", sid->sid_rev_num));
154 DEBUG(4,("netlogon %s ia %d\n", p, identauth));
158 sid->id_auth[2] = (identauth & 0xff000000) >> 24;
159 sid->id_auth[3] = (identauth & 0x00ff0000) >> 16;
160 sid->id_auth[4] = (identauth & 0x0000ff00) >> 8;
161 sid->id_auth[5] = (identauth & 0x000000ff);
165 while ((p = strtok(0, "-")) != NULL && sid->num_auths < MAXSUBAUTHS)
167 sid->sub_auths[sid->num_auths++] = atoi(p);
170 DEBUG(4,("make_dom_sid: %d SID: %s\n", __LINE__, domsid));
173 /*******************************************************************
174 reads or writes a DOM_SID structure.
175 ********************************************************************/
176 void smb_io_dom_sid(char *desc, DOM_SID *sid, prs_struct *ps, int depth)
180 if (sid == NULL) return;
182 prs_debug(ps, depth, desc, "smb_io_dom_sid");
187 prs_uint8 ("sid_rev_num", ps, depth, &(sid->sid_rev_num));
188 prs_uint8 ("num_auths ", ps, depth, &(sid->num_auths));
190 for (i = 0; i < 6; i++)
193 slprintf(tmp, sizeof(tmp) - 1, "id_auth[%d] ", i);
194 prs_uint8 (tmp, ps, depth, &(sid->id_auth[i]));
197 /* oops! XXXX should really issue a warning here... */
198 if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS;
200 prs_uint32s(False, "sub_auths ", ps, depth, sid->sub_auths, sid->num_auths);
203 /*******************************************************************
204 creates a DOM_SID2 structure.
205 ********************************************************************/
206 void make_dom_sid2(DOM_SID2 *sid, char *str_sid)
208 make_dom_sid(&(sid->sid), str_sid);
209 sid->num_auths = sid->sid.num_auths;
212 /*******************************************************************
213 reads or writes a DOM_SID2 structure.
214 ********************************************************************/
215 void smb_io_dom_sid2(char *desc, DOM_SID2 *sid, prs_struct *ps, int depth)
217 if (sid == NULL) return;
219 prs_debug(ps, depth, desc, "smb_io_dom_sid2");
224 prs_uint32("num_auths", ps, depth, &(sid->num_auths));
226 smb_io_dom_sid("sid", &(sid->sid), ps, depth);
229 /*******************************************************************
230 creates a STRHDR structure.
231 ********************************************************************/
232 void make_str_hdr(STRHDR *hdr, int max_len, int len, uint32 buffer)
234 hdr->str_max_len = max_len;
235 hdr->str_str_len = len;
236 hdr->buffer = buffer;
239 /*******************************************************************
240 reads or writes a STRHDR structure.
241 ********************************************************************/
242 void smb_io_strhdr(char *desc, STRHDR *hdr, prs_struct *ps, int depth)
244 if (hdr == NULL) return;
246 prs_debug(ps, depth, desc, "smb_io_strhdr");
251 prs_uint16("str_str_len", ps, depth, &(hdr->str_str_len));
252 prs_uint16("str_max_len", ps, depth, &(hdr->str_max_len));
253 prs_uint32("buffer ", ps, depth, &(hdr->buffer ));
255 /* oops! XXXX maybe issue a warning that this is happening... */
256 if (hdr->str_max_len > MAX_STRINGLEN) hdr->str_max_len = MAX_STRINGLEN;
257 if (hdr->str_str_len > MAX_STRINGLEN) hdr->str_str_len = MAX_STRINGLEN;
260 /*******************************************************************
261 creates a UNIHDR structure.
262 ********************************************************************/
263 void make_uni_hdr(UNIHDR *hdr, int max_len, int len, uint32 buffer)
265 hdr->uni_max_len = 2 * max_len;
266 hdr->uni_str_len = 2 * len;
267 hdr->buffer = buffer;
270 /*******************************************************************
271 reads or writes a UNIHDR structure.
272 ********************************************************************/
273 void smb_io_unihdr(char *desc, UNIHDR *hdr, prs_struct *ps, int depth)
275 if (hdr == NULL) return;
277 prs_debug(ps, depth, desc, "smb_io_unihdr");
282 prs_uint16("uni_str_len", ps, depth, &(hdr->uni_str_len));
283 prs_uint16("uni_max_len", ps, depth, &(hdr->uni_max_len));
284 prs_uint32("buffer ", ps, depth, &(hdr->buffer ));
286 /* oops! XXXX maybe issue a warning that this is happening... */
287 if (hdr->uni_max_len > MAX_UNISTRLEN) hdr->uni_max_len = MAX_UNISTRLEN;
288 if (hdr->uni_str_len > MAX_UNISTRLEN) hdr->uni_str_len = MAX_UNISTRLEN;
291 /*******************************************************************
292 creates a UNIHDR2 structure.
293 ********************************************************************/
294 void make_uni_hdr2(UNIHDR2 *hdr, int max_len, int len, uint16 terminate)
296 make_uni_hdr(&(hdr->unihdr), max_len, len, terminate);
297 hdr->buffer = len > 0 ? 1 : 0;
300 /*******************************************************************
301 reads or writes a UNIHDR2 structure.
302 ********************************************************************/
303 void smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth)
305 if (hdr2 == NULL) return;
307 prs_debug(ps, depth, desc, "smb_io_unihdr2");
312 smb_io_unihdr("hdr", &(hdr2->unihdr), ps, depth);
313 prs_uint32("buffer", ps, depth, &(hdr2->buffer));
316 /*******************************************************************
317 creates a UNISTR structure.
318 ********************************************************************/
319 void make_unistr(UNISTR *str, char *buf)
321 /* store the string (null-terminated copy) */
322 struni2(str->buffer, buf);
325 /*******************************************************************
326 reads or writes a UNISTR structure.
327 XXXX NOTE: UNISTR structures NEED to be null-terminated.
328 ********************************************************************/
329 void smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth)
331 if (uni == NULL) return;
333 prs_debug(ps, depth, desc, "smb_io_unistr");
337 prs_unistr("unistr", ps, depth, uni);
340 /*******************************************************************
341 creates a UNINOTSTR2 structure.
342 ********************************************************************/
343 void make_uninotstr2(UNINOTSTR2 *str, char *buf, int len)
345 /* set up string lengths. add one if string is not null-terminated */
346 str->uni_max_len = (len+1)*2;
348 str->uni_buf_len = (len+1)*2;
350 /* store the string (null-terminated copy) */
351 struni2(str->buffer, buf);
354 /*******************************************************************
355 reads or writes a UNINOTSTR2 structure.
356 XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
357 the uni_str_len member tells you how long the string is;
358 the uni_max_len member tells you how large the buffer is.
359 ********************************************************************/
360 void smb_io_uninotstr2(char *desc, UNINOTSTR2 *uni2, uint32 buffer, prs_struct *ps, int depth)
362 if (uni2 == NULL) return;
366 prs_debug(ps, depth, desc, "smb_io_uninotstr2");
371 prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len));
372 prs_uint32("undoc ", ps, depth, &(uni2->undoc ));
373 prs_uint32("uni_buf_len", ps, depth, &(uni2->uni_buf_len));
375 /* oops! XXXX maybe issue a warning that this is happening... */
376 if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN;
377 if (uni2->uni_buf_len > MAX_UNISTRLEN) uni2->uni_buf_len = MAX_UNISTRLEN;
379 /* buffer advanced by indicated length of string
380 NOT by searching for null-termination */
381 prs_uninotstr2(True, "buffer ", ps, depth, uni2);
385 prs_debug(ps, depth, desc, "smb_io_uninotstr2 - NULL");
387 bzero(uni2, sizeof(*uni2));
391 /*******************************************************************
392 creates a UNISTR2 structure: sets up the buffer, too
393 ********************************************************************/
394 void make_buf_unistr2(UNISTR2 *str, uint32 *ptr, char *buf)
399 make_unistr2(str, buf, strlen(buf));
404 make_unistr2(str, "", 0);
408 /*******************************************************************
409 copies a UNISTR2 structure.
410 ********************************************************************/
411 void copy_unistr2(UNISTR2 *str, UNISTR2 *from)
413 /* set up string lengths. add one if string is not null-terminated */
414 str->uni_max_len = from->uni_max_len;
415 str->undoc = from->undoc;
416 str->uni_str_len = from->uni_str_len;
418 /* copy the string */
419 memcpy(str->buffer, from->buffer, sizeof(from->buffer));
422 /*******************************************************************
423 creates a STRING2 structure.
424 ********************************************************************/
425 void make_string2(STRING2 *str, char *buf, int len)
427 /* set up string lengths. */
428 str->str_max_len = len;
430 str->str_str_len = len;
432 /* 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)
478 /* set up string lengths. add one if string is not null-terminated */
479 str->uni_max_len = len+1;
481 str->uni_str_len = len+1;
483 /* store the string (null-terminated 8 bit chars into 16 bit chars) */
484 struni2(str->buffer, buf);
487 /*******************************************************************
488 reads or writes a UNISTR2 structure.
489 XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
490 the uni_str_len member tells you how long the string is;
491 the uni_max_len member tells you how large the buffer is.
492 ********************************************************************/
493 void smb_io_unistr2(char *desc, UNISTR2 *uni2, uint32 buffer, prs_struct *ps, int depth)
495 if (uni2 == NULL) return;
499 prs_debug(ps, depth, desc, "smb_io_unistr2");
504 prs_uint32("uni_max_len", ps, depth, &(uni2->uni_max_len));
505 prs_uint32("undoc ", ps, depth, &(uni2->undoc ));
506 prs_uint32("uni_str_len", ps, depth, &(uni2->uni_str_len));
508 /* oops! XXXX maybe issue a warning that this is happening... */
509 if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN;
510 if (uni2->uni_str_len > MAX_UNISTRLEN) uni2->uni_str_len = MAX_UNISTRLEN;
512 /* buffer advanced by indicated length of string
513 NOT by searching for null-termination */
514 prs_unistr2(True, "buffer ", ps, depth, uni2);
518 prs_debug(ps, depth, desc, "smb_io_unistr2 - NULL");
520 bzero(uni2, sizeof(*uni2));
524 /*******************************************************************
525 creates a DOM_RID2 structure.
526 ********************************************************************/
527 void make_dom_rid2(DOM_RID2 *rid2, uint32 rid)
535 /*******************************************************************
536 reads or writes a DOM_RID2 structure.
537 ********************************************************************/
538 void smb_io_dom_rid2(char *desc, DOM_RID2 *rid2, prs_struct *ps, int depth)
540 if (rid2 == NULL) return;
542 prs_debug(ps, depth, desc, "smb_io_dom_rid2");
547 /* should be value 5, so enforce it */
550 /* should be value 5, so enforce it */
553 prs_uint32("type ", ps, depth, &(rid2->type));
554 prs_uint32("undoc ", ps, depth, &(rid2->undoc ));
555 prs_uint32("rid ", ps, depth, &(rid2->rid ));
556 prs_uint32("rid_idx", ps, depth, &(rid2->rid_idx ));
559 /*******************************************************************
560 creates a DOM_RID3 structure.
561 ********************************************************************/
562 void make_dom_rid3(DOM_RID3 *rid3, uint32 rid)
566 rid3->ptr_type = 0x1; /* non-zero, basically. */
570 /*******************************************************************
571 reads or writes a DOM_RID3 structure.
572 ********************************************************************/
573 void smb_io_dom_rid3(char *desc, DOM_RID3 *rid3, prs_struct *ps, int depth)
575 if (rid3 == NULL) return;
577 prs_debug(ps, depth, desc, "smb_io_dom_rid3");
582 prs_uint32("rid ", ps, depth, &(rid3->rid ));
583 prs_uint32("type1 ", ps, depth, &(rid3->type1 ));
584 prs_uint32("ptr_type", ps, depth, &(rid3->ptr_type));
585 prs_uint32("type2 ", ps, depth, &(rid3->type2 ));
588 /*******************************************************************
589 creates a DOM_RID4 structure.
590 ********************************************************************/
591 void make_dom_rid4(DOM_RID4 *rid4, uint16 unknown, uint16 attr, uint32 rid)
593 rid4->unknown = unknown;
598 /*******************************************************************
599 reads or writes a DOM_RID4 structure.
600 ********************************************************************/
601 void smb_io_dom_rid4(char *desc, DOM_RID4 *rid4, prs_struct *ps, int depth)
603 if (rid4 == NULL) return;
605 prs_debug(ps, depth, desc, "smb_io_dom_rid4. XXXX !check size of unknown! XXXX");
610 prs_uint32("unknown", ps, depth, &(rid4->unknown));
611 prs_uint16("attr ", ps, depth, &(rid4->attr ));
612 prs_uint32("rid ", ps, depth, &(rid4->rid ));
615 /*******************************************************************
616 makes a DOM_CLNT_SRV structure.
617 ********************************************************************/
618 void make_clnt_srv(DOM_CLNT_SRV *log, char *logon_srv, char *comp_name)
620 if (log == NULL) return;
622 DEBUG(5,("make_clnt_srv: %d\n", __LINE__));
624 if (logon_srv != NULL)
626 log->undoc_buffer = 1;
627 make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv));
631 log->undoc_buffer = 0;
634 if (comp_name != NULL)
636 log->undoc_buffer2 = 1;
637 make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name));
641 log->undoc_buffer2 = 0;
645 /*******************************************************************
646 reads or writes a DOM_CLNT_SRV structure.
647 ********************************************************************/
648 void smb_io_clnt_srv(char *desc, DOM_CLNT_SRV *log, prs_struct *ps, int depth)
650 if (log == NULL) return;
652 prs_debug(ps, depth, desc, "smb_io_clnt_srv");
657 prs_uint32("undoc_buffer ", ps, depth, &(log->undoc_buffer ));
658 if (log->undoc_buffer != 0)
660 smb_io_unistr2("unistr2", &(log->uni_logon_srv), log->undoc_buffer, ps, depth);
665 prs_uint32("undoc_buffer2", ps, depth, &(log->undoc_buffer2));
666 if (log->undoc_buffer2 != 0)
668 smb_io_unistr2("unistr2", &(log->uni_comp_name), log->undoc_buffer2, ps, depth);
672 /*******************************************************************
673 makes a DOM_LOG_INFO structure.
674 ********************************************************************/
675 void make_log_info(DOM_LOG_INFO *log, char *logon_srv, char *acct_name,
676 uint16 sec_chan, char *comp_name)
678 if (log == NULL) return;
680 DEBUG(5,("make_log_info %d\n", __LINE__));
682 log->undoc_buffer = 1;
684 make_unistr2(&(log->uni_logon_srv), logon_srv, strlen(logon_srv));
685 make_unistr2(&(log->uni_acct_name), acct_name, strlen(acct_name));
687 log->sec_chan = sec_chan;
689 make_unistr2(&(log->uni_comp_name), comp_name, strlen(comp_name));
692 /*******************************************************************
693 reads or writes a DOM_LOG_INFO structure.
694 ********************************************************************/
695 void smb_io_log_info(char *desc, DOM_LOG_INFO *log, prs_struct *ps, int depth)
697 if (log == NULL) return;
699 prs_debug(ps, depth, desc, "smb_io_log_info");
704 prs_uint32("undoc_buffer", ps, depth, &(log->undoc_buffer));
706 smb_io_unistr2("unistr2", &(log->uni_logon_srv), True, ps, depth);
707 smb_io_unistr2("unistr2", &(log->uni_acct_name), True, ps, depth);
709 prs_uint16("sec_chan", ps, depth, &(log->sec_chan));
711 smb_io_unistr2("unistr2", &(log->uni_comp_name), True, ps, depth);
714 /*******************************************************************
715 reads or writes a DOM_CHAL structure.
716 ********************************************************************/
717 void smb_io_chal(char *desc, DOM_CHAL *chal, prs_struct *ps, int depth)
719 if (chal == NULL) return;
721 prs_debug(ps, depth, desc, "smb_io_chal");
726 prs_uint8s (False, "data", ps, depth, chal->data, 8);
729 /*******************************************************************
730 reads or writes a DOM_CRED structure.
731 ********************************************************************/
732 void smb_io_cred(char *desc, DOM_CRED *cred, prs_struct *ps, int depth)
734 if (cred == NULL) return;
736 prs_debug(ps, depth, desc, "smb_io_cred");
741 smb_io_chal ("", &(cred->challenge), ps, depth);
742 smb_io_utime("", &(cred->timestamp), ps, depth);
745 /*******************************************************************
746 makes a DOM_CLNT_INFO2 structure.
747 ********************************************************************/
748 void make_clnt_info2(DOM_CLNT_INFO2 *clnt,
749 char *logon_srv, char *comp_name,
752 if (clnt == NULL) return;
754 DEBUG(5,("make_clnt_info: %d\n", __LINE__));
756 make_clnt_srv(&(clnt->login), logon_srv, comp_name);
758 if (clnt_cred != NULL)
761 memcpy(&(clnt->cred), clnt_cred, sizeof(clnt->cred));
769 /*******************************************************************
770 reads or writes a DOM_CLNT_INFO2 structure.
771 ********************************************************************/
772 void smb_io_clnt_info2(char *desc, DOM_CLNT_INFO2 *clnt, prs_struct *ps, int depth)
774 if (clnt == NULL) return;
776 prs_debug(ps, depth, desc, "smb_io_clnt_info2");
781 smb_io_clnt_srv("", &(clnt->login), ps, depth);
785 prs_uint32("ptr_cred", ps, depth, &(clnt->ptr_cred));
786 smb_io_cred ("", &(clnt->cred ), ps, depth);
789 /*******************************************************************
790 makes a DOM_CLNT_INFO structure.
791 ********************************************************************/
792 void make_clnt_info(DOM_CLNT_INFO *clnt,
793 char *logon_srv, char *acct_name,
794 uint16 sec_chan, char *comp_name,
797 if (clnt == NULL || cred == NULL) return;
799 DEBUG(5,("make_clnt_info\n"));
801 make_log_info(&(clnt->login), logon_srv, acct_name, sec_chan, comp_name);
802 memcpy(&(clnt->cred), cred, sizeof(clnt->cred));
805 /*******************************************************************
806 reads or writes a DOM_CLNT_INFO structure.
807 ********************************************************************/
808 void smb_io_clnt_info(char *desc, DOM_CLNT_INFO *clnt, prs_struct *ps, int depth)
810 if (clnt == NULL) return;
812 prs_debug(ps, depth, desc, "smb_io_clnt_info");
817 smb_io_log_info("", &(clnt->login), ps, depth);
818 smb_io_cred ("", &(clnt->cred ), ps, depth);
821 /*******************************************************************
822 makes a DOM_LOGON_ID structure.
823 ********************************************************************/
824 void make_logon_id(DOM_LOGON_ID *log, uint32 log_id_low, uint32 log_id_high)
826 if (log == NULL) return;
828 DEBUG(5,("make_logon_id: %d\n", __LINE__));
830 log->low = log_id_low;
831 log->high = log_id_high;
834 /*******************************************************************
835 reads or writes a DOM_LOGON_ID structure.
836 ********************************************************************/
837 void smb_io_logon_id(char *desc, DOM_LOGON_ID *log, prs_struct *ps, int depth)
839 if (log == NULL) return;
841 prs_debug(ps, depth, desc, "smb_io_logon_id");
846 prs_uint32("low ", ps, depth, &(log->low ));
847 prs_uint32("high", ps, depth, &(log->high));
850 /*******************************************************************
851 makes an OWF_INFO structure.
852 ********************************************************************/
853 void make_owf_info(OWF_INFO *hash, uint8 data[16])
855 if (hash == NULL) return;
857 DEBUG(5,("make_owf_info: %d\n", __LINE__));
861 memcpy(hash->data, data, sizeof(hash->data));
865 bzero(hash->data, sizeof(hash->data));
869 /*******************************************************************
870 reads or writes an OWF_INFO structure.
871 ********************************************************************/
872 void smb_io_owf_info(char *desc, OWF_INFO *hash, prs_struct *ps, int depth)
874 if (hash == NULL) return;
876 prs_debug(ps, depth, desc, "smb_io_owf_info");
881 prs_uint8s (False, "data", ps, depth, hash->data, 16);
884 /*******************************************************************
885 reads or writes a DOM_GID structure.
886 ********************************************************************/
887 void smb_io_gid(char *desc, DOM_GID *gid, prs_struct *ps, int depth)
889 if (gid == NULL) return;
891 prs_debug(ps, depth, desc, "smb_io_gid");
896 prs_uint32("g_rid", ps, depth, &(gid->g_rid));
897 prs_uint32("attr ", ps, depth, &(gid->attr ));
900 /*******************************************************************
901 reads or writes an POLICY_HND structure.
902 ********************************************************************/
903 void smb_io_pol_hnd(char *desc, POLICY_HND *pol, prs_struct *ps, int depth)
905 if (pol == NULL) return;
907 prs_debug(ps, depth, desc, "smb_io_pol_hnd");
912 prs_uint8s (False, "data", ps, depth, pol->data, POL_HND_SIZE);
915 /*******************************************************************
916 reads or writes a dom query structure.
917 ********************************************************************/
918 void smb_io_dom_query_3(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth)
920 smb_io_dom_query("", d_q, ps, depth);
923 /*******************************************************************
924 reads or writes a dom query structure.
925 ********************************************************************/
926 void smb_io_dom_query_5(char *desc, DOM_QUERY_3 *d_q, prs_struct *ps, int depth)
928 smb_io_dom_query("", d_q, ps, depth);
931 /*******************************************************************
932 reads or writes a dom query structure.
933 ********************************************************************/
934 void smb_io_dom_query(char *desc, DOM_QUERY *d_q, prs_struct *ps, int depth)
936 if (d_q == NULL) return;
938 prs_debug(ps, depth, desc, "smb_io_dom_query");
943 prs_uint16("uni_dom_max_len", ps, depth, &(d_q->uni_dom_max_len)); /* domain name string length * 2 */
944 prs_uint16("uni_dom_str_len", ps, depth, &(d_q->uni_dom_str_len)); /* domain name string length * 2 */
946 prs_uint32("buffer_dom_name", ps, depth, &(d_q->buffer_dom_name)); /* undocumented domain name string buffer pointer */
947 prs_uint32("buffer_dom_sid ", ps, depth, &(d_q->buffer_dom_sid )); /* undocumented domain SID string buffer pointer */
949 smb_io_unistr2("unistr2", &(d_q->uni_domain_name), d_q->buffer_dom_name, ps, depth); /* domain name (unicode string) */
951 if (d_q->buffer_dom_sid != 0)
953 smb_io_dom_sid2("", &(d_q->dom_sid), ps, depth); /* domain SID */
957 bzero(&(d_q->dom_sid), sizeof(d_q->dom_sid));
961 /*******************************************************************
962 reads or writes a DOM_NAME structure.
963 ********************************************************************/
964 void smb_io_dom_name(char *desc, DOM_NAME *name, prs_struct *ps, int depth)
966 if (name == NULL) return;
968 prs_debug(ps, depth, desc, "smb_io_dom_name");
973 prs_uint32("uni_str_len", ps, depth, &(name->uni_str_len));
975 /* don't know if len is specified by uni_str_len member... */
976 /* assume unicode string is unicode-null-terminated, instead */
978 smb_io_unistr("", &(name->str), ps, depth);