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;
31 /*******************************************************************
32 reads or writes a structure.
33 ********************************************************************/
34 void sec_io_info(char *desc, SEC_INFO *t, prs_struct *ps, int depth)
36 if (t == NULL) return;
38 prs_debug(ps, depth, desc, "sec_io_info");
43 prs_uint32("perms", ps, depth, &(t->perms));
46 /*******************************************************************
47 reads or writes a structure.
48 ********************************************************************/
49 void sec_io_ace(char *desc, SEC_ACE *t, prs_struct *ps, int depth)
52 uint32 offset_ace_size;
53 if (t == NULL) return;
55 prs_debug(ps, depth, desc, "sec_io_ace");
60 old_offset = ps->offset;
62 prs_uint16("unknown_1", ps, depth, &(t->unknown_1));
63 prs_uint16_pre("ace_size ", ps, depth, &(t->ace_size ), &offset_ace_size);
65 sec_io_info ("info", &t->info, ps, depth);
67 smb_io_dom_sid("sid ", &t->sid , ps, depth);
69 prs_uint16_post("ace_size ", ps, depth, &t->ace_size, offset_ace_size, old_offset);
72 /*******************************************************************
73 reads or writes a structure. this is one of those retrospective jobs,
74 which i hate. why do we have to do this? what's it all about?
75 ********************************************************************/
76 void sec_io_acl(char *desc, SEC_ACL *t, prs_struct *ps, int depth)
80 uint32 offset_acl_size;
82 if (t == NULL) return;
84 prs_debug(ps, depth, desc, "sec_io_acl");
89 old_offset = ps->offset;
91 prs_uint16("unknown_1", ps, depth, &(t->unknown_1));
92 prs_uint16_pre("acl_size ", ps, depth, &(t->acl_size ), &offset_acl_size);
93 prs_uint32("num_aces ", ps, depth, &(t->num_aces ));
95 for (i = 0; i < MIN(t->num_aces, MAX_SEC_ACES); i++)
98 snprintf(tmp, sizeof(tmp), "ace[%02d]: ", i);
99 sec_io_ace(tmp, &t->ace[i], ps, depth);
104 prs_uint16_post("acl_size ", ps, depth, &t->acl_size, offset_acl_size, old_offset);
108 /*******************************************************************
109 reads or writes a structure.
110 ********************************************************************/
111 void sec_io_desc(char *desc, SEC_DESC *t, prs_struct *ps, int depth)
113 uint32 off_owner_sid;
119 if (t == NULL) return;
121 prs_debug(ps, depth, desc, "sec_io_desc");
126 /* start of security descriptor stored for back-calc offset purposes */
127 old_offset = ps->offset;
129 prs_uint32("unknown_1", ps, depth, &(t->unknown_1));
131 prs_uint32_pre("off_owner_sid", ps, depth, &(t->off_owner_sid), &off_owner_sid);
132 prs_uint32_pre("off_pnt_sid ", ps, depth, &(t->off_pnt_sid ), &off_pnt_sid );
133 prs_uint32_pre("off_unknown ", ps, depth, &(t->off_unknown ), &off_unknown );
134 prs_uint32_pre("off_acl ", ps, depth, &(t->off_acl ), &off_acl );
136 prs_uint32_post("off_acl ", ps, depth, &(t->off_acl ), off_acl , old_offset);
137 sec_io_acl ("acl" , &t->acl , ps, depth);
140 prs_uint32_post("off_unknown ", ps, depth, &(t->off_unknown ), off_unknown , ps->offset);
142 prs_uint32_post("off_owner_sid", ps, depth, &(t->off_owner_sid), off_owner_sid, old_offset);
143 smb_io_dom_sid("owner_sid ", &t->owner_sid , ps, depth);
146 prs_uint32_post("off_pnt_sid ", ps, depth, &(t->off_pnt_sid ), off_pnt_sid , old_offset);
147 smb_io_dom_sid("parent_sid", &t->parent_sid, ps, depth);
151 /*******************************************************************
152 reads or writes a SEC_DESC_BUF structure.
153 ********************************************************************/
154 void sec_io_desc_buf(char *desc, SEC_DESC_BUF *sec, prs_struct *ps, int depth)
159 if (sec == NULL) return;
161 prs_debug(ps, depth, desc, "sec_io_desc_buf");
166 prs_uint32 ("max_len", ps, depth, &(sec->max_len));
167 prs_uint32 ("undoc ", ps, depth, &(sec->undoc ));
168 prs_uint32_pre("len ", ps, depth, &(sec->len ), &off_len);
170 old_offset = ps->offset;
172 /* reading, length is non-zero; writing, descriptor is non-NULL */
173 if ((sec->len != 0 || (!ps->io)) && sec->sec != NULL)
175 sec_io_desc("sec ", sec->sec, ps, depth);
178 prs_uint32_post("len ", ps, depth, &(sec->len ), off_len , old_offset);