Commit Graph

120 Commits

Author SHA1 Message Date
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
7b1ce0d746 fixed a race condition in the --delete handling code. The bug led to
spurious error messages about not be able to delete some files.

this fix also makes --delete processing more efficient
1998-05-27 06:30:50 +00:00
Andrew Tridgell
943882a289 - don't allow chown for the group of a file if running as a daemon and
uid!=0

- reset am_root after startup as a daemon
1998-05-23 05:57:08 +00:00
Andrew Tridgell
23e43fceeb fix shadowed variable 1998-05-22 12:07:23 +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
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
eb697c999b fixed a bug in the new . filename code 1998-05-11 12:29:19 +00:00
Andrew Tridgell
d4ebe7a7b1 changed the name of the temporary filename to include a leading . so
that it appears hidden while being transferred. This should be useful
when using rsync for mirroring so users accessing via ftp don't get
confused by the temporary files.
1998-05-10 13:45:03 +00:00
Andrew Tridgell
7a6421fa76 split the options parsing code into options.c
added the --port and --config options

use strlcpy() instead of strncpy()

some cleanups and formatting changes
1998-05-10 07:25:40 +00:00
Andrew Tridgell
9486289ce4 some large systematic changes to make socket conversion easier. The
biggest one is the use of rprintf() instead of fprintf()
1998-05-07 14:50:22 +00:00
Andrew Tridgell
d6e6ecbdbf handle broken readdir() on Solaris 2.6 (it returns the name offset by
2 characters!)
1998-05-06 07:00:38 +00:00
Andrew Tridgell
bcacc18bdf added support for 64 bit file offsets under Solaris 2.6. Not tested
yet.
1998-05-06 05:43:36 +00:00
Andrew Tridgell
3333ffbd43 revamped the -delete code. The last few bugs with it revealed that it
had a fundamental flaw in the way it detected duplicate deletion
scanning (which is very important when -R is used). I now store
inode/device numbers and use those to do the detection. This should be
a much less fragile method.
1998-04-17 06:07:23 +00:00
Andrew Tridgell
0a25de67e9 fixed a bug in the handling of -R with --delete
I introduced this bug in the last version as a side effect of fixing
the permissions on intermediate directories with -R. drat.
1998-04-13 06:39:33 +00:00
Andrew Tridgell
d867229ba0 handle sparse files more efficiently 1998-04-05 06:43:38 +00:00
Andrew Tridgell
1b2d733af2 a couple more system calls wrapped in syscall.c 1998-04-05 06:26:24 +00:00
Andrew Tridgell
98ae8c3e38 Solaris uses EEXIST instead of ENOTEMPTY. 1998-03-27 03:04:34 +00:00
Andrew Tridgell
6ba9279fb2 - added an internal io_error flag. Whenever an io error occurs (such
as not being able to open a directory) this flag is set and propogated
to the other end. When this flag is set the --delete code is
disabled. This prevents the problem that io or permission errors could
cause files to be incorrectly deleted on the destination.

- added a --timeout option. This allows you to set an IO timeout in
seconds. If no io occurs in that time then rsync exits with a timeout
error.

- changed some FERROR fds to FINFO
1998-03-26 04:18:47 +00:00
Andrew Tridgell
5fb543d587 if rsync fails to update the group of a file but nothing else then
don't report a problem. On most OSes non-root users can't change the
group of a file.
1998-03-26 00:32:51 +00:00
Andrew Tridgell
71c4617611 - on systems (such as intel linux) where off_t is 32 bits but "long long"
is 64 bits use long long to get the totals right when transferring
  more than 2^32 bytes of data.

- use inline on flist_up if the compiler supports it
1998-03-25 11:08:32 +00:00
Andrew Tridgell
3cb6f5d6cb added a --force option.
This options tells rsync to delete directories even if they are not
empty. This applies to both the --delete option and to cases where
rsync tries to copy a normal file but the destination contains a
directory of the same name. Normally rsync will refuse to do a
recursive directory deletion in such cases, by using --force the
recursive deletion will be done.
1998-03-25 06:05:47 +00:00
Andrew Tridgell
7796395a0a don't show basedir in printed path (a aesthetic change only) 1998-03-25 01:59:23 +00:00
Andrew Tridgell
7308bd66e0 added chmod() and chown() to syscall.c 1998-03-24 06:39:16 +00:00
Andrew Tridgell
31e125226d added wrappers around all the system calls that can change what is on
disk. The wrappers check for dry_run.
1998-03-23 13:25:30 +00:00
Andrew Tridgell
3a6a366fc5 finished 64 bit file offset support. Hopefully rsync can now transfer
files up to 2^64 bytes in size. Now I just need to find enough disk
space to test this :-)

The 64 bit offset code only works if off_t is 64 bits (or bigger!) on
both ends of the link. If one end tries to send a file greater than
2^31 in size and the other end doesn't support it then rsync will
abort.

This commit also cleans up some static declarations so they are in a
unitinitialised segment to save load time.
1998-03-23 12:52:57 +00:00
Andrew Tridgell
0b91056090 started to add some 64 bit file offset support - not complete yet 1998-03-23 08:49:48 +00:00
Andrew Tridgell
e7ebc36c70 if the file changes during transfer then don't loop forever trying to
update it
1998-03-23 07:11:51 +00:00
Andrew Tridgell
1aa71c8d57 don't adapt the block size to above half the chunk size 1998-03-23 06:26:08 +00:00
Andrew Tridgell
3ba62a8308 - keep a list of pids and send them a SIGUSR1 for cleanup rather than
using setpgrp()

