Commit Graph

182 Commits

Author SHA1 Message Date
Andrew Tridgell
08e5094d7f added some comments on blocking-io 2000-06-23 13:54:29 +00:00
Andrew Tridgell
c80ccabb0c added --blocking-io option 2000-06-23 13:50:18 +00:00
Andrew Tridgell
36349ea0be a very simple fix - if I'd only thought if it last week :)
rsh relies on stdin being blocking
ssh relies on stdout being non-blocking

what we've done before is to set both stdin and stdout to either
blocking or non-blocking. Now I set stdin to blocking and stdout to
non-blocking. This seems to fix all cases I've tested.
2000-04-09 02:16:42 +00:00
Andrew Tridgell
f0359dd00d went back to non-blokcing IO
it looks like ssh is willing to accept a non-blocking fd when used as
a transport, this seems to avoid the Solaris socketpair bug
2000-03-30 14:15:00 +00:00
Andrew Tridgell
08f15335b5 switch to using socketpair instead of pipe if possible. This fixes the
ssh clag problems as long as you also fix the same problem in sshd

removed all the old read buffering code from io.c as this was only
there to try to reduce the chance of clagging up sshd.
2000-01-28 12:37:58 +00:00
Andrew Tridgell
166aa72332 patch from David Murn to make sure the final 100% is always printed
when using --progress
2000-01-25 06:39:33 +00:00
Andrew Tridgell
182517e692 removed u_sleep() as it is no longer used anywhere 2000-01-23 07:38:20 +00:00
David Dykstra
dcc875e41e Define the WEXITSTATUS macro for systems that don't have it. 1999-12-29 21:11:57 +00:00
Andrew Tridgell
d79d1c69f7 fixed a bug with waitpid() - I'd forgotten about WEXITSTATUS ! 1999-12-09 06:46:11 +00:00
Andrew Tridgell
1f5c6343e6 removed old non-blocking fd code (a hangover from a earlier version of
io.c). Thanks to Theo for pointing out this brokenness.
1999-11-15 01:32:20 +00:00
Andrew Tridgell
8c9fd200f9 use do_open() instead of open() in several places to help the WinXX port
and O_BINARY
1999-10-25 22:04:09 +00:00
David Dykstra
79452d4693 Add a couple clarifying points to the sanitize_path() comments.
One is a note that a leading "/" in a symlink target will not behave
exactly as if a chroot had occurred, but I decided it wasn't worth the
making it the same.

The other is note about an extra harmless trailing "." that is added under
some rare circumstances.
1999-07-09 17:07:59 +00:00
David Dykstra
cb13abfed0 Fix significant security holes with "use chroot = no" in an rsync daemon:
1. The file paths being sent and received were not "sanitized" to
	ensure that there weren't any ".." components that would escape the
	top level directory.  This can't happen with the standard rsync
	client, but it could be exploited on both read and write if someone
	modified an rsync client.  This fix sanitizes all incoming and
	outgoing paths when "use chroot = no".

    2. If a module is also "read only = no", clients could have created
	symbolic links with ".." components that would allow writing
	outside of the module.  This could happen with the standard rsync
	client.  This fix sanitizes all incoming symbolic link targets
	when "use chroot = no".

Previously, only top-level paths (anything passed in command line arguments)
were sanitized.  Sorry, I didn't think about the individual file paths
before now.
1999-07-09 15:49:46 +00:00
David Dykstra
c7c11a0d4c When a file cannot be deleted because of ETXTBSY (in particular, when an
executable is busy on HPUX), rename it instead to .rsyncNNN.  Most of
the code was submitted by Ketil Kristiansen <ketil-k@osc.no>
1999-03-11 22:17:42 +00:00
David Dykstra
c226b7c2fd Move the initialization of push_dir, which calls getcwd, to early in main.
The reason for that is that on SVR2-based UTS 2.1.2 (which along with many
other old systems implements getcwd by forking "pwd") getcwd hangs when
called when other child processes are running.

I also added a quick return from push_dir if name == NULL so it doesn't
actually have to chdir anywhere when just initializing.

An initializing call to push_dir("/",0) had previously been put in at the
beginning of daemon_main() to avoid calling getcwd after a chroot, but
since that is no longer I needed I removed it and changed the call to
chdir("/") after chroot into a push_dir("/",0) so it will remember the
correct current directory.
1999-02-03 15:38:06 +00:00
David Dykstra
44e2e57837 Change sanitize_path() function to not malloc a copy since it only shrinks
paths and it is only used in places that have already just done a copy.
1998-11-24 20:18:11 +00:00
David Dykstra
b389939f87 Apply sanitize_paths() to glob expansions when use chroot = no. 1998-11-17 21:56:18 +00:00
Andrew Tridgell
5a788adec1 use native strlcat() and strlcpy() if available 1998-11-15 01:04:16 +00:00
Andrew Tridgell
37f9805dab changed strlcat() and strlcpy() to have the same semantics as the
OpenBSD functions of the same name.

