summaryrefslogtreecommitdiff
path: root/source3/client
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-08-11 02:13:01 +0000
committerJeremy Allison <jra@samba.org>1998-08-11 02:13:01 +0000
commit9042aa41c3c54e8dce600338cd4b796b65aaf066 (patch)
tree304c22f1553b8e249ed74901245e95761f6e1ba1 /source3/client
parentcd9bfc6310b7a3a792840525f52392c2de9db451 (diff)
downloadsamba-9042aa41c3c54e8dce600338cd4b796b65aaf066.tar.gz
samba-9042aa41c3c54e8dce600338cd4b796b65aaf066.tar.bz2
samba-9042aa41c3c54e8dce600338cd4b796b65aaf066.zip
Makefile.in: Added CHECK target back in (at Herb's request). Added
manpath in (although we don't currently use it). client/client.c: Added John Blair's fixes for "put -". include/nterr.h: Added NT_STATUS_NOTIFY_ENUM_DIR error code. smbd/nttrans.c: Added in devious fix for one-shot NT change notify bug. Jeremy. (This used to be commit 4ac3091e57e9ab234b3c051333ba521a92defa99)
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index ea1555beb4..f010dfebf4 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -1858,7 +1858,15 @@ static void do_put(char *rname,char *lname,file_info *finfo)
return;
}
- f = fopen(lname,"r");
+ /* allow files to be piped into smbclient
+ jdblair 24.jun.98 */
+ if (!strcmp(lname, "-")) {
+ f = stdin;
+ /* size of file is not known */
+ finfo->size = 0;
+ } else {
+ f = fopen(lname,"r");
+ }
if (!f)
{
@@ -1877,15 +1885,21 @@ static void do_put(char *rname,char *lname,file_info *finfo)
if (!maxwrite)
maxwrite = writebraw_supported?MAX(max_xmit,BUFFER_SIZE):(max_xmit-200);
- while (nread < finfo->size)
+ /* This is a rewrite of the read/write loop that doesn't require the input
+ file to be of a known length. This allows the stream pointer 'f' to
+ refer to stdin.
+
+ Rather than reallocing the read buffer every loop to keep it the min
+ necessary length this look uses a fixed length buffer and just tests
+ for eof on the file stream at the top of each loop.
+ jdblair, 24.jun.98 */
+
+ buf = (char *)malloc(maxwrite+4);
+ while (! feof(f) )
{
int n = maxwrite;
int ret;
- n = MIN(n,finfo->size - nread);
-
- buf = (char *)Realloc(buf,n+4);
-
fseek(f,nread,SEEK_SET);
if ((n = readfile(buf+4,1,n,f)) < 1)
{
@@ -1908,8 +1922,6 @@ static void do_put(char *rname,char *lname,file_info *finfo)
nread += n;
}
-
-
bzero(outbuf,smb_size);
set_message(outbuf,3,0,True);
CVAL(outbuf,smb_com) = SMBclose;
@@ -1951,7 +1963,7 @@ static void do_put(char *rname,char *lname,file_info *finfo)
finfo->size / (1.024*this_time + 1.0e-4),
put_total_size / (1.024*put_total_time_ms)));
}
-}
+}
@@ -1987,7 +1999,10 @@ static void cmd_put(char *dum_in, char *dum_out)
{
struct stat st;
- if (!file_exist(lname,&st)) {
+ /* allow '-' to represent stdin
+ jdblair, 24.jun.98 */
+ if (!file_exist(lname,&st) &&
+ (strcmp(lname,"-"))) {
DEBUG(0,("%s does not exist\n",lname));
return;
}
@@ -3556,8 +3571,10 @@ static void usage(char *pname)
/* modification to support PASSWD environmental var
25.Aug.97, jdblair@uab.edu */
- if (getenv("PASSWD"))
+ if (getenv("PASSWD")) {
pstrcpy(password,getenv("PASSWD"));
+ got_pass = True;
+ }
if (*username == 0 && getenv("LOGNAME"))
{