summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c55
-rw-r--r--source3/client/clientutil.c18
-rw-r--r--source3/client/clitar.c22
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/util.c79
-rw-r--r--source3/libsmb/clientgen.c40
6 files changed, 135 insertions, 80 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index ee6155621c..996678225e 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -152,7 +152,7 @@ void cli_smb_close(char *inbuf, char *outbuf, int clnt_fd, int c_num, int f_num)
SIVALS(outbuf,smb_vwv1, -1);
send_smb(clnt_fd, outbuf);
- receive_smb(clnt_fd,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(clnt_fd,inbuf,CLIENT_TIMEOUT);
}
/****************************************************************************
@@ -271,7 +271,7 @@ static BOOL chkpath(char *path,BOOL report)
#endif
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (report && CVAL(inbuf,smb_rcls) != 0)
DEBUG(2,("chkpath: %s\n",smb_errstr(inbuf)));
@@ -309,7 +309,7 @@ static void send_message(char *inbuf,char *outbuf)
send_smb(Client,outbuf);
- if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
+ if (!client_receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
{
printf("SMBsendstrt failed. (%s)\n",smb_errstr(inbuf));
return;
@@ -349,7 +349,7 @@ static void send_message(char *inbuf,char *outbuf)
send_smb(Client,outbuf);
- if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
+ if (!client_receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
{
printf("SMBsendtxt failed (%s)\n",smb_errstr(inbuf));
return;
@@ -372,7 +372,7 @@ static void send_message(char *inbuf,char *outbuf)
send_smb(Client,outbuf);
- if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
+ if (!client_receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
{
printf("SMBsendend failed (%s)\n",smb_errstr(inbuf));
return;
@@ -395,7 +395,7 @@ static void do_dskattr(void)
cli_setup_pkt(outbuf);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
DEBUG(0,("Error in dskattr: %s\n",smb_errstr(inbuf)));
@@ -714,7 +714,7 @@ static int do_short_dir(char *inbuf,char *outbuf,char *Mask,int attribute,void (
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
received = SVAL(inbuf,smb_vwv0);
@@ -764,7 +764,7 @@ static int do_short_dir(char *inbuf,char *outbuf,char *Mask,int attribute,void (
memcpy(p,status,21);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
DEBUG(0,("Error closing search: %s\n",smb_errstr(inbuf)));
@@ -1140,7 +1140,7 @@ static void do_get(char *rname,char *lname,file_info *finfo1)
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1267,7 +1267,7 @@ static void do_get(char *rname,char *lname,file_info *finfo1)
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1360,7 +1360,7 @@ static void do_get(char *rname,char *lname,file_info *finfo1)
SSVAL(outbuf,smb_vwv4,finfo.size - nread);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1424,7 +1424,7 @@ static void do_get(char *rname,char *lname,file_info *finfo1)
*p++ = 4;
*p = 0;
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
}
{
@@ -1657,7 +1657,7 @@ static BOOL do_mkdir(char *name)
strcpy(p,name);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1740,7 +1740,7 @@ static int smb_writeraw(char *outbuf,int fnum,int pos,char *buf,int n)
send_smb(Client,outbuf);
- if (!receive_smb(Client,inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
+ if (!client_receive_smb(Client,inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
return(0);
_smb_setlen(buf-4,n); /* HACK! XXXX */
@@ -1748,7 +1748,7 @@ static int smb_writeraw(char *outbuf,int fnum,int pos,char *buf,int n)
if (write_socket(Client,buf-4,n+4) != n+4)
return(0);
- if (!receive_smb(Client,inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0) {
+ if (!client_receive_smb(Client,inbuf,CLIENT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0) {
DEBUG(0,("Error writing remote file (2)\n"));
return(0);
}
@@ -1785,7 +1785,7 @@ static int smb_writefile(char *outbuf,int fnum,int pos,char *buf,int n)
memcpy(smb_buf(outbuf)+3,buf,n);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0) {
DEBUG(0,("%s writing remote file\n",smb_errstr(inbuf)));
@@ -1840,7 +1840,7 @@ static void do_put(char *rname,char *lname,file_info *finfo)
strcpy(p,rname);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1912,7 +1912,7 @@ static void do_put(char *rname,char *lname,file_info *finfo)
put_dos_date3(outbuf,smb_vwv1,close_time);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -2241,7 +2241,7 @@ static void cmd_print(char *inbuf,char *outbuf )
strcpy(p,rname);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -2295,7 +2295,7 @@ static void cmd_print(char *inbuf,char *outbuf )
SSVAL(smb_buf(outbuf),1,n);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -2317,7 +2317,7 @@ static void cmd_print(char *inbuf,char *outbuf )
SSVAL(outbuf,smb_vwv0,fnum);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -2351,7 +2351,7 @@ static void cmd_queue(char *inbuf,char *outbuf )
SSVAL(outbuf,smb_vwv1,0); /* the index into the queue */
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -2648,7 +2648,7 @@ static void do_del(file_info *finfo)
strcpy(p,mask);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
DEBUG(0,("%s deleting remote file %s\n",smb_errstr(inbuf),CNV_LANG(mask)));
@@ -2713,7 +2713,7 @@ static void cmd_rmdir(char *inbuf,char *outbuf )
strcpy(p,mask);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -2759,7 +2759,7 @@ static void cmd_rename(char *inbuf,char *outbuf )
strcpy(p,dest);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -3348,6 +3348,11 @@ static void wait_keyboard(char *buffer)
}
}
#endif
+
+ /* We deliberately use receive_smb instead of
+ client_receive_smb as we want to receive
+ session keepalives and then drop them here.
+ */
if (FD_ISSET(Client,&fds))
receive_smb(Client,buffer,0);
diff --git a/source3/client/clientutil.c b/source3/client/clientutil.c
index ca90845738..9ce2c80d84 100644
--- a/source3/client/clientutil.c
+++ b/source3/client/clientutil.c
@@ -132,7 +132,7 @@ BOOL cli_receive_trans_response(char *inbuf,int trans,
*data_len = *param_len = 0;
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
show_msg(inbuf);
/* sanity check */
@@ -175,7 +175,7 @@ BOOL cli_receive_trans_response(char *inbuf,int trans,
if (total_data <= *data_len && total_param <= *param_len)
break;
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
show_msg(inbuf);
/* sanity check */
@@ -258,7 +258,7 @@ BOOL cli_send_trans_request(char *outbuf,int trans,
if (this_ldata < ldata || this_lparam < lparam)
{
/* receive interim response */
- if (!receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
+ if (!client_receive_smb(Client,inbuf,SHORT_TIMEOUT) || CVAL(inbuf,smb_rcls) != 0)
{
DEBUG(0,("%s request failed (%s)\n",
trans==SMBtrans?"SMBtrans":"SMBtrans2", smb_errstr(inbuf)));
@@ -340,7 +340,7 @@ BOOL cli_send_session_request(char *inbuf,char *outbuf)
send_smb(Client,outbuf);
DEBUG(5,("Sent session request\n"));
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,0) == 0x84) /* C. Hoch 9/14/95 Start */
{
@@ -500,7 +500,7 @@ BOOL cli_send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setup)
CVAL(smb_buf(outbuf),0) = 2;
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
show_msg(inbuf);
@@ -644,7 +644,7 @@ BOOL cli_send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setup)
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
show_msg(inbuf);
@@ -759,7 +759,7 @@ BOOL cli_send_login(char *inbuf,char *outbuf,BOOL start_session,BOOL use_setup)
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
/* trying again with a blank password */
if (CVAL(inbuf,smb_rcls) != 0 &&
@@ -827,7 +827,7 @@ void cli_send_logout(void )
cli_setup_pkt(outbuf);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,SHORT_TIMEOUT);
+ client_receive_smb(Client,inbuf,SHORT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -946,7 +946,7 @@ BOOL cli_reopen_connection(char *inbuf,char *outbuf)
cli_setup_pkt(outbuf);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,SHORT_TIMEOUT);
+ client_receive_smb(Client,inbuf,SHORT_TIMEOUT);
close_sockets();
if (!cli_open_sockets(0)) return(False);
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 1e7c45691b..05cb13656a 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -472,7 +472,7 @@ static int do_setrattr(char *fname, int attr, int setit)
*p++ = 0;
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
DEBUG(5,("getatr: %s\n",smb_errstr(inbuf)));
@@ -510,7 +510,7 @@ static int do_setrattr(char *fname, int attr, int setit)
*p++ = 0;
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -547,7 +547,7 @@ static BOOL smbcreat(file_info finfo, int *fnum, char *inbuf, char *outbuf)
strcpy(p,finfo.name);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -586,7 +586,7 @@ static BOOL smbwrite(int fnum, int n, int low, int high, int left,
SSVAL(smb_buf(outbuf),1,n);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -625,7 +625,7 @@ static BOOL smbshut(file_info finfo, int fnum, char *inbuf, char *outbuf)
finfo.mtime));
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -655,7 +655,7 @@ static BOOL smbchkpath(char *fname, char *inbuf, char *outbuf)
strcpy(p,fname);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
DEBUG(5,("smbchkpath: %s\n",smb_errstr(inbuf)));
@@ -682,7 +682,7 @@ static BOOL smbmkdir(char *fname, char *inbuf, char *outbuf)
strcpy(p,fname);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -828,7 +828,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -962,7 +962,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
}
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1056,7 +1056,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
SSVAL(outbuf,smb_vwv4,finfo.size - nread);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (CVAL(inbuf,smb_rcls) != 0)
{
@@ -1117,7 +1117,7 @@ static void do_atar(char *rname,char *lname,file_info *finfo1)
SIVALS(outbuf,smb_vwv1,-1);
send_smb(Client,outbuf);
- receive_smb(Client,inbuf,CLIENT_TIMEOUT);
+ client_receive_smb(Client,inbuf,CLIENT_TIMEOUT);
if (!ignore_close_error && CVAL(inbuf,smb_rcls) != 0)
{
diff --git a/source3/include/proto.h b/source3/include/proto.h
index a3fd1d1f0f..6301a7b39d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1433,6 +1433,7 @@ int write_data(int fd,char *buffer,int N);
int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align);
int read_smb_length(int fd,char *inbuf,int timeout);
BOOL receive_smb(int fd,char *buffer, int timeout);
+BOOL client_receive_smb(int fd,char *buffer, int timeout);
BOOL receive_local_message(int fd, char *buffer, int buffer_len, int timeout);
BOOL push_local_message(char *buf, int msg_len);
BOOL receive_message_or_smb(int smbfd, int oplock_fd,
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 41ea593ae5..409fe7135c 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2240,32 +2240,27 @@ int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align)
/****************************************************************************
read 4 bytes of a smb packet and return the smb length of the packet
-possibly store the result in the buffer
+store the result in the buffer
+This version of the function will return a length of zero on receiving
+a keepalive packet.
****************************************************************************/
-int read_smb_length(int fd,char *inbuf,int timeout)
+static int read_smb_length_return_keepalive(int fd,char *inbuf,int timeout)
{
- char *buffer;
- char buf[4];
int len=0, msg_type;
BOOL ok=False;
- if (inbuf)
- buffer = inbuf;
- else
- buffer = buf;
-
while (!ok)
{
if (timeout > 0)
- ok = (read_with_timeout(fd,buffer,4,4,timeout) == 4);
+ ok = (read_with_timeout(fd,inbuf,4,4,timeout) == 4);
else
- ok = (read_data(fd,buffer,4) == 4);
+ ok = (read_data(fd,inbuf,4) == 4);
if (!ok)
return(-1);
- len = smb_len(buffer);
- msg_type = CVAL(buffer,0);
+ len = smb_len(inbuf);
+ msg_type = CVAL(inbuf,0);
if (msg_type == 0x85)
DEBUG(5,("Got keepalive packet\n"));
@@ -2276,12 +2271,37 @@ int read_smb_length(int fd,char *inbuf,int timeout)
return(len);
}
+/****************************************************************************
+read 4 bytes of a smb packet and return the smb length of the packet
+store the result in the buffer. This version of the function will
+never return a session keepalive (length of zero).
+****************************************************************************/
+int read_smb_length(int fd,char *inbuf,int timeout)
+{
+ int len;
+
+ for(;;)
+ {
+ len = read_smb_length(fd, inbuf, timeout);
+
+ if(len < 0)
+ return len;
+ /* Ignore session keepalives. */
+ if(CVAL(inbuf,0) != 0x85)
+ break;
+ }
+
+ return len;
+}
/****************************************************************************
read an smb from a fd. Note that the buffer *MUST* be of size
BUFFER_SIZE+SAFETY_MARGIN.
-The timeout is in milli seconds
+ The timeout is in milli seconds.
+
+ This function will return on a
+ receipt of a session keepalive packet.
****************************************************************************/
BOOL receive_smb(int fd,char *buffer, int timeout)
{
@@ -2291,7 +2311,7 @@ BOOL receive_smb(int fd,char *buffer, int timeout)
bzero(buffer,smb_size + 100);
- len = read_smb_length(fd,buffer,timeout);
+ len = read_smb_length_return_keepalive(fd,buffer,timeout);
if (len < 0)
return(False);
@@ -2312,6 +2332,35 @@ BOOL receive_smb(int fd,char *buffer, int timeout)
}
/****************************************************************************
+ read an smb from a fd ignoring all keepalive packets. Note that the buffer
+ *MUST* be of size BUFFER_SIZE+SAFETY_MARGIN.
+ The timeout is in milli seconds
+
+ This is exactly the same as receive_smb except that it never returns
+ a session keepalive packet (just as receive_smb used to do).
+ receive_smb was changed to return keepalives as the oplock processing means this call
+ should never go into a blocking read.
+****************************************************************************/
+
+BOOL client_receive_smb(int fd,char *buffer, int timeout)
+{
+ BOOL ret;
+
+ for(;;)
+ {
+ ret = receive_smb(fd, buffer, timeout);
+
+ if(ret == False)
+ return ret;
+
+ /* Ignore session keepalive packets. */
+ if(CVAL(buffer,0) != 0x85)
+ break;
+ }
+ return ret;
+}
+
+/****************************************************************************
read a message from a udp fd.
The timeout is in milli seconds
****************************************************************************/
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index d827eadfe1..4185c19fea 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -104,7 +104,7 @@ static BOOL cli_send_trans(struct cli_state *cli,
if (this_ldata < ldata || this_lparam < lparam) {
/* receive interim response */
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout) ||
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout) ||
CVAL(cli->inbuf,smb_rcls) != 0) {
return(False);
}
@@ -165,7 +165,7 @@ static BOOL cli_receive_trans(struct cli_state *cli,
*data_len = *param_len = 0;
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
show_msg(cli->inbuf);
@@ -216,7 +216,7 @@ static BOOL cli_receive_trans(struct cli_state *cli,
if (total_data <= *data_len && total_param <= *param_len)
break;
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
show_msg(cli->inbuf);
@@ -484,7 +484,7 @@ BOOL cli_session_setup(struct cli_state *cli,
}
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
show_msg(cli->inbuf);
@@ -543,7 +543,7 @@ BOOL cli_send_tconX(struct cli_state *cli,
SCVAL(cli->inbuf,smb_rcls, 1);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
if (CVAL(cli->inbuf,smb_rcls) != 0) {
@@ -567,7 +567,7 @@ BOOL cli_tdis(struct cli_state *cli)
cli_setup_packet(cli);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
return CVAL(cli->inbuf,smb_rcls) == 0;
@@ -599,7 +599,7 @@ BOOL cli_mv(struct cli_state *cli, char *fname_src, char *fname_dst)
strcpy(p,fname_dst);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -633,7 +633,7 @@ BOOL cli_unlink(struct cli_state *cli, char *fname)
strcpy(p,fname);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -666,7 +666,7 @@ BOOL cli_mkdir(struct cli_state *cli, char *dname)
strcpy(p,dname);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -698,7 +698,7 @@ BOOL cli_rmdir(struct cli_state *cli, char *dname)
strcpy(p,dname);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -758,7 +758,7 @@ int cli_open(struct cli_state *cli, char *fname, int flags, int share_mode)
p = skip_string(p,1);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return -1;
}
@@ -790,7 +790,7 @@ BOOL cli_close(struct cli_state *cli, int fnum)
SIVALS(cli->outbuf,smb_vwv1,-1);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -831,7 +831,7 @@ BOOL cli_lock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int ti
SIVAL(p, 6, len);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -871,7 +871,7 @@ BOOL cli_unlock(struct cli_state *cli, int fnum, uint32 offset, uint32 len, int
SIVAL(p, 6, len);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -906,7 +906,7 @@ int cli_read(struct cli_state *cli, int fnum, char *buf, uint32 offset, uint16 s
SSVAL(cli->outbuf,smb_vwv6,size);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return -1;
}
@@ -950,7 +950,7 @@ int cli_write(struct cli_state *cli, int fnum, char *buf, uint32 offset, uint16
memcpy(p, buf, size);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return -1;
}
@@ -984,7 +984,7 @@ BOOL cli_getatr(struct cli_state *cli, char *fname,
strcpy(p+1, fname);
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -1035,7 +1035,7 @@ BOOL cli_setatr(struct cli_state *cli, char *fname, int attr, time_t t)
*p = 4;
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout)) {
return False;
}
@@ -1242,7 +1242,7 @@ BOOL cli_negprot(struct cli_state *cli)
CVAL(smb_buf(cli->outbuf),0) = 2;
send_smb(cli->fd,cli->outbuf);
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
show_msg(cli->inbuf);
@@ -1322,7 +1322,7 @@ BOOL cli_session_request(struct cli_state *cli, char *host, int name_type,
send_smb(cli->fd,cli->outbuf);
DEBUG(5,("Sent session request\n"));
- if (!receive_smb(cli->fd,cli->inbuf,cli->timeout))
+ if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
if (CVAL(cli->inbuf,0) != 0x82) {