Debian sarge -----Original Message----- From: Yutaka Sato [mailto:pficabdyi-mykgh47uistw.ml@delegate.org] Sent: Montag, 18. Juni 2007 09:24 To: pficabdyi-mykgh47uistw.ml@delegate.org Cc: Nuellmann, Thorsten; pficabdyi-mykgh47uistw.ml@delegate.org Subject: Re: [DeleGate-En:3758] ftp sftp get problem Hi, In message <_A3757@delegate-en.ML_> on 06/15/07(19:33:52) you "Nuellmann, Thorsten" <puyhabdyi-mykgh47uistw.ml@delegate.org> wrote: |Thanks for your help the new one works fine. On what OS are you using DeleGate? I think you are lucky if you see it works without a problem on your machine. I tested gateways of {HTTP,HTTPS,FTP,FTPS} toward sftp on different platforms including MacOSX, Linux, FreeBsd and Solaris, then I found problems on most of them except a part of MacOSX and Linux with relatively old sftp command. I coped with the problems in 9.6.2-pre1 and it seems to work with any version of sftp command. But if you use it practically, especially if you use it to download a large file, it is recommended to modify the sftp command as the enclosed patch including: sftp-client.c: suppress error on seek error (to be able to write to FIFO) bsd-openpty.c: suppress turning on of ECHO With a sftp commaned with the modification to sftp-client.c, you can use it as follows which does not create a temporary file of the size of the transferred data: MOUNT="/* sftp://server/* noseek" With the modifcation to bsd-openpty.c, you can get rid of the prompt string of sftp inserted at the top and end of a directroy list. Cheers, Yutaka -- 9 9 Yutaka Sato <pfqcabdyi-mykgh47uistw.ml@delegate.org> http://delegate.org/y.sato/ ( ~ ) National Institute of Advanced Industrial Science and Technology _< >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan Do the more with the less -- B. Fuller download ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-4.6p1.tar.gz gzip -d < openssh-4.6p1.tar.gz | tar xf - cd openssh-4.6p1 patch < sftpdg ./configre --prefix=`pwd` make make install export PATH=`pwd`:$PATH delegated -P8021 SERVER=ftp MOUNT="/* sftp://server/* noseek" ... //////////////////////////////////////////////////////////////////////// // diff -cr openssh-4.6p1/sftp-client.c ./sftp-client.c *** openssh-4.6p1/sftp-client.c Mon Feb 19 20:13:39 2007 --- ./sftp-client.c Mon Jun 11 17:25:35 2007 *************** *** 895,901 **** --- 895,905 ---- if (len > req->len) fatal("Received more data than asked for " "%u > %u", len, req->len); + /* if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || + */ + if (((lseek(local_fd, req->offset, SEEK_SET) == -1 && + errno != ESPIPE) || atomicio(vwrite, local_fd, data, len) != len) && !write_error) { write_errno = errno; diff -cr openssh-4.6p1/openbsd-compat/bsd-openpty.c ./openbsd-compat/bsd-openpty.c *** openssh-4.6p1/openbsd-compat/bsd-openpty.c Thu Aug 24 18:52:30 2006 --- ./openbsd-compat/bsd-openpty.c Mon Jun 11 19:08:20 2007 *************** *** 204,210 **** --- 204,213 ---- } /* set tty modes to a sane state for broken clients */ if (tcgetattr(*amaster, &tio) != -1) { + /* tio.c_lflag |= (ECHO | ISIG | ICANON); + */ + tio.c_lflag |= (ISIG | ICANON); tio.c_oflag |= (OPOST | ONLCR); tio.c_iflag |= ICRNL; tcsetattr(*amaster, TCSANOW, &tio); //////////////////////////////////////////////////////////////////////// //