changed slprintf() to take buffer length rather than buffer length -1
1998-11-14 23:31:58 +00:00
David Dykstra
b5f9e67d57 Change sanitize_path() to not use clean_fname() because it removes the
trailing slash.  This caused a problem when using "use chroot" and sources
that contained a trailing slash (which prevents the last filename component
of the source from being included in the destination).  Instead, have
sanitize_path() remove "." components and duplicated slashes ("//") itself.
1998-11-06 17:07:07 +00:00
David Dykstra
1b8e662a24 Call clean_fname() in sanitize_path() to catch some more strange but
legal file name syntaxes.
1998-11-03 21:49:38 +00:00
Andrew Tridgell
654175798b patch from Alberto Accomazzi <aaccomazzi@cfa.harvard.edu> to add
different exit codes for different conditions.
1998-11-03 07:08:27 +00:00
Andrew Tridgell
f7632fc60d if no local destination is provided for the transfer then provide
a "ls -l" style listing of the files that would be transferred
1998-11-02 00:52:01 +00:00
Andrew Tridgell
f8be5ef4cb added a vsnprintf() implementation from cvslock. See the notes on the
license at the top of lib/snprintf.c
1998-10-26 23:23:45 +00:00
David Dykstra
375a4556c7 Add --compare-dest option which enables specifying an additional destination
for comparisons when syncing.  Useful for syncing into a scratch area and
doing a flash-cutover when it is completed.
1998-10-26 21:42:38 +00:00
Andrew Tridgell
932be9aa52 handle sstem (sco 3) with glob but not glob.h 1998-09-09 06:31:13 +00:00
Andrew Tridgell
6e4fb64e61 added finddead target, removed dead code and made some functions
static
1998-09-09 05:57:34 +00:00
Andrew Tridgell
3eb388185b a couple of changes to where the nonblocking settings are called. 1998-08-27 05:05:14 +00:00
Andrew Tridgell
c46ded4621 I think I might havefinally fixed the rsync hanging bug. It was caused
by a read during an io_flush() triggered during a readfd(). A simple
logic bug in the io code :(
1998-07-20 05:36:25 +00:00
Andrew Tridgell
4b957c2238 added the --safe-links option to disallow symlinks outside the
destination tree
1998-07-17 10:00:48 +00:00
Andrew Tridgell
43b06eeae9 output progress % every 1k instead of every 1%, this is better for
large files.
1998-07-02 01:28:39 +00:00
Andrew Tridgell
eb86d661d7 added --progress option which shows the progress of transfers. This
gives bored users something to watch.
1998-07-02 00:47:13 +00:00
Andrew Tridgell
a5343e765b put set_nonblocking() code back in. 1998-06-18 09:32:45 +00:00
Andrew Tridgell
aa9b77a56c replace calls to strcmp() with a u_strcmp() function that uses only
unsigned comparisons. Transferring files between two machines that
treated strcmp() differently led to the files being given the wrong
name at the destination if the filenames had characters > 128 (such as
Kanji characters) and the source and destination machines treated
strcmp() differently (ie. one treated strings as signed and the other
as unsigned).

We now treat all string comparisons for file list sorting as unsigned.
1998-06-01 13:39:54 +00:00
Andrew Tridgell
5243c216d6 replaced chdir and getcwd calls with push_dir/pop_dir functions. These
are faster and don't cause problems in a chrooted environment on any
systems.
1998-05-29 14:36:39 +00:00
Andrew Tridgell
fe8c0a9824 use Realloc instead of realloc 1998-05-28 06:40:25 +00:00
Andrew Tridgell
4c36ddbeec heaps of cleanup in the io code.
we no longer use non-blocking IO, instead it uses select a lot more,
being careful to always allow for reading whenever a valid read fd is
available and chcking timeouts.

also split the file io calls into fileio.c
1998-05-27 12:37:22 +00:00
Andrew Tridgell
bb0f7089fe check for munmap as well as mmap. NextStep only has mmap in standard
libs
1998-05-26 14:18:59 +00:00
Andrew Tridgell
e24c850818 need a ifdef around some mmap code 1998-05-22 13:51:26 +00:00
Andrew Tridgell
754d120c98 use mmap() for files of any size. This should be much more buffer
cache friendly.
1998-05-21 05:52:37 +00:00
Andrew Tridgell
ba5e128d23 fixed a bug in the glob expansion code (pointed out by
hazard.bsn@blkseanet.net.eu.org)
1998-05-18 14:00:24 +00:00
Andrew Tridgell
8d9dc9f99d this is a large commit which adds io multiplexing, thus giving error
messages from the server when using the socket code.

I've doen a fair bit of testing and I don't seem to have broken
anything, but it is a very complex change. More testing needed!
1998-05-18 08:20:26 +00:00
Andrew Tridgell
f72399f867 fixed handling of vsprintf on SunOS 1998-05-16 00:46:16 +00:00
Andrew Tridgell
3e607d2354 got rid of "EOF in map_ptr" problem. If a file shrinks mid transfer
then we supply a zero filled buffer at the end and rely on the
checksum to cause a retry. This is really the best we can do as there
is no correct semantics for copying a changing file!
1998-05-15 14:00:12 +00:00
Andrew Tridgell
e42c9458c2 use strlcat() strlcpy() and slprintf() whenever possible to avoid any
chance of a buffer overflow
1998-05-15 09:26:01 +00:00
Andrew Tridgell
087bf010d2 allow the specification of multiple filenames (with or without
wildcards) to a rsync server. For example you can do:

rsync -avz samba::'ftp/pub/samba/README ftp/pub/samba/*.gz' .
1998-05-15 08:43:11 +00:00
Andrew Tridgell
5a96ee0599 make host access controls case insensitive 1998-05-14 04:31:03 +00:00
Andrew Tridgell
0cea42440f removed a debug line 1998-05-13 15:56:03 +00:00
Andrew Tridgell
874895d51a added globbing support in the rsync daemon. This will allow you to
specify wildcards when grabbing files from a anon rsync daemon.
1998-05-13 15:44:04 +00:00
Andrew Tridgell
31593dd610 improved max connections code. Now use fcntl instead of flock.
also started on authentication code (I'm doing a challenge response
system initially)
1998-05-13 09:38:54 +00:00