1
1
mc/vfs
Norbert Warmuth a04ee60c23 Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de>
* setup.c: save and restore new global variable/option
ftp_use_unix_list_options


Tue Sep 15 20:31:32 1998  Norbert Warmuth  <k3190@fh-sw.de>

* ftpfs.c (ftp_use_unix_list_options): New global variable/option.
If true we try to use 'LIST -la <path>'. When it fails we use the
two commands 'CWD <path>' and 'LIST' instead.

(resolve_symlink): rewritten. Don't get a second directory listing
with `LIST -lLa'. Instead use the cache to get the file stat of
symbolic links. If the directory the symlink points to isn't
already in the cache the directory listing will be fetched and
stored in the directory cache (without resolving symlinks
recursively).
The new method to resolve symlinks is faster if symlinks
the same directory or the directory the symlink points to
is already in the cache.
This function was small and nice until I discovered that it was
broken for symlinks to symlinks. Now it looks ugly and perhaps I
will revert it to use "LIST -lLa" again. With a fast connection it
doesn't matter which methode we use but with a slow connection I
wouldn't hesitate to burn more cpu cycles on the client side.

(retrieve_dir): Added parameter to tell whether to resolve
symlinks (don't resolve symlinks in directory listings retrieved
while resolving symlinks).
When we don't get a directory listing with 'LIST -la <path>' then
try to get it with `CWD <path>; LIST'.


Tue Sep 15 20:27:29 1998  Norbert Warmuth  <k3190@fh-sw.de

* ftpfs.c (login_server): s/ftpfs_get_host/my_get_host/

(retrieve_file_start2): Don't create target file O_EXCL, in
copy_file_file we check existance of the target file and know
that we want to truncate it (this change was already done a
while back but it was reverted with the vfs-split).


Tue Sep 15 20:15:42 1998  Norbert Warmuth  <k3190@fh-sw.de>

* ftpfs.h (struct connection): added boolean which indicates that
the ftp server doesn't unterstand Unix ls options

* ftpfs.h (struct dir): added enum to store symlink status of the
in memory directory cache (directory has no symbolic links;
symbolic links but not yet resolved; symbolic links which are resolved)


Tue Sep 15 20:02:08 1998  Norbert Warmuth  <k3190@fh-sw.de>

