Commit Graph

353 Commits

Author SHA1 Message Date
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
6957ae33a9 moved file deletion to before the fork() to prevent a race condition
pointed out by byrnes@curl.com
2000-01-24 11:20:25 +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
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
f855a7d01a fixed a bug that made us use only 16 bits of the file checksum when
comparing checksums for the --checksum (-c) option.
1999-06-26 01:06:38 +00:00
Andrew Tridgell
cec8aa7724 handle the case of an empty file list in get_local_name 1999-04-06 12:30:36 +00:00
Andrew Tridgell
4c36a13ef2 don't abort the server side if the file list is empty (perhaps because
all files have been excluded).
1999-04-06 12:28:54 +00:00
David Dykstra
ebb00c8e29 Changed the protocol version to 20 so that --stats will work without -v in
both directions.
1999-03-15 21:17:58 +00:00
David Dykstra
b33b791e6b Add --delete-excluded option to delete files on the receiving side that
are excluded.  Implies --delete.
1999-02-22 19:55:57 +00:00
David Dykstra
17d31b380b Changed --stats implementation to work without -v in only these two
situations:
    1. the client is the receiver of files.  Can't do it otherwise yet
	because without -v the bytes written from the sender's generator
	process will not be counted.
    2. both the remote and local protocol versions are >=20.  I did not
	change the protocol version yet because it is such a minor change
	that it isn't worth it, although I did test it with the protocol
	version set to 20.
If neither of the situations hold, it prints a message saying to use -v.
1999-02-18 17:23:44 +00:00
David Dykstra
23c5aef18e A slight compensation I had just added for total bytes read when using -v
was incorrect.  It's hard to tell how many bytes are actually read because
transferring the value changes it and depending on its value it may
transfer 4 or 12 bytes so instead change the sender side to not include the
length of the counters it sends at all (it had been including one but three
are sent).
1999-02-10 22:16:32 +00:00
David Dykstra
e19452a96c Allow --stats to work without -v. 1999-02-10 21:54:12 +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
1f0610ef82 Fix segmentation fault when using -vvv. Suggested by assar@sics.se. 1999-01-11 17:07:27 +00:00
Andrew Tridgell
a9766ef147 log filename(line) in exit_cleanup() to make tracking down problems
easier in rsync daemons.
1998-11-15 01:21:42 +00:00
David Dykstra
2acf81eb00 Add support for optional ":PORT" in rsync URL. 1998-11-03 21:17:40 +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
9b73d1c0e9 put the pid on each line of the log file to facilitate
auto-parsing. Requested by Jarkko Hietaniemi (jhi@iki.fi)
1998-10-29 11:11:38 +00:00
Andrew Tridgell
11a5a3c704 and I thought I wasn't going to do any rsync coding for a while ...
Jason Andrade convinced me to add ftpd style logging of transfers,
enabled with a "transfer logging" option in rsyncd.conf

you can customise the format in log.c
1998-10-28 03:28:30 +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
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
b11ed3b150 - close stdout and stderr and reopen then as /dev/null when running as
a daemon. This prevents library functions (such as getopt) stuffing up
our protocol stream when errors are detected.

- 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 04:50:48 +00:00
Andrew Tridgell
ca6c93f817 check whether there is a / before a : in the rsync command line. If
there is then assume that the : is from a filename, not a host:dir
separator. This allows you to copy files with a : in them. (suggestion
from pfeifer@wait.de)
1998-07-17 14:05:57 +00:00
Andrew Tridgell
1f658d4207 fixed a problem with rsync buffering the debug output when redirected
to a file.
1998-07-17 07:07:23 +00:00
Andrew Tridgell
1a0de6c68b remove a useless debug message 1998-07-17 05:38:21 +00:00
Andrew Tridgell
bcf5b1335d - use explicit flushes instead of setlinebuf. I've had reports of
verbose info not being line buffered to files.

- add a call to localtime() in open_log() in order to prime the C
  libraries timezone cache before the chroot(). This should fix the
  problem of rsyncd log entries being in GMT time.
1998-07-02 10:57:20 +00:00
Andrew Tridgell
b536f47e3c - don't show "created directory" message unless verbose is selected
- check for null buf in show_progress
1998-07-02 02:08:55 +00:00
Andrew Tridgell
b3e10ed75b enable output buffering in the recv generator. This makes a
significant difference when the transport is ssh as ssh will otherwise
output a complete frame for each checksum record, which increases the
checksum data in size by a factor of around 4.
1998-07-02 01:27:14 +00:00
Andrew Tridgell
c95da96a0c added a --partial option which tells rsync to keep partially
transferred files if the transfer is interrupted.

added a "options summary" section to the man page
1998-07-01 03:36:03 +00:00
Andrew Tridgell
e1b3d5c4be set network file descriptors non-blocking before starting main rsync
algorithm.
1998-06-18 09:34:56 +00:00
Andrew Tridgell
fc8a6b9705 added some fflush() calls to make sure the statistics lines are
printed when redirecting output to a file.
1998-06-02 12:46:46 +00:00
Andrew Tridgell
a800434a82 added --stats option for verbose stats on the file transfer 1998-06-01 03:42:14 +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
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
1ff5450d31 formatting changes 1998-05-26 14:17:27 +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
e08c961083 handle rsh clients that don't like half-open connections 1998-05-18 09:34:33 +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
593fde2d3b if f_in == f_out then don't close one of them 1998-05-17 15:18:25 +00:00
Andrew Tridgell
22d6234e04 close some unnecessary file descriptors in do_recv() 1998-05-17 07:22:53 +00:00
Andrew Tridgell
08ac228fbd moved usage mesage after am_daemon test (I'd broken daemon mode) 1998-05-17 03:51:41 +00:00
Andrew Tridgell
6c29af2251 close the other half of the pipe in do_recv(). This fixes the problem
where a rsync receive process could hang around after the connection
has gone away if a fatal error occurs (such as someone killing the
other end)
1998-05-17 01:24:16 +00:00
Andrew Tridgell
6c00346849 check for right number of arguments _after_ the option parsing.
this stops "rsync -v" causing a segv.
1998-05-16 15:18:07 +00:00
Andrew Tridgell
d186eb1a56 - print the stats at the right place when uploading in the rsync
daemon
- update spec file
1998-05-16 05:24:40 +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
e42c9458c2 use strlcat() strlcpy() and slprintf() whenever possible to avoid any
chance of a buffer overflow
1998-05-15 09:26:01 +00:00