1998-03-11 21:11:04 +00:00
/*
2002-01-30 06:08:46 +00:00
* Unix SMB / CIFS implementation .
1998-03-11 21:11:04 +00:00
* RPC Pipe client / server routines
1999-12-13 13:27:58 +00:00
* Copyright ( C ) Andrew Tridgell 1992 - 1997 ,
* Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1997 ,
* Copyright ( C ) Paul Ashton 1997.
* Copyright ( C ) Jeremy Allison 1999.
1998-03-11 21:11:04 +00: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
* the Free Software Foundation ; either version 2 of the License , or
* ( 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
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 675 Mass Ave , Cambridge , MA 0213 9 , USA .
*/
# include "includes.h"
2002-07-15 10:35:28 +00:00
# undef DBGC_CLASS
# define DBGC_CLASS DBGC_RPC_PARSE
1998-03-11 21:11:04 +00:00
/*******************************************************************
interface / version dce / rpc pipe identification
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
# define TRANS_SYNT_V2 \
{ \
{ \
0x8a885d04 , 0x1ceb , 0x11c9 , \
2004-04-13 14:39:48 +00:00
{ 0x9f , 0xe8 } , \
{ 0x08 , 0x00 , \
2005-03-23 23:26:33 +00:00
0x2b , 0x10 , 0x48 , 0x60 } \
1999-12-13 13:27:58 +00:00
} , 0x02 \
}
# define SYNT_NETLOGON_V2 \
{ \
{ \
0x8a885d04 , 0x1ceb , 0x11c9 , \
2004-04-13 14:39:48 +00:00
{ 0x9f , 0xe8 } , \
{ 0x08 , 0x00 , \
2005-03-23 23:26:33 +00:00
0x2b , 0x10 , 0x48 , 0x60 } \
1999-12-13 13:27:58 +00:00
} , 0x02 \
}
# define SYNT_WKSSVC_V1 \
{ \
{ \
0x6bffd098 , 0xa112 , 0x3610 , \
2004-04-13 14:39:48 +00:00
{ 0x98 , 0x33 } , \
{ 0x46 , 0xc3 , \
2005-03-23 23:26:33 +00:00
0xf8 , 0x7e , 0x34 , 0x5a } \
1999-12-13 13:27:58 +00:00
} , 0x01 \
}
# define SYNT_SRVSVC_V3 \
{ \
{ \
0x4b324fc8 , 0x1670 , 0x01d3 , \
2004-04-13 14:39:48 +00:00
{ 0x12 , 0x78 } , \
{ 0x5a , 0x47 , \
2005-03-23 23:26:33 +00:00
0xbf , 0x6e , 0xe1 , 0x88 } \
1999-12-13 13:27:58 +00:00
} , 0x03 \
}
# define SYNT_LSARPC_V0 \
{ \
{ \
0x12345778 , 0x1234 , 0xabcd , \
2004-04-13 14:39:48 +00:00
{ 0xef , 0x00 } , \
{ 0x01 , 0x23 , \
2005-03-23 23:26:33 +00:00
0x45 , 0x67 , 0x89 , 0xab } \
1999-12-13 13:27:58 +00:00
} , 0x00 \
}
2002-10-04 19:33:41 +00:00
# define SYNT_LSARPC_V0_DS \
2002-10-04 04:10:23 +00:00
{ \
{ \
0x3919286a , 0xb10c , 0x11d0 , \
2004-04-13 14:39:48 +00:00
{ 0x9b , 0xa8 } , \
{ 0x00 , 0xc0 , \
2005-03-23 23:26:33 +00:00
0x4f , 0xd9 , 0x2e , 0xf5 } \
2002-10-04 04:10:23 +00:00
} , 0x00 \
}
1999-12-13 13:27:58 +00:00
# define SYNT_SAMR_V1 \
{ \
{ \
0x12345778 , 0x1234 , 0xabcd , \
2004-04-13 14:39:48 +00:00
{ 0xef , 0x00 } , \
{ 0x01 , 0x23 , \
2005-03-23 23:26:33 +00:00
0x45 , 0x67 , 0x89 , 0xac } \
1999-12-13 13:27:58 +00:00
} , 0x01 \
}
# define SYNT_NETLOGON_V1 \
{ \
{ \
0x12345678 , 0x1234 , 0xabcd , \
2004-04-13 14:39:48 +00:00
{ 0xef , 0x00 } , \
{ 0x01 , 0x23 , \
2005-03-23 23:26:33 +00:00
0x45 , 0x67 , 0xcf , 0xfb } \
1999-12-13 13:27:58 +00:00
} , 0x01 \
}
# define SYNT_WINREG_V1 \
{ \
{ \
0x338cd001 , 0x2244 , 0x31f1 , \
2004-04-13 14:39:48 +00:00
{ 0xaa , 0xaa } , \
{ 0x90 , 0x00 , \
2005-03-23 23:26:33 +00:00
0x38 , 0x00 , 0x10 , 0x03 } \
1999-12-13 13:27:58 +00:00
} , 0x01 \
}
2000-02-07 16:25:15 +00:00
# define SYNT_SPOOLSS_V1 \
{ \
{ \
2000-03-06 11:13:40 +00:00
0x12345678 , 0x1234 , 0xabcd , \
2004-04-13 14:39:48 +00:00
{ 0xef , 0x00 } , \
{ 0x01 , 0x23 , \
2005-03-23 23:26:33 +00:00
0x45 , 0x67 , 0x89 , 0xab } \
2000-02-07 16:25:15 +00:00
} , 0x01 \
}
1999-12-13 13:27:58 +00:00
# define SYNT_NONE_V0 \
{ \
{ \
0x0 , 0x0 , 0x0 , \
2004-04-13 14:39:48 +00:00
{ 0x00 , 0x00 } , \
{ 0x00 , 0x00 , \
2005-03-23 23:26:33 +00:00
0x00 , 0x00 , 0x00 , 0x00 } \
1999-12-13 13:27:58 +00:00
} , 0x00 \
}
2000-05-18 18:43:53 +00:00
# define SYNT_NETDFS_V3 \
{ \
{ \
0x4fc742e0 , 0x4a10 , 0x11cf , \
2004-04-13 14:39:48 +00:00
{ 0x82 , 0x73 } , \
{ 0x00 , 0xaa , \
2000-05-18 18:43:53 +00:00
0x00 , 0x4a , 0xe6 , 0x73 } \
} , 0x03 \
}
2003-04-14 02:08:03 +00:00
# define SYNT_ECHO_V1 \
{ \
{ \
0x60a15ec5 , 0x4de8 , 0x11d7 , \
2004-04-13 14:39:48 +00:00
{ 0xa6 , 0x37 } , \
{ 0x00 , 0x50 , \
2003-04-14 02:08:03 +00:00
0x56 , 0xa2 , 0x01 , 0x82 } \
} , 0x01 \
}
2003-10-24 13:49:29 +00:00
# define SYNT_SHUTDOWN_V1 \
{ \
{ \
0x894de0c0 , 0x0d55 , 0x11d3 , \
2004-04-13 14:39:48 +00:00
{ 0xa3 , 0x22 } , \
{ 0x00 , 0xc0 , \
2003-10-24 13:49:29 +00:00
0x4f , 0xa3 , 0x21 , 0xa1 } \
} , 0x01 \
}
2005-03-23 23:26:33 +00:00
# define SYNT_SVCCTL_V2 \
{ \
{ \
0x367abb81 , 0x9844 , 0x35f1 , \
{ 0xad , 0x32 } , \
{ 0x98 , 0xf0 , \
0x38 , 0x00 , 0x10 , 0x03 } \
} , 0x02 \
}
# define SYNT_EVENTLOG_V0 \
{ \
{ \
0x82273fdc , 0xe32a , 0x18c3 , \
{ 0x3f , 0x78 } , \
{ 0x82 , 0x79 , \
0x29 , 0xdc , 0x23 , 0xea } \
} , 0x00 \
}
2005-09-30 17:13:37 +00:00
# define SYNT_NTSVCS_V1 \
{ \
{ \
0x8d9f4e40 , 0xa03d , 0x11ce , \
{ 0x8f , 0x69 } , \
{ 0x08 , 0x00 , \
0x3e , 0x30 , 0x05 , 0x1b } \
} , 0x01 \
}
2002-10-04 04:10:23 +00:00
/*
* IMPORTANT ! ! If you update this structure , make sure to
* update the index # defines in smb . h .
*/
2003-01-03 08:28:12 +00:00
const struct pipe_id_info pipe_names [ ] =
1998-03-11 21:11:04 +00:00
{
2002-10-04 04:10:23 +00:00
/* client pipe , abstract syntax , server pipe , transfer syntax */
{ PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 } ,
2002-10-04 19:33:41 +00:00
{ PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 } ,
2002-10-04 04:10:23 +00:00
{ PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 } ,
{ PIPE_NETLOGON , SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 } ,
{ PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 } ,
{ PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 } ,
{ PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 } ,
{ PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 } ,
{ PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 } ,
2003-04-14 02:08:03 +00:00
{ PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 } ,
2003-10-24 13:49:29 +00:00
{ PIPE_SHUTDOWN , SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 } ,
2005-03-23 23:26:33 +00:00
{ PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 } ,
{ PIPE_EVENTLOG , SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 } ,
2005-09-30 17:13:37 +00:00
{ PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 } ,
2002-10-04 04:10:23 +00:00
{ NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 }
1998-03-11 21:11:04 +00:00
} ;
2005-09-30 17:13:37 +00:00
/****************************************************************************
Return the pipe name from the index .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
const char * cli_get_pipe_name ( int pipe_idx )
{
return & pipe_names [ pipe_idx ] . client_pipe [ 5 ] ;
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an RPC_HDR structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_rpc_hdr ( RPC_HDR * hdr , enum RPC_PKT_TYPE pkt_type , uint8 flags ,
1998-03-11 21:11:04 +00:00
uint32 call_id , int data_len , int auth_len )
{
hdr - > major = 5 ; /* RPC version 5 */
hdr - > minor = 0 ; /* minor version 0 */
hdr - > pkt_type = pkt_type ; /* RPC packet type */
hdr - > flags = flags ; /* dce/rpc flags */
1999-12-13 13:27:58 +00:00
hdr - > pack_type [ 0 ] = 0x10 ; /* little-endian data representation */
hdr - > pack_type [ 1 ] = 0 ; /* packed data representation */
hdr - > pack_type [ 2 ] = 0 ; /* packed data representation */
hdr - > pack_type [ 3 ] = 0 ; /* packed data representation */
1998-03-11 21:11:04 +00:00
hdr - > frag_len = data_len ; /* fragment length, fill in later */
hdr - > auth_len = auth_len ; /* authentication length */
hdr - > call_id = call_id ; /* call identifier - match incoming RPC */
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_HDR structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_hdr ( const char * desc , RPC_HDR * rpc , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rpc = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_uint8 ( " major " , ps , depth , & rpc - > major ) )
return False ;
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
if ( ! prs_uint8 ( " minor " , ps , depth , & rpc - > minor ) )
return False ;
if ( ! prs_uint8 ( " pkt_type " , ps , depth , & rpc - > pkt_type ) )
return False ;
if ( ! prs_uint8 ( " flags " , ps , depth , & rpc - > flags ) )
return False ;
2001-03-12 21:09:55 +00:00
/* We always marshall in little endian format. */
if ( MARSHALLING ( ps ) )
rpc - > pack_type [ 0 ] = 0x10 ;
1999-12-13 13:27:58 +00:00
if ( ! prs_uint8 ( " pack_type0 " , ps , depth , & rpc - > pack_type [ 0 ] ) )
return False ;
if ( ! prs_uint8 ( " pack_type1 " , ps , depth , & rpc - > pack_type [ 1 ] ) )
return False ;
if ( ! prs_uint8 ( " pack_type2 " , ps , depth , & rpc - > pack_type [ 2 ] ) )
return False ;
if ( ! prs_uint8 ( " pack_type3 " , ps , depth , & rpc - > pack_type [ 3 ] ) )
return False ;
1999-11-15 22:11:10 +00:00
1999-12-13 13:27:58 +00:00
/*
* If reading and pack_type [ 0 ] = = 0 then the data is in big - endian
* format . Set the flag in the prs_struct to specify reverse - endainness .
*/
1999-11-15 22:11:10 +00:00
2001-03-12 21:09:55 +00:00
if ( UNMARSHALLING ( ps ) & & rpc - > pack_type [ 0 ] = = 0 ) {
1999-12-13 13:27:58 +00:00
DEBUG ( 10 , ( " smb_io_rpc_hdr: PDU data format is big-endian. Setting flag. \n " ) ) ;
2001-03-09 23:48:58 +00:00
prs_set_endian_data ( ps , RPC_BIG_ENDIAN ) ;
1999-12-13 13:27:58 +00:00
}
1999-11-15 22:11:10 +00:00
1999-12-13 13:27:58 +00:00
if ( ! prs_uint16 ( " frag_len " , ps , depth , & rpc - > frag_len ) )
return False ;
if ( ! prs_uint16 ( " auth_len " , ps , depth , & rpc - > auth_len ) )
return False ;
if ( ! prs_uint32 ( " call_id " , ps , depth , & rpc - > call_id ) )
return False ;
1999-11-15 22:11:10 +00:00
return True ;
}
2003-10-03 15:07:15 +00:00
/*******************************************************************
Reads or writes an RPC_IFACE structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static BOOL smb_io_rpc_iface ( const char * desc , RPC_IFACE * ifc , prs_struct * ps , int depth )
{
if ( ifc = = NULL )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2003-10-03 15:07:15 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_iface " ) ;
depth + + ;
2004-04-13 14:39:48 +00:00
if ( ! prs_align ( ps ) )
return False ;
if ( ! smb_io_uuid ( " uuid " , & ifc - > uuid , ps , depth ) )
1999-12-13 13:27:58 +00:00
return False ;
2003-10-03 15:07:15 +00:00
2003-10-03 20:13:11 +00:00
if ( ! prs_uint32 ( " version " , ps , depth , & ifc - > version ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an RPC_ADDR_STR structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-10-15 18:46:22 +00:00
2003-01-03 08:28:12 +00:00
static void init_rpc_addr_str ( RPC_ADDR_STR * str , const char * name )
1999-12-13 13:27:58 +00:00
{
str - > len = strlen ( name ) + 1 ;
fstrcpy ( str - > str , name ) ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_ADDR_STR structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
static BOOL smb_io_rpc_addr_str ( const char * desc , RPC_ADDR_STR * str , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( str = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_addr_str " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_align ( ps ) )
return False ;
1999-10-15 18:46:22 +00:00
1999-12-13 13:27:58 +00:00
if ( ! prs_uint16 ( " len " , ps , depth , & str - > len ) )
return False ;
if ( ! prs_uint8s ( True , " str " , ps , depth , ( uchar * ) str - > str , MIN ( str - > len , sizeof ( str - > str ) ) ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an RPC_HDR_BBA structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
static void init_rpc_hdr_bba ( RPC_HDR_BBA * bba , uint16 max_tsize , uint16 max_rsize , uint32 assoc_gid )
{
1998-03-11 21:11:04 +00:00
bba - > max_tsize = max_tsize ; /* maximum transmission fragment size (0x1630) */
bba - > max_rsize = max_rsize ; /* max receive fragment size (0x1630) */
bba - > assoc_gid = assoc_gid ; /* associated group id (0x0) */
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_HDR_BBA structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
static BOOL smb_io_rpc_hdr_bba ( const char * desc , RPC_HDR_BBA * rpc , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rpc = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_bba " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_uint16 ( " max_tsize " , ps , depth , & rpc - > max_tsize ) )
return False ;
if ( ! prs_uint16 ( " max_rsize " , ps , depth , & rpc - > max_rsize ) )
return False ;
if ( ! prs_uint32 ( " assoc_gid " , ps , depth , & rpc - > assoc_gid ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
2005-06-08 03:48:40 +00:00
/*******************************************************************
Inits an RPC_CONTEXT structure .
Note the transfer pointer must remain valid until this is marshalled .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void init_rpc_context ( RPC_CONTEXT * rpc_ctx , uint16 context_id , RPC_IFACE * abstract , RPC_IFACE * transfer )
{
rpc_ctx - > context_id = context_id ; /* presentation context identifier (0x0) */
rpc_ctx - > num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */
/* num and vers. of interface client is using */
rpc_ctx - > abstract = * abstract ;
/* vers. of interface to use for replies */
rpc_ctx - > transfer = transfer ;
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an RPC_HDR_RB structure .
2005-06-08 03:48:40 +00:00
Note the context pointer must remain valid until this is marshalled .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_rpc_hdr_rb ( RPC_HDR_RB * rpc ,
1998-03-11 21:11:04 +00:00
uint16 max_tsize , uint16 max_rsize , uint32 assoc_gid ,
2005-06-08 03:48:40 +00:00
RPC_CONTEXT * context )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
init_rpc_hdr_bba ( & rpc - > bba , max_tsize , max_rsize , assoc_gid ) ;
1998-03-11 21:11:04 +00:00
2005-06-08 03:48:40 +00:00
rpc - > num_contexts = 1 ;
rpc - > rpc_context = context ;
}
1998-03-11 21:11:04 +00:00
2005-06-08 03:48:40 +00:00
/*******************************************************************
Reads or writes an RPC_CONTEXT structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-03-11 21:11:04 +00:00
2005-06-08 03:48:40 +00:00
BOOL smb_io_rpc_context ( const char * desc , RPC_CONTEXT * rpc_ctx , prs_struct * ps , int depth )
{
int i ;
if ( rpc_ctx = = NULL )
return False ;
if ( ! prs_align ( ps ) )
return False ;
if ( ! prs_uint16 ( " context_id " , ps , depth , & rpc_ctx - > context_id ) )
return False ;
if ( ! prs_uint8 ( " num_transfer_syntaxes " , ps , depth , & rpc_ctx - > num_transfer_syntaxes ) )
return False ;
/* num_transfer_syntaxes must not be zero. */
if ( rpc_ctx - > num_transfer_syntaxes = = 0 )
return False ;
if ( ! smb_io_rpc_iface ( " " , & rpc_ctx - > abstract , ps , depth ) )
return False ;
if ( UNMARSHALLING ( ps ) ) {
if ( ! ( rpc_ctx - > transfer = PRS_ALLOC_MEM ( ps , RPC_IFACE , rpc_ctx - > num_transfer_syntaxes ) ) ) {
return False ;
}
}
for ( i = 0 ; i < rpc_ctx - > num_transfer_syntaxes ; i + + ) {
if ( ! smb_io_rpc_iface ( " " , & rpc_ctx - > transfer [ i ] , ps , depth ) )
return False ;
}
return True ;
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_HDR_RB structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_hdr_rb ( const char * desc , RPC_HDR_RB * rpc , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
2005-04-08 04:13:19 +00:00
int i ;
1999-12-13 13:27:58 +00:00
if ( rpc = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_rb " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! smb_io_rpc_hdr_bba ( " " , & rpc - > bba , ps , depth ) )
return False ;
1998-03-11 21:11:04 +00:00
2005-06-17 18:05:46 +00:00
if ( ! prs_uint8 ( " num_contexts " , ps , depth , & rpc - > num_contexts ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-03-11 21:11:04 +00:00
2005-06-17 18:05:46 +00:00
/* 3 pad bytes following - will be mopped up by the prs_align in smb_io_rpc_context(). */
2005-06-08 03:48:40 +00:00
/* num_contexts must not be zero. */
if ( rpc - > num_contexts = = 0 )
1999-12-13 13:27:58 +00:00
return False ;
2005-04-08 04:13:19 +00:00
2005-06-08 03:48:40 +00:00
if ( UNMARSHALLING ( ps ) ) {
if ( ! ( rpc - > rpc_context = PRS_ALLOC_MEM ( ps , RPC_CONTEXT , rpc - > num_contexts ) ) ) {
2005-04-08 04:13:19 +00:00
return False ;
2005-06-08 03:48:40 +00:00
}
}
for ( i = 0 ; i < rpc - > num_contexts ; i + + ) {
if ( ! smb_io_rpc_context ( " " , & rpc - > rpc_context [ i ] , ps , depth ) )
2005-04-08 04:13:19 +00:00
return False ;
2005-06-08 03:48:40 +00:00
}
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an RPC_RESULTS structure .
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
lkclXXXX only one reason at the moment !
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
static void init_rpc_results ( RPC_RESULTS * res ,
1998-03-11 21:11:04 +00:00
uint8 num_results , uint16 result , uint16 reason )
{
res - > num_results = num_results ; /* the number of results (0x01) */
res - > result = result ; /* result (0x00 = accept) */
res - > reason = reason ; /* reason (0x00 = no reason specified) */
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_RESULTS structure .
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
lkclXXXX only one reason at the moment !
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
static BOOL smb_io_rpc_results ( const char * desc , RPC_RESULTS * res , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( res = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_results " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
if ( ! prs_uint8 ( " num_results " , ps , depth , & res - > num_results ) )
return False ;
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
if ( ! prs_align ( ps ) )
return False ;
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
if ( ! prs_uint16 ( " result " , ps , depth , & res - > result ) )
return False ;
if ( ! prs_uint16 ( " reason " , ps , depth , & res - > reason ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Init an RPC_HDR_BA structure .
1998-03-11 21:11:04 +00:00
1999-12-13 13:27:58 +00:00
lkclXXXX only one reason at the moment !
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_rpc_hdr_ba ( RPC_HDR_BA * rpc ,
1998-03-11 21:11:04 +00:00
uint16 max_tsize , uint16 max_rsize , uint32 assoc_gid ,
2003-01-03 08:28:12 +00:00
const char * pipe_addr ,
1998-03-11 21:11:04 +00:00
uint8 num_results , uint16 result , uint16 reason ,
RPC_IFACE * transfer )
{
1999-12-13 13:27:58 +00:00
init_rpc_hdr_bba ( & rpc - > bba , max_tsize , max_rsize , assoc_gid ) ;
init_rpc_addr_str ( & rpc - > addr , pipe_addr ) ;
init_rpc_results ( & rpc - > res , num_results , result , reason ) ;
1998-03-11 21:11:04 +00:00
/* the transfer syntax from the request */
1999-12-13 13:27:58 +00:00
memcpy ( & rpc - > transfer , transfer , sizeof ( rpc - > transfer ) ) ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_HDR_BA structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_hdr_ba ( const char * desc , RPC_HDR_BA * rpc , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rpc = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_ba " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! smb_io_rpc_hdr_bba ( " " , & rpc - > bba , ps , depth ) )
return False ;
if ( ! smb_io_rpc_addr_str ( " " , & rpc - > addr , ps , depth ) )
return False ;
if ( ! smb_io_rpc_results ( " " , & rpc - > res , ps , depth ) )
return False ;
if ( ! smb_io_rpc_iface ( " " , & rpc - > transfer , ps , depth ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Init an RPC_HDR_REQ structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_rpc_hdr_req ( RPC_HDR_REQ * hdr , uint32 alloc_hint , uint16 opnum )
{
1998-10-08 23:57:46 +00:00
hdr - > alloc_hint = alloc_hint ; /* allocation hint */
hdr - > context_id = 0 ; /* presentation context identifier */
hdr - > opnum = opnum ; /* opnum */
1998-04-10 18:21:16 +00:00
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_HDR_REQ structure .
1998-04-10 18:21:16 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_hdr_req ( const char * desc , RPC_HDR_REQ * rpc , prs_struct * ps , int depth )
1998-04-10 18:21:16 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rpc = = NULL )
return False ;
1998-04-10 18:21:16 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_req " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_uint32 ( " alloc_hint " , ps , depth , & rpc - > alloc_hint ) )
return False ;
if ( ! prs_uint16 ( " context_id " , ps , depth , & rpc - > context_id ) )
return False ;
if ( ! prs_uint16 ( " opnum " , ps , depth , & rpc - > opnum ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-04-10 18:21:16 +00:00
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_HDR_RESP structure .
1998-03-11 21:11:04 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_hdr_resp ( const char * desc , RPC_HDR_RESP * rpc , prs_struct * ps , int depth )
1998-03-11 21:11:04 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rpc = = NULL )
return False ;
1998-03-11 21:11:04 +00:00
1998-04-10 18:21:16 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_resp " ) ;
1998-03-11 21:11:04 +00:00
depth + + ;
1999-12-13 13:27:58 +00:00
if ( ! prs_uint32 ( " alloc_hint " , ps , depth , & rpc - > alloc_hint ) )
return False ;
if ( ! prs_uint16 ( " context_id " , ps , depth , & rpc - > context_id ) )
return False ;
if ( ! prs_uint8 ( " cancel_ct " , ps , depth , & rpc - > cancel_count ) )
return False ;
if ( ! prs_uint8 ( " reserved " , ps , depth , & rpc - > reserved ) )
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-03-11 21:11:04 +00:00
}
2000-02-29 21:39:54 +00:00
/*******************************************************************
Reads or writes an RPC_HDR_FAULT structure .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_hdr_fault ( const char * desc , RPC_HDR_FAULT * rpc , prs_struct * ps , int depth )
2000-02-29 21:39:54 +00:00
{
if ( rpc = = NULL )
return False ;
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_fault " ) ;
depth + + ;
2006-03-22 14:41:07 +00:00
if ( ! prs_dcerpc_status ( " status " , ps , depth , & rpc - > status ) )
2000-02-29 21:39:54 +00:00
return False ;
if ( ! prs_uint32 ( " reserved " , ps , depth , & rpc - > reserved ) )
return False ;
return True ;
}
1998-10-07 21:42:24 +00:00
/*******************************************************************
2005-07-27 20:25:04 +00:00
Inits an RPC_HDR_AUTH structure .
1998-10-07 21:42:24 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-07-27 20:25:04 +00:00
void init_rpc_hdr_auth ( RPC_HDR_AUTH * rai ,
1998-10-07 21:42:24 +00:00
uint8 auth_type , uint8 auth_level ,
2005-07-27 20:25:04 +00:00
uint8 auth_pad_len ,
uint32 auth_context_id )
1998-10-07 21:42:24 +00:00
{
2005-09-30 17:13:37 +00:00
rai - > auth_type = auth_type ;
rai - > auth_level = auth_level ;
2005-07-27 20:25:04 +00:00
rai - > auth_pad_len = auth_pad_len ;
rai - > auth_reserved = 0 ;
rai - > auth_context_id = auth_context_id ;
1998-10-07 21:42:24 +00:00
}
/*******************************************************************
2005-07-27 20:25:04 +00:00
Reads or writes an RPC_HDR_AUTH structure .
1998-10-07 21:42:24 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-07-27 20:25:04 +00:00
BOOL smb_io_rpc_hdr_auth ( const char * desc , RPC_HDR_AUTH * rai , prs_struct * ps , int depth )
1998-10-07 21:42:24 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rai = = NULL )
return False ;
1998-10-07 21:42:24 +00:00
2005-07-27 20:25:04 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_hdr_auth " ) ;
1998-10-07 21:42:24 +00:00
depth + + ;
2005-07-27 20:25:04 +00:00
if ( ! prs_align ( ps ) )
1999-12-13 13:27:58 +00:00
return False ;
1998-10-07 21:42:24 +00:00
2005-09-30 17:13:37 +00:00
if ( ! prs_uint8 ( " auth_type " , ps , depth , & rai - > auth_type ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-09-30 17:13:37 +00:00
if ( ! prs_uint8 ( " auth_level " , ps , depth , & rai - > auth_level ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-07-27 20:25:04 +00:00
if ( ! prs_uint8 ( " auth_pad_len " , ps , depth , & rai - > auth_pad_len ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-07-27 20:25:04 +00:00
if ( ! prs_uint8 ( " auth_reserved " , ps , depth , & rai - > auth_reserved ) )
1999-12-13 13:27:58 +00:00
return False ;
2005-07-27 20:25:04 +00:00
if ( ! prs_uint32 ( " auth_context_id " , ps , depth , & rai - > auth_context_id ) )
1999-12-13 13:27:58 +00:00
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-10-07 21:42:24 +00:00
}
1998-10-19 17:32:10 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Checks an RPC_AUTH_VERIFIER structure .
1998-10-19 17:32:10 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
BOOL rpc_auth_verifier_chk ( RPC_AUTH_VERIFIER * rav ,
2003-01-03 08:28:12 +00:00
const char * signature , uint32 msg_type )
1998-10-19 17:32:10 +00:00
{
return ( strequal ( rav - > signature , signature ) & & rav - > msg_type = = msg_type ) ;
}
1998-10-08 23:57:46 +00:00
/*******************************************************************
1999-12-13 13:27:58 +00:00
Inits an RPC_AUTH_VERIFIER structure .
1998-10-08 23:57:46 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
void init_rpc_auth_verifier ( RPC_AUTH_VERIFIER * rav ,
2003-01-03 08:28:12 +00:00
const char * signature , uint32 msg_type )
1998-10-08 23:57:46 +00:00
{
fstrcpy ( rav - > signature , signature ) ; /* "NTLMSSP" */
rav - > msg_type = msg_type ; /* NTLMSSP_MESSAGE_TYPE */
}
/*******************************************************************
1999-12-13 13:27:58 +00:00
Reads or writes an RPC_AUTH_VERIFIER structure .
1998-10-08 23:57:46 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2003-01-03 08:28:12 +00:00
BOOL smb_io_rpc_auth_verifier ( const char * desc , RPC_AUTH_VERIFIER * rav , prs_struct * ps , int depth )
1998-10-08 23:57:46 +00:00
{
1999-12-13 13:27:58 +00:00
if ( rav = = NULL )
return False ;
1998-10-08 23:57:46 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_auth_verifier " ) ;
depth + + ;
1999-12-13 13:27:58 +00:00
/* "NTLMSSP" */
2003-04-22 15:54:36 +00:00
if ( ! prs_string ( " signature " , ps , depth , rav - > signature ,
1999-12-13 13:27:58 +00:00
sizeof ( rav - > signature ) ) )
return False ;
if ( ! prs_uint32 ( " msg_type " , ps , depth , & rav - > msg_type ) ) /* NTLMSSP_MESSAGE_TYPE */
return False ;
1999-10-15 18:46:22 +00:00
return True ;
1998-10-08 23:57:46 +00:00
}
2003-04-06 07:04:09 +00:00
/*******************************************************************
2005-09-30 17:13:37 +00:00
This parses an RPC_AUTH_VERIFIER for schannel . I think
2003-04-06 07:04:09 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 17:13:37 +00:00
BOOL smb_io_rpc_schannel_verifier ( const char * desc , RPC_AUTH_VERIFIER * rav , prs_struct * ps , int depth )
2003-04-06 07:04:09 +00:00
{
if ( rav = = NULL )
return False ;
2005-09-30 17:13:37 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_schannel_verifier " ) ;
2003-04-06 07:04:09 +00:00
depth + + ;
2003-04-22 15:54:36 +00:00
if ( ! prs_string ( " signature " , ps , depth , rav - > signature , sizeof ( rav - > signature ) ) )
2003-04-06 07:04:09 +00:00
return False ;
2003-04-22 15:54:36 +00:00
if ( ! prs_uint32 ( " msg_type " , ps , depth , & rav - > msg_type ) )
2003-04-06 07:04:09 +00:00
return False ;
return True ;
}
1998-03-11 21:11:04 +00:00
/*******************************************************************
2005-09-30 17:13:37 +00:00
creates an RPC_AUTH_SCHANNEL_NEG structure .
1998-10-08 23:57:46 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 13:27:58 +00:00
2005-09-30 17:13:37 +00:00
void init_rpc_auth_schannel_neg ( RPC_AUTH_SCHANNEL_NEG * neg ,
2003-04-09 15:54:17 +00:00
const char * domain , const char * myname )
{
2003-04-16 15:39:57 +00:00
neg - > type1 = 0 ;
neg - > type2 = 0x3 ;
2003-04-09 15:54:17 +00:00
fstrcpy ( neg - > domain , domain ) ;
fstrcpy ( neg - > myname , myname ) ;
}
2003-04-06 07:04:09 +00:00
/*******************************************************************
2005-09-30 17:13:37 +00:00
Reads or writes an RPC_AUTH_SCHANNEL_NEG structure .
2003-04-06 07:04:09 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 17:13:37 +00:00
BOOL smb_io_rpc_auth_schannel_neg ( const char * desc , RPC_AUTH_SCHANNEL_NEG * neg ,
2003-04-06 07:04:09 +00:00
prs_struct * ps , int depth )
{
if ( neg = = NULL )
return False ;
2005-09-30 17:13:37 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_auth_schannel_neg " ) ;
2003-04-06 07:04:09 +00:00
depth + + ;
if ( ! prs_align ( ps ) )
return False ;
2003-04-16 15:39:57 +00:00
if ( ! prs_uint32 ( " type1 " , ps , depth , & neg - > type1 ) )
2003-04-06 07:04:09 +00:00
return False ;
2003-04-16 15:39:57 +00:00
if ( ! prs_uint32 ( " type2 " , ps , depth , & neg - > type2 ) )
2003-04-09 15:54:17 +00:00
return False ;
2003-04-22 15:54:36 +00:00
if ( ! prs_string ( " domain " , ps , depth , neg - > domain , sizeof ( neg - > domain ) ) )
2003-04-06 07:04:09 +00:00
return False ;
2003-04-22 15:54:36 +00:00
if ( ! prs_string ( " myname " , ps , depth , neg - > myname , sizeof ( neg - > myname ) ) )
2003-04-16 15:39:57 +00:00
return False ;
2003-04-06 07:04:09 +00:00
return True ;
}
/*******************************************************************
2005-09-30 17:13:37 +00:00
reads or writes an RPC_AUTH_SCHANNEL_CHK structure .
2003-04-06 07:04:09 +00:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2005-09-30 17:13:37 +00:00
BOOL smb_io_rpc_auth_schannel_chk ( const char * desc , int auth_len ,
RPC_AUTH_SCHANNEL_CHK * chk ,
2003-04-06 07:04:09 +00:00
prs_struct * ps , int depth )
{
if ( chk = = NULL )
return False ;
2005-09-30 17:13:37 +00:00
prs_debug ( ps , depth , desc , " smb_io_rpc_auth_schannel_chk " ) ;
2003-04-06 07:04:09 +00:00
depth + + ;
2004-05-13 20:32:21 +00:00
if ( ! prs_uint8s ( False , " sig " , ps , depth , chk - > sig , sizeof ( chk - > sig ) ) )
return False ;
if ( ! prs_uint8s ( False , " seq_num " , ps , depth , chk - > seq_num , sizeof ( chk - > seq_num ) ) )
return False ;
if ( ! prs_uint8s ( False , " packet_digest " , ps , depth , chk - > packet_digest , sizeof ( chk - > packet_digest ) ) )
return False ;
2005-09-30 17:13:37 +00:00
if ( auth_len = = RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN ) {
2004-05-13 20:32:21 +00:00
if ( ! prs_uint8s ( False , " confounder " , ps , depth , chk - > confounder , sizeof ( chk - > confounder ) ) )
return False ;
}
2003-04-06 07:04:09 +00:00
return True ;
}