855d46420a7d198d4042828333be0c63d9bcb392
[samba.git] / source / smbparse.c
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    Samba utility functions
5    Copyright (C) Luke Leighton 1996 - 1997  Paul Ashton 1997
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "includes.h"
23
24 extern int DEBUGLEVEL;
25
26
27 /*******************************************************************
28 reads or writes a UTIME type.
29 ********************************************************************/
30 char* smb_io_utime(BOOL io, UTIME *t, char *q, char *base, int align, int depth)
31 {
32         if (t == NULL) return NULL;
33
34         DEBUG(5,("%s%04x smb_io_utime\n",  tab_depth(depth), PTR_DIFF(q, base)));
35         depth++;
36
37         q = align_offset(q, base, align);
38         
39         DBG_RW_IVAL ("time", depth, base, io, q, t->time); q += 4;
40
41         return q;
42 }
43
44 /*******************************************************************
45 reads or writes an NTTIME structure.
46 ********************************************************************/
47 char* smb_io_time(BOOL io, NTTIME *nttime, char *q, char *base, int align, int depth)
48 {
49         if (nttime == NULL) return NULL;
50
51         DEBUG(5,("%s%04x smb_io_time\n",  tab_depth(depth), PTR_DIFF(q, base)));
52         depth++;
53
54         q = align_offset(q, base, align);
55         
56         DBG_RW_IVAL("low ", depth, base, io, q, nttime->low ); q += 4; /* low part */
57         DBG_RW_IVAL("high", depth, base, io, q, nttime->high); q += 4; /* high part */
58
59         return q;
60 }
61
62 /*******************************************************************
63 reads or writes a DOM_SID structure.
64 ********************************************************************/
65 char* smb_io_dom_sid(BOOL io, DOM_SID *sid, char *q, char *base, int align, int depth)
66 {
67         int i;
68
69         if (sid == NULL) return NULL;
70
71         DEBUG(5,("%s%04x smb_io_dom_sid\n",  tab_depth(depth), PTR_DIFF(q, base)));
72         depth++;
73
74         DBG_RW_IVAL("num_auths ", depth, base, io, q, sid->num_auths); q += 4;
75         DBG_RW_CVAL("sid_no    ", depth, base, io, q, sid->sid_no); q++; 
76         DBG_RW_CVAL("num_auths ", depth, base, io, q, sid->num_auths); q++;
77
78         for (i = 0; i < 6; i++)
79         {
80                 fstring tmp;
81                 sprintf(tmp, "id_auth[%d] ", i);
82                 DBG_RW_CVAL(tmp, depth, base, io, q, sid->id_auth[i]); q++;
83         }
84
85         /* oops! XXXX should really issue a warning here... */
86         if (sid->num_auths > MAXSUBAUTHS) sid->num_auths = MAXSUBAUTHS;
87
88         DBG_RW_PIVAL("num_auths ", depth, base, io, q, sid->sub_auths, sid->num_auths); q += sid->num_auths * 4;
89
90         return q;
91 }
92
93 /*******************************************************************
94 reads or writes a UNIHDR structure.
95 ********************************************************************/
96 char* smb_io_unihdr(BOOL io, UNIHDR *hdr, char *q, char *base, int align, int depth)
97 {
98         if (hdr == NULL) return NULL;
99
100         DEBUG(5,("%s%04x smb_io_unihdr\n",  tab_depth(depth), PTR_DIFF(q, base)));
101         depth++;
102
103         /* should be value 4, so enforce it. */
104         hdr->undoc = 4;
105
106         q = align_offset(q, base, align);
107         
108         DBG_RW_IVAL("uni_max_len", depth, base, io, q, hdr->uni_max_len); q += 4;
109         DBG_RW_IVAL("uni_str_len", depth, base, io, q, hdr->uni_str_len); q += 4;
110         DBG_RW_IVAL("undoc      ", depth, base, io, q, hdr->undoc      ); q += 4;
111
112         return q;
113 }
114
115 /*******************************************************************
116 reads or writes a UNIHDR2 structure.
117 ********************************************************************/
118 char* smb_io_unihdr2(BOOL io, UNIHDR2 *hdr2, char *q, char *base, int align, int depth)
119 {
120         if (hdr2 == NULL) return NULL;
121
122         DEBUG(5,("%s%04x smb_io_unihdr2\n",  tab_depth(depth), PTR_DIFF(q, base)));
123         depth++;
124
125         q = align_offset(q, base, align);
126
127         q = smb_io_unihdr(io, &(hdr2->unihdr), q, base, align, depth);
128         DBG_RW_IVAL("undoc_buffer", depth, base, io, q, hdr2->undoc_buffer); q += 4;
129
130         return q;
131 }
132
133 /*******************************************************************
134 reads or writes a UNISTR structure.
135 XXXX NOTE: UNISTR structures NEED to be null-terminated.
136 ********************************************************************/
137 char* smb_io_unistr(BOOL io, UNISTR *uni, char *q, char *base, int align, int depth)
138 {
139         if (uni == NULL) return NULL;
140
141         DEBUG(5,("%s%04x smb_io_unistr\n",  tab_depth(depth), PTR_DIFF(q, base)));
142         depth++;
143
144         q = align_offset(q, base, align);
145         
146         if (io)
147         {
148                 /* io True indicates read _from_ the SMB buffer into the string */
149                 q += 2 * unistrcpy((char*)uni->buffer, q);
150         }
151         else
152         {
153                 /* io True indicates copy _from_ the string into SMB buffer */
154                 q += 2 * unistrcpy(q, (char*)uni->buffer);
155         }
156         return q;
157 }
158
159 /*******************************************************************
160 reads or writes a UNISTR2 structure.
161 XXXX NOTE: UNISTR2 structures need NOT be null-terminated.
162      the uni_str_len member tells you how long the string is;
163      the uni_max_len member tells you how large the buffer is.
164 ********************************************************************/
165 char* smb_io_unistr2(BOOL io, UNISTR2 *uni2, char *q, char *base, int align, int depth)
166 {
167         if (uni2 == NULL) return NULL;
168
169         DEBUG(5,("%s%04x smb_io_unistr2\n",  tab_depth(depth), PTR_DIFF(q, base)));
170         depth++;
171
172         q = align_offset(q, base, align);
173         
174         /* should be value 0, so enforce it. */
175         uni2->undoc = 0;
176
177         DBG_RW_IVAL("uni_max_len", depth, base, io, q, uni2->uni_max_len); q += 4;
178         DBG_RW_IVAL("undoc      ", depth, base, io, q, uni2->undoc      ); q += 4;
179         DBG_RW_IVAL("uni_str_len", depth, base, io, q, uni2->uni_str_len); q += 4;
180
181         /* oops! XXXX maybe issue a warning that this is happening... */
182         if (uni2->uni_max_len > MAX_UNISTRLEN) uni2->uni_max_len = MAX_UNISTRLEN;
183         if (uni2->uni_str_len > MAX_UNISTRLEN) uni2->uni_str_len = MAX_UNISTRLEN;
184
185         /* buffer advanced by indicated length of string
186        NOT by searching for null-termination */
187         DBG_RW_PSVAL("buffer    ", depth, base, io, q, uni2->buffer, uni2->uni_max_len); q += uni2->uni_max_len * 2;
188
189         return q;
190 }
191
192 /*******************************************************************
193 reads or writes a DOM_SID2 structure.
194 ********************************************************************/
195 char* smb_io_dom_sid2(BOOL io, DOM_SID2 *sid2, char *q, char *base, int align, int depth)
196 {
197         if (sid2 == NULL) return NULL;
198
199         DEBUG(5,("%s%04x smb_io_dom_sid2\n",  tab_depth(depth), PTR_DIFF(q, base)));
200         depth++;
201
202         q = align_offset(q, base, align);
203         
204         /* should be value 5, so enforce it */
205         sid2->type = 5;
206
207         /* should be value 0, so enforce it */
208         sid2->undoc = 0;
209
210         DBG_RW_IVAL("type ", depth, base, io, q, sid2->type ); q += 4;
211         DBG_RW_IVAL("undoc", depth, base, io, q, sid2->undoc); q += 4;
212
213         q = smb_io_unihdr2(io, &(sid2->hdr), q, base, align, depth);
214         q = smb_io_unistr (io, &(sid2->str), q, base, align, depth);
215
216         return q;
217 }
218
219 /*******************************************************************
220 reads or writes a DOM_RID2 structure.
221 ********************************************************************/
222 char* smb_io_dom_rid2(BOOL io, DOM_RID2 *rid2, char *q, char *base, int align, int depth)
223 {
224         if (rid2 == NULL) return NULL;
225
226         DEBUG(5,("%s%04x smb_io_dom_rid2\n",  tab_depth(depth), PTR_DIFF(q, base)));
227         depth++;
228
229         q = align_offset(q, base, align);
230         
231         /* should be value 5, so enforce it */
232         rid2->type = 5;
233
234         /* should be value 5, so enforce it */
235         rid2->undoc = 5;
236
237         DBG_RW_IVAL("type   ", depth, base, io, q, rid2->type); q += 4;
238         DBG_RW_IVAL("undoc  ", depth, base, io, q, rid2->undoc   ); q += 4;
239         DBG_RW_IVAL("rid    ", depth, base, io, q, rid2->rid     ); q += 4;
240         DBG_RW_IVAL("rid_idx", depth, base, io, q, rid2->rid_idx ); q += 4;
241
242         return q;
243 }
244
245 /*******************************************************************
246 reads or writes a DOM_LOG_INFO structure.
247 ********************************************************************/
248 char* smb_io_log_info(BOOL io, DOM_LOG_INFO *log, char *q, char *base, int align, int depth)
249 {
250         if (log == NULL) return NULL;
251
252         DEBUG(5,("%s%04x smb_io_log_info\n",  tab_depth(depth), PTR_DIFF(q, base)));
253         depth++;
254
255         q = align_offset(q, base, align);
256         
257         DBG_RW_IVAL("undoc_buffer", depth, base, io, q, log->undoc_buffer); q += 4;
258
259         q = smb_io_unistr2(io, &(log->uni_logon_srv), q, base, align, depth);
260         q = smb_io_unistr2(io, &(log->uni_acct_name), q, base, align, depth);
261
262         DBG_RW_SVAL("sec_chan", depth, base, io, q, log->sec_chan); q += 2;
263
264         q = smb_io_unistr2(io, &(log->uni_comp_name), q, base, align, depth);
265
266         return q;
267 }
268
269 /*******************************************************************
270 reads or writes a DOM_CHAL structure.
271 ********************************************************************/
272 char* smb_io_chal(BOOL io, DOM_CHAL *chal, char *q, char *base, int align, int depth)
273 {
274         if (chal == NULL) return NULL;
275
276         DEBUG(5,("%s%04x smb_io_chal\n",  tab_depth(depth), PTR_DIFF(q, base)));
277         depth++;
278
279         q = align_offset(q, base, align);
280         
281         DBG_RW_IVAL("data[0]", depth, base, io, q, chal->data[0]); q += 4;
282         DBG_RW_IVAL("data[1]", depth, base, io, q, chal->data[1]); q += 4;
283 /*
284         DBG_RW_PCVAL("data", depth, base, io, q, chal->data, 8); q += 8;
285 */
286         return q;
287 }
288
289 /*******************************************************************
290 reads or writes a DOM_CRED structure.
291 ********************************************************************/
292 char* smb_io_cred(BOOL io, DOM_CRED *cred, char *q, char *base, int align, int depth)
293 {
294         if (cred == NULL) return NULL;
295
296         DEBUG(5,("%s%04x smb_io_cred\n",  tab_depth(depth), PTR_DIFF(q, base)));
297         depth++;
298
299         q = align_offset(q, base, align);
300         
301         q = smb_io_chal (io, &(cred->challenge), q, base, align, depth);
302         q = smb_io_utime(io, &(cred->timestamp), q, base, align, depth);
303
304         return q;
305 }
306
307 /*******************************************************************
308 reads or writes a DOM_CLNT_INFO structure.
309 ********************************************************************/
310 char* smb_io_clnt_info(BOOL io, DOM_CLNT_INFO *clnt, char *q, char *base, int align, int depth)
311 {
312         if (clnt == NULL) return NULL;
313
314         DEBUG(5,("%s%04x smb_io_clnt_info\n",  tab_depth(depth), PTR_DIFF(q, base)));
315         depth++;
316
317         q = align_offset(q, base, align);
318         
319         q = smb_io_log_info(io, &(clnt->login), q, base, align, depth);
320         q = smb_io_cred    (io, &(clnt->cred ), q, base, align, depth);
321
322         return q;
323 }
324
325 /*******************************************************************
326 reads or writes a DOM_LOGON_ID structure.
327 ********************************************************************/
328 char* smb_io_logon_id(BOOL io, DOM_LOGON_ID *log, char *q, char *base, int align, int depth)
329 {
330         if (log == NULL) return NULL;
331
332         DEBUG(5,("%s%04x smb_io_logon_id\n",  tab_depth(depth), PTR_DIFF(q, base)));
333         depth++;
334
335         q = align_offset(q, base, align);
336         
337         DBG_RW_IVAL("low ", depth, base, io, q, log->low ); q += 4;
338         DBG_RW_IVAL("high", depth, base, io, q, log->high); q += 4;
339
340         return q;
341 }
342
343 /*******************************************************************
344 reads or writes an ARC4_OWF structure.
345 ********************************************************************/
346 char* smb_io_arc4_owf(BOOL io, ARC4_OWF *hash, char *q, char *base, int align, int depth)
347 {
348         if (hash == NULL) return NULL;
349
350         DEBUG(5,("%s%04x smb_io_arc4_owf\n",  tab_depth(depth), PTR_DIFF(q, base)));
351         depth++;
352
353         q = align_offset(q, base, align);
354         
355         DBG_RW_PCVAL("data", depth, base, io, q, hash->data, 16); q += 16;
356
357         return q;
358 }
359
360 /*******************************************************************
361 reads or writes an DOM_ID_INFO_1 structure.
362 ********************************************************************/
363 char* smb_io_id_info1(BOOL io, DOM_ID_INFO_1 *id, char *q, char *base, int align, int depth)
364 {
365         if (id == NULL) return NULL;
366
367         DEBUG(5,("%s%04x smb_io_id_info1\n",  tab_depth(depth), PTR_DIFF(q, base)));
368         depth++;
369
370         q = align_offset(q, base, align);
371         
372         q = smb_io_unihdr(io, &(id->hdr_domain_name   ), q, base, align, depth);
373
374         DBG_RW_IVAL("param", depth, base, io, q, id->param); q += 4;
375         q = smb_io_logon_id(io, &(id->logon_id), q, base, align, depth);
376
377         q = smb_io_unihdr(io, &(id->hdr_user_name     ), q, base, align, depth);
378         q = smb_io_unihdr(io, &(id->hdr_workgroup_name), q, base, align, depth);
379
380         q = smb_io_arc4_owf(io, &(id->arc4_lm_owf), q, base, align, depth);
381         q = smb_io_arc4_owf(io, &(id->arc4_nt_owf), q, base, align, depth);
382
383         q = smb_io_unistr2(io, &(id->uni_domain_name   ), q, base, align, depth);
384         q = smb_io_unistr2(io, &(id->uni_user_name     ), q, base, align, depth);
385         q = smb_io_unistr2(io, &(id->uni_workgroup_name), q, base, align, depth);
386
387         return q;
388 }
389
390 /*******************************************************************
391 reads or writes a DOM_SAM_INFO structure.
392 ********************************************************************/
393 char* smb_io_sam_info(BOOL io, DOM_SAM_INFO *sam, char *q, char *base, int align, int depth)
394 {
395         if (sam == NULL) return NULL;
396
397         DEBUG(5,("%s%04x smb_io_sam_info\n",  tab_depth(depth), PTR_DIFF(q, base)));
398         depth++;
399
400         q = align_offset(q, base, align);
401         
402         q = smb_io_clnt_info(io, &(sam->client  ), q, base, align, depth);
403         q = smb_io_cred     (io, &(sam->rtn_cred), q, base, align, depth);
404
405         DBG_RW_IVAL("logon_level", depth, base, io, q, sam->logon_level); q += 4;
406         DBG_RW_SVAL("auth_level ", depth, base, io, q, sam->auth_level ); q += 4;
407
408         switch (sam->auth_level)
409         {
410                 case 1:
411                 {
412                         q = smb_io_id_info1(io, &(sam->auth.id1), q, base, align, depth);
413                         break;
414                 }
415                 default:
416                 {
417                         /* PANIC! */
418                         break;
419                 }
420         }
421         return q;
422 }
423
424 /*******************************************************************
425 reads or writes a DOM_GID structure.
426 ********************************************************************/
427 char* smb_io_gid(BOOL io, DOM_GID *gid, char *q, char *base, int align, int depth)
428 {
429         if (gid == NULL) return NULL;
430
431         DEBUG(5,("%s%04x smb_io_gid\n",  tab_depth(depth), PTR_DIFF(q, base)));
432         depth++;
433
434         q = align_offset(q, base, align);
435         
436         DBG_RW_IVAL("gid ", depth, base, io, q, gid->gid ); q += 4;
437         DBG_RW_IVAL("attr", depth, base, io, q, gid->attr); q += 4;
438
439         return q;
440 }
441
442 /*******************************************************************
443 reads or writes an RPC_HDR structure.
444 ********************************************************************/
445 char* smb_io_rpc_hdr(BOOL io, RPC_HDR *rpc, char *q, char *base, int align, int depth)
446 {
447         if (rpc == NULL) return NULL;
448
449         DEBUG(5,("%s%04x smb_io_rpc_hdr\n",  tab_depth(depth), PTR_DIFF(q, base)));
450         depth++;
451
452         /* reserved should be zero: enforce it */
453         rpc->reserved = 0;
454
455         DBG_RW_CVAL("major     ", depth, base, io, q, rpc->major); q++;
456         DBG_RW_CVAL("minor     ", depth, base, io, q, rpc->minor); q++;
457         DBG_RW_CVAL("pkt_type  ", depth, base, io, q, rpc->pkt_type); q++;
458         DBG_RW_CVAL("frag      ", depth, base, io, q, rpc->frag); q++;
459         DBG_RW_IVAL("pack_type ", depth, base, io, q, rpc->pack_type); q += 4;
460         DBG_RW_SVAL("frag_len  ", depth, base, io, q, rpc->frag_len); q += 2;
461         DBG_RW_SVAL("auth_len  ", depth, base, io, q, rpc->auth_len); q += 2;
462         DBG_RW_IVAL("call_id   ", depth, base, io, q, rpc->call_id); q += 4;
463         DBG_RW_IVAL("alloc_hint", depth, base, io, q, rpc->alloc_hint); q += 4;
464         DBG_RW_CVAL("context_id", depth, base, io, q, rpc->context_id); q++;
465         DBG_RW_CVAL("reserved  ", depth, base, io, q, rpc->reserved); q++;
466
467         return q;
468 }
469
470 /*******************************************************************
471 reads or writes an LSA_POL_HND structure.
472 ********************************************************************/
473 char* smb_io_pol_hnd(BOOL io, LSA_POL_HND *pol, char *q, char *base, int align, int depth)
474 {
475         if (pol == NULL) return NULL;
476
477         DEBUG(5,("%s%04x smb_io_pol_hnd\n",  tab_depth(depth), PTR_DIFF(q, base)));
478         depth++;
479
480         q = align_offset(q, base, align);
481         
482         DBG_RW_PCVAL("data", depth, base, io, q, pol->data, POL_HND_SIZE); q += POL_HND_SIZE;
483
484         return q;
485 }
486
487 /*******************************************************************
488 reads or writes a dom query structure.
489 ********************************************************************/
490 char* smb_io_dom_query_3(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align, int depth)
491 {
492         return smb_io_dom_query(io, d_q, q, base, align, depth);
493 }
494
495 /*******************************************************************
496 reads or writes a dom query structure.
497 ********************************************************************/
498 char* smb_io_dom_query_5(BOOL io, DOM_QUERY_3 *d_q, char *q, char *base, int align, int depth)
499 {
500         return smb_io_dom_query(io, d_q, q, base, align, depth);
501 }
502
503 /*******************************************************************
504 reads or writes a dom query structure.
505 ********************************************************************/
506 char* smb_io_dom_query(BOOL io, DOM_QUERY *d_q, char *q, char *base, int align, int depth)
507 {
508         if (d_q == NULL) return NULL;
509
510         DEBUG(5,("%s%04x smb_io_dom_query\n",  tab_depth(depth), PTR_DIFF(q, base)));
511         depth++;
512
513         q = align_offset(q, base, align);
514         
515         DBG_RW_SVAL("uni_dom_max_len", depth, base, io, q, d_q->uni_dom_max_len); q += 2; /* domain name string length * 2 */
516         DBG_RW_SVAL("uni_dom_str_len", depth, base, io, q, d_q->uni_dom_str_len); q += 2; /* domain name string length * 2 */
517
518         DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, d_q->buffer_dom_name); q += 4; /* undocumented domain name string buffer pointer */
519         DBG_RW_IVAL("buffer_dom_sid ", depth, base, io, q, d_q->buffer_dom_sid ); q += 4; /* undocumented domain SID string buffer pointer */
520
521         if (d_q->buffer_dom_name != 0)
522         {
523                 q = smb_io_unistr2(io, &(d_q->uni_domain_name), q, base, align, depth); /* domain name (unicode string) */
524         }
525         if (d_q->buffer_dom_sid != 0)
526         {
527                 q = smb_io_dom_sid(io, &(d_q->dom_sid), q, base, align, depth); /* domain SID */
528         }
529
530         return q;
531 }
532
533 /*******************************************************************
534 reads or writes a DOM_R_REF structure.
535 ********************************************************************/
536 char* smb_io_dom_r_ref(BOOL io, DOM_R_REF *r_r, char *q, char *base, int align, int depth)
537 {
538         int i;
539
540         DEBUG(5,("%s%04x smb_io_dom_r_ref\n",  tab_depth(depth), PTR_DIFF(q, base)));
541         depth++;
542
543         if (r_r == NULL) return NULL;
544
545         q = align_offset(q, base, align);
546         
547         DBG_RW_IVAL("undoc_buffer   ", depth, base, io, q, r_r->undoc_buffer); q += 4; /* undocumented buffer pointer. */
548         DBG_RW_IVAL("num_ref_doms_1 ", depth, base, io, q, r_r->num_ref_doms_1); q += 4; /* num referenced domains? */
549         DBG_RW_IVAL("buffer_dom_name", depth, base, io, q, r_r->buffer_dom_name); q += 4; /* undocumented domain name buffer pointer. */
550         DBG_RW_IVAL("max_entries    ", depth, base, io, q, r_r->max_entries); q += 4; /* 32 - max number of entries */
551         DBG_RW_IVAL("num_ref_doms_2 ", depth, base, io, q, r_r->num_ref_doms_2); q += 4; /* 4 - num referenced domains? */
552
553         q = smb_io_unihdr2(io, &(r_r->hdr_dom_name), q, base, align, depth); /* domain name unicode string header */
554
555         for (i = 0; i < r_r->num_ref_doms_1-1; i++)
556         {
557                 q = smb_io_unihdr2(io, &(r_r->hdr_ref_dom[i]), q, base, align, depth);
558         }
559
560         q = smb_io_unistr(io, &(r_r->uni_dom_name), q, base, align, depth); /* domain name unicode string */
561
562         for (i = 0; i < r_r->num_ref_doms_2; i++)
563         {
564                 q = smb_io_dom_sid(io, &(r_r->ref_dom[i]), q, base, align, depth); /* referenced domain SIDs */
565         }
566         return q;
567 }
568
569 /*******************************************************************
570 reads or writes a DOM_NAME structure.
571 ********************************************************************/
572 char* smb_io_dom_name(BOOL io, DOM_NAME *name, char *q, char *base, int align, int depth)
573 {
574         if (name == NULL) return NULL;
575
576         DEBUG(5,("%s%04x smb_io_dom_name\n",  tab_depth(depth), PTR_DIFF(q, base)));
577         depth++;
578
579         q = align_offset(q, base, align);
580         
581         DBG_RW_IVAL("uni_str_len", depth, base, io, q, name->uni_str_len); q += 4;
582
583         /* don't know if len is specified by uni_str_len member... */
584         /* assume unicode string is unicode-null-terminated, instead */
585
586         q = smb_io_unistr(io, &(name->str), q, base, align, depth);
587
588         return q;
589 }
590
591
592 /*******************************************************************
593 reads or writes a structure.
594 ********************************************************************/
595 char* smb_io_neg_flags(BOOL io, NEG_FLAGS *neg, char *q, char *base, int align, int depth)
596 {
597         if (neg == NULL) return NULL;
598
599         DEBUG(5,("%s%04x smb_io_neg_flags\n",  tab_depth(depth), PTR_DIFF(q, base)));
600         depth++;
601
602         q = align_offset(q, base, align);
603         
604         DBG_RW_IVAL("neg_flags", depth, base, io, q, neg->neg_flags); q += 4;
605
606         return q;
607 }
608
609
610 #if 0
611 /*******************************************************************
612 reads or writes a structure.
613 ********************************************************************/
614  char* smb_io_(BOOL io, *, char *q, char *base, int align, int depth)
615 {
616         if (== NULL) return NULL;
617
618         q = align_offset(q, base, align);
619         
620         DBG_RW_IVAL("", depth, base, io, q, ); q += 4;
621
622         return q;
623 }
624 #endif
625