diff options
author | Jeremy Allison <jra@samba.org> | 1998-08-11 02:13:01 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 1998-08-11 02:13:01 +0000 |
commit | 9042aa41c3c54e8dce600338cd4b796b65aaf066 (patch) | |
tree | 304c22f1553b8e249ed74901245e95761f6e1ba1 | |
parent | cd9bfc6310b7a3a792840525f52392c2de9db451 (diff) | |
download | samba-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)
-rw-r--r-- | source3/Makefile.in | 7 | ||||
-rw-r--r-- | source3/client/client.c | 39 | ||||
-rw-r--r-- | source3/include/nterr.h | 1 | ||||
-rw-r--r-- | source3/smbd/nttrans.c | 14 |
4 files changed, 48 insertions, 13 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index f0cc4d30ee..4d6969363a 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -5,6 +5,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ +mandir=@mandir@ INSTALL_BIN=$(exec_prefix)/bin INSTALL_MAN=$(prefix)/man @@ -187,11 +188,15 @@ PROTO_OBJ = $(SMBD_OBJ) $(NMBD_OBJ) $(SWAT_OBJ) $(CLIENT_OBJ) # now the rules... ###################################################################### -all : $(SPROGS) $(PROGS) +all : CHECK $(SPROGS) $(PROGS) .SUFFIXES: .SUFFIXES: .c .o .h +CHECK: + @echo "Using FLAGS = $(FLAGS)" + @echo "Using LIBS = $(LIBS)" + .c.o: $(INCLUDES) @echo Compiling $*.c @$(CC) -I. -I$(srcdir) $(FLAGS) -c $< -o $@ 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")) { diff --git a/source3/include/nterr.h b/source3/include/nterr.h index 643d93bc93..a94464a013 100644 --- a/source3/include/nterr.h +++ b/source3/include/nterr.h @@ -504,3 +504,4 @@ #define NT_STATUS_TOO_MANY_LINKS (613) #define NT_STATUS_QUOTA_LIST_INCONSISTENT (614) #define NT_STATUS_FILE_IS_OFFLINE (615) +#define NT_STATUS_NOTIFY_ENUM_DIR (0x10C) diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index c6782cd45f..143bfc9a8b 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "nterr.h" extern int DEBUGLEVEL; extern int Protocol; @@ -984,6 +985,17 @@ static void change_notify_reply_packet(char *inbuf, int error_class, uint32 erro construct_reply_common(inbuf, outbuf); + /* + * If we're returning a 'too much in the directory changed' we need to + * set this is an NT error status flags. If we don't then the (probably + * untested) code in the NT redirector has a bug in that it doesn't re-issue + * the change notify.... Ah - I *love* it when I get so deeply into this I + * can even determine how MS failed to test stuff and why.... :-). JRA. + */ + + if(error_class == 0 && error_code == NT_STATUS_NOTIFY_ENUM_DIR) + SSVAL(outbuf,smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES); + ERROR(error_class,error_code); send_smb(Client,outbuf); } @@ -1104,7 +1116,7 @@ Error was %s.\n", fsp->name, strerror(errno) )); */ DEBUG(5,("process_pending_change_notify_queue: directory fnum = %d, name = %s changed\n", fnum, fsp->name )); - change_notify_reply_packet(cnbp->request_buf,ERRDOS,ERROR_NOTIFY_ENUM_DIR); + change_notify_reply_packet(cnbp->request_buf,0,NT_STATUS_NOTIFY_ENUM_DIR); free((char *)ubi_slRemNext( &change_notify_queue, prev)); cnbp = (change_notify_buf *)(prev ? ubi_slNext(prev) : ubi_slFirst(&change_notify_queue)); unbecome_user(); |