1998-11-09 19:40:38 +03:00
/*
2002-07-15 14:35:28 +04:00
* Unix SMB / Netbios implementation .
* Version 1.9 .
1998-11-09 19:40:38 +03:00
* RPC Pipe client / server routines
2000-06-01 21:01:34 +04:00
* Copyright ( C ) Andrew Tridgell 1992 - 1998 ,
2005-01-20 21:31:11 +03:00
* Copyright ( C ) Jeremy R . Allison 1995 - 2005.
2000-06-01 21:01:34 +04:00
* Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1998 ,
* Copyright ( C ) Paul Ashton 1997 - 1998.
1998-11-09 19:40:38 +03:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2007-07-09 23:25:36 +04:00
* the Free Software Foundation ; either version 3 of the License , or
1998-11-09 19:40:38 +03:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2007-07-10 09:23:25 +04:00
* along with this program ; if not , see < http : //www.gnu.org/licenses/>.
1998-11-09 19:40:38 +03:00
*/
# include "includes.h"
2002-07-15 14:35:28 +04:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_RPC_PARSE
1998-11-09 19:40:38 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SEC_ACCESS structure .
1998-11-09 19:40:38 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
2007-10-19 04:40:25 +04:00
bool sec_io_access ( const char * desc , SEC_ACCESS * t , prs_struct * ps , int depth )
1999-10-15 22:46:22 +04:00
{
1999-12-13 16:27:58 +03:00
if ( t = = NULL )
return False ;
1998-11-09 19:40:38 +03:00
1998-11-13 02:35:05 +03:00
prs_debug ( ps , depth , desc , " sec_io_access " ) ;
1998-11-09 19:40:38 +03:00
depth + + ;
2000-06-01 21:01:34 +04:00
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " mask " , ps , depth , t ) )
2000-06-01 21:01:34 +04:00
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-11-13 02:35:05 +03:00
}
1998-11-09 19:40:38 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Reads or writes a SEC_ACE structure .
1998-11-09 19:40:38 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
2007-10-19 04:40:25 +04:00
bool sec_io_ace ( const char * desc , SEC_ACE * psa , prs_struct * ps , int depth )
1998-11-09 19:40:38 +03:00
{
uint32 old_offset ;
uint32 offset_ace_size ;
2006-09-23 22:24:03 +04:00
uint8 type ;
2000-06-01 21:01:34 +04:00
if ( psa = = NULL )
1999-12-13 16:27:58 +03:00
return False ;
1998-11-09 19:40:38 +03:00
prs_debug ( ps , depth , desc , " sec_io_ace " ) ;
depth + + ;
2000-06-01 21:01:34 +04:00
2000-05-27 05:26:34 +04:00
old_offset = prs_offset ( ps ) ;
1998-11-09 19:40:38 +03:00
2006-09-23 22:24:03 +04:00
if ( MARSHALLING ( ps ) ) {
type = ( uint8 ) psa - > type ;
}
if ( ! prs_uint8 ( " type " , ps , depth , & type ) )
2000-06-01 21:01:34 +04:00
return False ;
2006-09-23 22:24:03 +04:00
if ( UNMARSHALLING ( ps ) ) {
psa - > type = ( enum security_ace_type ) type ;
}
2000-06-01 21:01:34 +04:00
if ( ! prs_uint8 ( " flags " , ps , depth , & psa - > flags ) )
return False ;
if ( ! prs_uint16_pre ( " size " , ps , depth , & psa - > size , & offset_ace_size ) )
return False ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " access_mask " , ps , depth , & psa - > access_mask ) )
2000-06-01 21:01:34 +04:00
return False ;
2002-03-10 04:54:44 +03:00
/* check whether object access is present */
if ( ! sec_ace_object ( psa - > type ) ) {
if ( ! smb_io_dom_sid ( " trustee " , & psa - > trustee , ps , depth ) )
return False ;
} else {
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " obj_flags " , ps , depth , & psa - > object . object . flags ) )
2002-03-10 04:54:44 +03:00
return False ;
2006-09-21 02:23:12 +04:00
if ( psa - > object . object . flags & SEC_ACE_OBJECT_PRESENT )
if ( ! smb_io_uuid ( " obj_guid " , & psa - > object . object . type . type , ps , depth ) )
2002-03-10 04:54:44 +03:00
return False ;
2006-09-21 02:23:12 +04:00
if ( psa - > object . object . flags & SEC_ACE_OBJECT_INHERITED_PRESENT )
if ( ! smb_io_uuid ( " inh_guid " , & psa - > object . object . inherited_type . inherited_type , ps , depth ) )
2002-03-10 04:54:44 +03:00
return False ;
if ( ! smb_io_dom_sid ( " trustee " , & psa - > trustee , ps , depth ) )
return False ;
}
1999-12-13 16:27:58 +03:00
2005-01-20 21:31:11 +03:00
/* Theorectically an ACE can have a size greater than the
sum of its components . When marshalling , pad with extra null bytes up to the
correct size . */
if ( MARSHALLING ( ps ) & & ( psa - > size > prs_offset ( ps ) - old_offset ) ) {
uint32 extra_len = psa - > size - ( prs_offset ( ps ) - old_offset ) ;
uint32 i ;
uint8 c = 0 ;
for ( i = 0 ; i < extra_len ; i + + ) {
if ( ! prs_uint8 ( " ace extra space " , ps , depth , & c ) )
return False ;
}
}
2000-06-01 21:01:34 +04:00
if ( ! prs_uint16_post ( " size " , ps , depth , & psa - > size , offset_ace_size , old_offset ) )
return False ;
2005-01-20 21:31:11 +03:00
1999-10-15 22:46:22 +04:00
return True ;
1998-11-09 19:40:38 +03:00
}
1999-12-13 16:27:58 +03:00
/*******************************************************************
2000-06-01 21:01:34 +04:00
Reads or writes a SEC_ACL structure .
1999-12-13 16:27:58 +03:00
First of the xx_io_xx functions that allocates its data structures
1999-02-24 01:39:54 +03:00
for you as it reads them .
1998-11-09 19:40:38 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
2007-10-19 04:40:25 +04:00
bool sec_io_acl ( const char * desc , SEC_ACL * * ppsa , prs_struct * ps , int depth )
1998-11-09 19:40:38 +03:00
{
2003-03-18 02:04:03 +03:00
unsigned int i ;
1998-11-09 19:40:38 +03:00
uint32 old_offset ;
uint32 offset_acl_size ;
2000-06-01 21:01:34 +04:00
SEC_ACL * psa ;
2006-09-23 21:59:52 +04:00
uint16 revision ;
1999-02-24 01:39:54 +03:00
2002-07-15 14:35:28 +04:00
/*
* Note that the size is always a multiple of 4 bytes due to the
* nature of the data structure . Therefore the prs_align ( ) calls
* have been removed as they through us off when doing two - layer
2005-03-15 22:43:44 +03:00
* marshalling such as in the printing code ( RPC_BUFFER ) . - - jerry
2002-07-15 14:35:28 +04:00
*/
2000-06-01 21:01:34 +04:00
if ( ppsa = = NULL )
1999-12-13 16:27:58 +03:00
return False ;
2000-06-01 21:01:34 +04:00
psa = * ppsa ;
if ( UNMARSHALLING ( ps ) & & psa = = NULL ) {
/*
* This is a read and we must allocate the stuct to read into .
*/
2004-12-07 21:25:53 +03:00
if ( ( psa = PRS_ALLOC_MEM ( ps , SEC_ACL , 1 ) ) = = NULL )
2000-06-01 21:01:34 +04:00
return False ;
* ppsa = psa ;
}
1998-11-09 19:40:38 +03:00
prs_debug ( ps , depth , desc , " sec_io_acl " ) ;
depth + + ;
2000-06-01 21:01:34 +04:00
1999-12-13 16:27:58 +03:00
old_offset = prs_offset ( ps ) ;
1998-11-09 19:40:38 +03:00
2006-09-23 21:59:52 +04:00
if ( MARSHALLING ( ps ) ) {
revision = ( uint16 ) psa - > revision ;
}
if ( ! prs_uint16 ( " revision " , ps , depth , & revision ) )
2000-06-01 21:01:34 +04:00
return False ;
1998-11-09 19:40:38 +03:00
2006-09-23 21:59:52 +04:00
if ( UNMARSHALLING ( ps ) ) {
psa - > revision = ( enum security_acl_revision ) revision ;
}
2000-06-01 21:01:34 +04:00
if ( ! prs_uint16_pre ( " size " , ps , depth , & psa - > size , & offset_acl_size ) )
return False ;
1999-08-04 00:30:25 +04:00
2000-06-01 21:01:34 +04:00
if ( ! prs_uint32 ( " num_aces " , ps , depth , & psa - > num_aces ) )
1999-10-15 22:46:22 +04:00
return False ;
2000-06-01 21:01:34 +04:00
2001-06-26 10:31:55 +04:00
if ( UNMARSHALLING ( ps ) ) {
2007-05-14 18:23:51 +04:00
if ( psa - > num_aces ) {
if ( ( psa - > aces = PRS_ALLOC_MEM ( ps , SEC_ACE , psa - > num_aces ) ) = = NULL )
return False ;
} else {
psa - > aces = NULL ;
}
1998-11-13 02:35:05 +03:00
}
2000-06-01 21:01:34 +04:00
for ( i = 0 ; i < psa - > num_aces ; i + + ) {
1998-11-09 19:40:38 +03:00
fstring tmp ;
2000-06-01 21:01:34 +04:00
slprintf ( tmp , sizeof ( tmp ) - 1 , " ace_list[%02d]: " , i ) ;
2006-09-21 02:23:12 +04:00
if ( ! sec_io_ace ( tmp , & psa - > aces [ i ] , ps , depth ) )
1999-12-13 16:27:58 +03:00
return False ;
1998-11-09 19:40:38 +03:00
}
2005-01-20 21:31:11 +03:00
/* Theorectically an ACL can have a size greater than the
sum of its components . When marshalling , pad with extra null bytes up to the
correct size . */
if ( MARSHALLING ( ps ) & & ( psa - > size > prs_offset ( ps ) - old_offset ) ) {
uint32 extra_len = psa - > size - ( prs_offset ( ps ) - old_offset ) ;
uint8 c = 0 ;
for ( i = 0 ; i < extra_len ; i + + ) {
if ( ! prs_uint8 ( " acl extra space " , ps , depth , & c ) )
return False ;
}
}
2000-06-01 21:01:34 +04:00
if ( ! prs_uint16_post ( " size " , ps , depth , & psa - > size , offset_acl_size , old_offset ) )
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-11-09 19:40:38 +03:00
}
/*******************************************************************
2000-06-01 21:01:34 +04:00
Reads or writes a SEC_DESC structure .
If reading and the * ppsd = NULL , allocates the structure .
1998-11-09 19:40:38 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2000-06-01 21:01:34 +04:00
2007-10-19 04:40:25 +04:00
bool sec_io_desc ( const char * desc , SEC_DESC * * ppsd , prs_struct * ps , int depth )
1998-11-09 19:40:38 +03:00
{
1998-11-11 22:22:08 +03:00
uint32 old_offset ;
2000-06-01 21:01:34 +04:00
uint32 max_offset = 0 ; /* after we're done, move offset to end */
2002-03-10 04:54:44 +03:00
uint32 tmp_offset = 0 ;
2006-09-21 02:23:12 +04:00
uint32 off_sacl , off_dacl , off_owner_sid , off_grp_sid ;
2006-09-23 21:59:52 +04:00
uint16 revision ;
2005-01-20 21:31:11 +03:00
2000-06-01 21:01:34 +04:00
SEC_DESC * psd ;
1999-12-13 16:27:58 +03:00
2000-06-01 21:01:34 +04:00
if ( ppsd = = NULL )
1999-12-13 16:27:58 +03:00
return False ;
1999-02-24 01:39:54 +03:00
2000-06-01 21:01:34 +04:00
psd = * ppsd ;
2000-06-07 05:49:23 +04:00
if ( psd = = NULL ) {
if ( UNMARSHALLING ( ps ) ) {
2004-12-07 21:25:53 +03:00
if ( ( psd = PRS_ALLOC_MEM ( ps , SEC_DESC , 1 ) ) = = NULL )
2000-06-07 05:49:23 +04:00
return False ;
* ppsd = psd ;
} else {
/* Marshalling - just ignore. */
return True ;
}
2000-06-01 21:01:34 +04:00
}
1998-11-09 19:40:38 +03:00
prs_debug ( ps , depth , desc , " sec_io_desc " ) ;
depth + + ;
1998-11-11 22:22:08 +03:00
/* start of security descriptor stored for back-calc offset purposes */
1999-12-13 16:27:58 +03:00
old_offset = prs_offset ( ps ) ;
2000-06-01 21:01:34 +04:00
2006-09-23 21:59:52 +04:00
if ( MARSHALLING ( ps ) ) {
revision = ( uint16 ) psd - > revision ;
}
if ( ! prs_uint16 ( " revision " , ps , depth , & revision ) )
2000-06-01 21:01:34 +04:00
return False ;
2006-09-23 21:59:52 +04:00
if ( UNMARSHALLING ( ps ) ) {
2007-07-28 22:52:28 +04:00
psd - > revision = ( enum security_descriptor_revision ) revision ;
2006-09-23 21:59:52 +04:00
}
2000-06-01 21:01:34 +04:00
if ( ! prs_uint16 ( " type " , ps , depth , & psd - > type ) )
return False ;
2005-01-20 21:31:11 +03:00
if ( MARSHALLING ( ps ) ) {
uint32 offset = SEC_DESC_HEADER_SIZE ;
/*
* Work out the offsets here , as we write it out .
*/
if ( psd - > sacl ! = NULL ) {
2006-09-21 02:23:12 +04:00
off_sacl = offset ;
2005-01-20 21:31:11 +03:00
offset + = psd - > sacl - > size ;
} else {
2006-09-21 02:23:12 +04:00
off_sacl = 0 ;
2005-01-20 21:31:11 +03:00
}
if ( psd - > dacl ! = NULL ) {
2006-09-21 02:23:12 +04:00
off_dacl = offset ;
2005-01-20 21:31:11 +03:00
offset + = psd - > dacl - > size ;
} else {
2006-09-21 02:23:12 +04:00
off_dacl = 0 ;
2005-01-20 21:31:11 +03:00
}
if ( psd - > owner_sid ! = NULL ) {
2006-09-21 02:23:12 +04:00
off_owner_sid = offset ;
2007-12-30 00:16:31 +03:00
offset + = ndr_size_dom_sid ( psd - > owner_sid , 0 ) ;
2005-01-20 21:31:11 +03:00
} else {
2006-09-21 02:23:12 +04:00
off_owner_sid = 0 ;
2005-01-20 21:31:11 +03:00
}
2006-09-21 02:23:12 +04:00
if ( psd - > group_sid ! = NULL ) {
off_grp_sid = offset ;
2007-12-30 00:16:31 +03:00
offset + = ndr_size_dom_sid ( psd - > group_sid , 0 ) ;
2005-01-20 21:31:11 +03:00
} else {
2006-09-21 02:23:12 +04:00
off_grp_sid = 0 ;
2005-01-20 21:31:11 +03:00
}
}
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " off_owner_sid " , ps , depth , & off_owner_sid ) )
2000-06-01 21:01:34 +04:00
return False ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " off_grp_sid " , ps , depth , & off_grp_sid ) )
2000-06-01 21:01:34 +04:00
return False ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " off_sacl " , ps , depth , & off_sacl ) )
2000-06-01 21:01:34 +04:00
return False ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32 ( " off_dacl " , ps , depth , & off_dacl ) )
2000-06-01 21:01:34 +04:00
return False ;
1999-12-13 16:27:58 +03:00
max_offset = MAX ( max_offset , prs_offset ( ps ) ) ;
2006-09-21 02:23:12 +04:00
if ( off_owner_sid ! = 0 ) {
2000-06-01 21:01:34 +04:00
2003-02-15 01:55:46 +03:00
tmp_offset = prs_offset ( ps ) ;
2006-09-21 02:23:12 +04:00
if ( ! prs_set_offset ( ps , old_offset + off_owner_sid ) )
2002-07-15 14:35:28 +04:00
return False ;
2000-06-01 21:01:34 +04:00
if ( UNMARSHALLING ( ps ) ) {
1999-08-04 00:30:25 +04:00
/* reading */
2004-12-07 21:25:53 +03:00
if ( ( psd - > owner_sid = PRS_ALLOC_MEM ( ps , DOM_SID , 1 ) ) = = NULL )
2000-06-01 21:01:34 +04:00
return False ;
1998-11-13 02:35:05 +03:00
}
2000-06-01 21:01:34 +04:00
if ( ! smb_io_dom_sid ( " owner_sid " , psd - > owner_sid , ps , depth ) )
1999-12-13 16:27:58 +03:00
return False ;
2002-03-10 04:54:44 +03:00
2002-07-15 14:35:28 +04:00
max_offset = MAX ( max_offset , prs_offset ( ps ) ) ;
1998-11-13 02:35:05 +03:00
2002-07-15 14:35:28 +04:00
if ( ! prs_set_offset ( ps , tmp_offset ) )
return False ;
}
1998-11-13 02:35:05 +03:00
2006-09-21 02:23:12 +04:00
if ( psd - > group_sid ! = 0 ) {
2000-06-01 21:01:34 +04:00
2003-02-15 01:55:46 +03:00
tmp_offset = prs_offset ( ps ) ;
2006-09-21 02:23:12 +04:00
if ( ! prs_set_offset ( ps , old_offset + off_grp_sid ) )
2002-07-15 14:35:28 +04:00
return False ;
2000-06-01 21:01:34 +04:00
if ( UNMARSHALLING ( ps ) ) {
1999-08-04 00:30:25 +04:00
/* reading */
2006-09-21 02:23:12 +04:00
if ( ( psd - > group_sid = PRS_ALLOC_MEM ( ps , DOM_SID , 1 ) ) = = NULL )
2000-06-01 21:01:34 +04:00
return False ;
1999-08-04 00:30:25 +04:00
}
1999-02-24 01:39:54 +03:00
2006-09-21 02:23:12 +04:00
if ( ! smb_io_dom_sid ( " grp_sid " , psd - > group_sid , ps , depth ) )
1999-10-15 22:46:22 +04:00
return False ;
2002-07-15 14:35:28 +04:00
max_offset = MAX ( max_offset , prs_offset ( ps ) ) ;
2002-03-10 04:54:44 +03:00
2002-07-15 14:35:28 +04:00
if ( ! prs_set_offset ( ps , tmp_offset ) )
return False ;
2000-05-27 05:26:34 +04:00
}
1999-12-13 16:27:58 +03:00
2006-09-21 02:23:12 +04:00
if ( ( psd - > type & SEC_DESC_SACL_PRESENT ) & & off_sacl ) {
2003-02-15 01:55:46 +03:00
tmp_offset = prs_offset ( ps ) ;
2006-09-21 02:23:12 +04:00
if ( ! prs_set_offset ( ps , old_offset + off_sacl ) )
2000-06-01 21:01:34 +04:00
return False ;
if ( ! sec_io_acl ( " sacl " , & psd - > sacl , ps , depth ) )
return False ;
2002-07-15 14:35:28 +04:00
max_offset = MAX ( max_offset , prs_offset ( ps ) ) ;
if ( ! prs_set_offset ( ps , tmp_offset ) )
1999-12-13 16:27:58 +03:00
return False ;
1999-02-24 01:39:54 +03:00
}
2006-09-21 02:23:12 +04:00
if ( ( psd - > type & SEC_DESC_DACL_PRESENT ) & & off_dacl ! = 0 ) {
2003-02-15 01:55:46 +03:00
tmp_offset = prs_offset ( ps ) ;
2006-09-21 02:23:12 +04:00
if ( ! prs_set_offset ( ps , old_offset + off_dacl ) )
2000-06-01 21:01:34 +04:00
return False ;
if ( ! sec_io_acl ( " dacl " , & psd - > dacl , ps , depth ) )
return False ;
2002-07-15 14:35:28 +04:00
max_offset = MAX ( max_offset , prs_offset ( ps ) ) ;
if ( ! prs_set_offset ( ps , tmp_offset ) )
1999-12-13 16:27:58 +03:00
return False ;
}
1999-08-04 00:30:25 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_set_offset ( ps , max_offset ) )
return False ;
2005-01-20 21:31:11 +03:00
1999-10-15 22:46:22 +04:00
return True ;
1998-11-12 00:44:02 +03:00
}
1998-11-09 19:40:38 +03:00
/*******************************************************************
2000-06-01 21:01:34 +04:00
Reads or writes a SEC_DESC_BUF structure .
1998-11-09 19:40:38 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2000-06-01 21:01:34 +04:00
2007-10-19 04:40:25 +04:00
bool sec_io_desc_buf ( const char * desc , SEC_DESC_BUF * * ppsdb , prs_struct * ps , int depth )
1998-11-09 19:40:38 +03:00
{
1998-11-11 22:22:08 +03:00
uint32 off_len ;
1998-11-12 22:21:20 +03:00
uint32 off_max_len ;
1998-11-11 22:22:08 +03:00
uint32 old_offset ;
1998-11-12 22:21:20 +03:00
uint32 size ;
2006-09-21 02:23:12 +04:00
uint32 len ;
2000-06-01 21:01:34 +04:00
SEC_DESC_BUF * psdb ;
2006-09-21 02:23:12 +04:00
uint32 ptr ;
1999-12-13 16:27:58 +03:00
2000-06-01 21:01:34 +04:00
if ( ppsdb = = NULL )
1999-12-13 16:27:58 +03:00
return False ;
1998-11-11 22:22:08 +03:00
2000-06-01 21:01:34 +04:00
psdb = * ppsdb ;
if ( UNMARSHALLING ( ps ) & & psdb = = NULL ) {
2004-12-07 21:25:53 +03:00
if ( ( psdb = PRS_ALLOC_MEM ( ps , SEC_DESC_BUF , 1 ) ) = = NULL )
2000-06-01 21:01:34 +04:00
return False ;
* ppsdb = psdb ;
}
1998-11-09 19:40:38 +03:00
prs_debug ( ps , depth , desc , " sec_io_desc_buf " ) ;
depth + + ;
2000-06-01 21:01:34 +04:00
if ( ! prs_align ( ps ) )
return False ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32_pre ( " max_len " , ps , depth , & psdb - > sd_size , & off_max_len ) )
2000-06-01 21:01:34 +04:00
return False ;
1999-08-04 00:30:25 +04:00
2006-09-21 02:23:12 +04:00
ptr = 1 ;
if ( ! prs_uint32 ( " ptr " , ps , depth , & ptr ) )
2000-06-01 21:01:34 +04:00
return False ;
1998-11-13 02:35:05 +03:00
2007-12-30 01:00:49 +03:00
len = ndr_size_security_descriptor ( psdb - > sd , 0 ) ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32_pre ( " len " , ps , depth , & len , & off_len ) )
2000-06-01 21:01:34 +04:00
return False ;
2000-05-27 05:26:34 +04:00
2000-06-01 21:01:34 +04:00
old_offset = prs_offset ( ps ) ;
1999-02-24 01:39:54 +03:00
2000-05-27 05:26:34 +04:00
/* reading, length is non-zero; writing, descriptor is non-NULL */
2006-09-21 02:23:12 +04:00
if ( ( UNMARSHALLING ( ps ) & & psdb - > sd_size ! = 0 ) | | ( MARSHALLING ( ps ) & & psdb - > sd ! = NULL ) ) {
if ( ! sec_io_desc ( " sec " , & psdb - > sd , ps , depth ) )
2000-06-01 21:01:34 +04:00
return False ;
2000-05-27 05:26:34 +04:00
}
2000-06-01 21:01:34 +04:00
if ( ! prs_align ( ps ) )
return False ;
size = prs_offset ( ps ) - old_offset ;
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32_post ( " max_len " , ps , depth , & psdb - > sd_size , off_max_len , size = = 0 ? psdb - > sd_size : size ) )
2000-06-01 21:01:34 +04:00
return False ;
1999-12-13 16:27:58 +03:00
2006-09-21 02:23:12 +04:00
if ( ! prs_uint32_post ( " len " , ps , depth , & len , off_len , size ) )
1999-12-13 16:27:58 +03:00
return False ;
1999-10-15 22:46:22 +04:00
return True ;
1998-11-09 19:40:38 +03:00
}