* shared_ftp_fish.c, fish.c: updated references to retrieve_dir to
honour the additional boolean parameter
1998-09-15 19:41:22 +00:00
..
extfs Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
samba * samba/configure.in: Require Autoconf 2.52 to make Debian 1997-01-01 01:23:31 +00:00
.cvsignore * Makefile.am (BUILT_SOURCES): Make it `make dist' friendly. 1998-08-06 21:10:06 +00:00
callback.h Fixed number of callbacks, added prototype of function to set 1998-06-08 13:00:29 +00:00
ChangeLog Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> 1998-09-15 19:41:22 +00:00
container.c Initial revision 1998-02-27 04:54:42 +00:00
container.h Initial revision 1998-02-27 04:54:42 +00:00
extfs.c Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
extfs.h Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
fish.c Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> 1998-09-15 19:41:22 +00:00
fish.h Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
ftpfs.c Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> 1998-09-15 19:41:22 +00:00
ftpfs.h Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> 1998-09-15 19:41:22 +00:00
local.c Added vfs_uid for use by libvfs.so users (rpc.nfsd) 1998-08-25 16:00:16 +00:00
Make-mc.in *** empty log message *** 1998-09-14 20:50:11 +00:00
Makefile.am *** empty log message *** 1998-09-14 20:50:11 +00:00
Makefile.in Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
mcfs.c Wed, 10 Jun 1998 17:43:25 +0200 [Vincent] 1998-06-10 15:43:51 +00:00
mcfs.h Initial revision 1998-02-27 04:54:42 +00:00
mcserv.c Integration of Pavel Machek's vfs code split and vfs syntax change. 1998-05-26 00:53:24 +00:00
names.c Integration of Pavel Machek's vfs code split and vfs syntax change. 1998-05-26 00:53:24 +00:00
names.h Initial revision 1998-02-27 04:54:42 +00:00
README.fish Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
sfs.c 1998-09-14 Norbert Warmuth <k3190@fh-sw.de> 1998-09-14 19:21:04 +00:00
shared_ftp_fish.c Tue Sep 15 20:51:42 1998 Norbert Warmuth <k3190@fh-sw.de> 1998-09-15 19:41:22 +00:00
shared_tar_ext.c Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
tar.c Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
tar.h Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
tcputil.c Integration of Pavel Machek's vfs code split and vfs syntax change. 1998-05-26 00:53:24 +00:00
tcputil.h Initial revision 1998-02-27 04:54:42 +00:00
undelfs.c Undelfs was too broken for too long. 1998-08-31 10:02:52 +00:00
undelfs.h Initial revision 1998-02-27 04:54:42 +00:00
util-alone.c Adding unarj and various small but neccessary bits. 1998-09-03 19:43:38 +00:00
util-alone.h Files I had forgotten to add from Pavel's VFS split. 1998-05-26 05:08:10 +00:00
utilvfs.c Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
vfs.c Adding fish, cleanups, and small updates everywhere to support fish. 1998-09-13 10:40:43 +00:00
vfs.h *** empty log message *** 1998-09-14 20:50:11 +00:00

		FIles transferred over SHell protocol (V 0.0.2)
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This protocol was designed for transferring files over secureshell
(ssh) connection. It can be as well used for transfers over rsh, and
there may be other uses.

Client sends requests of following form:

#FISH_COMMAND
equivalent shell commands,
which may be multiline

Only fish commands are defined here, shell equivalents are for your
information only and will probably vary from implementation to
implementation. Fish commands always have priority: server is
expected to execute fish command if it understands it. If it does not,
however, it can try the luck and execute shell command.

Server's reply is multiline, but alwyas ends with

### 000<optional text>

line. ### is prefix to mark this line, 000 is return code. Return
codes are superset to those used in ftp.

There are few new exit codes defined:

000 don't know; if there were no previous lines, this marks COMPLETE
success, if they were, it marks failure.

001 don't know; if there were no previous lines, this marks
PRELIMinary success, if they were, it marks failure

				Connecting
				~~~~~~~~~~
Client uses "echo FISH:;/bin/sh" as command executed on remote
machine. This should make it possible for server to distinguish FISH
connections from normal rsh/ssh.

				Commands
				~~~~~~~~
#FISH
echo; start_fish_server; echo '### 200'

This command is sent at the begining. It marks that client wishes to
talk via FISH protocol. #VER command must follow. If server
understands FISH protocol, it has option to put FISH server somewhere
on system path and name it start_fish_server.

#VER 0.0.2 <feature1> <feature2> <...>
echo '### 000'

This command is the second one. It sends client version and extensions
to the server. Server should reply with protocol version to be used,
and list of extensions accepted.

VER 0.0.0 <feature2>
### 200

#PWD
pwd; echo '### 200'

Server should reply with current directory (in form /abc/def/ghi)
followed by line indicating success.

#LIST /directory
ls -lLa $1 | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
S$s
d$m $d $y
:$n
"; done )
ls -lLa $1 | grep '^[cb]' | ( while read p x u g a i m d y n; do echo "P$p $u.$g
E$a$i
dD$m $d $y
:$n
"; done )
echo '### 200'

This allows client to list directory or get status information about
single file. Output is in following form (any line except :<filename>
may be ommited):

P<unix permissions> <owner>.<group>
S<size>
d<3-letters month name> <day> <year or HH:MM>
D<year> <month> <day> <hour> <minute> <second>[.1234]
E<major-of-device>,<minor>
:<filename>
L<filename symlink points to>
<blank line to separate items>

Unix permissions are of form X--------- where X is type of
file. Currently, '-' means regular file, 'd' means directory, 'c', 'b'
means character and block device, 'l' means symbolic link, 'p' means
FIFO and 's' means socket.

'd' has three fields: month (one of strings Jan Feb Mar Apr May Jun
Jul Aug Sep Oct Nov Dec), day of month, and third is either single
number indicating year, or HH:MM field (assume current year in such
case). As you've probably noticed, this is pretty broken; it is for
compatibility with ls listing.

#RETR /some/name
ls -l /some/name | ( read a b c d x e; echo $x ); echo '### 100'; cat /some/name; echo '### 200'

Server sends line with filesize on it, followed by line with ### 100
indicating partial success, then it sends binary data (exactly
filesize bytes) and follows them with (with no preceeding newline) ###
200.

Note that there's no way to abort running RETR command - except
closing the connection.

#STOR <size> /file/name
> /file/name; echo '### 001'; ( dd bs=4096 count=<size/4096>; dd bs=<size%4096> count=1 ) 2>/dev/null | ( cat > %s; cat > /dev/null ); echo '### 200'

This command is for storing /file/name, which is exactly size bytes
big. You probably think I went crazy. Well, I did not: that strange
cat > /dev/null has purpose to discard any extra data which was not
written to disk (due to for example out of space condition).

[Why? Imagine uploading file with "rm -rf /" line in it.]

#CWD /somewhere
cd /somewhere; echo '### 000'

It is specified here, but I'm not sure how wise idea is to use this
one: it breaks stateless-ness of the protocol.

Following commands should be rather self-explanatory:

#CHMOD 1234 file
chmod 1234 file; echo '### 000'

#DELE /some/path
rm -f /some/path; echo '### 000'

#MKD /some/path
mkdir /some/path; echo '### 000'

#RMD /some/path
rmdir /some/path; echo '### 000'

#RENAME /path/a /path/b
mv /path/a /path/b; echo '### 000'

#LINK /path/a /path/b
ln /path/a /path/b; echo '### 000'

#SYMLINK /path/a /path/b
ln -s /path/a /path/b; echo '### 000'

#CHOWN user /file/name
chown user /file/name; echo '### 000'

#CHGRP group /file/name
chgrp group /file/name; echo '### 000'

#READ <offset> <size> /path/and/filename
cat /path/and/filename | ( dd bs=4096 count=<offset/4096> > /dev/null;
dd bs=<offset%4096> count=1 > /dev/null;
dd bs=4096 count=<offset/4096>;
dd bs=<offset%4096> count=1; )

Returns ### 200 on successfull exit, ### 291 on successfull exit when
reading ended at eof, ### 292 on successfull exit when reading did not
end at eof.

#WRITE <offset> <size> /path/and/filename

Hmm, shall we define these ones if we know our client is not going to
use them?


That's all, folks!
						pavel@ucw.cz