Andrew Tridgell [Fri, 28 Jan 2000 15:29:59 +0000 (15:29 +0000)]
- switched on multiplexing for all connections, not just daemon
connections (this fixes the stderr/stdout problem). Upped
protocol version for backward compat
- use multiplexing on error fd
- upped minimal protocol version
- got rid of some ugly code in the write buffering
Andrew Tridgell [Tue, 25 Jan 2000 14:17:21 +0000 (14:17 +0000)]
the convoluted nest of #ifdefs that is fnmatch.c caught us again. On
my system the LIBC tests meant it never compiled and we used the
broken system one.
Andrew Tridgell [Mon, 24 Jan 2000 12:02:44 +0000 (12:02 +0000)]
make the replacement inet_aton() function independent of
inet_addr(). Some systems were detecting a missing inet_aton(), but
actually had it and inet_addr() called it, causing infinite recursion
Andrew Tridgell [Sun, 23 Jan 2000 13:16:30 +0000 (13:16 +0000)]
removed Daves include-only optimisation. One of the bug reports turned
out to be caused by it and it seems rather a lot of extra effort for
what must really be a minor optimisation in most cases
Andrew Tridgell [Sun, 23 Jan 2000 07:36:56 +0000 (07:36 +0000)]
added some really ugly code to allow errors to propogate to
clients when writing to a rsync server
it works like this:
- we have an extra pipe from the receiver to the generator
- the server always runs with multiplexing on
- errors from the generator go down the multiplexed connection
- errors from the receiver go over the pipe, and from there to
the multiplexed conn
David Dykstra [Mon, 10 Jan 2000 22:39:45 +0000 (22:39 +0000)]
Make all the rsync objects dependent on all the header files except the
zlib header fiels in Makefile.in. I've been burned several times because
objects did not get rebuilt when header files changed.
David Dykstra [Mon, 10 Jan 2000 20:36:20 +0000 (20:36 +0000)]
Needed to comment out the inclusion of headers in fnmatch.c because it
couldn't find some of them (especially <fnmatch.h>, because it wasn't
looking in the current directory). The header files are included better
from ../rsync.h.
David Dykstra [Fri, 7 Jan 2000 17:58:44 +0000 (17:58 +0000)]
Upgrade lib/fnmatch.[ch] to the latest from glibc-2.1.2 because the
FNM_PATHNAME flag (to stop at slashes in path names) was not working.
Ironically, the bug in glibc's fnmatch was reported on the rsync mailing
list in late October, and rsync's configure.in was changed to detect the
bad glibc and use the internal fnmatch, but the internal fnmatch was based
on the same buggy glibc!
David Dykstra [Thu, 6 Jan 2000 16:15:36 +0000 (16:15 +0000)]
If a destination file cannot be opened, pretend it doesn't exist rather
than skipping it and thus not updating it. For example, the ownership or
mode on a file may prevent opening it, but the directory may still be
writable so the file could be completely replaced.
Andrew Tridgell [Thu, 6 Jan 2000 00:26:00 +0000 (00:26 +0000)]
when we do a lchown() on a file we have to flush the cached perms on
the file if the file has the setuid or setgid bits set as the chown
has a side effect of removing the setuid and setgid bits.
we re-do the stat in this case
David Dykstra [Wed, 29 Dec 1999 20:50:48 +0000 (20:50 +0000)]
When writing to a daemon with read only = false and uid = root and -g,
was not preserving group permisions. Bug was introduced March 1 in
version 1.100 of rsync.c with an error in re-ordering of the boolean
expressions. In order to completely preserve the earlier semantics,
change_gid should depend on "(am_root || !am_daemon)", but I don't see why
group ownership should behave differently in a non-root daemon.
David Dykstra [Wed, 29 Dec 1999 20:45:23 +0000 (20:45 +0000)]
When not using -p and file being copied to already existed, was mistakenly
using all the mode bits of the existing file rather than just the permissions,
including the file type.
David Dykstra [Thu, 4 Nov 1999 15:43:38 +0000 (15:43 +0000)]
Fixed bug introduced by calling do_open() for O_RDONLY files. Changed it
so the check for dry_run and CHECK_RO are not done when flags is O_RDONLY.
Only do the adding of O_BINARY, which was the intention.
David Dykstra [Fri, 9 Jul 1999 17:07:59 +0000 (17:07 +0000)]
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.
David Dykstra [Fri, 9 Jul 1999 15:49:46 +0000 (15:49 +0000)]
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.
Andrew Tridgell [Tue, 6 Apr 1999 14:52:32 +0000 (14:52 +0000)]
set the exit code to RERR_FILEIO is io_error is set when we exit. This
catches most sorts of io errors and ensures we report a error in our
exit status.
Andrew Tridgell [Tue, 6 Apr 1999 11:34:06 +0000 (11:34 +0000)]
fix the man page to reflect the fact that exclude options in
rsyncd.conf are not passed to the client and thus only affect the file
lists on the server.
David Dykstra [Fri, 2 Apr 1999 18:24:27 +0000 (18:24 +0000)]
Small bug fix for the --compare-dest option: when a file's contents
hadn't changed but its permissions had, the file wasn't copied but
its permissions were attempted to be set anyway. Made a change to
skip setting the permissions in that case.
David Dykstra [Wed, 24 Mar 1999 19:28:03 +0000 (19:28 +0000)]
Backed out the change to create missing parent directories when using
--compare-dest. It was due to an incomplete analysis of the problem,
sorry. I left a comment in its place indicating that normally the
parent directories should already have been created.
It turned out to actually be a bug in nsbd in which it was not always
including all the parent directories in the include list like it was
supposed to. The files themselves were still being sent but that was only
because my exclude_the_rest optimization was kicking in; if it weren't,
excluding the parent directories would have had the side effect of
excluding the files too. So it really had nothing to do with the
--compare-dest option after all, just with the requirement that if you use
--exclude '*' you need to explicitly include all parent directories of
files you include.
David Dykstra [Wed, 24 Mar 1999 16:39:07 +0000 (16:39 +0000)]
The "pid file" was getting created mode 666, not applying the umask
because at that point in the program the umask is set to 0. Now creating
the file with mode (666 & ~orig_umask).
David Dykstra [Tue, 23 Mar 1999 22:20:10 +0000 (22:20 +0000)]
Fix bug with --compare-dest option where missing parent directories in the
target destination were not getting created. There was a case in
receiver.c to do that but it was only getting invoked when the -R option is
specified, although I don't know why it was limited to that.
It's too bad I didn't get a chance to more fully test the use of
--compare-dest by my nsbd program before releasing rsync 2.3.0. I'll
probably need to put a workaround in nsbd too until the next release
of rsync.
David Dykstra [Fri, 12 Mar 1999 18:21:53 +0000 (18:21 +0000)]
Include a test for a working getopt_long because the one on some versions
of cygwin doesn't work. Thanks to Martin Krumpolec <krumpo@pobox.sk> for
the patch. At the same time, include cache checks in configure.in for a few
items that were missing the checks.
David Dykstra [Fri, 12 Mar 1999 17:36:52 +0000 (17:36 +0000)]
When -R is used, send the permissions of the original top directories to
the receiver even when not combined with -r. Without this, the directories
were getting created mode 777 because the default umask on receivers is
often 00.
David Dykstra [Thu, 11 Mar 1999 22:17:42 +0000 (22:17 +0000)]
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>
David Dykstra [Tue, 9 Mar 1999 21:55:16 +0000 (21:55 +0000)]
Check for EINVAL from a rename error call in addition to ENOENT because
David Campbell <david@pastornet.net.au> reported that that helps data
be received onto a windows box running cygwin b19.
David Dykstra [Fri, 5 Mar 1999 16:37:44 +0000 (16:37 +0000)]
Update config.guess from a new official GNU version.
I believe this is the latest, which comes with automake 1.4 (somebody
else is in charge of installing the GNU stuff on my system so I'm not
100% sure it's the absolute latest, but it was updated just a couple
weeks ago).
David Dykstra [Thu, 4 Mar 1999 21:48:52 +0000 (21:48 +0000)]
The change a couple days ago to create files initially without group and
other access resulted in group and other access being left off when the
'-p' option was not used. This fixes it by reintroducing the ACCESSPERMS
mask and setting permissions to (file->mode & ACCESSPERMS) if preserve_perms
is off. I decided to change the mask INITPERMMASK to INITACCESSPERMS at
the same time. When preserve_perms is off, rsync is restored to the
previous behavior of having the permissions of the original file with the
umask and setuid/setgid bits shut off.
Also, I decided that a check for "(updated && (file->mode & ~ACCESSPERMS))"
is no longer needed since as far as I can tell that would have only affected
permissions when not running as root and when a chgrp was done to a group
the user was not a member of, using system V chgrp semantics. This is no
longer allowed.
David Dykstra [Tue, 2 Mar 1999 20:56:17 +0000 (20:56 +0000)]
Disable the optimization that treats include-only files as a special case
whenever delete_mode is on. People reported problems when it kicked in
while using --delete and while using --delete-excluded.
David Dykstra [Tue, 2 Mar 1999 16:42:46 +0000 (16:42 +0000)]
Change getgroups to use GETGROUPS_T as the type of the group array returned,
as calculated by the configure macro AC_TYPE_GETGROUPS. Without that, it
doesn't work properly on systems like sunos 4 where gid_t is defined to
be an unsigned short but getgroups is defined to return an array of integers.
David Dykstra [Mon, 1 Mar 1999 21:22:54 +0000 (21:22 +0000)]
Change the mask used when creating temporary files from 777 to 700, to prevent
an obscure race-condition security hole where a file may for a short time
have the wrong group. Could have used 707 instead but that's just too weird
of a permission. The define name used to be ACCESSPERMS but that is defined
as 777 on Linux, so changed the name to INITPERMMASK.
David Dykstra [Mon, 1 Mar 1999 21:16:49 +0000 (21:16 +0000)]
When comparing -1 to a group id, cast -1 with gid_t because on some systems
such as sunos4 gid_t is an unsigned short. This prevented the just-added
non-mapped group test from working on sunos4.
David Dykstra [Mon, 1 Mar 1999 19:24:39 +0000 (19:24 +0000)]
Prevent the -g option from preserving groups that a non-root receiver
does not belong to, in these two ways:
1. If a group mapping doesn't exist for a group name, do not preserve
it for a non-root receiver. This is especially evident with the
sender is a daemon using chroot because then no mappings are
available.
2. Before setting the group on a file make sure that it is in the list
of groups returned by getgroups(). The same thing is done by chgrp
on systems that support bsd-style chown/chgrp, and this enforces
that it happens the same way on all systems. Overhead is very
little, especially since most systems don't allow more then 16
groups per user.
David Dykstra [Thu, 25 Feb 1999 17:58:31 +0000 (17:58 +0000)]
Removed am_client variable. It was being set in one place, when a client
of a socket (that is, a --daemon) server, but never looked at. The way to
test whether or not on a client is (!am_server).