Commit Graph

210 Commits

Author SHA1 Message Date
Martin Pool
a039749b4c Print strerror when a system error occurs; add a new function rsyserr
to do this.  This is not used in every case yet -- I've just changed a
few cases that were causing trouble.  Please convert others as you see them.
2000-10-26 07:24:18 +00:00
David Dykstra
45a8354004 When running as --daemon in the background and using a "log file" rsyncd.conf
directive, close the log file every time it is open when going to sleep on
the socket.  This allows the log file to get cleaned out by another process.
2000-10-24 18:50:08 +00:00
Andrew Tridgell
27e3e9c906 detect list_only a bit earlier 2000-08-29 04:46:50 +00:00
David Dykstra
b6a30afc98 Undo last setting of blocking_io. I hadn't reviewed the code well enough;
turns out that when client is talking to a server daemon it never executes
this leg of code.  Oops.  The people who said it made a difference when
they changed the code must have been wrong.
2000-08-04 21:26:17 +00:00
David Dykstra
ed91f3e418 Turn on blocking_io when starting client of rsync server daemon. 2000-08-04 21:18:23 +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
09b7f5dbb1 move the read only daemon test to after the protocol setup 2000-01-29 05:02:23 +00:00
Andrew Tridgell
ff41a59f58 - 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
2000-01-28 15:29:59 +00:00
Andrew Tridgell
8a5d6bba09 don't use stderr after we become a daemon 2000-01-24 09:19:44 +00:00
Andrew Tridgell
554e0a8dd0 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

it required some incredibly ugly code. damn.
2000-01-23 07:36:56 +00:00
Andrew Tridgell
e30f065766 make --address work for a client connecting to a server 2000-01-10 04:49:51 +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
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
ad517ce5b3 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).
1999-03-24 16:39:07 +00:00
David Dykstra
896bd482c0 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).
1999-02-25 17:58:31 +00:00
David Dykstra
b86f0cefa2 Add --quiet/-q option. Contributed by Rich Salz salzr@certco.com. 1999-02-09 17:25:35 +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
716baed7ff Fix serious bug with "use chroot = no" option which caused "uid =" and "gid ="
to be ignored.  At the same time, change the "uid =" and "gid =" options to
be ignored when not running the daemon as super-user, to make it more
convenient for those people and to make it portable to systems such as
cygwin which don't support the uid/gid notions.
1999-01-21 17:10:32 +00:00
Andrew Tridgell
5e71c4446e made the "max connections" and "lock file" local rather than global
options so you can set them on a per-module basis (requested by
kernel.org mirror maintiner)
1999-01-08 07:51:25 +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
cd64343a7a Add "include" and "include from" rsyncd.conf options. Contributed
by Dennis Gilbert <dennis@oit.pdx.edu>.
1998-11-23 21:54:01 +00:00
Andrew Tridgell
cd8185f2bd added "refuse options" option 1998-11-19 06:35:49 +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
81791cfccb added timeout option in rsyncd.conf 1998-11-04 03:14:22 +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
97cb8dc29b added %m, %P and %u options to logging 1998-10-30 05:53:05 +00:00
Andrew Tridgell
27d3cdbc94 syslog support in rsync daemon has been broken since I added the "log
file" option. I wonder why noone reported it? Or did everyone just use
"log file" ?
1998-10-28 10:43:31 +00:00
David Dykstra
8638dd48f7 Add "use chroot" and "pid file" rsyncd.conf options. The former allows one
to disable the use of chroot so rsync --daemon can be run as a non-root
user (if a non-privileged --port is used).  The latter allows one to
specify a file in which to write the process id of the daemon, which is
useful when rsync --daemon is not run from inetd.
1998-10-26 21:51:47 +00:00
Andrew Tridgell
f98df1d9b7 wanr people who use path names to rsync :: 1998-09-09 05:51:08 +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
0199b05f25 fixed the relative paths bug pointed out by Alberto Accomazzi 1998-07-23 03:09:14 +00:00
Andrew Tridgell
41979ff87c - defer the error message from the options parsing until after the
socket is multiplexed. This allows clients sending new options which
the remote server doesn't understand to get a sensible error message.
1998-07-19 05:22:05 +00:00
Andrew Tridgell
8d72ef6e52 use error to detect lockfile open failures vs. max connections reached
and report an appropriate error message
1998-07-17 05:37:18 +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
2b6b4d539b added support for --include, --include-from and the +/- syntax 1998-05-27 11:02:33 +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
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
d0d56395c8 for authenticated access record the authenticated username in the logs 1998-05-16 07:45:26 +00:00
Andrew Tridgell
7b372642ec - distinguish downloads and uploads in the syslog messages
- add stats on uploads in syslog
1998-05-16 03:03:57 +00:00
Andrew Tridgell
a6801c3977 added a "socket options" option to rsyncd.conf. This option will
provide hours of fun for those people who like to tune their systems
to the utmost degree.
1998-05-15 13:25:19 +00:00
Andrew Tridgell
f9e940efc7 load just the globals section of the config file when the daemon
starts so we know the syslog facility for the "starting" message
1998-05-15 10:52:54 +00:00
Andrew Tridgell
1a016bfdec - changed the log messages to show the requested path
- some more paranoid buffer size checks
- separate open syslog call
- handle systems without LOG_NDELAY
1998-05-15 10:34:07 +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
5805327b28 fixed typo in rsyncd exclude handling 1998-05-15 01:14:48 +00:00
Andrew Tridgell
8f3a2d54a6 added "exclude" and "exclude from" options to rsyncd.conf.
This is useful for mirroring a web site when you don't want users to
mirror everything.
1998-05-15 01:02:49 +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
c8e78d87ad improved the authentication and in particular the error reporting 1998-05-13 12:21:10 +00:00
Andrew Tridgell
bcb7e50250 first working version of challenge response authentication. needs
testing.
1998-05-13 11:49:05 +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