~ubuntu-branches/ubuntu/oneiric/samba/oneiric-security

« back to all changes in this revision

Viewing changes to source/rpc_parse/parse_sec.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-07-21 17:53:23 UTC
  • mfrom: (0.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050721175323-m3oh6aoigywohfnq
Tags: 3.0.14a-6ubuntu1
Resynchronise with Debian, resolving merge conflicts (#12360)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *  Version 1.9.
4
4
 *  RPC Pipe client / server routines
5
5
 *  Copyright (C) Andrew Tridgell              1992-1998,
6
 
 *  Copyright (C) Jeremy R. Allison            1995-2003.
 
6
 *  Copyright (C) Jeremy R. Allison            1995-2005.
7
7
 *  Copyright (C) Luke Kenneth Casson Leighton 1996-1998,
8
8
 *  Copyright (C) Paul Ashton                  1997-1998.
9
9
 *  
94
94
                        return False;
95
95
        }
96
96
 
 
97
        /* Theorectically an ACE can have a size greater than the
 
98
           sum of its components. When marshalling, pad with extra null bytes up to the
 
99
           correct size. */
 
100
 
 
101
        if (MARSHALLING(ps) && (psa->size > prs_offset(ps) - old_offset)) {
 
102
                uint32 extra_len = psa->size - (prs_offset(ps) - old_offset);
 
103
                uint32 i;
 
104
                uint8 c = 0;
 
105
 
 
106
                for (i = 0; i < extra_len; i++) {
 
107
                        if (!prs_uint8("ace extra space", ps, depth, &c))
 
108
                                return False;
 
109
                }
 
110
        }
 
111
 
97
112
        if(!prs_uint16_post("size ", ps, depth, &psa->size, offset_ace_size, old_offset))
98
113
                return False;
 
114
 
99
115
        return True;
100
116
}
101
117
 
165
181
                        return False;
166
182
        }
167
183
 
 
184
        /* Theorectically an ACL can have a size greater than the
 
185
           sum of its components. When marshalling, pad with extra null bytes up to the
 
186
           correct size. */
 
187
 
 
188
        if (MARSHALLING(ps) && (psa->size > prs_offset(ps) - old_offset)) {
 
189
                uint32 extra_len = psa->size - (prs_offset(ps) - old_offset);
 
190
                uint8 c = 0;
 
191
 
 
192
                for (i = 0; i < extra_len; i++) {
 
193
                        if (!prs_uint8("acl extra space", ps, depth, &c))
 
194
                                return False;
 
195
                }
 
196
        }
 
197
 
168
198
        if(!prs_uint16_post("size     ", ps, depth, &psa->size, offset_acl_size, old_offset))
169
199
                return False;
170
200
 
181
211
        uint32 old_offset;
182
212
        uint32 max_offset = 0; /* after we're done, move offset to end */
183
213
        uint32 tmp_offset = 0;
184
 
        
 
214
 
185
215
        SEC_DESC *psd;
186
216
 
187
217
        if (ppsd == NULL)
203
233
        prs_debug(ps, depth, desc, "sec_io_desc");
204
234
        depth++;
205
235
 
206
 
#if 0   
207
 
        /*
208
 
         * if alignment is needed, should be done by the the 
209
 
         * caller.  Not here.  This caused me problems when marshalling
210
 
         * printer info into a buffer.   --jerry
211
 
         */
212
 
        if(!prs_align(ps))
213
 
                return False;
214
 
#endif
215
 
        
216
236
        /* start of security descriptor stored for back-calc offset purposes */
217
237
        old_offset = prs_offset(ps);
218
238
 
222
242
        if(!prs_uint16("type     ", ps, depth, &psd->type))
223
243
                return False;
224
244
 
 
245
        if (MARSHALLING(ps)) {
 
246
                uint32 offset = SEC_DESC_HEADER_SIZE;
 
247
 
 
248
                /*
 
249
                 * Work out the offsets here, as we write it out.
 
250
                 */
 
251
 
 
252
                if (psd->sacl != NULL) {
 
253
                        psd->off_sacl = offset;
 
254
                        offset += psd->sacl->size;
 
255
                } else {
 
256
                        psd->off_sacl = 0;
 
257
                }
 
258
 
 
259
                if (psd->dacl != NULL) {
 
260
                        psd->off_dacl = offset;
 
261
                        offset += psd->dacl->size;
 
262
                } else {
 
263
                        psd->off_dacl = 0;
 
264
                }
 
265
 
 
266
                if (psd->owner_sid != NULL) {
 
267
                        psd->off_owner_sid = offset;
 
268
                        offset += sid_size(psd->owner_sid);
 
269
                } else {
 
270
                        psd->off_owner_sid = 0;
 
271
                }
 
272
 
 
273
                if (psd->grp_sid != NULL) {
 
274
                        psd->off_grp_sid = offset;
 
275
                        offset += sid_size(psd->grp_sid);
 
276
                } else {
 
277
                        psd->off_grp_sid = 0;
 
278
                }
 
279
        }
 
280
 
225
281
        if(!prs_uint32("off_owner_sid", ps, depth, &psd->off_owner_sid))
226
282
                return False;
227
283
 
289
345
                        return False;
290
346
        }
291
347
 
292
 
 
293
348
        if ((psd->type & SEC_DESC_DACL_PRESENT) && psd->off_dacl != 0) {
294
349
                tmp_offset = prs_offset(ps);
295
350
                if(!prs_set_offset(ps, old_offset + psd->off_dacl))
303
358
 
304
359
        if(!prs_set_offset(ps, max_offset))
305
360
                return False;
 
361
 
306
362
        return True;
307
363
}
308
364