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