mirror of
https://github.com/samba-team/samba.git
synced 2025-02-24 13:57:43 +03:00
client.c clientutil.c proto.h
rpc_pipes/ntclientlsa.c rpc_pipes/ntclientnet.c rpc_pipes/ntclientpipe.c : added extra argument to cli_call_api() to allow specifying the length of the \PIPE\ name. it appears that, like when the name of the pipe is NULL and OS-2 requires two extra bytes _after_ the NULL name, that NT requires two bytes after the NULL-terminated name "\PIPE\". these two bytes vary, but values seen so far are: 0x72 0x70; 0x63 0x65; 0x44 0x65; 0x4E 0x00. there appears not to be much logic to this. purpose unknown. ntclient.c: put Set Named Pipe Handle State call directly after SMBopenX call.
This commit is contained in:
parent
4525c3b6e5
commit
54c245be15
@ -551,7 +551,7 @@ static int do_long_dir(char *inbuf,char *outbuf,char *Mask,int attribute,void (*
|
|||||||
}
|
}
|
||||||
/* ??? original code added 1 pad byte after param */
|
/* ??? original code added 1 pad byte after param */
|
||||||
|
|
||||||
cli_send_trans_request(outbuf,SMBtrans2,NULL,FID_UNUSED,0,
|
cli_send_trans_request(outbuf,SMBtrans2,NULL,0,FID_UNUSED,0,
|
||||||
NULL,param,&setup,
|
NULL,param,&setup,
|
||||||
0,12+strlen(mask)+1,1,
|
0,12+strlen(mask)+1,1,
|
||||||
BUFFER_SIZE,10,0);
|
BUFFER_SIZE,10,0);
|
||||||
@ -2137,7 +2137,7 @@ static void do_cancel(int job)
|
|||||||
SSVAL(p,0,job);
|
SSVAL(p,0,job);
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
||||||
if (cli_call_api(PIPE_LANMAN, PTR_DIFF(p,param),0, 0,
|
if (cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p,param),0, 0,
|
||||||
6, 1000,
|
6, 1000,
|
||||||
&rprcnt,&rdrcnt,
|
&rprcnt,&rdrcnt,
|
||||||
param,NULL, NULL,
|
param,NULL, NULL,
|
||||||
@ -2211,7 +2211,7 @@ static void cmd_stat(char *inbuf,char *outbuf)
|
|||||||
strcpy(p,cur_dir);
|
strcpy(p,cur_dir);
|
||||||
strcat(p,buf);
|
strcat(p,buf);
|
||||||
|
|
||||||
cli_send_trans_request(outbuf,SMBtrans2,NULL,FID_UNUSED,0,
|
cli_send_trans_request(outbuf,SMBtrans2,NULL,0,FID_UNUSED,0,
|
||||||
NULL,param,&setup,
|
NULL,param,&setup,
|
||||||
0,6 + strlen(p)+1,1,
|
0,6 + strlen(p)+1,1,
|
||||||
BUFFER_SIZE,2,0);
|
BUFFER_SIZE,2,0);
|
||||||
@ -2473,7 +2473,7 @@ static void cmd_p_queue_4(char *inbuf,char *outbuf )
|
|||||||
p = skip_string(p,1);
|
p = skip_string(p,1);
|
||||||
|
|
||||||
DEBUG(1,("Calling DosPrintJobEnum()...\n"));
|
DEBUG(1,("Calling DosPrintJobEnum()...\n"));
|
||||||
if( cli_call_api(PIPE_LANMAN, PTR_DIFF(p,param), 0,
|
if( cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p,param), 0,
|
||||||
10, 0, 4096,
|
10, 0, 4096,
|
||||||
&rprcnt, &rdrcnt,
|
&rprcnt, &rdrcnt,
|
||||||
param, NULL, NULL,
|
param, NULL, NULL,
|
||||||
@ -2580,7 +2580,7 @@ static void cmd_qinfo(char *inbuf,char *outbuf )
|
|||||||
p = skip_string(p,1);
|
p = skip_string(p,1);
|
||||||
|
|
||||||
DEBUG(1,("Calling DosPrintQueueGetInfo()...\n"));
|
DEBUG(1,("Calling DosPrintQueueGetInfo()...\n"));
|
||||||
if( cli_call_api(PIPE_LANMAN, PTR_DIFF(p,param), 0, 0,
|
if( cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p,param), 0, 0,
|
||||||
10, 4096,
|
10, 4096,
|
||||||
&rprcnt, &rdrcnt,
|
&rprcnt, &rdrcnt,
|
||||||
param, NULL, NULL,
|
param, NULL, NULL,
|
||||||
@ -2976,7 +2976,7 @@ static BOOL browse_host(BOOL sort)
|
|||||||
SSVAL(p,2,BUFFER_SIZE);
|
SSVAL(p,2,BUFFER_SIZE);
|
||||||
p += 4;
|
p += 4;
|
||||||
|
|
||||||
if (cli_call_api(PIPE_LANMAN, PTR_DIFF(p,param),0, 0,
|
if (cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p,param),0, 0,
|
||||||
1024, BUFFER_SIZE,
|
1024, BUFFER_SIZE,
|
||||||
&rprcnt,&rdrcnt,
|
&rprcnt,&rdrcnt,
|
||||||
param,NULL, NULL,
|
param,NULL, NULL,
|
||||||
@ -3068,7 +3068,7 @@ static void server_info()
|
|||||||
SSVAL(p,2,1000);
|
SSVAL(p,2,1000);
|
||||||
p += 6;
|
p += 6;
|
||||||
|
|
||||||
if (cli_call_api(PIPE_LANMAN, PTR_DIFF(p,param),0, 0,
|
if (cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p,param),0, 0,
|
||||||
6, 1000,
|
6, 1000,
|
||||||
&rprcnt,&rdrcnt,
|
&rprcnt,&rdrcnt,
|
||||||
param,NULL, NULL,
|
param,NULL, NULL,
|
||||||
@ -3143,7 +3143,7 @@ static BOOL list_servers(char *wk_grp)
|
|||||||
/* first ask for a list of servers in this workgroup */
|
/* first ask for a list of servers in this workgroup */
|
||||||
SIVAL(svtype_p,0,SV_TYPE_ALL);
|
SIVAL(svtype_p,0,SV_TYPE_ALL);
|
||||||
|
|
||||||
if (cli_call_api(PIPE_LANMAN, PTR_DIFF(p+4,param),0, 0,
|
if (cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p+4,param),0, 0,
|
||||||
8, BUFFER_SIZE - SAFETY_MARGIN,
|
8, BUFFER_SIZE - SAFETY_MARGIN,
|
||||||
&rprcnt,&rdrcnt,
|
&rprcnt,&rdrcnt,
|
||||||
param,NULL, NULL,
|
param,NULL, NULL,
|
||||||
@ -3182,7 +3182,7 @@ static BOOL list_servers(char *wk_grp)
|
|||||||
/* now ask for a list of workgroups */
|
/* now ask for a list of workgroups */
|
||||||
SIVAL(svtype_p,0,SV_TYPE_DOMAIN_ENUM);
|
SIVAL(svtype_p,0,SV_TYPE_DOMAIN_ENUM);
|
||||||
|
|
||||||
if (cli_call_api(PIPE_LANMAN, PTR_DIFF(p+4,param),0, 0,
|
if (cli_call_api(PIPE_LANMAN, 0,PTR_DIFF(p+4,param),0, 0,
|
||||||
8, BUFFER_SIZE - SAFETY_MARGIN,
|
8, BUFFER_SIZE - SAFETY_MARGIN,
|
||||||
&rprcnt,&rdrcnt,
|
&rprcnt,&rdrcnt,
|
||||||
param,NULL, NULL,
|
param,NULL, NULL,
|
||||||
|
@ -92,7 +92,8 @@ void cli_setup_pkt(char *outbuf)
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
call a remote api
|
call a remote api
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL cli_call_api(char *pipe_name, int prcnt,int drcnt, int srcnt,
|
BOOL cli_call_api(char *pipe_name, int pipe_name_len,
|
||||||
|
int prcnt,int drcnt, int srcnt,
|
||||||
int mprcnt,int mdrcnt,
|
int mprcnt,int mdrcnt,
|
||||||
int *rprcnt,int *rdrcnt,
|
int *rprcnt,int *rdrcnt,
|
||||||
char *param,char *data, uint16 *setup,
|
char *param,char *data, uint16 *setup,
|
||||||
@ -104,7 +105,9 @@ BOOL cli_call_api(char *pipe_name, int prcnt,int drcnt, int srcnt,
|
|||||||
if (!inbuf) inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
|
if (!inbuf) inbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
|
||||||
if (!outbuf) outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
|
if (!outbuf) outbuf = (char *)malloc(BUFFER_SIZE + SAFETY_MARGIN);
|
||||||
|
|
||||||
cli_send_trans_request(outbuf,SMBtrans,pipe_name, 0,0,
|
if (pipe_name_len == 0) pipe_name_len = strlen(pipe_name);
|
||||||
|
|
||||||
|
cli_send_trans_request(outbuf,SMBtrans,pipe_name, pipe_name_len, 0,0,
|
||||||
data, param, setup,
|
data, param, setup,
|
||||||
drcnt, prcnt, srcnt,
|
drcnt, prcnt, srcnt,
|
||||||
mdrcnt, mprcnt, 0);
|
mdrcnt, mprcnt, 0);
|
||||||
@ -194,7 +197,7 @@ BOOL cli_receive_trans_response(char *inbuf,int trans,
|
|||||||
send a SMB trans or trans2 request
|
send a SMB trans or trans2 request
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
BOOL cli_send_trans_request(char *outbuf,int trans,
|
BOOL cli_send_trans_request(char *outbuf,int trans,
|
||||||
char *name,int fid,int flags,
|
char *name,int name_len, int fid,int flags,
|
||||||
char *data,char *param,uint16 *setup,
|
char *data,char *param,uint16 *setup,
|
||||||
int ldata,int lparam,int lsetup,
|
int ldata,int lparam,int lsetup,
|
||||||
int mdata,int mparam,int msetup)
|
int mdata,int mparam,int msetup)
|
||||||
@ -215,7 +218,7 @@ BOOL cli_send_trans_request(char *outbuf,int trans,
|
|||||||
SSVAL(outbuf,smb_tid,cnum);
|
SSVAL(outbuf,smb_tid,cnum);
|
||||||
cli_setup_pkt(outbuf);
|
cli_setup_pkt(outbuf);
|
||||||
|
|
||||||
outparam = smb_buf(outbuf)+(trans==SMBtrans ? strlen(name)+1 : 3);
|
outparam = smb_buf(outbuf)+(trans==SMBtrans ? name_len+1 : 3);
|
||||||
outdata = outparam+this_lparam;
|
outdata = outparam+this_lparam;
|
||||||
|
|
||||||
/* primary request */
|
/* primary request */
|
||||||
@ -235,7 +238,7 @@ BOOL cli_send_trans_request(char *outbuf,int trans,
|
|||||||
SSVAL(outbuf,smb_setup+i*SIZEOFWORD,setup[i]);
|
SSVAL(outbuf,smb_setup+i*SIZEOFWORD,setup[i]);
|
||||||
p = smb_buf(outbuf);
|
p = smb_buf(outbuf);
|
||||||
if (trans==SMBtrans)
|
if (trans==SMBtrans)
|
||||||
strcpy(p,name); /* name[] */
|
memcpy(p,name, name_len+1); /* name[] */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*p++ = 0; /* put in a null smb_name */
|
*p++ = 0; /* put in a null smb_name */
|
||||||
|
@ -106,6 +106,13 @@ BOOL do_nt_login(char *desthost, char *myhostname,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**************** Set Named Pipe State ***************/
|
||||||
|
if (!rpc_pipe_set_hnd_state(PIPE_LSARPC, fnum, 0x4300))
|
||||||
|
{
|
||||||
|
free(inbuf); free(outbuf);
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
/******************* bind request on \PIPE\lsarpc *****************/
|
/******************* bind request on \PIPE\lsarpc *****************/
|
||||||
|
|
||||||
/* create and send a MSRPC command with api LSA_OPENPOLICY */
|
/* create and send a MSRPC command with api LSA_OPENPOLICY */
|
||||||
@ -132,13 +139,6 @@ BOOL do_nt_login(char *desthost, char *myhostname,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************** Set Named Pipe State ***************/
|
|
||||||
if (!rpc_pipe_set_hnd_state(PIPE_LSARPC, fnum, 0x4300))
|
|
||||||
{
|
|
||||||
free(inbuf); free(outbuf);
|
|
||||||
return False;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************* Open Policy ********************/
|
/******************* Open Policy ********************/
|
||||||
|
|
||||||
fstrcpy(server_name, ("\\\\"));
|
fstrcpy(server_name, ("\\\\"));
|
||||||
@ -198,16 +198,16 @@ BOOL do_nt_login(char *desthost, char *myhostname,
|
|||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************* bind request on \PIPE\NETLOGON *****************/
|
/**************** Set Named Pipe State ***************/
|
||||||
|
if (!rpc_pipe_set_hnd_state(PIPE_NETLOGON, fnum, 0x4300))
|
||||||
if (!rpc_pipe_bind(PIPE_NETLOGON, fnum, ++call_id, &abstract, &transfer))
|
|
||||||
{
|
{
|
||||||
free(inbuf); free(outbuf);
|
free(inbuf); free(outbuf);
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************** Set Named Pipe State ***************/
|
/******************* bind request on \PIPE\NETLOGON *****************/
|
||||||
if (!rpc_pipe_set_hnd_state(PIPE_NETLOGON, fnum, 0x4300))
|
|
||||||
|
if (!rpc_pipe_bind(PIPE_NETLOGON, fnum, ++call_id, &abstract, &transfer))
|
||||||
{
|
{
|
||||||
free(inbuf); free(outbuf);
|
free(inbuf); free(outbuf);
|
||||||
return False;
|
return False;
|
||||||
|
@ -73,7 +73,8 @@ void cli_sockopt(struct cli_state *cli, char *options);
|
|||||||
/*The following definitions come from clientutil.c */
|
/*The following definitions come from clientutil.c */
|
||||||
|
|
||||||
void cli_setup_pkt(char *outbuf);
|
void cli_setup_pkt(char *outbuf);
|
||||||
BOOL cli_call_api(char *pipe_name, int prcnt,int drcnt, int srcnt,
|
BOOL cli_call_api(char *pipe_name, int pipe_name_len,
|
||||||
|
int prcnt,int drcnt, int srcnt,
|
||||||
int mprcnt,int mdrcnt,
|
int mprcnt,int mdrcnt,
|
||||||
int *rprcnt,int *rdrcnt,
|
int *rprcnt,int *rdrcnt,
|
||||||
char *param,char *data, uint16 *setup,
|
char *param,char *data, uint16 *setup,
|
||||||
@ -82,7 +83,7 @@ BOOL cli_receive_trans_response(char *inbuf,int trans,
|
|||||||
int *data_len,int *param_len,
|
int *data_len,int *param_len,
|
||||||
char **data,char **param);
|
char **data,char **param);
|
||||||
BOOL cli_send_trans_request(char *outbuf,int trans,
|
BOOL cli_send_trans_request(char *outbuf,int trans,
|
||||||
char *name,int fid,int flags,
|
char *name,int name_len, int fid,int flags,
|
||||||
char *data,char *param,uint16 *setup,
|
char *data,char *param,uint16 *setup,
|
||||||
int ldata,int lparam,int lsetup,
|
int ldata,int lparam,int lsetup,
|
||||||
int mdata,int mparam,int msetup);
|
int mdata,int mparam,int msetup);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user