1998-03-12 00:11:04 +03:00
/*
* Unix SMB / Netbios implementation .
* Version 1.9 .
* RPC Pipe client / server routines
* Copyright ( C ) Andrew Tridgell 1992 - 1998 ,
* Copyright ( C ) Luke Kenneth Casson Leighton 1996 - 1998 ,
* Copyright ( C ) Paul Ashton 1998.
1999-12-13 16:27:58 +03:00
* Copyright ( C ) Jeremy Allison 1999.
1998-03-12 00:11:04 +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
* 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 .
*/
# ifdef SYSLOG
# undef SYSLOG
# endif
# include "includes.h"
extern int DEBUGLEVEL ;
extern struct pipe_id_info pipe_names [ ] ;
1999-12-13 16:27:58 +03:00
extern fstring global_myworkgroup ;
1998-04-28 05:24:40 +04:00
extern pstring global_myname ;
1998-03-12 00:11:04 +03:00
/********************************************************************
1999-12-13 16:27:58 +03:00
Rpc pipe call id .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1998-09-05 09:07:05 +04:00
static uint32 get_rpc_call_id ( void )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
static uint32 call_id = 0 ;
return + + call_id ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
1999-12-13 16:27:58 +03:00
Use SMBreadX to get rest of one fragment ' s worth of rpc data .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
static BOOL rpc_read ( struct cli_state * cli , prs_struct * rdata , uint32 data_to_read , uint32 * rdata_offset )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
size_t size = ( size_t ) cli - > max_recv_frag ;
int stream_offset = 0 ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
int num_read ;
1999-12-13 16:27:58 +03:00
char * pdata ;
uint32 err ;
int extra_data_size = ( ( int ) * rdata_offset ) + ( ( int ) data_to_read ) - ( int ) prs_data_size ( rdata ) ;
1998-04-21 06:36:37 +04:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_read: data_to_read: %u rdata offset: %u extra_data_size: %d \n " ,
( int ) data_to_read , ( unsigned int ) * rdata_offset , extra_data_size ) ) ;
1998-04-21 06:36:37 +04:00
1999-12-13 16:27:58 +03:00
/*
* Grow the buffer if needed to accommodate the data to be read .
*/
if ( extra_data_size > 0 ) {
if ( ! prs_force_grow ( rdata , ( uint32 ) extra_data_size ) ) {
DEBUG ( 0 , ( " rpc_read: Failed to grow parse struct by %d bytes. \n " , extra_data_size ) ) ;
return False ;
}
DEBUG ( 5 , ( " rpc_read: grew buffer by %d bytes to %u \n " , extra_data_size , prs_data_size ( rdata ) ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
pdata = prs_data_p ( rdata ) + * rdata_offset ;
1998-10-20 22:27:49 +04:00
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
do /* read data using SMBreadX */
{
1999-12-13 16:27:58 +03:00
if ( size > ( size_t ) data_to_read )
size = ( size_t ) data_to_read ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
num_read = ( int ) cli_read ( cli , cli - > nt_pipe_fnum , pdata , ( off_t ) stream_offset , size ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_read: num_read = %d, read offset: %d, to read: %d \n " ,
num_read , stream_offset , data_to_read ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( cli_error ( cli , NULL , & err , NULL ) ) {
DEBUG ( 0 , ( " rpc_read: Error %u in cli_read \n " , ( unsigned int ) err ) ) ;
return False ;
1999-10-21 20:53:50 +04:00
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
data_to_read - = num_read ;
stream_offset + = num_read ;
pdata + = num_read ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
} while ( num_read > 0 & & data_to_read > 0 ) ;
/* && err == (0x80000000 | STATUS_BUFFER_OVERFLOW)); */
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/*
* Update the current offset into rdata by the amount read .
*/
* rdata_offset + = stream_offset ;
1998-03-12 00:11:04 +03:00
1998-10-21 20:58:34 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
1999-12-13 16:27:58 +03:00
Checks the header .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
1998-10-14 10:29:20 +04:00
static BOOL rpc_check_hdr ( prs_struct * rdata , RPC_HDR * rhdr ,
1999-12-13 16:27:58 +03:00
BOOL * first , BOOL * last , uint32 * len )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_check_hdr: rdata->data_size = %u \n " , ( uint32 ) prs_data_size ( rdata ) ) ) ;
1998-04-21 06:36:37 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr ( " rpc_hdr " , rhdr , rdata , 0 ) ) {
DEBUG ( 0 , ( " rpc_check_hdr: Failed to unmarshall RPC_HDR. \n " ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return False ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( prs_offset ( rdata ) ! = RPC_HEADER_LEN ) {
DEBUG ( 0 , ( " rpc_check_hdr: offset was %x, should be %x. \n " , prs_offset ( rdata ) , RPC_HEADER_LEN ) ) ;
return False ;
}
1998-04-21 06:36:37 +04:00
2000-08-01 22:32:34 +04:00
( * first ) = ( ( rhdr - > flags & RPC_FLG_FIRST ) ! = 0 ) ;
( * last ) = ( ( rhdr - > flags & RPC_FLG_LAST ) ! = 0 ) ;
1999-12-13 16:27:58 +03:00
( * len ) = ( uint32 ) rhdr - > frag_len - prs_data_size ( rdata ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
return ( rhdr - > pkt_type ! = RPC_FAULT ) ;
1998-03-12 00:11:04 +03:00
}
1999-12-13 16:27:58 +03:00
static void NTLMSSPcalc_ap ( struct cli_state * cli , unsigned char * data , uint32 len )
1998-11-12 07:17:54 +03:00
{
unsigned char * hash = cli - > ntlmssp_hash ;
1999-12-13 16:27:58 +03:00
unsigned char index_i = hash [ 256 ] ;
unsigned char index_j = hash [ 257 ] ;
int ind ;
1998-11-12 07:17:54 +03:00
1999-12-13 16:27:58 +03:00
for ( ind = 0 ; ind < len ; ind + + ) {
unsigned char tc ;
unsigned char t ;
1998-11-12 07:17:54 +03:00
1999-12-13 16:27:58 +03:00
index_i + + ;
index_j + = hash [ index_i ] ;
1998-11-12 07:17:54 +03:00
1999-12-13 16:27:58 +03:00
tc = hash [ index_i ] ;
hash [ index_i ] = hash [ index_j ] ;
hash [ index_j ] = tc ;
1998-11-12 07:17:54 +03:00
1999-12-13 16:27:58 +03:00
t = hash [ index_i ] + hash [ index_j ] ;
data [ ind ] = data [ ind ] ^ hash [ t ] ;
}
1998-11-12 07:17:54 +03:00
1999-12-13 16:27:58 +03:00
hash [ 256 ] = index_i ;
hash [ 257 ] = index_j ;
1998-11-12 07:17:54 +03:00
}
1998-10-14 10:29:20 +04:00
/****************************************************************************
1999-12-13 16:27:58 +03:00
Verify data on an rpc pipe .
The VERIFY & SEAL code is only executed on packets that look like this :
Request / Response PDU ' s look like the following . . .
| < - - - - - - - - - - - - - - - - - - PDU len - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > |
| < - HDR_LEN - - > | < - - REQ LEN - - - - - - > | . . . . . . . . . . . . . | < - AUTH_HDRLEN - > | < - AUTH_LEN - - > |
+ - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - +
| RPC HEADER | REQ / RESP HEADER | DATA . . . . . . | AUTH_HDR | AUTH DATA |
+ - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - +
Never on bind requests / responses .
1998-10-14 10:29:20 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL rpc_auth_pipe ( struct cli_state * cli , prs_struct * rdata , int len , int auth_len )
1998-10-14 10:29:20 +04:00
{
1999-12-13 16:27:58 +03:00
/*
* The following is that length of the data we must sign or seal .
* This doesn ' t include the RPC headers or the auth_len or the RPC_HDR_AUTH_LEN
* preceeding the auth_data .
*/
int data_len = len - RPC_HEADER_LEN - RPC_HDR_RESP_LEN - RPC_HDR_AUTH_LEN - auth_len ;
/*
* The start of the data to sign / seal is just after the RPC headers .
*/
char * reply_data = prs_data_p ( rdata ) + RPC_HEADER_LEN + RPC_HDR_REQ_LEN ;
1998-10-14 10:29:20 +04:00
2000-08-01 22:32:34 +04:00
BOOL auth_verify = ( ( cli - > ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SIGN ) ! = 0 ) ;
BOOL auth_seal = ( ( cli - > ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SEAL ) ! = 0 ) ;
1998-10-14 10:29:20 +04:00
DEBUG ( 5 , ( " rpc_auth_pipe: len: %d auth_len: %d verify %s seal %s \n " ,
len , auth_len , BOOLSTR ( auth_verify ) , BOOLSTR ( auth_seal ) ) ) ;
1999-12-13 16:27:58 +03:00
/*
* Unseal any sealed data in the PDU , not including the
* 8 byte auth_header or the auth_data .
*/
1998-10-14 10:29:20 +04:00
1999-12-13 16:27:58 +03:00
if ( auth_seal ) {
DEBUG ( 10 , ( " rpc_auth_pipe: unseal \n " ) ) ;
1998-10-14 10:29:20 +04:00
dump_data ( 100 , reply_data , data_len ) ;
1998-11-12 07:17:54 +03:00
NTLMSSPcalc_ap ( cli , ( uchar * ) reply_data , data_len ) ;
1998-10-14 10:29:20 +04:00
dump_data ( 100 , reply_data , data_len ) ;
}
1999-12-13 16:27:58 +03:00
if ( auth_verify | | auth_seal ) {
RPC_HDR_AUTH rhdr_auth ;
1998-10-19 21:32:10 +04:00
prs_struct auth_req ;
1999-12-13 16:27:58 +03:00
char data [ RPC_HDR_AUTH_LEN ] ;
/*
* We set dp to be the end of the packet , minus the auth_len
* and the length of the header that preceeds the auth_data .
*/
char * dp = prs_data_p ( rdata ) + len - auth_len - RPC_HDR_AUTH_LEN ;
if ( dp - prs_data_p ( rdata ) > prs_data_size ( rdata ) ) {
DEBUG ( 0 , ( " rpc_auth_pipe: auth data > data size ! \n " ) ) ;
return False ;
}
memcpy ( data , dp , sizeof ( data ) ) ;
2000-07-27 04:47:19 +04:00
prs_init ( & auth_req , 0 , 4 , cli - > mem_ctx , UNMARSHALL ) ;
1999-12-13 16:27:58 +03:00
prs_give_memory ( & auth_req , data , RPC_HDR_AUTH_LEN , False ) ;
/*
* Unmarshall the 8 byte auth_header that comes before the
* auth data .
*/
if ( ! smb_io_rpc_hdr_auth ( " hdr_auth " , & rhdr_auth , & auth_req , 0 ) ) {
DEBUG ( 0 , ( " rpc_auth_pipe: unmarshalling RPC_HDR_AUTH failed. \n " ) ) ;
return False ;
}
if ( ! rpc_hdr_auth_chk ( & rhdr_auth ) ) {
DEBUG ( 0 , ( " rpc_auth_pipe: rpc_hdr_auth_chk failed. \n " ) ) ;
1998-10-19 21:32:10 +04:00
return False ;
}
}
1999-12-13 16:27:58 +03:00
/*
* Now unseal and check the auth verifier in the auth_data at
* then end of the packet . The 4 bytes skipped in the unseal
* seem to be a buffer pointer preceeding the sealed data .
*/
if ( auth_verify ) {
RPC_AUTH_NTLMSSP_CHK chk ;
uint32 crc32 ;
1998-10-14 10:29:20 +04:00
prs_struct auth_verf ;
1999-12-13 16:27:58 +03:00
char data [ RPC_AUTH_NTLMSSP_CHK_LEN ] ;
char * dp = prs_data_p ( rdata ) + len - auth_len ;
if ( dp - prs_data_p ( rdata ) > prs_data_size ( rdata ) ) {
DEBUG ( 0 , ( " rpc_auth_pipe: auth data > data size ! \n " ) ) ;
return False ;
}
1998-10-19 21:32:10 +04:00
1998-10-14 10:29:20 +04:00
DEBUG ( 10 , ( " rpc_auth_pipe: verify \n " ) ) ;
1999-12-13 16:27:58 +03:00
dump_data ( 100 , dp , auth_len ) ;
NTLMSSPcalc_ap ( cli , ( uchar * ) ( dp + 4 ) , auth_len - 4 ) ;
memcpy ( data , dp , RPC_AUTH_NTLMSSP_CHK_LEN ) ;
1998-10-14 10:29:20 +04:00
dump_data ( 100 , data , auth_len ) ;
2000-07-27 04:47:19 +04:00
prs_init ( & auth_verf , 0 , 4 , cli - > mem_ctx , UNMARSHALL ) ;
1999-12-13 16:27:58 +03:00
prs_give_memory ( & auth_verf , data , RPC_AUTH_NTLMSSP_CHK_LEN , False ) ;
if ( ! smb_io_rpc_auth_ntlmssp_chk ( " auth_sign " , & chk , & auth_verf , 0 ) ) {
DEBUG ( 0 , ( " rpc_auth_pipe: unmarshalling RPC_AUTH_NTLMSSP_CHK failed. \n " ) ) ;
return False ;
}
crc32 = crc32_calc_buffer ( reply_data , data_len ) ;
if ( ! rpc_auth_ntlmssp_chk ( & chk , crc32 , cli - > ntlmssp_seq_num ) ) {
DEBUG ( 0 , ( " rpc_auth_pipe: rpc_auth_ntlmssp_chk failed. \n " ) ) ;
1998-10-14 10:29:20 +04:00
return False ;
}
1998-10-21 05:35:01 +04:00
cli - > ntlmssp_seq_num + + ;
1998-10-14 10:29:20 +04:00
}
return True ;
}
1998-03-12 00:11:04 +03:00
/****************************************************************************
1999-12-13 16:27:58 +03:00
Send data on an rpc pipe , which * must * be in one fragment .
1998-03-12 00:11:04 +03:00
receive response data from an rpc pipe , which may be large . . .
1999-12-13 16:27:58 +03:00
Read the first fragment : unfortunately have to use SMBtrans for the first
1998-03-12 00:11:04 +03:00
bit , then SMBreadX for subsequent bits .
1999-12-13 16:27:58 +03:00
If first fragment received also wasn ' t the last fragment , continue
1998-03-12 00:11:04 +03:00
getting fragments until we _do_ receive the last fragment .
1999-12-13 16:27:58 +03:00
Request / Response PDU ' s look like the following . . .
| < - - - - - - - - - - - - - - - - - - PDU len - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > |
| < - HDR_LEN - - > | < - - REQ LEN - - - - - - > | . . . . . . . . . . . . . | < - AUTH_HDRLEN - > | < - AUTH_LEN - - > |
+ - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - +
| RPC HEADER | REQ / RESP HEADER | DATA . . . . . . | AUTH_HDR | AUTH DATA |
+ - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + - - - - - - - - - - - - - +
Where the presence of the AUTH_HDR and AUTH are dependent on the
signing & sealing being neogitated .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL rpc_api_pipe ( struct cli_state * cli , uint16 cmd , prs_struct * data , prs_struct * rdata )
1998-04-24 02:45:53 +04:00
{
1999-12-13 16:27:58 +03:00
uint32 len ;
char * rparam = NULL ;
uint32 rparam_len = 0 ;
uint16 setup [ 2 ] ;
uint32 err ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
BOOL first = True ;
BOOL last = True ;
1999-12-13 16:27:58 +03:00
RPC_HDR rhdr ;
char * pdata = data ? prs_data_p ( data ) : NULL ;
uint32 data_len = data ? prs_offset ( data ) : 0 ;
char * prdata = NULL ;
uint32 rdata_len = 0 ;
uint32 current_offset = 0 ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
/*
* Create setup parameters - must be in native byte order .
*/
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
setup [ 0 ] = cmd ;
1999-12-13 16:27:58 +03:00
setup [ 1 ] = cli - > nt_pipe_fnum ; /* Pipe file handle. */
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_api_pipe: cmd:%x fnum:%x \n " , ( int ) cmd , ( int ) cli - > nt_pipe_fnum ) ) ;
1999-11-07 01:45:31 +03:00
1999-12-13 16:27:58 +03:00
/* send the data: receive a response. */
2001-02-20 13:11:40 +03:00
if ( ! cli_api_pipe ( cli , " \\ PIPE \\ " ,
1999-12-13 16:27:58 +03:00
setup , 2 , 0 , /* Setup, length, max */
NULL , 0 , 0 , /* Params, length, max */
pdata , data_len , data_len , /* data, length, max */
& rparam , & rparam_len , /* return params, len */
& prdata , & rdata_len ) ) /* return data, len */
{
DEBUG ( 0 , ( " cli_pipe: return critical error. Error was %s \n " , cli_errstr ( cli ) ) ) ;
return False ;
}
1999-11-07 01:45:31 +03:00
1999-12-13 16:27:58 +03:00
/*
* Throw away returned params - we know we won ' t use them .
*/
1999-11-07 01:45:31 +03:00
1999-12-13 16:27:58 +03:00
if ( rparam ) {
free ( rparam ) ;
rparam = NULL ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
1999-12-13 16:27:58 +03:00
if ( prdata = = NULL ) {
DEBUG ( 0 , ( " rpc_api_pipe: cmd %x on pipe %x failed to return data. \n " ,
( int ) cmd , ( int ) cli - > nt_pipe_fnum ) ) ;
return False ;
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
/*
* Give this memory as dynamically allocated to the return parse struct .
*/
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
prs_give_memory ( rdata , prdata , rdata_len , True ) ;
current_offset = rdata_len ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( ! rpc_check_hdr ( rdata , & rhdr , & first , & last , & len ) ) {
prs_mem_free ( rdata ) ;
return False ;
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( rhdr . pkt_type = = RPC_BINDACK ) {
if ( ! last & & ! first ) {
DEBUG ( 5 , ( " rpc_api_pipe: bug in server (AS/U?), setting fragment first/last ON. \n " ) ) ;
first = True ;
last = True ;
1999-11-07 01:45:31 +03:00
}
1999-12-13 16:27:58 +03:00
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( rhdr . pkt_type = = RPC_RESPONSE ) {
RPC_HDR_RESP rhdr_resp ;
if ( ! smb_io_rpc_hdr_resp ( " rpc_hdr_resp " , & rhdr_resp , rdata , 0 ) ) {
DEBUG ( 5 , ( " rpc_api_pipe: failed to unmarshal RPC_HDR_RESP. \n " ) ) ;
prs_mem_free ( rdata ) ;
return False ;
1998-10-15 09:47:29 +04:00
}
1999-12-13 16:27:58 +03:00
}
1998-10-15 09:47:29 +04:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_api_pipe: len left: %u smbtrans read: %u \n " ,
( unsigned int ) len , ( unsigned int ) rdata_len ) ) ;
/* check if data to be sent back was too large for one SMB. */
/* err status is only informational: the _real_ check is on the length */
if ( len > 0 ) {
/* || err == (0x80000000 | STATUS_BUFFER_OVERFLOW)) */
/*
* Read the rest of the first response PDU .
*/
if ( ! rpc_read ( cli , rdata , len , & current_offset ) ) {
prs_mem_free ( rdata ) ;
return False ;
1999-11-07 01:45:31 +03:00
}
1999-12-13 16:27:58 +03:00
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
/*
* Now we have a complete PDU , check the auth struct if any was sent .
*/
1999-11-07 01:45:31 +03:00
1999-12-13 16:27:58 +03:00
if ( rhdr . auth_len ! = 0 ) {
if ( ! rpc_auth_pipe ( cli , rdata , rhdr . frag_len , rhdr . auth_len ) )
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return False ;
1999-12-13 16:27:58 +03:00
/*
* Drop the auth footers from the current offset .
* We need this if there are more fragments .
* The auth footers consist of the auth_data and the
* preceeding 8 byte auth_header .
*/
current_offset - = ( rhdr . auth_len + RPC_HDR_AUTH_LEN ) ;
}
/*
* Only one rpc fragment , and it has been read .
*/
1998-10-14 10:29:20 +04:00
1999-12-13 16:27:58 +03:00
if ( first & & last ) {
DEBUG ( 6 , ( " rpc_api_pipe: fragment first and last both set \n " ) ) ;
return True ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
1999-12-13 16:27:58 +03:00
/*
* Read more fragments until we get the last one .
*/
while ( ! last ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
RPC_HDR_RESP rhdr_resp ;
int num_read ;
1999-12-13 16:27:58 +03:00
char hdr_data [ RPC_HEADER_LEN + RPC_HDR_RESP_LEN ] ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
prs_struct hps ;
1999-12-13 16:27:58 +03:00
/*
* First read the header of the next PDU .
*/
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
2000-07-27 04:47:19 +04:00
prs_init ( & hps , 0 , 4 , cli - > mem_ctx , UNMARSHALL ) ;
1999-12-13 16:27:58 +03:00
prs_give_memory ( & hps , hdr_data , sizeof ( hdr_data ) , False ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
num_read = cli_read ( cli , cli - > nt_pipe_fnum , hdr_data , 0 , RPC_HEADER_LEN + RPC_HDR_RESP_LEN ) ;
if ( cli_error ( cli , NULL , & err , NULL ) ) {
DEBUG ( 0 , ( " rpc_api_pipe: cli_read error : %d \n " , err ) ) ;
1998-10-14 10:29:20 +04:00
return False ;
}
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_api_pipe: read header (size:%d) \n " , num_read ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( num_read ! = RPC_HEADER_LEN + RPC_HDR_RESP_LEN ) {
DEBUG ( 0 , ( " rpc_api_pipe: Error : requested %d bytes, got %d. \n " ,
RPC_HEADER_LEN + RPC_HDR_RESP_LEN , num_read ) ) ;
return False ;
1999-10-21 20:53:50 +04:00
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( ! rpc_check_hdr ( & hps , & rhdr , & first , & last , & len ) )
return False ;
if ( ! smb_io_rpc_hdr_resp ( " rpc_hdr_resp " , & rhdr_resp , & hps , 0 ) ) {
DEBUG ( 0 , ( " rpc_api_pipe: Error in unmarshalling RPC_HDR_RESP. \n " ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return False ;
}
1999-12-13 16:27:58 +03:00
if ( first ) {
DEBUG ( 0 , ( " rpc_api_pipe: secondary PDU rpc header has 'first' set ! \n " ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return False ;
}
1998-10-14 10:29:20 +04:00
1999-12-13 16:27:58 +03:00
/*
* Now read the rest of the PDU .
*/
if ( ! rpc_read ( cli , rdata , len , & current_offset ) )
1998-10-14 10:29:20 +04:00
return False ;
1999-12-13 16:27:58 +03:00
/*
* Verify any authentication footer .
*/
if ( rhdr . auth_len ! = 0 ) {
if ( ! rpc_auth_pipe ( cli , rdata , rhdr . frag_len , rhdr . auth_len ) )
return False ;
/*
* Drop the auth footers from the current offset .
* The auth footers consist of the auth_data and the
* preceeding 8 byte auth_header .
* We need this if there are more fragments .
*/
current_offset - = ( rhdr . auth_len + RPC_HDR_AUTH_LEN ) ;
1998-10-14 10:29:20 +04:00
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
return True ;
1998-03-12 00:11:04 +03:00
}
/*******************************************************************
creates a DCE / RPC bind request
- initialises the parse structure .
- dynamically allocates the header data structure
- caller is expected to free the header data structure once used .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL create_rpc_bind_req ( prs_struct * rpc_out , BOOL do_auth , uint32 rpc_call_id ,
1998-04-24 02:45:53 +04:00
RPC_IFACE * abstract , RPC_IFACE * transfer ,
1998-10-09 23:05:19 +04:00
char * my_name , char * domain , uint32 neg_flags )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
RPC_HDR hdr ;
RPC_HDR_RB hdr_rb ;
char buffer [ 4096 ] ;
prs_struct auth_info ;
int auth_len = 0 ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
2000-07-27 04:47:19 +04:00
prs_init ( & auth_info , 0 , 4 , prs_get_mem_context ( rpc_out ) , MARSHALL ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( do_auth ) {
RPC_HDR_AUTH hdr_auth ;
RPC_AUTH_VERIFIER auth_verifier ;
RPC_AUTH_NTLMSSP_NEG ntlmssp_neg ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
/*
* Create the auth structs we will marshall .
*/
init_rpc_hdr_auth ( & hdr_auth , NTLMSSP_AUTH_TYPE , NTLMSSP_AUTH_LEVEL , 0x00 , 1 ) ;
init_rpc_auth_verifier ( & auth_verifier , " NTLMSSP " , NTLMSSP_NEGOTIATE ) ;
init_rpc_auth_ntlmssp_neg ( & ntlmssp_neg , neg_flags , my_name , domain ) ;
/*
* Use the 4 k buffer to store the auth info .
*/
prs_give_memory ( & auth_info , buffer , sizeof ( buffer ) , False ) ;
1998-10-08 01:42:24 +04:00
1999-12-13 16:27:58 +03:00
/*
* Now marshall the data into the temporary parse_struct .
*/
1998-10-07 02:03:04 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr_auth ( " hdr_auth " , & hdr_auth , & auth_info , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to marshall RPC_HDR_AUTH. \n " ) ) ;
return False ;
}
if ( ! smb_io_rpc_auth_verifier ( " auth_verifier " , & auth_verifier , & auth_info , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to marshall RPC_AUTH_VERIFIER. \n " ) ) ;
return False ;
}
1998-10-07 02:03:04 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_auth_ntlmssp_neg ( " ntlmssp_neg " , & ntlmssp_neg , & auth_info , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to marshall RPC_AUTH_NTLMSSP_NEG. \n " ) ) ;
return False ;
}
1998-10-07 02:03:04 +04:00
1999-12-13 16:27:58 +03:00
/* Auth len in the rpc header doesn't include auth_header. */
auth_len = prs_offset ( & auth_info ) - RPC_HDR_AUTH_LEN ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
/* create the request RPC_HDR */
1999-12-13 16:27:58 +03:00
init_rpc_hdr ( & hdr , RPC_BIND , 0x0 , rpc_call_id ,
RPC_HEADER_LEN + RPC_HDR_RB_LEN + prs_offset ( & auth_info ) ,
auth_len ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr ( " hdr " , & hdr , rpc_out , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to marshall RPC_HDR. \n " ) ) ;
return False ;
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
/* create the bind request RPC_HDR_RB */
init_rpc_hdr_rb ( & hdr_rb , MAX_PDU_FRAG_LEN , MAX_PDU_FRAG_LEN , 0x0 ,
0x1 , 0x0 , 0x1 , abstract , transfer ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
/* Marshall the bind request data */
if ( ! smb_io_rpc_hdr_rb ( " " , & hdr_rb , rpc_out , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to marshall RPC_HDR_RB. \n " ) ) ;
return False ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
1999-12-13 16:27:58 +03:00
/*
* Grow the outgoing buffer to store any auth info .
*/
if ( hdr . auth_len ! = 0 ) {
if ( ! prs_append_prs_data ( rpc_out , & auth_info ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to grow parse struct to add auth. \n " ) ) ;
return False ;
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
return True ;
1998-03-12 00:11:04 +03:00
}
1998-10-09 03:57:46 +04:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Creates a DCE / RPC bind authentication response .
This is the packet that is sent back to the server once we
have received a BIND - ACK , to finish the third leg of
the authentication handshake .
1998-10-09 03:57:46 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL create_rpc_bind_resp ( struct pwd_info * pwd ,
1998-10-09 03:57:46 +04:00
char * domain , char * user_name , char * my_name ,
uint32 ntlmssp_cli_flgs ,
1998-10-14 11:00:00 +04:00
uint32 rpc_call_id ,
1999-12-13 16:27:58 +03:00
prs_struct * rpc_out )
1998-10-09 03:57:46 +04:00
{
1999-12-13 16:27:58 +03:00
unsigned char lm_owf [ 24 ] ;
unsigned char nt_owf [ 24 ] ;
RPC_HDR hdr ;
RPC_HDR_AUTHA hdr_autha ;
RPC_AUTH_VERIFIER auth_verifier ;
RPC_AUTH_NTLMSSP_RESP ntlmssp_resp ;
char buffer [ 4096 ] ;
prs_struct auth_info ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* Marshall the variable length data into a temporary parse
* struct , pointing into a 4 k local buffer .
*/
2000-07-27 04:47:19 +04:00
prs_init ( & auth_info , 0 , 4 , prs_get_mem_context ( rpc_out ) , MARSHALL ) ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* Use the 4 k buffer to store the auth info .
*/
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
prs_give_memory ( & auth_info , buffer , sizeof ( buffer ) , False ) ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* Create the variable length auth_data .
*/
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
init_rpc_auth_verifier ( & auth_verifier , " NTLMSSP " , NTLMSSP_AUTH ) ;
pwd_get_lm_nt_owf ( pwd , lm_owf , nt_owf ) ;
init_rpc_auth_ntlmssp_resp ( & ntlmssp_resp ,
lm_owf , nt_owf ,
domain , user_name , my_name ,
ntlmssp_cli_flgs ) ;
/*
* Marshall the variable length auth_data into a temp parse_struct .
*/
if ( ! smb_io_rpc_auth_verifier ( " auth_verifier " , & auth_verifier , & auth_info , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_resp: failed to marshall RPC_AUTH_VERIFIER. \n " ) ) ;
return False ;
}
if ( ! smb_io_rpc_auth_ntlmssp_resp ( " ntlmssp_resp " , & ntlmssp_resp , & auth_info , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_resp: failed to marshall RPC_AUTH_NTLMSSP_RESP. \n " ) ) ;
return False ;
}
/* Create the request RPC_HDR */
init_rpc_hdr ( & hdr , RPC_BINDRESP , 0x0 , rpc_call_id ,
RPC_HEADER_LEN + RPC_HDR_AUTHA_LEN + prs_offset ( & auth_info ) ,
prs_offset ( & auth_info ) ) ;
/* Marshall it. */
if ( ! smb_io_rpc_hdr ( " hdr " , & hdr , rpc_out , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_resp: failed to marshall RPC_HDR. \n " ) ) ;
return False ;
}
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/* Create the request RPC_HDR_AUTHA */
init_rpc_hdr_autha ( & hdr_autha , MAX_PDU_FRAG_LEN , MAX_PDU_FRAG_LEN ,
NTLMSSP_AUTH_TYPE , NTLMSSP_AUTH_LEVEL , 0x00 ) ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr_autha ( " hdr_autha " , & hdr_autha , rpc_out , 0 ) ) {
DEBUG ( 0 , ( " create_rpc_bind_resp: failed to marshall RPC_HDR_AUTHA. \n " ) ) ;
return False ;
}
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* Append the auth data to the outgoing buffer .
*/
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
if ( ! prs_append_prs_data ( rpc_out , & auth_info ) ) {
DEBUG ( 0 , ( " create_rpc_bind_req: failed to grow parse struct to add auth. \n " ) ) ;
return False ;
}
1998-10-09 03:57:46 +04:00
return True ;
}
1998-03-12 00:11:04 +03:00
/*******************************************************************
1999-12-13 16:27:58 +03:00
Creates a DCE / RPC request .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
static BOOL create_rpc_request ( prs_struct * rpc_out , uint8 op_num , int data_len , int auth_len )
1998-03-12 00:11:04 +03:00
{
1998-10-09 03:57:46 +04:00
uint32 alloc_hint ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
RPC_HDR hdr ;
1999-12-13 16:27:58 +03:00
RPC_HDR_REQ hdr_req ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " create_rpc_request: opnum: 0x%x data_len: 0x%x \n " , op_num , data_len ) ) ;
1998-03-12 00:11:04 +03:00
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
/* create the rpc header RPC_HDR */
1999-12-13 16:27:58 +03:00
init_rpc_hdr ( & hdr , RPC_REQUEST , RPC_FLG_FIRST | RPC_FLG_LAST ,
1998-10-09 03:57:46 +04:00
get_rpc_call_id ( ) , data_len , auth_len ) ;
1999-12-13 16:27:58 +03:00
/*
* The alloc hint should be the amount of data , not including
* RPC headers & footers .
*/
1998-10-09 03:57:46 +04:00
if ( auth_len ! = 0 )
1999-12-13 16:27:58 +03:00
alloc_hint = data_len - RPC_HEADER_LEN - RPC_HDR_AUTH_LEN - auth_len ;
1998-10-09 03:57:46 +04:00
else
1999-12-13 16:27:58 +03:00
alloc_hint = data_len - RPC_HEADER_LEN ;
1998-10-09 03:57:46 +04:00
DEBUG ( 10 , ( " create_rpc_request: data_len: %x auth_len: %x alloc_hint: %x \n " ,
data_len , auth_len , alloc_hint ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/* Create the rpc request RPC_HDR_REQ */
init_rpc_hdr_req ( & hdr_req , alloc_hint , op_num ) ;
1998-03-12 00:11:04 +03:00
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
/* stream-time... */
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr ( " hdr " , & hdr , rpc_out , 0 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr_req ( " hdr_req " , & hdr_req , rpc_out , 0 ) )
return False ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( prs_offset ( rpc_out ) ! = RPC_HEADER_LEN + RPC_HDR_REQ_LEN )
return False ;
1998-03-12 00:11:04 +03:00
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
1999-12-13 16:27:58 +03:00
Send a request on an rpc pipe .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
BOOL rpc_api_pipe_req ( struct cli_state * cli , uint8 op_num ,
1998-04-24 02:45:53 +04:00
prs_struct * data , prs_struct * rdata )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
prs_struct outgoing_packet ;
uint32 data_len ;
uint32 auth_len ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
BOOL ret ;
1998-10-09 03:57:46 +04:00
BOOL auth_verify ;
BOOL auth_seal ;
1998-11-14 00:41:01 +03:00
uint32 crc32 = 0 ;
1999-12-13 16:27:58 +03:00
char * pdata_out = NULL ;
1998-03-12 00:11:04 +03:00
2000-08-01 22:32:34 +04:00
auth_verify = ( ( cli - > ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SIGN ) ! = 0 ) ;
auth_seal = ( ( cli - > ntlmssp_srv_flgs & NTLMSSP_NEGOTIATE_SEAL ) ! = 0 ) ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* The auth_len doesn ' t include the RPC_HDR_AUTH_LEN .
*/
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
auth_len = ( auth_verify ? RPC_AUTH_NTLMSSP_CHK_LEN : 0 ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/*
* PDU len is header , plus request header , plus data , plus
* auth_header_len ( if present ) , plus auth_len ( if present ) .
* NB . The auth stuff should be aligned on an 8 byte boundary
* to be totally DCE / RPC spec complient . For now we cheat and
* hope that the data structs defined are a multiple of 8 bytes .
*/
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
if ( ( prs_offset ( data ) % 8 ) ! = 0 ) {
DEBUG ( 5 , ( " rpc_api_pipe_req: Outgoing data not a multiple of 8 bytes.... \n " ) ) ;
1998-10-09 03:57:46 +04:00
}
1999-12-13 16:27:58 +03:00
data_len = RPC_HEADER_LEN + RPC_HDR_REQ_LEN + prs_offset ( data ) +
( auth_verify ? RPC_HDR_AUTH_LEN : 0 ) + auth_len ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* Malloc a parse struct to hold it ( and enough for alignments ) .
*/
2000-07-27 04:47:19 +04:00
if ( ! prs_init ( & outgoing_packet , data_len + 8 , 4 , cli - > mem_ctx , MARSHALL ) ) {
1999-12-13 16:27:58 +03:00
DEBUG ( 0 , ( " rpc_api_pipe_req: Failed to malloc %u bytes. \n " , ( unsigned int ) data_len ) ) ;
return False ;
1998-10-14 10:29:20 +04:00
}
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
pdata_out = prs_data_p ( & outgoing_packet ) ;
/*
* Write out the RPC header and the request header .
*/
if ( ! create_rpc_request ( & outgoing_packet , op_num , data_len , auth_len ) ) {
DEBUG ( 0 , ( " rpc_api_pipe_req: Failed to create RPC request. \n " ) ) ;
prs_mem_free ( & outgoing_packet ) ;
return False ;
}
/*
* Seal the outgoing data if requested .
*/
1998-10-14 10:29:20 +04:00
1999-12-13 16:27:58 +03:00
if ( auth_seal ) {
crc32 = crc32_calc_buffer ( prs_data_p ( data ) , prs_offset ( data ) ) ;
NTLMSSPcalc_ap ( cli , ( unsigned char * ) prs_data_p ( data ) , prs_offset ( data ) ) ;
1998-10-09 03:57:46 +04:00
}
1999-12-13 16:27:58 +03:00
/*
* Now copy the data into the outgoing packet .
*/
if ( ! prs_append_prs_data ( & outgoing_packet , data ) ) {
DEBUG ( 0 , ( " rpc_api_pipe_req: Failed to append data to outgoing packet. \n " ) ) ;
prs_mem_free ( & outgoing_packet ) ;
return False ;
1998-10-09 03:57:46 +04:00
}
1999-12-13 16:27:58 +03:00
/*
* Add a trailing auth_verifier if needed .
*/
if ( auth_seal | | auth_verify ) {
RPC_HDR_AUTH hdr_auth ;
init_rpc_hdr_auth ( & hdr_auth , NTLMSSP_AUTH_TYPE ,
NTLMSSP_AUTH_LEVEL , 0x08 , ( auth_verify ? 1 : 0 ) ) ;
if ( ! smb_io_rpc_hdr_auth ( " hdr_auth " , & hdr_auth , & outgoing_packet , 0 ) ) {
DEBUG ( 0 , ( " rpc_api_pipe_req: Failed to marshal RPC_HDR_AUTH. \n " ) ) ;
prs_mem_free ( & outgoing_packet ) ;
return False ;
}
1998-10-09 03:57:46 +04:00
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/*
* Finally the auth data itself .
*/
if ( auth_verify ) {
RPC_AUTH_NTLMSSP_CHK chk ;
uint32 current_offset = prs_offset ( & outgoing_packet ) ;
init_rpc_auth_ntlmssp_chk ( & chk , NTLMSSP_SIGN_VERSION , crc32 , cli - > ntlmssp_seq_num + + ) ;
if ( ! smb_io_rpc_auth_ntlmssp_chk ( " auth_sign " , & chk , & outgoing_packet , 0 ) ) {
DEBUG ( 0 , ( " rpc_api_pipe_req: Failed to marshal RPC_AUTH_NTLMSSP_CHK. \n " ) ) ;
prs_mem_free ( & outgoing_packet ) ;
return False ;
}
NTLMSSPcalc_ap ( cli , ( unsigned char * ) & pdata_out [ current_offset + 4 ] , RPC_AUTH_NTLMSSP_CHK_LEN - 4 ) ;
}
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
DEBUG ( 100 , ( " data_len: %x data_calc_len: %x \n " , data_len , prs_offset ( & outgoing_packet ) ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
ret = rpc_api_pipe ( cli , 0x0026 , & outgoing_packet , rdata ) ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
prs_mem_free ( & outgoing_packet ) ;
1998-03-12 00:11:04 +03:00
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return ret ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
1999-12-13 16:27:58 +03:00
Set the handle state .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1999-12-13 16:27:58 +03:00
static BOOL rpc_pipe_set_hnd_state ( struct cli_state * cli , char * pipe_name , uint16 device_state )
1998-04-24 02:45:53 +04:00
{
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
BOOL state_set = False ;
char param [ 2 ] ;
uint16 setup [ 2 ] ; /* only need 2 uint16 setup parameters */
char * rparam = NULL ;
char * rdata = NULL ;
uint32 rparam_len , rdata_len ;
1999-12-13 16:27:58 +03:00
if ( pipe_name = = NULL )
return False ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 5 , ( " Set Handle state Pipe[%x]: %s - device state:%x \n " ,
1999-12-13 16:27:58 +03:00
cli - > nt_pipe_fnum , pipe_name , device_state ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
/* create parameters: device state */
SSVAL ( param , 0 , device_state ) ;
/* create setup parameters. */
setup [ 0 ] = 0x0001 ;
1999-12-13 16:27:58 +03:00
setup [ 1 ] = cli - > nt_pipe_fnum ; /* pipe file handle. got this from an SMBOpenX. */
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
/* send the data on \PIPE\ */
2001-02-20 13:11:40 +03:00
if ( cli_api_pipe ( cli , " \\ PIPE \\ " ,
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
setup , 2 , 0 , /* setup, length, max */
param , 2 , 0 , /* param, length, max */
NULL , 0 , 1024 , /* data, length, max */
& rparam , & rparam_len , /* return param, length */
& rdata , & rdata_len ) ) /* return data, length */
{
DEBUG ( 5 , ( " Set Handle state: return OK \n " ) ) ;
state_set = True ;
}
1999-12-13 16:27:58 +03:00
if ( rparam )
free ( rparam ) ;
if ( rdata )
free ( rdata ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return state_set ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
check the rpc bind acknowledge response
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
static BOOL valid_pipe_name ( char * pipe_name , RPC_IFACE * abstract , RPC_IFACE * transfer )
1998-03-12 00:11:04 +03:00
{
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
int pipe_idx = 0 ;
1999-12-13 16:27:58 +03:00
while ( pipe_names [ pipe_idx ] . client_pipe ! = NULL ) {
if ( strequal ( pipe_name , pipe_names [ pipe_idx ] . client_pipe ) ) {
DEBUG ( 5 , ( " Bind Abstract Syntax: " ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
dump_data ( 5 , ( char * ) & ( pipe_names [ pipe_idx ] . abstr_syntax ) ,
sizeof ( pipe_names [ pipe_idx ] . abstr_syntax ) ) ;
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " Bind Transfer Syntax: " ) ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
dump_data ( 5 , ( char * ) & ( pipe_names [ pipe_idx ] . trans_syntax ) ,
sizeof ( pipe_names [ pipe_idx ] . trans_syntax ) ) ;
/* copy the required syntaxes out so we can do the right bind */
1999-12-13 16:27:58 +03:00
* transfer = pipe_names [ pipe_idx ] . trans_syntax ;
* abstract = pipe_names [ pipe_idx ] . abstr_syntax ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return True ;
}
pipe_idx + + ;
} ;
DEBUG ( 5 , ( " Bind RPC Pipe[%s] unsupported \n " , pipe_name ) ) ;
return False ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
check the rpc bind acknowledge response
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
static BOOL check_bind_response ( RPC_HDR_BA * hdr_ba , char * pipe_name , RPC_IFACE * transfer )
1998-03-12 00:11:04 +03:00
{
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
int i = 0 ;
1999-12-13 16:27:58 +03:00
while ( ( pipe_names [ i ] . client_pipe ! = NULL ) & & hdr_ba - > addr . len > 0 ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 6 , ( " bind_rpc_pipe: searching pipe name: client:%s server:%s \n " ,
pipe_names [ i ] . client_pipe , pipe_names [ i ] . server_pipe ) ) ;
1999-12-13 16:27:58 +03:00
if ( ( strequal ( pipe_name , pipe_names [ i ] . client_pipe ) ) ) {
if ( strequal ( hdr_ba - > addr . str , pipe_names [ i ] . server_pipe ) ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 5 , ( " bind_rpc_pipe: server pipe_name found: %s \n " ,
pipe_names [ i ] . server_pipe ) ) ;
break ;
1999-12-13 16:27:58 +03:00
} else {
1998-10-15 09:47:29 +04:00
DEBUG ( 4 , ( " bind_rpc_pipe: pipe_name %s != expected pipe %s. oh well! \n " ,
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
pipe_names [ i ] . server_pipe ,
hdr_ba - > addr . str ) ) ;
1998-10-15 09:47:29 +04:00
break ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
1999-12-13 16:27:58 +03:00
} else {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
i + + ;
}
}
1999-12-13 16:27:58 +03:00
if ( pipe_names [ i ] . server_pipe = = NULL ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 2 , ( " bind_rpc_pipe: pipe name %s unsupported \n " , hdr_ba - > addr . str ) ) ;
return False ;
}
/* check the transfer syntax */
1999-12-13 16:27:58 +03:00
if ( ( hdr_ba - > transfer . version ! = transfer - > version ) | |
( memcmp ( & hdr_ba - > transfer . uuid , & transfer - > uuid , sizeof ( transfer - > uuid ) ) ! = 0 ) ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 0 , ( " bind_rpc_pipe: transfer syntax differs \n " ) ) ;
return False ;
}
/* lkclXXXX only accept one result: check the result(s) */
1999-12-13 16:27:58 +03:00
if ( hdr_ba - > res . num_results ! = 0x1 | | hdr_ba - > res . result ! = 0 ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 2 , ( " bind_rpc_pipe: bind denied results: %d reason: %x \n " ,
hdr_ba - > res . num_results , hdr_ba - > res . reason ) ) ;
}
DEBUG ( 5 , ( " bind_rpc_pipe: accepted! \n " ) ) ;
return True ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
1999-12-13 16:27:58 +03:00
Create and send the third packet in an RPC auth .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
static BOOL rpc_send_auth_reply ( struct cli_state * cli , prs_struct * rdata , uint32 rpc_call_id )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
RPC_HDR_AUTH rhdr_auth ;
RPC_AUTH_VERIFIER rhdr_verf ;
RPC_AUTH_NTLMSSP_CHAL rhdr_chal ;
char buffer [ MAX_PDU_FRAG_LEN ] ;
prs_struct rpc_out ;
ssize_t ret ;
unsigned char p24 [ 24 ] ;
unsigned char lm_owf [ 24 ] ;
unsigned char lm_hash [ 16 ] ;
if ( ! smb_io_rpc_hdr_auth ( " " , & rhdr_auth , rdata , 0 ) ) {
DEBUG ( 0 , ( " rpc_send_auth_reply: Failed to unmarshall RPC_HDR_AUTH. \n " ) ) ;
return False ;
}
if ( ! smb_io_rpc_auth_verifier ( " " , & rhdr_verf , rdata , 0 ) ) {
DEBUG ( 0 , ( " rpc_send_auth_reply: Failed to unmarshall RPC_AUTH_VERIFIER. \n " ) ) ;
return False ;
}
if ( ! smb_io_rpc_auth_ntlmssp_chal ( " " , & rhdr_chal , rdata , 0 ) ) {
DEBUG ( 0 , ( " rpc_send_auth_reply: Failed to unmarshall RPC_AUTH_NTLMSSP_CHAL. \n " ) ) ;
return False ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
cli - > ntlmssp_cli_flgs = rhdr_chal . neg_flags ;
pwd_make_lm_nt_owf ( & cli - > pwd , rhdr_chal . challenge ) ;
2000-07-27 04:47:19 +04:00
prs_init ( & rpc_out , 0 , 4 , cli - > mem_ctx , MARSHALL ) ;
1999-12-13 16:27:58 +03:00
prs_give_memory ( & rpc_out , buffer , sizeof ( buffer ) , False ) ;
create_rpc_bind_resp ( & cli - > pwd , cli - > domain ,
cli - > user_name , global_myname ,
cli - > ntlmssp_cli_flgs , rpc_call_id ,
& rpc_out ) ;
pwd_get_lm_nt_owf ( & cli - > pwd , lm_owf , NULL ) ;
pwd_get_lm_nt_16 ( & cli - > pwd , lm_hash , NULL ) ;
NTLMSSPOWFencrypt ( lm_hash , lm_owf , p24 ) ;
1998-03-12 00:11:04 +03:00
1998-10-09 03:57:46 +04:00
{
1999-12-13 16:27:58 +03:00
unsigned char j = 0 ;
int ind ;
unsigned char k2 [ 8 ] ;
memcpy ( k2 , p24 , 5 ) ;
k2 [ 5 ] = 0xe5 ;
k2 [ 6 ] = 0x38 ;
k2 [ 7 ] = 0xb0 ;
for ( ind = 0 ; ind < 256 ; ind + + )
cli - > ntlmssp_hash [ ind ] = ( unsigned char ) ind ;
for ( ind = 0 ; ind < 256 ; ind + + ) {
unsigned char tc ;
j + = ( cli - > ntlmssp_hash [ ind ] + k2 [ ind % 8 ] ) ;
tc = cli - > ntlmssp_hash [ ind ] ;
cli - > ntlmssp_hash [ ind ] = cli - > ntlmssp_hash [ j ] ;
cli - > ntlmssp_hash [ j ] = tc ;
}
cli - > ntlmssp_hash [ 256 ] = 0 ;
cli - > ntlmssp_hash [ 257 ] = 0 ;
}
memset ( ( char * ) lm_hash , ' \0 ' , sizeof ( lm_hash ) ) ;
if ( ( ret = cli_write ( cli , cli - > nt_pipe_fnum , 0x8 , prs_data_p ( & rpc_out ) ,
0 , ( size_t ) prs_offset ( & rpc_out ) ) ) ! = ( ssize_t ) prs_offset ( & rpc_out ) ) {
DEBUG ( 0 , ( " rpc_send_auth_reply: cli_write failed. Return was %d \n " , ( int ) ret ) ) ;
1998-10-09 03:57:46 +04:00
return False ;
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
cli - > ntlmssp_srv_flgs = rhdr_chal . neg_flags ;
return True ;
}
/****************************************************************************
Do an rpc bind .
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2000-07-07 10:20:46 +04:00
BOOL rpc_pipe_bind ( struct cli_state * cli , char * pipe_name , char * my_name )
1999-12-13 16:27:58 +03:00
{
RPC_IFACE abstract ;
RPC_IFACE transfer ;
prs_struct rpc_out ;
prs_struct rdata ;
BOOL do_auth = ( cli - > ntlmssp_cli_flgs ! = 0 ) ;
uint32 rpc_call_id ;
2000-07-17 09:40:48 +04:00
char buffer [ MAX_PDU_FRAG_LEN ] ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " Bind RPC Pipe[%x]: %s \n " , cli - > nt_pipe_fnum , pipe_name ) ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
if ( ! valid_pipe_name ( pipe_name , & abstract , & transfer ) )
return False ;
1998-03-12 00:11:04 +03:00
2000-07-27 04:47:19 +04:00
prs_init ( & rpc_out , 0 , 4 , cli - > mem_ctx , MARSHALL ) ;
2000-07-17 09:40:48 +04:00
/*
* Use the MAX_PDU_FRAG_LEN buffer to store the bind request .
*/
prs_give_memory ( & rpc_out , buffer , sizeof ( buffer ) , False ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
rpc_call_id = get_rpc_call_id ( ) ;
1999-11-07 01:45:31 +03:00
1999-12-13 16:27:58 +03:00
/* Marshall the outgoing data. */
create_rpc_bind_req ( & rpc_out , do_auth , rpc_call_id ,
& abstract , & transfer ,
global_myname , cli - > domain , cli - > ntlmssp_cli_flgs ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/* Initialize the incoming data struct. */
2000-07-27 04:47:19 +04:00
prs_init ( & rdata , 0 , 4 , cli - > mem_ctx , UNMARSHALL ) ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
/* send data on \PIPE\. receive a response */
if ( rpc_api_pipe ( cli , 0x0026 , & rpc_out , & rdata ) ) {
RPC_HDR_BA hdr_ba ;
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
DEBUG ( 5 , ( " rpc_pipe_bind: rpc_api_pipe returned OK. \n " ) ) ;
1998-10-08 01:42:24 +04:00
1999-12-13 16:27:58 +03:00
if ( ! smb_io_rpc_hdr_ba ( " " , & hdr_ba , & rdata , 0 ) ) {
DEBUG ( 0 , ( " rpc_pipe_bind: Failed to unmarshall RPC_HDR_BA. \n " ) ) ;
prs_mem_free ( & rdata ) ;
return False ;
1998-10-15 09:47:29 +04:00
}
1999-12-13 16:27:58 +03:00
if ( ! check_bind_response ( & hdr_ba , pipe_name , & transfer ) ) {
DEBUG ( 0 , ( " rpc_pipe_bind: check_bind_response failed. \n " ) ) ;
prs_mem_free ( & rdata ) ;
return False ;
1998-10-08 01:42:24 +04:00
}
1999-12-13 16:27:58 +03:00
cli - > max_xmit_frag = hdr_ba . bba . max_tsize ;
cli - > max_recv_frag = hdr_ba . bba . max_rsize ;
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
/*
* If we ' re doing NTLMSSP auth we need to send a reply to
* the bind - ack to complete the 3 - way challenge response
* handshake .
*/
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
if ( do_auth & & ! rpc_send_auth_reply ( cli , & rdata , rpc_call_id ) ) {
DEBUG ( 0 , ( " rpc_pipe_bind: rpc_send_auth_reply failed. \n " ) ) ;
prs_mem_free ( & rdata ) ;
return False ;
1998-10-09 03:57:46 +04:00
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
1998-03-12 00:11:04 +03:00
1999-12-13 16:27:58 +03:00
prs_mem_free ( & rdata ) ;
return True ;
1998-03-12 00:11:04 +03:00
}
1998-10-17 00:07:02 +04:00
/****************************************************************************
1999-12-13 16:27:58 +03:00
Set ntlmssp negotiation flags .
1998-10-17 00:07:02 +04:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-10-17 01:36:19 +04:00
void cli_nt_set_ntlmssp_flgs ( struct cli_state * cli , uint32 ntlmssp_flgs )
1998-10-17 00:07:02 +04:00
{
cli - > ntlmssp_cli_flgs = ntlmssp_flgs ;
}
1998-03-12 00:11:04 +03:00
/****************************************************************************
1999-12-13 16:27:58 +03:00
Open a session .
1998-03-12 00:11:04 +03:00
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
BOOL cli_nt_session_open ( struct cli_state * cli , char * pipe_name )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
int fnum ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
2000-08-01 22:32:34 +04:00
if ( cli - > capabilities & CAP_NT_SMBS ) {
2000-12-04 10:39:22 +03:00
if ( ( fnum = cli_nt_create ( cli , & ( pipe_name [ 5 ] ) , DESIRED_ACCESS_PIPE ) ) = = - 1 ) {
1998-10-09 23:34:57 +04:00
DEBUG ( 0 , ( " cli_nt_session_open: cli_nt_create failed on pipe %s to machine %s. Error was %s \n " ,
1999-12-13 16:27:58 +03:00
& ( pipe_name [ 5 ] ) , cli - > desthost , cli_errstr ( cli ) ) ) ;
1998-10-09 23:34:57 +04:00
return False ;
}
1999-12-13 16:27:58 +03:00
cli - > nt_pipe_fnum = ( uint16 ) fnum ;
} else {
if ( ( fnum = cli_open ( cli , pipe_name , O_CREAT | O_RDWR , DENY_NONE ) ) = = - 1 ) {
1998-10-09 23:34:57 +04:00
DEBUG ( 0 , ( " cli_nt_session_open: cli_open failed on pipe %s to machine %s. Error was %s \n " ,
1999-12-13 16:27:58 +03:00
pipe_name , cli - > desthost , cli_errstr ( cli ) ) ) ;
1998-10-09 23:34:57 +04:00
return False ;
}
1999-12-13 16:27:58 +03:00
cli - > nt_pipe_fnum = ( uint16 ) fnum ;
1998-10-09 23:34:57 +04:00
/**************** Set Named Pipe State ***************/
1999-12-13 16:27:58 +03:00
if ( ! rpc_pipe_set_hnd_state ( cli , pipe_name , 0x4300 ) ) {
1998-10-09 23:34:57 +04:00
DEBUG ( 0 , ( " cli_nt_session_open: pipe hnd state failed. Error was %s \n " ,
1999-12-13 16:27:58 +03:00
cli_errstr ( cli ) ) ) ;
cli_close ( cli , cli - > nt_pipe_fnum ) ;
1998-10-09 23:34:57 +04:00
return False ;
}
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
}
/******************* bind request on pipe *****************/
1998-10-09 03:57:46 +04:00
1999-12-13 16:27:58 +03:00
if ( ! rpc_pipe_bind ( cli , pipe_name , global_myname ) ) {
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
DEBUG ( 0 , ( " cli_nt_session_open: rpc bind failed. Error was %s \n " ,
1999-12-13 16:27:58 +03:00
cli_errstr ( cli ) ) ) ;
cli_close ( cli , cli - > nt_pipe_fnum ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return False ;
}
/*
1998-10-09 03:57:46 +04:00
* Setup the remote server name prefixed by \ and the machine account name .
*/
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
1999-12-13 16:27:58 +03:00
fstrcpy ( cli - > srv_name_slash , " \\ \\ " ) ;
fstrcat ( cli - > srv_name_slash , cli - > desthost ) ;
strupper ( cli - > srv_name_slash ) ;
fstrcpy ( cli - > clnt_name_slash , " \\ \\ " ) ;
fstrcat ( cli - > clnt_name_slash , global_myname ) ;
strupper ( cli - > clnt_name_slash ) ;
fstrcpy ( cli - > mach_acct , global_myname ) ;
fstrcat ( cli - > mach_acct , " $ " ) ;
strupper ( cli - > mach_acct ) ;
Makefile.in :
- added srvsvc client files
clientgen.c :
- replaced cli_error(cli, int *cls, int *err) with
cli_error(cli, uint8 cls, uint32 *err). this version detects
32 bit status messages. the DOS error "MORE_DATA", the
equivalent of the 32 bit *warning* 0x8000 0005
(STATUS_BUFFER_OVERFLOW), was being processed as an error,
terminating the cli_receive_trans() call.
cli_pipe.c :
- replaced calls that had been incorrectly modified from
32 bit warnings (0x8000 0005 - STATUS_BUFFER_OVERFLOW)
to 8 bit DOS errors (0x01 0xEA - MORE_DATA).
the use of the old version of cli_error (DOS only)
instead of the new one (DOS and 32 bit) caused the
dce/rpc client code to fail.
- replaced 2 space indentation with tab indentation in all functions.
cli_srvsvc.c :
cmd_srvsvc.c :
- added these files back in, fixing them up to use jeremy's
modified versions of the dce/rpc client functions.
parse_srv.c :
- added back in some "unused" functions required by dce/rpc
client-side code. it would be helpful if all such "unused"
functions could be added back in.
rpcclient.c :
- added "session", "file", "share", "connection" enumeration
functions back in. these are equivalent to nt's "NetXXXXXEnum"
Win32 (MSDN) functions.
- added "srvinfo" function back in. this is equivalent to
nt's NetServerGetInfo Win32 (MSDN) function.
(This used to be commit bcf39ffdcc64e049bca2d70a394a99976291e81d)
1998-10-03 01:09:23 +04:00
return True ;
1998-03-12 00:11:04 +03:00
}
/****************************************************************************
close the session
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
1998-04-24 02:45:53 +04:00
1999-12-13 16:27:58 +03:00
void cli_nt_session_close ( struct cli_state * cli )
1998-03-12 00:11:04 +03:00
{
1999-12-13 16:27:58 +03:00
cli_close ( cli , cli - > nt_pipe_fnum ) ;
1998-03-12 00:11:04 +03:00
}