- adapt the block size for really large files to reduce the checksum
  size and memory overheads
1998-03-23 04:44:44 +00:00
Andrew Tridgell
3ec4dd9781 a large change to make rsync much more memory efficient. This is done
in 3 ways:

1) the realloc is done on a list of pointers, not a list of structures
2) only the basename of the file is now kept in the file struct an a
   util function f_name() is now used to access the full name when
   required.
3) pointers to directory names are re-used

hopefully I haven't broken anything. This will need lots of testing.
1998-03-23 03:45:02 +00:00
Andrew Tridgell
6bbbc08b83 *** empty log message *** 1998-01-13 19:25:59 +00:00
Andrew Tridgell
13dc412d76 *** empty log message *** 1998-01-13 19:19:48 +00:00
Andrew Tridgell
950ab32d38 *** empty log message *** 1998-01-13 18:35:10 +00:00
Andrew Tridgell
3b3a2fbcf0 *** empty log message *** 1998-01-06 16:53:52 +00:00
Andrew Tridgell
964ca2eca5 simplified the logic of whether to skip a file or not. The -c
(always_checksum) option is probably now more useful.
1997-12-31 16:39:34 +00:00
Andrew Tridgell
684b4e3113 buffer overflow patches from mhpower@mit.edu (Matt Power) 1997-12-30 17:36:58 +00:00
Andrew Tridgell
f3644f1f2d - added a debug message
- rebuilt prototypes
1997-12-28 22:26:51 +00:00
Andrew Tridgell
82306bf6d6 *** empty log message *** 1997-12-17 11:07:17 +00:00
Andrew Tridgell
cbbe489208 handle things more grecefully when one machine supports hard links and
the other doesn't or one machine supports soft links and the other
doesn't.
1997-12-16 23:09:22 +00:00
Andrew Tridgell
fee64929a3 fixed a bug in the handling of the new --relative option. The file was
being opened twice but closed once. The process eventually died with
an out of file descriptors error.
1997-12-16 20:29:35 +00:00
Andrew Tridgell
d966ee254a fixed a nasty bug in the handling of the --delete option when there
are duplicate file names in the list of files to be transferred
(eg. the user specifies the same file twice).
1997-12-16 17:59:49 +00:00
Andrew Tridgell
7c59690640 process directory permissions and times ater hard links becuase the
hard link processing can modify the directory times
1997-12-15 22:23:30 +00:00
Andrew Tridgell
13a1f7929e some people are now using rsync as a public server, using various
patches or wrappers. One problem with this is that rsync was not
written with this in mind and wasn't very careful about possible stack
overflows etc which could lead to security breaches. This wasn't a
problem when run in the traditional way as any user that can run rsync
can login anyway and cause much more damage that way.
This patch attempts to close possible stack overflow problems. I've
checked for all strcpy(), strcat(), sprintf() and memcpy()
overflows. I would appreciate it if someone else with a devious mind
could also go through the rsync source code and see if there are any
other stack overflows possible. Let me know if you do.
1997-12-15 21:35:37 +00:00
Andrew Tridgell
e92338c82d several changes:
- by popular demand I have changed the behaviour of the --delete
option. It should now work as "expected" for even those people silly
enough not to read the man page. rsync will now only look for
candidate files/directories to delete in directories that are
explicitly transferred from the sender
- updated the README a bit
- try to fail a bit more gracefully when rsync runs out of disk
space. I don't think this issues is fully resolved yet
1997-12-15 21:04:04 +00:00
rsync-bugs
58da1efac1 minor cleanups (unused variables etc) 1997-12-15 19:11:24 +00:00
Andrew Tridgell
6574b4f7d9 added a --relative (== -R) option. This is what Anthony Thyssen
suggested on the list recently. See the man page entry for details but
basically it changes the behaviour so that paths are not stripped,
thus allowing you to specify a single rsync command to sync lots of
directories/files while preserving the full path name of each file.
also fixed a bug in the handling of umasks when both the source and
destination machines are local. We need to reset the umask before the
exec to ensure that the child gets a correct umask.
1997-12-15 14:43:27 +00:00
Paul Mackerras
774ef68f00 minor bugfixes 1997-04-11 06:18:02 +00:00
Andrew Tridgell
8bf737494f - check for sys/select.h
- check for and use lchown if possible

- fix problem with root directory on source and destination
1996-10-01 06:40:36 +00:00
Andrew Tridgell
7b8356d0bc - detect presence of remsh and use it instead of rsh
- handle directory ownership and permissions much better.

- fix bug where links caused the permissions of files to be
set incorrectly

- override the default umask in setting file permissions

- better handling -o and -D being passed to non-root users

- handle rsync to a destination of /

- fix the handling of mismatched file types at either end of the
link. For example, if the destination is a link and the source is not.
1996-10-01 04:12:30 +00:00
Andrew Tridgell
52296954fe add warning if corruption detected 1996-07-12 14:37:25 +00:00