Compare commits

..

66 Commits

Author SHA1 Message Date
Wayne Davison
cbb95d3d24 Preparing for release of 2.6.9pre3 2006-10-26 17:06:41 +00:00
Wayne Davison
d9126a861f Run tweak_manpage_dashes on the man pages we generate. 2006-10-24 16:17:31 +00:00
Wayne Davison
b4768a1397 Undo temporary changes used for build-farm testing of ACL patch. 2006-10-24 15:09:57 +00:00
Wayne Davison
47b032e97f Added a define for WIFEXITED() that is used if one is missing. 2006-10-24 03:31:30 +00:00
Wayne Davison
50dfd5b4fe Document the --no-motd option. 2006-10-24 00:56:46 +00:00
Wayne Davison
1de02c273d Document the --no-motd option, with a caveat on how it can also
hide the module listing.
2006-10-24 00:36:46 +00:00
Wayne Davison
9ce7fc3887 Obey the new --no-motd option. 2006-10-24 00:36:42 +00:00
Wayne Davison
dc1f7b9ea3 Added the --no-motd option to silence just the text output at the
start of a daemon transfer.
2006-10-24 00:36:38 +00:00
Wayne Davison
ee7cf95b13 Post-process manpages with the tweak_manpage_dashes perl script. 2006-10-24 00:33:32 +00:00
Wayne Davison
492fc3536d Run patch with -t so that it doesn't ask any questions. 2006-10-24 00:24:56 +00:00
Wayne Davison
5e61bdb4d5 A perl script that does appropriate backslash escaping of '-' chars
in manpages.
2006-10-24 00:09:18 +00:00
Wayne Davison
f964ac5eee - Fixed an error-handling path in try_dests_reg().
- Added a comment.
2006-10-22 22:36:36 +00:00
Wayne Davison
c55b39afad Use "test" instead of "[ ... ]" for better portability. 2006-10-22 07:29:21 +00:00
Wayne Davison
a27463a9a2 Added missing cleanup of empty ACL files. 2006-10-22 07:18:21 +00:00
Wayne Davison
590eb6c02d Change the unpatch code for NetBSD. 2006-10-22 04:26:59 +00:00
Wayne Davison
0d7a6b4906 Temporary changes to have the build-farm configure and build
the ACL version of rsync (patched in via patches/acls.diff).
2006-10-22 03:17:45 +00:00
Wayne Davison
b4f0287197 Mention the fix that lets a push now override the partial-dir exclude. 2006-10-18 05:20:05 +00:00
Wayne Davison
8d6386809e The server should not be adding an assumed filter rule based on the
partial-dir setting (since the client is sending us the rules).
2006-10-18 05:15:35 +00:00
Wayne Davison
230328a30a Added a risk filter for the partial-dir since we use --delete-after. 2006-10-18 05:14:10 +00:00
Wayne Davison
5819d6b14a Stop disabling the RSYNC_PARTIAL_DIR environment variable now that
there is a newer rsync on samba.org.
2006-10-18 04:46:26 +00:00
Wayne Davison
7b4a40ed70 Make sure the new link_dest_used value gets zeroed on init. 2006-10-17 18:49:04 +00:00
Wayne Davison
f210dcadf4 - Fixed a compile problem ("len" not defined) in inet_ntop4().
- Replaced sprintf() with snprintf() in inet_ntop6().
2006-10-16 18:11:24 +00:00
Wayne Davison
178a1d2048 - Die if we can't edit the release date into NEWS or OLDNEWS.
- Don't remove any *pre*diff* files until the final release.
2006-10-15 21:44:15 +00:00
Wayne Davison
a4b4e0770b Improved a comment. 2006-10-15 15:57:27 +00:00
Wayne Davison
2a6e35db31 Improved a couple existing items. 2006-10-15 15:49:31 +00:00
Wayne Davison
e3794138d8 Use the new case_N.h file to make sure that our cleanup_step case
statements never get out of sequence when the code changes.
2006-10-15 15:43:26 +00:00
Wayne Davison
fdd10da6f7 A helper file for cleanup.c. 2006-10-15 15:42:01 +00:00
Wayne Davison
5f12a07bff Now that samba.org has a modern rsync, we can go back to using
hard-links on the moved files and use rsync to effect the hard-
links on the remote system (which will make a future transfer
more efficient in the absense of --detect-renamed).
2006-10-15 05:04:59 +00:00
Wayne Davison
6a4a1d0cb0 Preparing for release of 2.6.9pre2 2006-10-14 20:35:17 +00:00
Wayne Davison
434c40986d Use the MAX_RENAMES_DIGITS define in the relevant snprintf(). 2006-10-14 20:31:33 +00:00
Wayne Davison
8ee6857702 Improved the description of the code-checker work.. 2006-10-14 20:30:43 +00:00
Wayne Davison
721ddc903f Updated the news about the exit_cleanup() improvement. 2006-10-14 20:01:22 +00:00
Wayne Davison
154c345db0 Improved the _exit_cleanup() function to handle potential recursions
back to the function via the calls that it is making.  The new code
treats each recursion back into the function as an opportunity to
take up where we left off (skipping whatever step just failed).
2006-10-14 19:58:52 +00:00
Wayne Davison
25f637a334 Got rid of EXIT_OR_RETURN() macro again -- switching to a better
recursion-prevention heuristic in _exit_cleanup().
2006-10-14 18:51:21 +00:00
Wayne Davison
2356d73bb4 The cleanup code that handles moving the temp file to the partial
file needed to check that cleanup_fname was not NULL to prevent
any possibility of a recursion starting into that code again.
2006-10-14 02:29:29 +00:00
Wayne Davison
4968423e71 Mention the latest fixes and internal changes. 2006-10-14 02:02:47 +00:00
Wayne Davison
99eba67585 Got rid of the recent paranoid length check because it didn't help
to silence a code-checker warning.
2006-10-14 01:17:36 +00:00
Wayne Davison
5abe03d6e8 Restore build order back to normal. 2006-10-14 01:15:16 +00:00
Wayne Davison
83078af5b0 Changed sprintf() calls to snprintf(). 2006-10-13 23:46:32 +00:00
Wayne Davison
185aa5b0e5 Turned an sprintf() call into snprintf(). 2006-10-13 23:42:52 +00:00
Wayne Davison
cabd60fdce - Changed some sprintf() calls to snprintf() calls.
- Changed two last strcpy() calls to strlcpy() calls.
2006-10-13 23:38:14 +00:00
Wayne Davison
10944395bf Changed sprintf() calls to snprintf() calls. 2006-10-13 23:35:53 +00:00
Wayne Davison
204f4f4d09 Changed strcpy() calls into memcpy() calls. 2006-10-13 23:17:37 +00:00
Wayne Davison
c9bce0b8f8 Changed strcpy() calls into strlcpy() calls, just to be extra safe. 2006-10-13 23:17:33 +00:00
Wayne Davison
deee574b11 Added a paranoid length check. 2006-10-13 23:17:30 +00:00
Wayne Davison
55410368e5 - Changed strcpy() calls into strlcpy() calls, just to be extra safe.
- Added a default: exit_cleanup() case to a switch.
- Made the check_name() function take a buffer size arg.
2006-10-13 23:17:27 +00:00
Wayne Davison
e4fdf1debe - Use precompiler conditionals in to_wire_mode() and from_write_mode()
to get rid of code that is not needed on the current system.
- Silence a code-checker warning in send_file_entry().
- Silence a code-checker warning in make_file().
- Fixed a bug in f_name_cmp() that could compare an empty filename
  incorrectly (which might only happen if we transformed a dot-dir
  into an empty name).  (Thanks, code checker!)
2006-10-13 17:07:13 +00:00
Wayne Davison
1580899c1d More temporary name juggling to get all code analyzed. 2006-10-13 17:02:39 +00:00
Wayne Davison
f863b76300 Changed one more exit_cleanup() call into EXIT_OR_RETURN(). 2006-10-13 14:28:56 +00:00
Wayne Davison
5e1ec06f09 Temporarily reorder the OBJS line so that the IBM code checker
can analyze some of the other programs (since it runs out of
time analyzing them all).
2006-10-13 14:17:22 +00:00
Wayne Davison
36e2ea6068 Use new FNONE value when setting/comparing enum logcode vars. 2006-10-13 07:48:35 +00:00
Wayne Davison
f4164b73b4 - Use the new FNONE enum instead of a literal 0 value. 2006-10-13 07:38:21 +00:00
Wayne Davison
9ef506a2b2 If in_exit_cleanup is set, some of our functions return instead of
calling exit_cleanup() (which is a safer way to avoid an infinite
loop when the exit code uses the log functions than allowing the
_exit_cleanup() function to return back into our code).
2006-10-13 07:38:18 +00:00
Wayne Davison
b1b54199ef - When exiting, set the flag "in_exit_cleanup".
- Mark _exit_cleanup() with NORETURN.
- Don't ever return from _exit_cleanup().
2006-10-13 07:38:15 +00:00
Wayne Davison
33394b769d Mark out_of_memory() and overflow_exit() with NORETURN. 2006-10-13 07:38:11 +00:00
Wayne Davison
011e85a5e3 - Added FNONE to the "enum logcode" values.
- Added a NORETURN define to mark a function that never returns.
2006-10-13 07:38:05 +00:00
Wayne Davison
d5dcb6f775 Silence some IBM checker warnings and made a slight optimization
to get_tmpname().
2006-10-13 07:18:29 +00:00
Wayne Davison
0c25dedf31 Simplified the function-finding regex, and made it more versatile
(so we don't need to keep adding variable-type strings).
2006-10-13 06:50:56 +00:00
Wayne Davison
6105464b79 Indented the function comments with "* ". 2006-10-13 06:49:44 +00:00
Wayne Davison
4d51f0db79 Don't use a bool directly in an int comparison. 2006-10-13 06:27:59 +00:00
Wayne Davison
ff530f04a0 Function fcntl() only takes 2 args when using F_GETFL. 2006-10-13 06:26:02 +00:00
Wayne Davison
e8b21fe406 Cast pat_len to an int when using it as a field width. 2006-10-13 06:24:24 +00:00
Wayne Davison
71cb9df386 Some OSes can't chmod -t for a file, so I changed the logic of our
to to substitute a chmod that will work everywhere.
2006-10-13 04:59:53 +00:00
Wayne Davison
f97c2d4a9b - Clarified the "dont compress" option.
- Cleaned up some trailing whitespace.
2006-10-13 01:37:44 +00:00
Wayne Davison
b8a6dae038 Updated the man pages to work with version 2.x of yodl. 2006-10-13 01:24:57 +00:00
Wayne Davison
969f7ed5b7 Fixed an infinite loop in parse_rule() when a filter rule is too
longer for MAXPATHLEN.  Also fixed a couple spots nearby that were
erroneously treating pointer "cp" as a '\0'-terminated string.
2006-10-13 01:22:48 +00:00
33 changed files with 470 additions and 280 deletions

33
NEWS
View File

@@ -69,6 +69,14 @@ Changes since 2.6.8:
- Fixed a bug in the daemon's "incoming chmod" rule: newly-created
directories no longer get the 'F' (file) rules applied to them.
- Fixed an infinite loop bug when a filter rule was rejected due to being
overly long.
- When the server receives a --partial-dir option from the client, it no
longer runs the client-side code that adds an assumed filter rule (since
the client will be sending us the rules in the usual manner, and they
may have chosen to override the auto-added rule).
ENHANCEMENTS:
- Added the --log-file=FILE and --log-file-format=FORMAT options. These
@@ -93,16 +101,41 @@ Changes since 2.6.8:
(The deprecated --remove-sent-files is still understood for now, and
still behaves in the same way as before.)
- Added the option --no-motd to suppress the message-of-the-day output
from a daemon when doing a copy. (See the manpage for a caveat.)
- Added a new environment variable to the pre-/post-xfer exec commands (in
the daemon's config file): RSYNC_PID. This value will be the same in
both the pre- and post-xfer commands, so it can be used if the pre-xfer
command wants to cache some arg/request info for the post-xfer command.
INTERNAL:
- Did a code audit using IBM's code-checker program and made several
changes, including: replacing most of the strcpy() and sprintf()
calls with strlcpy(), snprintf(), and memcpy(), adding a 0-value to
an enum that had been intermingling a literal 0 with the defined enum
values, silencing some uninitialized memory checks, marking some
functions with a "noreturn" attribute, and changing an "if" that
could never succeed on some platforms into a pre-processor directive
that conditionally compiles the code.
- Fixed a potential bug in f_name_cmp() when both the args are a
top-level "." dir (which doesn't happen in normal operations).
- Changed exit_cleanup() so that it can never return instead of exit.
The old code might return if it found the exit_cleanup() function
was being called recursively. The new code is segmented so that
any recursive calls move on to the next step of the exit-processing.
DEVELOPER RELATED:
- The acls.diff and xattrs.diff patches have received a bunch of work to
make them much closer to being acceptable in the main distribution.
- The rsync.yo and rsyncd.conf.yo files have been updated to work
better with the latest yodl 2.x releases.
- Updated config.guess and config.sub to their 2006-02-23 version.
- Updated various files to include the latest FSF address and to have

80
case_N.h Normal file
View File

@@ -0,0 +1,80 @@
/*
* End-of-run cleanup helper code used by cleanup.c.
*
* Copyright (C) 2006 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* This is included by cleanup.c multiple times, once for every segement in
* the _exit_cleanup() code. This produces the next "case N:" statement in
* sequence and increments the cleanup_step variable by 1. This ensures that
* our case statements never get out of whack due to added/removed steps. */
#if !defined EXIT_CLEANUP_CASE_0
#define EXIT_CLEANUP_CASE_0
case 0:
#elif !defined EXIT_CLEANUP_CASE_1
#define EXIT_CLEANUP_CASE_1
case 1:
#elif !defined EXIT_CLEANUP_CASE_2
#define EXIT_CLEANUP_CASE_2
case 2:
#elif !defined EXIT_CLEANUP_CASE_3
#define EXIT_CLEANUP_CASE_3
case 3:
#elif !defined EXIT_CLEANUP_CASE_4
#define EXIT_CLEANUP_CASE_4
case 4:
#elif !defined EXIT_CLEANUP_CASE_5
#define EXIT_CLEANUP_CASE_5
case 5:
#elif !defined EXIT_CLEANUP_CASE_6
#define EXIT_CLEANUP_CASE_6
case 6:
#elif !defined EXIT_CLEANUP_CASE_7
#define EXIT_CLEANUP_CASE_7
case 7:
#elif !defined EXIT_CLEANUP_CASE_8
#define EXIT_CLEANUP_CASE_8
case 8:
#elif !defined EXIT_CLEANUP_CASE_9
#define EXIT_CLEANUP_CASE_9
case 9:
#elif !defined EXIT_CLEANUP_CASE_10
#define EXIT_CLEANUP_CASE_10
case 10:
#elif !defined EXIT_CLEANUP_CASE_11
#define EXIT_CLEANUP_CASE_11
case 11:
#elif !defined EXIT_CLEANUP_CASE_12
#define EXIT_CLEANUP_CASE_12
case 12:
#elif !defined EXIT_CLEANUP_CASE_13
#define EXIT_CLEANUP_CASE_13
case 13:
#elif !defined EXIT_CLEANUP_CASE_14
#define EXIT_CLEANUP_CASE_14
case 14:
#elif !defined EXIT_CLEANUP_CASE_15
#define EXIT_CLEANUP_CASE_15
case 15:
#elif !defined EXIT_CLEANUP_CASE_16
#define EXIT_CLEANUP_CASE_16
case 16:
#else
#error Need to add more case statements!
#endif
cleanup_step++;

154
cleanup.c
View File

@@ -92,77 +92,111 @@ pid_t cleanup_child_pid = -1;
*
* @param code one of the RERR_* codes from errcode.h.
**/
void _exit_cleanup(int code, const char *file, int line)
NORETURN void _exit_cleanup(int code, const char *file, int line)
{
int ocode = code;
static int inside_cleanup = 0;
if (inside_cleanup > 10) {
/* prevent the occasional infinite recursion */
return;
}
inside_cleanup++;
static int cleanup_step = 0;
static int exit_code = 0;
static int unmodified_code = 0;
SIGACTION(SIGUSR1, SIG_IGN);
SIGACTION(SIGUSR2, SIG_IGN);
if (verbose > 3) {
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
code, file, line);
}
if (exit_code) /* Preserve first error code when recursing. */
code = exit_code;
if (cleanup_child_pid != -1) {
int status;
if (wait_process(cleanup_child_pid, &status, WNOHANG)
== cleanup_child_pid) {
status = WEXITSTATUS(status);
if (status > code)
code = status;
/* Some of our actions might cause a recursive call back here, so we
* keep track of where we are in the cleanup and never repeat a step. */
switch (cleanup_step) {
#include "case_N.h" /* case 0: cleanup_step++; */
exit_code = unmodified_code = code;
if (verbose > 3) {
rprintf(FINFO,
"_exit_cleanup(code=%d, file=%s, line=%d): entered\n",
code, file, line);
}
}
if (cleanup_got_literal && cleanup_new_fname && keep_partial
&& handle_partial_dir(cleanup_new_fname, PDIR_CREATE)) {
char *fname = cleanup_fname;
cleanup_fname = NULL;
if (cleanup_fd_r != -1)
close(cleanup_fd_r);
if (cleanup_fd_w != -1) {
flush_write_file(cleanup_fd_w);
close(cleanup_fd_w);
/* FALLTHROUGH */
#include "case_N.h"
if (cleanup_child_pid != -1) {
int status;
int pid = wait_process(cleanup_child_pid, &status, WNOHANG);
if (pid == cleanup_child_pid) {
status = WEXITSTATUS(status);
if (status > code)
code = exit_code = status;
}
}
finish_transfer(cleanup_new_fname, fname, NULL,
cleanup_file, 0, !partial_dir);
}
io_flush(FULL_FLUSH);
if (cleanup_fname)
do_unlink(cleanup_fname);
if (code)
kill_all(SIGUSR1);
if (cleanup_pid && cleanup_pid == getpid()) {
char *pidf = lp_pid_file();
if (pidf && *pidf)
unlink(lp_pid_file());
/* FALLTHROUGH */
#include "case_N.h"
if (cleanup_got_literal && cleanup_fname && cleanup_new_fname
&& keep_partial && handle_partial_dir(cleanup_new_fname, PDIR_CREATE)) {
char *fname = cleanup_fname;
cleanup_fname = NULL;
if (cleanup_fd_r != -1)
close(cleanup_fd_r);
if (cleanup_fd_w != -1) {
flush_write_file(cleanup_fd_w);
close(cleanup_fd_w);
}
finish_transfer(cleanup_new_fname, fname, NULL,
cleanup_file, 0, !partial_dir);
}
/* FALLTHROUGH */
#include "case_N.h"
io_flush(FULL_FLUSH);
/* FALLTHROUGH */
#include "case_N.h"
if (cleanup_fname)
do_unlink(cleanup_fname);
if (code)
kill_all(SIGUSR1);
if (cleanup_pid && cleanup_pid == getpid()) {
char *pidf = lp_pid_file();
if (pidf && *pidf)
unlink(lp_pid_file());
}
if (code == 0) {
if (io_error & IOERR_DEL_LIMIT)
code = exit_code = RERR_DEL_LIMIT;
if (io_error & IOERR_VANISHED)
code = exit_code = RERR_VANISHED;
if (io_error & IOERR_GENERAL || log_got_error)
code = exit_code = RERR_PARTIAL;
}
if (code || am_daemon || (logfile_name && (am_server || !verbose)))
log_exit(code, file, line);
/* FALLTHROUGH */
#include "case_N.h"
if (verbose > 2) {
rprintf(FINFO,
"_exit_cleanup(code=%d, file=%s, line=%d): "
"about to call exit(%d)\n",
unmodified_code, file, line, code);
}
/* FALLTHROUGH */
#include "case_N.h"
close_all();
/* FALLTHROUGH */
default:
break;
}
if (code == 0) {
if (io_error & IOERR_DEL_LIMIT)
code = RERR_DEL_LIMIT;
if (io_error & IOERR_VANISHED)
code = RERR_VANISHED;
if (io_error & IOERR_GENERAL || log_got_error)
code = RERR_PARTIAL;
}
if (code || am_daemon || (logfile_name && (am_server || !verbose)))
log_exit(code, file, line);
if (verbose > 2) {
rprintf(FINFO,"_exit_cleanup(code=%d, file=%s, line=%d): about to call exit(%d)\n",
ocode, file, line, code);
}
close_all();
exit(code);
}

View File

@@ -50,7 +50,7 @@ char *client_addr(int fd)
initialised = 1;
if (am_server) { /* daemon over --rsh mode */
strcpy(addr_buf, "0.0.0.0");
strlcpy(addr_buf, "0.0.0.0", sizeof addr_buf);
if ((ssh_info = getenv("SSH_CONNECTION")) != NULL
|| (ssh_info = getenv("SSH_CLIENT")) != NULL
|| (ssh_info = getenv("SSH2_CLIENT")) != NULL) {
@@ -99,7 +99,7 @@ char *client_name(int fd)
if (initialised)
return name_buf;
strcpy(name_buf, default_name);
strlcpy(name_buf, default_name, sizeof name_buf);
initialised = 1;
memset(&ss, 0, sizeof ss);
@@ -133,6 +133,8 @@ char *client_name(int fd)
memcpy(&ss, answer->ai_addr, ss_len);
break;
#endif
default:
exit_cleanup(RERR_SOCKETIO);
}
freeaddrinfo(answer);
} else {
@@ -142,7 +144,7 @@ char *client_name(int fd)
if (lookup_name(fd, &ss, ss_len, name_buf, sizeof name_buf,
port_buf, sizeof port_buf) == 0)
check_name(fd, &ss, name_buf);
check_name(fd, &ss, name_buf, sizeof name_buf);
return name_buf;
}
@@ -206,18 +208,18 @@ void client_sockaddr(int fd,
**/
int lookup_name(int fd, const struct sockaddr_storage *ss,
socklen_t ss_len,
char *name_buf, size_t name_buf_len,
char *port_buf, size_t port_buf_len)
char *name_buf, size_t name_buf_size,
char *port_buf, size_t port_buf_size)
{
int name_err;
/* reverse lookup */
name_err = getnameinfo((struct sockaddr *) ss, ss_len,
name_buf, name_buf_len,
port_buf, port_buf_len,
name_buf, name_buf_size,
port_buf, port_buf_size,
NI_NAMEREQD | NI_NUMERICSERV);
if (name_err != 0) {
strcpy(name_buf, default_name);
strlcpy(name_buf, default_name, name_buf_size);
rprintf(FLOG, "name lookup failed for %s: %s\n",
client_addr(fd), gai_strerror(name_err));
return name_err;
@@ -298,7 +300,7 @@ int compare_addrinfo_sockaddr(const struct addrinfo *ai,
**/
int check_name(int fd,
const struct sockaddr_storage *ss,
char *name_buf)
char *name_buf, size_t name_buf_size)
{
struct addrinfo hints, *res, *res0;
int error;
@@ -312,7 +314,7 @@ int check_name(int fd,
if (error) {
rprintf(FLOG, "forward name lookup for %s failed: %s\n",
name_buf, gai_strerror(error));
strcpy(name_buf, default_name);
strlcpy(name_buf, default_name, name_buf_size);
return error;
}
@@ -328,13 +330,13 @@ int check_name(int fd,
* address that was the same as ss. */
rprintf(FLOG, "no known address for \"%s\": "
"spoofed address?\n", name_buf);
strcpy(name_buf, default_name);
strlcpy(name_buf, default_name, name_buf_size);
} else if (res == NULL) {
/* We hit the end of the list without finding an
* address that was the same as ss. */
rprintf(FLOG, "%s is not a known address for \"%s\": "
"spoofed address?\n", client_addr(fd), name_buf);
strcpy(name_buf, default_name);
strlcpy(name_buf, default_name, name_buf_size);
}
freeaddrinfo(res0);

View File

@@ -24,6 +24,7 @@
extern int verbose;
extern int quiet;
extern int output_motd;
extern int list_only;
extern int am_sender;
extern int am_server;
@@ -205,7 +206,10 @@ int start_inband_exchange(char *user, char *path, int f_in, int f_out,
return -1;
}
rprintf(FINFO, "%s\n", line);
/* This might be a MOTD line or a module listing, but there is
* no way to differentiate it. The manpage mentions this. */
if (output_motd)
rprintf(FINFO, "%s\n", line);
}
kluge_around_eof = 0;

View File

@@ -5,7 +5,7 @@ AC_CONFIG_SRCDIR([byteorder.h])
AC_CONFIG_HEADER(config.h)
AC_PREREQ(2.59)
RSYNC_VERSION=2.6.9pre1
RSYNC_VERSION=2.6.9pre3
AC_SUBST(RSYNC_VERSION)
AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])

View File

@@ -906,12 +906,14 @@ void parse_rule(struct filter_list_struct *listp, const char *pattern,
&pat_len, &new_mflags);
if (!cp)
break;
pattern = cp + pat_len;
if (pat_len >= MAXPATHLEN) {
rprintf(FERROR, "discarding over-long filter: %s\n",
cp);
rprintf(FERROR, "discarding over-long filter: %.*s\n",
(int)pat_len, cp);
continue;
}
pattern = cp + pat_len;
if (new_mflags & MATCHFLG_CLEAR_LIST) {
if (verbose > 2) {
@@ -931,11 +933,9 @@ void parse_rule(struct filter_list_struct *listp, const char *pattern,
}
len = pat_len;
if (new_mflags & MATCHFLG_EXCLUDE_SELF) {
const char *name = strrchr(cp, '/');
if (name)
len -= ++name - cp;
else
name = cp;
const char *name = cp + len;
while (name > cp && name[-1] != '/') name--;
len -= name - cp;
add_rule(listp, name, len, 0, 0);
new_mflags &= ~MATCHFLG_EXCLUDE_SELF;
len = pat_len;

43
flist.c
View File

@@ -233,17 +233,21 @@ static int is_excluded(char *fname, int is_dir, int filter_level)
static int to_wire_mode(mode_t mode)
{
#ifdef SUPPORT_LINKS
if (S_ISLNK(mode) && (_S_IFLNK != 0120000))
#if _S_IFLNK != 0120000
if (S_ISLNK(mode))
return (mode & ~(_S_IFMT)) | 0120000;
#endif
return (int)mode;
#endif
return mode;
}
static mode_t from_wire_mode(int mode)
{
if ((mode & (_S_IFMT)) == 0120000 && (_S_IFLNK != 0120000))
#if _S_IFLNK != 0120000
if ((mode & (_S_IFMT)) == 0120000)
return (mode & ~(_S_IFMT)) | _S_IFLNK;
return (mode_t)mode;
#endif
return mode;
}
static void send_directory(int f, struct file_list *flist,
@@ -446,7 +450,7 @@ static void send_file_entry(struct file_struct *file, int f)
#endif
#ifdef SUPPORT_HARD_LINKS
if (flags & XMIT_HAS_IDEV_DATA) {
if (file->link_u.idev) {
if (protocol_version < 26) {
/* 32-bit dev_t and ino_t */
write_int(f, dev);
@@ -741,9 +745,10 @@ struct file_struct *make_file(char *fname, struct file_list *flist,
memset(sum, 0, SUM_LENGTH);
if (stp && S_ISDIR(stp->st_mode))
if (stp && S_ISDIR(stp->st_mode)) {
st = *stp; /* Needed for "symlink/." with --relative. */
else if (readlink_stat(thisname, &st, linkname) != 0) {
*linkname = '\0'; /* make IBM code checker happy */
} else if (readlink_stat(thisname, &st, linkname) != 0) {
int save_errno = errno;
/* See if file is excluded before reporting an error. */
if (filter_level != NO_FILTERS
@@ -1692,15 +1697,15 @@ static void output_flist(struct file_list *flist)
for (i = 0; i < flist->count; i++) {
file = flist->files[i];
if ((am_root || am_sender) && preserve_uid)
sprintf(uidbuf, " uid=%ld", (long)file->uid);
snprintf(uidbuf, sizeof uidbuf, " uid=%ld", (long)file->uid);
else
*uidbuf = '\0';
if (preserve_gid && file->gid != GID_NONE)
sprintf(gidbuf, " gid=%ld", (long)file->gid);
snprintf(gidbuf, sizeof gidbuf, " gid=%ld", (long)file->gid);
else
*gidbuf = '\0';
if (!am_sender)
sprintf(depthbuf, "%d", file->dir.depth);
snprintf(depthbuf, sizeof depthbuf, "%d", file->dir.depth);
rprintf(FINFO, "[%s] i=%d %s %s%s%s%s mode=0%o len=%.0f%s%s flags=%x\n",
who, i, am_sender ? NS(file->dir.root) : depthbuf,
file->dirname ? file->dirname : "",
@@ -1757,10 +1762,6 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
c1 = (uchar*)"";
} else
state1 = s_BASE;
} else if (!*c1) {
type1 = t_path;
state1 = s_SLASH;
c1 = (uchar*)"/";
} else {
type1 = t_path;
state1 = s_DIR;
@@ -1774,10 +1775,6 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
c2 = (uchar*)"";
} else
state2 = s_BASE;
} else if (!*c2) {
type2 = t_path;
state2 = s_SLASH;
c2 = (uchar*)"/";
} else {
type2 = t_path;
state2 = s_DIR;
@@ -1786,9 +1783,7 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
if (type1 != type2)
return type1 == t_PATH ? 1 : -1;
while (1) {
if ((dif = (int)*c1++ - (int)*c2++) != 0)
break;
do {
if (!*c1) {
switch (state1) {
case s_DIR:
@@ -1851,7 +1846,7 @@ int f_name_cmp(struct file_struct *f1, struct file_struct *f2)
if (type1 != type2)
return type1 == t_PATH ? 1 : -1;
}
}
} while ((dif = (int)*c1++ - (int)*c2++) == 0);
return dif;
}
@@ -1878,9 +1873,9 @@ char *f_name(struct file_struct *f, char *fbuf)
int len = strlen(f->dirname);
memcpy(fbuf, f->dirname, len);
fbuf[len] = '/';
strcpy(fbuf + len + 1, f->basename);
strlcpy(fbuf + len + 1, f->basename, MAXPATHLEN - (len + 1));
} else
strcpy(fbuf, f->basename);
strlcpy(fbuf, f->basename, MAXPATHLEN);
return fbuf;
}

View File

@@ -453,7 +453,7 @@ static void sum_sizes_sqroot(struct sum_struct *sum, int64 len)
int64 l;
int b = BLOCKSUM_BIAS;
for (l = len; l >>= 1; b += 2) {}
for (c = blength; c >>= 1 && b; b--) {}
for (c = blength; (c >>= 1) && b; b--) {}
/* add a bit, subtract rollsum, round up. */
s2length = (b + 1 - 32 + 7) / 8; /* --optimize in compiler-- */
s2length = MAX(s2length, csum_length);
@@ -647,7 +647,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
j = best_match;
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
if (link_stat(cmpbuf, stp, 0) < 0)
match_level = 0;
return -1;
}
if (match_level == 3 && !copy_dest) {
@@ -941,7 +941,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
}
if (set_file_attrs(fname, file, statret ? NULL : &st, 0)
&& verbose && code && f_out != -1)
&& verbose && code != FNONE && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
&& (file->flags & FLAG_DEL_HERE))
@@ -1010,7 +1010,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
#endif
if (!copy_dest)
return;
itemizing = code = 0;
itemizing = 0;
code = FNONE;
}
}
if (preserve_hard_links && file->link_u.links
@@ -1026,12 +1027,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
itemize(file, ndx, statret, &st,
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code && verbose) {
if (code != FNONE && verbose) {
rprintf(code, "%s -> %s\n", fname,
file->u.link);
}
if (preserve_hard_links && file->link_u.links)
hard_link_cluster(file, ndx, itemizing, code);
/* This does not check remove_source_files == 1
* because this is one of the items that the old
* --remove-sent-files option would remove. */
if (remove_source_files)
goto return_with_success;
}
@@ -1051,7 +1055,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
#endif
if (!copy_dest)
return;
itemizing = code = 0;
itemizing = 0;
code = FNONE;
}
}
if (statret != 0
@@ -1081,7 +1086,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
itemize(file, ndx, statret, &st,
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code && verbose)
if (code != FNONE && verbose)
rprintf(code, "%s\n", fname);
if (preserve_hard_links && file->link_u.links) {
hard_link_cluster(file, ndx,
@@ -1363,7 +1368,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name)
if (protocol_version >= 29) {
itemizing = 1;
maybe_ATTRS_REPORT = stdout_format_has_i ? 0 : ATTRS_REPORT;
code = logfile_format_has_i ? 0 : FLOG;
code = logfile_format_has_i ? FNONE : FLOG;
} else if (am_daemon) {
itemizing = logfile_format_has_i && do_xfers;
maybe_ATTRS_REPORT = ATTRS_REPORT;
@@ -1371,7 +1376,7 @@ void generate_files(int f_out, struct file_list *flist, char *local_name)
} else if (!am_server) {
itemizing = stdout_format_has_i;
maybe_ATTRS_REPORT = stdout_format_has_i ? 0 : ATTRS_REPORT;
code = itemizing ? 0 : FINFO;
code = itemizing ? FNONE : FINFO;
} else {
itemizing = 0;
maybe_ATTRS_REPORT = ATTRS_REPORT;

10
hlink.c
View File

@@ -83,6 +83,7 @@ static void link_idev_data(void)
FPTR(cur)->F_HLINDEX = to;
FPTR(cur)->F_NEXT = hlink_list[++from];
FPTR(cur)->link_u.links->link_dest_used = 0;
}
pool_free(idev_pool, 0, FPTR(cur)->link_u.idev);
if (from > start) {
@@ -94,6 +95,7 @@ static void link_idev_data(void)
FPTR(cur)->F_HLINDEX = to;
FPTR(cur)->F_NEXT = head;
FPTR(cur)->flags |= FLAG_HLINK_EOL;
FPTR(cur)->link_u.links->link_dest_used = 0;
hlink_list[to++] = head;
} else
FPTR(cur)->link_u.links = NULL;
@@ -216,8 +218,10 @@ int hard_link_check(struct file_struct *file, int ndx, char *fname,
continue;
statret = 1;
st = &st3;
if (verbose < 2 || !stdout_format_has_i)
itemizing = code = 0;
if (verbose < 2 || !stdout_format_has_i) {
itemizing = 0;
code = FNONE;
}
break;
}
if (!unchanged_file(cmpbuf, file, &st3))
@@ -266,7 +270,7 @@ int hard_link_one(struct file_struct *file, int ndx, char *fname,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
terse ? "" : toname);
}
if (code && verbose && !terse)
if (code != FNONE && verbose && !terse)
rprintf(code, "%s => %s\n", fname, toname);
return 0;
}

View File

@@ -25,11 +25,11 @@
#ifndef HAVE_STRDUP
char *strdup(char *s)
{
int l = strlen(s) + 1;
char *ret = (char *)malloc(l);
if (ret)
strcpy(ret,s);
return ret;
int len = strlen(s) + 1;
char *ret = (char *)malloc(len);
if (ret)
memcpy(ret, s, len);
return ret;
}
#endif

View File

@@ -75,13 +75,14 @@ inet_ntop4(const unsigned char *src, char *dst, size_t size)
{
static const char *fmt = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
size_t len;
if ((size_t)sprintf(tmp, fmt, src[0], src[1], src[2], src[3]) >= size)
{
len = snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]);
if (len >= size) {
errno = ENOSPC;
return (NULL);
}
strcpy(dst, tmp);
memcpy(dst, tmp, len + 1);
return (dst);
}
@@ -106,7 +107,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
int i, inc;
/*
* Preprocess:
@@ -157,13 +158,14 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
/* Is this address an encapsulated IPv4? */
if (i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
if (!inet_ntop4(src+12, tp,
sizeof tmp - (tp - tmp)))
if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
return (NULL);
tp += strlen(tp);
break;
}
tp += sprintf(tp, "%x", words[i]);
inc = snprintf(tp, 5, "%x", words[i]);
assert(inc < 5);
tp += inc;
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) ==
@@ -178,7 +180,7 @@ inet_ntop6(const unsigned char *src, char *dst, size_t size)
errno = ENOSPC;
return (NULL);
}
strcpy(dst, tmp);
memcpy(dst, tmp, tp - tmp);
return (dst);
}
#endif /* AF_INET6 */

View File

@@ -30,7 +30,7 @@ void permstring(char *perms, mode_t mode)
static const char *perm_map = "rwxrwxrwx";
int i;
strcpy(perms, "----------");
strlcpy(perms, "----------", 11);
for (i = 0; i < 9; i++) {
if (mode & (1 << i))

View File

@@ -272,7 +272,7 @@ pool_stats(alloc_pool_t p, int fd, int summarize)
if (pool->live)
FDEXTSTAT(pool->live);
strcpy(buf, " FREE BOUND\n");
strlcpy(buf, " FREE BOUND\n", sizeof buf);
write(fd, buf, strlen(buf));
for (cur = pool->free; cur; cur = cur->next)

View File

@@ -336,7 +336,7 @@ static struct parm_struct parm_table[] =
/***************************************************************************
Initialise the global parameter structure.
* Initialise the global parameter structure.
***************************************************************************/
static void init_globals(void)
{
@@ -344,7 +344,7 @@ static void init_globals(void)
}
/***************************************************************************
Initialise the sDefault parameter structure.
* Initialise the sDefault parameter structure.
***************************************************************************/
static void init_locals(void)
{
@@ -432,7 +432,7 @@ static BOOL do_section(char *sectionname);
/***************************************************************************
initialise a service to the defaults
* initialise a service to the defaults
***************************************************************************/
static void init_service(service *pservice)
{
@@ -466,8 +466,8 @@ static void string_set(char **s, const char *v)
/***************************************************************************
add a new service to the services array initialising it with the given
service
* add a new service to the services array initialising it with the given
* service
***************************************************************************/
static int add_a_service(service *pservice, char *name)
{
@@ -506,7 +506,7 @@ static int add_a_service(service *pservice, char *name)
}
/***************************************************************************
Do a case-insensitive, whitespace-ignoring string compare.
* Do a case-insensitive, whitespace-ignoring string compare.
***************************************************************************/
static int strwicmp(char *psz1, char *psz2)
{
@@ -538,8 +538,8 @@ static int strwicmp(char *psz1, char *psz2)
}
/***************************************************************************
Map a parameter's string representation to something we can use.
Returns False if the parameter string is not recognised, else TRUE.
* Map a parameter's string representation to something we can use.
* Returns False if the parameter string is not recognised, else TRUE.
***************************************************************************/
static int map_parameter(char *parmname)
{
@@ -558,9 +558,9 @@ static int map_parameter(char *parmname)
/***************************************************************************
Set a boolean variable from the text value stored in the passed string.
Returns True in success, False if the passed string does not correctly
represent a boolean.
* Set a boolean variable from the text value stored in the passed string.
* Returns True in success, False if the passed string does not correctly
* represent a boolean.
***************************************************************************/
static BOOL set_boolean(BOOL *pb, char *parmvalue)
{
@@ -586,7 +586,7 @@ static BOOL set_boolean(BOOL *pb, char *parmvalue)
}
/***************************************************************************
Find a service by name. Otherwise works like get_service.
* Find a service by name. Otherwise works like get_service.
***************************************************************************/
static int getservicebyname(char *name, service *pserviceDest)
{
@@ -606,8 +606,7 @@ static int getservicebyname(char *name, service *pserviceDest)
/***************************************************************************
Copy a service structure to another
* Copy a service structure to another
***************************************************************************/
static void copy_service(service *pserviceDest,
service *pserviceSource)
@@ -652,8 +651,8 @@ static void copy_service(service *pserviceDest,
/***************************************************************************
Process a parameter for a particular service number. If snum < 0
then assume we are in the globals
* Process a parameter for a particular service number. If snum < 0
* then assume we are in the globals
***************************************************************************/
static BOOL lp_do_parameter(int snum, char *parmname, char *parmvalue)
{
@@ -744,7 +743,7 @@ static BOOL lp_do_parameter(int snum, char *parmname, char *parmvalue)
}
/***************************************************************************
Process a parameter.
* Process a parameter.
***************************************************************************/
static BOOL do_parameter(char *parmname, char *parmvalue)
{
@@ -752,9 +751,9 @@ static BOOL do_parameter(char *parmname, char *parmvalue)
}
/***************************************************************************
Process a new section (service). At this stage all sections are services.
Later we'll have special sections that permit server parameters to be set.
Returns True on success, False on failure.
* Process a new section (service). At this stage all sections are services.
* Later we'll have special sections that permit server parameters to be set.
* Returns True on success, False on failure.
***************************************************************************/
static BOOL do_section(char *sectionname)
{
@@ -799,8 +798,8 @@ static BOOL do_section(char *sectionname)
/***************************************************************************
Load the services array from the services file. Return True on success,
False on failure.
* Load the services array from the services file. Return True on success,
* False on failure.
***************************************************************************/
BOOL lp_load(char *pszFname, int globals_only)
{
@@ -831,7 +830,7 @@ BOOL lp_load(char *pszFname, int globals_only)
/***************************************************************************
return the max number of services
* return the max number of services
***************************************************************************/
int lp_numservices(void)
{
@@ -839,10 +838,10 @@ int lp_numservices(void)
}
/***************************************************************************
Return the number of the service with the given name, or -1 if it doesn't
exist. Note that this is a DIFFERENT ANIMAL from the internal function
getservicebyname()! This works ONLY if all services have been loaded, and
does not copy the found service.
* Return the number of the service with the given name, or -1 if it doesn't
* exist. Note that this is a DIFFERENT ANIMAL from the internal function
* getservicebyname()! This works ONLY if all services have been loaded, and
* does not copy the found service.
***************************************************************************/
int lp_number(char *name)
{

9
log.c
View File

@@ -90,7 +90,6 @@ struct {
{ 0, NULL }
};
/*
* Map from rsync error code to name, or return NULL.
*/
@@ -386,7 +385,7 @@ void rsyserr(enum logcode code, int errcode, const char *format, ...)
char buf[BIGPATHBUFLEN];
size_t len;
strcpy(buf, RSYNC_NAME ": ");
strlcpy(buf, RSYNC_NAME ": ", sizeof buf);
len = (sizeof RSYNC_NAME ": ") - 1;
va_start(ap, format);
@@ -536,15 +535,15 @@ static void log_formatted(enum logcode code, char *format, char *op,
case 'L':
if (hlink && *hlink) {
n = hlink;
strcpy(buf2, " => ");
strlcpy(buf2, " => ", sizeof buf2);
} else if (S_ISLNK(file->mode) && file->u.link) {
n = file->u.link;
strcpy(buf2, " -> ");
strlcpy(buf2, " -> ", sizeof buf2);
} else {
n = "";
if (!fmt[1])
break;
strcpy(buf2, " ");
strlcpy(buf2, " ", sizeof buf2);
}
strlcat(fmt, "s", sizeof fmt);
snprintf(buf2 + 4, sizeof buf2 - 4, fmt, n);

4
main.c
View File

@@ -1258,8 +1258,8 @@ static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig))
char cmd_buf[300];
int ret;
sprintf(cmd_buf, get_panic_action(),
getpid(), getpid());
snprintf(cmd_buf, sizeof cmd_buf, get_panic_action(),
getpid(), getpid());
/* Unless we failed to execute gdb, we allow the process to
* continue. I'm not sure if that's right. */

View File

@@ -54,15 +54,14 @@ BEGIN {
printf "int %s(void);\n", a[2]
}
/^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ {
/^static|^extern/ || /[;]/ {
next;
}
!/^OFF_T|^size_t|^off_t|^pid_t|^unsigned|^mode_t|^DIR|^user|^int|^char|^uint|^uchar|^short|^struct|^BOOL|^void|^time|^const|^RETSIGTYPE/ {
!/^[A-Za-z][A-Za-z0-9_]* / {
next;
}
/[(].*[)][ \t]*$/ {
printf "%s;\n",$0;
next;
@@ -73,4 +72,3 @@ BEGIN {
printf "%s\n",$0;
next;
}

View File

@@ -164,6 +164,7 @@ char *dest_option = NULL;
int verbose = 0;
int quiet = 0;
int output_motd = 1;
int log_before_transfer = 0;
int stdout_format_has_i = 0;
int stdout_format_has_o_or_i = 0;
@@ -281,6 +282,7 @@ void usage(enum logcode F)
rprintf(F,"Options\n");
rprintf(F," -v, --verbose increase verbosity\n");
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," -a, --archive archive mode; same as -rlptgoD (no -H)\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
@@ -407,6 +409,8 @@ static struct poptOption long_options[] = {
{"no-verbose", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
{"no-v", 0, POPT_ARG_VAL, &verbose, 0, 0, 0 },
{"quiet", 'q', POPT_ARG_NONE, 0, 'q', 0, 0 },
{"motd", 0, POPT_ARG_VAL, &output_motd, 1, 0, 0 },
{"no-motd", 0, POPT_ARG_VAL, &output_motd, 0, 0, 0 },
{"stats", 0, POPT_ARG_NONE, &do_stats, 0, 0, 0 },
{"human-readable", 'h', POPT_ARG_NONE, 0, 'h', 0, 0},
{"dry-run", 'n', POPT_ARG_NONE, &dry_run, 0, 0, 0 },
@@ -613,8 +617,9 @@ static char err_buf[200];
void option_error(void)
{
if (!err_buf[0]) {
strcpy(err_buf, "Error parsing options: "
"option may be supported on client but not on server?\n");
strlcpy(err_buf, "Error parsing options: option may "
"be supported on client but not on server?\n",
sizeof err_buf);
}
rprintf(FERROR, RSYNC_NAME ": %s", err_buf);
@@ -832,7 +837,9 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
case OPT_DAEMON:
if (am_daemon) {
strcpy(err_buf, "Attempt to hack rsync thwarted!\n");
strlcpy(err_buf,
"Attempt to hack rsync thwarted!\n",
sizeof err_buf);
return 0;
}
poptFreeContext(pc);
@@ -1391,7 +1398,7 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
clean_fname(partial_dir, 1);
if (!*partial_dir || strcmp(partial_dir, ".") == 0)
partial_dir = NULL;
else if (*partial_dir != '/') {
else if (*partial_dir != '/' && !am_server) {
parse_rule(&filter_list, partial_dir,
MATCHFLG_NO_PREFIXES|MATCHFLG_DIRECTORY, 0);
}
@@ -1499,7 +1506,7 @@ void server_options(char **args,int *argc)
argstr[x++] = 'n';
if (preserve_links)
argstr[x++] = 'l';
if (xfer_dirs > (recurse || !delete_mode || !am_sender))
if (xfer_dirs > (recurse || !delete_mode || !am_sender ? 1 : 0))
argstr[x++] = 'd';
if (am_sender) {
if (keep_dirlinks)

View File

@@ -1,6 +1,6 @@
Summary: A program for synchronizing files over a network.
Name: rsync
Version: 2.6.9pre1
Version: 2.6.9pre3
Release: 1
Group: Applications/Internet
Source: ftp://rsync.samba.org/pub/rsync/rsync-%{version}.tar.gz

View File

@@ -100,8 +100,11 @@ system "find . -name 'rsync-HEAD-*' -daystart -mtime +14 | xargs rm -f";
system 'ls -ltr';
if ($upload) {
$ENV{RSYNC_PARTIAL_DIR} = ''; # The rsync on samba.org is OLD.
system "rsync -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/nightly";
my $opt = '';
if (defined $ENV{RSYNC_PARTIAL_DIR}) {
$opt = " -f 'R $ENV{RSYNC_PARTIAL_DIR}'";
}
system "rsync$opt -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/nightly";
}
exit;

View File

@@ -162,18 +162,22 @@ foreach my $fn (@tweak_files) {
} elsif ($fn =~ /\.yo/) {
s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;
s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;
} elsif ($fn eq 'NEWS') {
s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*\n/$1 ($today)\n/mi
or die "Couldn't update NEWS file with release date!\n";
} elsif ($fn eq 'OLDNEWS') {
s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m
or die "Couldn't update OLDNEWS file with release date!\n";
} else {
s/^(NEWS for rsync \Q$version\E) \(UNRELEASED\)\s*\n/$1 ($today)\n/m;
s/^\t\S\S\s\S\S\S\s\d\d\d\d(\t\Q$version\E)/\t$ztoday$1/m;
die "Unrecognized file in \@tweak_files: $fn\n";
}
open(OUT, '>', $fn) or die $!;
print OUT $_;
close OUT;
}
system "yodl2man -o rsync.1 rsync.yo";
system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo";
#system "perl -pi -e \"s/\\\\\\'/\\\\&'/g\" rsync.1 rsyncd.conf.5";
system "yodl2man -o rsync.1 rsync.yo; ./tweak_manpage_dashes rsync.1";
system "yodl2man -o rsyncd.conf.5 rsyncd.conf.yo; ./tweak_manpage_dashes rsyncd.conf.5";
mkdir('patches/tmp') or die $!;
system "rsync -a --exclude=patches/ --exclude-from=.cvsignore . patches/tmp/cvsdir/";
@@ -214,7 +218,7 @@ print $break, <<EOT;
About to do the following in the samba-rsync-ftp dir:
- move the old tar/diff files into the appropriate old-* dirs
- copy the moved tar/diff files on samba.org$skipping
- hard-link the moved tar/diff files on samba.org$skipping
- create release tar, "$tar_name"
- create release diffs, "$diff_name"
- update README, *NEWS, TODO, and cvs.log
@@ -240,38 +244,33 @@ if ($diffdir ne $dest) {
# We need to run this regardless of $lastversion's "pre"ness.
my @moved_files;
foreach my $fn (glob('rsync*pre*.tar.gz*'), glob('rsync*pre*-NEWS')) {
my $new_fn = "old-previews/$fn";
rename($fn, $new_fn) or die $!;
push(@moved_files, $new_fn);
link($fn, "old-previews/$fn") or die $!;
push(@moved_files, $fn);
}
if ($version !~ /pre/) {
foreach my $fn (glob('rsync*.tar.gz*'), glob('rsync*-NEWS')) {
next if $fn =~ /^rsync.*pre/;
my $new_fn = "old-versions/$fn";
rename($fn, $new_fn) or die $!;
push(@moved_files, $new_fn);
link($fn, "old-versions/$fn") or die $!;
push(@moved_files, $fn);
}
foreach my $fn (glob('rsync*pre*.diffs.gz*')) {
unlink($fn);
}
foreach my $fn (glob('rsync*.diffs.gz*')) {
next if $fn =~ /^rsync.*pre/;
my $new_fn = "old-patches/$fn";
rename($fn, $new_fn) or die $!;
push(@moved_files, $new_fn);
link($fn, "old-patches/$fn") or die $!;
push(@moved_files, $fn);
}
}
# Optimize our future upload (in the absence of --detect-renamed) by
# copying the above moved files on the remote server.
# using rsync to hard-link the above files on samba.org.
if ($live) {
my $remote_cmd = '';
foreach (@moved_files) {
my($path, $fn) = m#(.*)/([^/]+)$#;
$remote_cmd .= "cp -p /home/ftp/pub/rsync/{$fn,$path};";
}
system "ssh samba.org '$remote_cmd'";
system "rsync -avHOC --include='rsync*.gz*' --include='old-*/' --exclude='*' . samba.org:/home/ftp/pub/rsync";
}
foreach (glob("rsync*pre*.diffs.gz*")) {
foreach (@moved_files) {
unlink($_);
}

View File

@@ -18,6 +18,8 @@ man: rsync.1 rsyncd.conf.5
rsync.1: rsync.yo
yodl2man -o rsync.1 rsync.yo
-./tweak_manpage_dashes rsync.1
rsyncd.conf.5: rsyncd.conf.yo
yodl2man -o rsyncd.conf.5 rsyncd.conf.yo
-./tweak_manpage_dashes rsyncd.conf.5

View File

@@ -104,7 +104,7 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now,
stats.num_files - stats.current_file_index - 1,
stats.num_files);
} else
strcpy(eol, "\r");
strlcpy(eol, "\r", sizeof eol);
rprintf(FCLIENT, "%12s %3d%% %7.2f%s %4d:%02d:%02d%s",
human_num(ofs), pct, rate, units,
remain_h, remain_m, remain_s, eol);

View File

@@ -84,15 +84,13 @@ static int updating_basis;
static int get_tmpname(char *fnametmp, char *fname)
{
int maxname, added, length = 0;
char *f;
int length = 0;
int maxname;
if (tmpdir) {
/* Note: this can't overflow, so the return value is safe */
length = strlcpy(fnametmp, tmpdir, MAXPATHLEN - 2);
fnametmp[length++] = '/';
fnametmp[length] = '\0'; /* always NULL terminated */
}
if ((f = strrchr(fname, '/')) != NULL) {
@@ -105,8 +103,9 @@ static int get_tmpname(char *fnametmp, char *fname)
} else
f = fname;
fnametmp[length++] = '.';
fnametmp[length] = '\0'; /* always NULL terminated */
/* The maxname value is bufsize, and includes space for the '\0'.
* (Note that NAME_MAX get -8 for the leading '.' above.) */
maxname = MIN(MAXPATHLEN - 7 - length, NAME_MAX - 8);
if (maxname < 1) {
@@ -115,8 +114,10 @@ static int get_tmpname(char *fnametmp, char *fname)
return 0;
}
strlcpy(fnametmp + length, f, maxname);
strcat(fnametmp + length, ".XXXXXX");
added = strlcpy(fnametmp + length, f, maxname);
if (added >= maxname)
added = maxname - 1;
memcpy(fnametmp + length + added, ".XXXXXX", 8);
return 1;
}
@@ -519,7 +520,10 @@ int recv_files(int f_in, struct file_list *flist, char *local_name)
}
}
if (fd1 != -1 && do_fstat(fd1,&st) != 0) {
if (fd1 == -1) {
st.st_mode = 0;
st.st_size = 0;
} else if (do_fstat(fd1,&st) != 0) {
rsyserr(FERROR, errno, "fstat %s failed",
full_fname(fnamecmp));
discard_receive_data(f_in, file->length);

View File

@@ -161,7 +161,7 @@
/* Log-message categories. Only FERROR and FINFO get sent over the socket,
* but FLOG and FSOCKERR can be sent over the receiver -> generator pipe.
* FLOG only goes to the log file, not the client; FCLIENT is the opposite. */
enum logcode { FERROR=1, FINFO=2, FLOG=3, FCLIENT=4, FSOCKERR=5 };
enum logcode { FNONE=0, FERROR=1, FINFO=2, FLOG=3, FCLIENT=4, FSOCKERR=5 };
/* Messages types that are sent over the message channel. The logcode
* values must all be present here with identical numbers. */
@@ -667,6 +667,7 @@ struct chmod_mode_struct;
#endif
#define UNUSED(x) x __attribute__((__unused__))
#define NORETURN __attribute__((__noreturn__))
#include "proto.h"
@@ -856,6 +857,9 @@ size_t strlcat(char *d, const char *s, size_t bufsize);
#ifndef WEXITSTATUS
#define WEXITSTATUS(stat) ((int)(((stat)>>8)&0xFF))
#endif
#ifndef WIFEXITED
#define WIFEXITED(stat) ((int)((stat)&0xFF) == 0)
#endif
#define exit_cleanup(code) _exit_cleanup(code, __FILE__, __LINE__)

View File

@@ -1,5 +1,5 @@
mailto(rsync-bugs@samba.org)
manpage(rsync)(1)(11 Oct 2006)()()
manpage(rsync)(1)(26 Oct 2006)()()
manpagename(rsync)(faster, flexible replacement for rcp)
manpagesynopsis()
@@ -33,7 +33,7 @@ report that accompanies this package.
Some of the additional features of rsync are:
itemize(
itemization(
it() support for copying links, devices, owners, groups, and permissions
it() exclude and exclude-from options similar to GNU tar
it() a CVS exclude mode for ignoring the same files that CVS would ignore
@@ -182,7 +182,7 @@ CONNECTIONS section below for information on that.)
Using rsync in this way is the same as using it with a remote shell except
that:
itemize(
itemization(
it() you either use a double colon :: instead of a single colon to
separate the hostname from the path, or you use an rsync:// URL.
it() the first word of the "path" is actually a module name.
@@ -299,6 +299,7 @@ Here is a short summary of the options available in rsync. Please refer
to the detailed description below for a complete description. verb(
-v, --verbose increase verbosity
-q, --quiet suppress non-error messages
--no-motd suppress daemon-mode MOTD (see caveat)
-c, --checksum skip based on checksum, not mod-time & size
-a, --archive archive mode; same as -rlptgoD (no -H)
--no-OPTION turn off an implied OPTION (e.g. --no-D)
@@ -401,8 +402,7 @@ to the detailed description below for a complete description. verb(
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
--version print version number
(-h) --help show this help (see below for -h comment)
)
(-h) --help show this help (see below for -h comment))
Rsync can also be run as a daemon, in which case the following options are
accepted: verb(
@@ -418,8 +418,7 @@ accepted: verb(
-v, --verbose increase verbosity
-4, --ipv4 prefer IPv4
-6, --ipv6 prefer IPv6
-h, --help show this help (if used after --daemon)
)
-h, --help show this help (if used after --daemon))
manpageoptions()
@@ -459,6 +458,13 @@ are given during the transfer, notably suppressing information messages
from the remote server. This flag is useful when invoking rsync from
cron.
dit(bf(--no-motd)) This option affects the information that is output
by the client at the start of a daemon transfer. This suppresses the
message-of-the-day (MOTD) text, but it also affects the list of modules
that the daemon sends in response to the "rsync host::" request (due to
a limitation in the rsync protocol), so omit this option if you want to
request the list of modules from the deamon.
dit(bf(-I, --ignore-times)) Normally rsync will skip any files that are
already the same size and have the same modification time-stamp.
This option turns off this "quick check" behavior, causing all files to
@@ -742,7 +748,7 @@ be the source permissions.)
When this option is em(off), permissions are set as follows:
quote(itemize(
quote(itemization(
it() Existing files (including updated files) retain their existing
permissions, though the bf(--executability) option might change just
the execute permission for the file.
@@ -789,7 +795,7 @@ not enabled. A regular file is considered to be executable if at least one
executability differs from that of the corresponding source file, rsync
modifies the destination file's permissions as follows:
quote(itemize(
quote(itemization(
it() To make a file non-executable, rsync turns off all its 'x'
permissions.
it() To make a file executable, rsync turns on each 'x' permission that
@@ -1158,7 +1164,7 @@ exact list of files to transfer (as read from the specified FILE or bf(-)
for standard input). It also tweaks the default behavior of rsync to make
transferring just the specified files and directories easier:
quote(itemize(
quote(itemization(
it() The bf(--relative) (bf(-R)) option is implied, which preserves the path
information that is specified for each item in the file (use
bf(--no-relative) or bf(--no-R) if you want to turn that off).
@@ -1391,7 +1397,7 @@ modified.
The update types that replace the bf(Y) are as follows:
quote(itemize(
quote(itemization(
it() A bf(<) means that a file is being transferred to the remote host
(sent).
it() A bf(>) means that a file is being transferred to the local host
@@ -1417,7 +1423,7 @@ a "?" (this can happen when talking to an older rsync).
The attribute that is associated with each letter is as follows:
quote(itemize(
quote(itemization(
it() A bf(c) means the checksum of the file is different and will be
updated by the file transfer (requires bf(--checksum)).
it() A bf(s) means the size of the file is different and will be updated
@@ -1492,7 +1498,7 @@ dit(bf(--stats)) This tells rsync to print a verbose set of statistics
on the file transfer, allowing you to tell how effective the rsync
algorithm is for your data.
The current statistics are as follows: quote(itemize(
The current statistics are as follows: quote(itemization(
it() bf(Number of files) is the count of all "files" (in the generic
sense), which includes directories, symlinks, etc.
it() bf(Number of files transferred) is the count of normal files that
@@ -1919,7 +1925,7 @@ The include/exclude rules each specify a pattern that is matched against
the names of the files that are going to be transferred. These patterns
can take several forms:
itemize(
itemization(
it() if the pattern starts with a / then it is anchored to a
particular spot in the hierarchy of files, otherwise it is matched
against the end of the pathname. This is similar to a leading ^ in
@@ -1997,7 +2003,7 @@ tt(- *)nl()
Here are some examples of exclude/include matching:
itemize(
itemization(
it() "- *.o" would exclude all filenames matching *.o
it() "- /foo" would exclude a file (or directory) named foo in the
transfer-root directory
@@ -2044,7 +2050,7 @@ tt(:n- .non-inherited-per-dir-excludes)nl()
The following modifiers are accepted after a merge or dir-merge rule:
itemize(
itemization(
it() A bf(-) specifies that the file should consist of only exclude
patterns, with no other rule-parsing except for in-file comments.
it() A bf(+) specifies that the file should consist of only include
@@ -2071,7 +2077,7 @@ itemize(
The following modifiers are accepted after a "+" or "-":
itemize(
itemization(
it() A "/" specifies that the include/exclude rule should be matched
against the absolute pathname of the current item. For example,
"-/ /etc/passwd" would exclude the passwd file any time the transfer
@@ -2346,7 +2352,7 @@ and the information to repeat this operation is stored in "foo" and
into the directory /bdest/dir. The differences between the two examples
reveals some of the flexibility you have in how you deal with batches:
itemize(
itemization(
it() The first example shows that the initial copy doesn't have to be
local -- you can push or pull data to/from a remote host using either the
remote-shell syntax or rsync daemon syntax, as desired.
@@ -2550,7 +2556,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
manpagesection(VERSION)
This man page is current for version 2.6.9pre1 of rsync.
This man page is current for version 2.6.9pre3 of rsync.
manpagesection(INTERNAL OPTIONS)

View File

@@ -1,5 +1,5 @@
mailto(rsync-bugs@samba.org)
manpage(rsyncd.conf)(5)(11 Oct 2006)()()
manpage(rsyncd.conf)(5)(26 Oct 2006)()()
manpagename(rsyncd.conf)(configuration file for rsync in daemon mode)
manpagesynopsis()
@@ -8,27 +8,27 @@ rsyncd.conf
manpagedescription()
The rsyncd.conf file is the runtime configuration file for rsync when
run as an rsync daemon.
run as an rsync daemon.
The rsyncd.conf file controls authentication, access, logging and
available modules.
manpagesection(FILE FORMAT)
The file consists of modules and parameters. A module begins with the
The file consists of modules and parameters. A module begins with the
name of the module in square brackets and continues until the next
module begins. Modules contain parameters of the form 'name = value'.
The file is line-based -- that is, each newline-terminated line represents
either a comment, a module name or a parameter.
Only the first equals sign in a parameter is significant. Whitespace before
Only the first equals sign in a parameter is significant. Whitespace before
or after the first equals sign is discarded. Leading, trailing and internal
whitespace in module and parameter names is irrelevant. Leading and
trailing whitespace in a parameter value is discarded. Internal whitespace
within a parameter value is retained verbatim.
Any line beginning with a hash (#) is ignored, as are lines containing
Any line beginning with a hash (#) is ignored, as are lines containing
only whitespace.
Any line ending in a \ is "continued" on the next line in the
@@ -37,12 +37,12 @@ customary UNIX fashion.
The values following the equals sign in parameters are all either a string
(no quotes needed) or a boolean, which may be given as yes/no, 0/1 or
true/false. Case is not significant in boolean values, but is preserved
in string values.
in string values.
manpagesection(LAUNCHING THE RSYNC DAEMON)
The rsync daemon is launched by specifying the bf(--daemon) option to
rsync.
rsync.
The daemon must run with root privileges if you wish to use chroot, to
bind to a port numbered under 1024 (as is the default 873), or to set
@@ -58,7 +58,7 @@ When run via inetd you should add a line like this to /etc/services:
verb( rsync 873/tcp)
and a single line something like this to /etc/inetd.conf:
verb( rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon)
Replace "/usr/bin/rsync" with the path to where you have rsync installed on
@@ -67,12 +67,12 @@ reread its config file.
Note that you should bf(not) send the rsync daemon a HUP signal to force
it to reread the tt(rsyncd.conf) file. The file is re-read on each client
connection.
connection.
manpagesection(GLOBAL OPTIONS)
The first parameters in the file (before a [module] header) are the
global parameters.
global parameters.
You may also include any module parameters in the global part of the
config file in which case the supplied value will override the
@@ -126,7 +126,7 @@ for each module in tt(rsyncd.conf).
dit(bf(use chroot)) If "use chroot" is true, the rsync daemon will chroot
to the "path" before starting the file transfer with the client. This has
the advantage of extra protection against possible implementation security
holes, but it has the disadvantages of requiring super-user privileges,
holes, but it has the disadvantages of requiring super-user privileges,
of not being able to follow symbolic links that are either absolute or outside
of the new root path, and of complicating the preservation of usernames and groups
(see below). When "use chroot" is false, for security reasons,
@@ -195,7 +195,7 @@ which allows the client to request one level of verbosity.
dit(bf(lock file)) The "lock file" option specifies the file to use to
support the "max connections" option. The rsync daemon uses record
locking on this file to ensure that the max connections limit is not
exceeded for the modules sharing the lock file.
exceeded for the modules sharing the lock file.
The default is tt(/var/run/rsyncd.lock).
dit(bf(read only)) The "read only" option determines whether clients
@@ -247,7 +247,7 @@ Because this exclude list is not passed to the client it only applies on
the daemon: that is, it excludes files received by a client when receiving
from a daemon and files deleted on a daemon when sending to a daemon, but
it doesn't exclude files from being deleted on a client when receiving
from a daemon.
from a daemon.
dit(bf(exclude from)) The "exclude from" option specifies a filename
on the daemon that contains exclude patterns, one per line.
@@ -313,13 +313,13 @@ username:password pairs separated by a single colon. Any line starting
with a hash (#) is considered a comment and is skipped. The passwords
can contain any characters but be warned that many operating systems
limit the length of passwords that can be typed at the client end, so
you may find that passwords longer than 8 characters don't work.
you may find that passwords longer than 8 characters don't work.
There is no default for the "secrets file" option, you must choose a name
(such as tt(/etc/rsyncd.secrets)). The file must normally not be readable
by "other"; see "strict modes".
dit(bf(strict modes)) The "strict modes" option determines whether or not
dit(bf(strict modes)) The "strict modes" option determines whether or not
the permissions on the secrets file will be checked. If "strict modes" is
true, then the secrets file must not be readable by any user ID other
than the one that the rsync daemon is running under. If "strict modes" is
@@ -333,7 +333,7 @@ connection is rejected.
Each pattern can be in one of five forms:
quote(itemize(
quote(itemization(
it() a dotted decimal IPv4 address of the form a.b.c.d, or an IPv6 address
of the form a:b:c::d:e:f. In this case the incoming machine's IP address
must match exactly.
@@ -364,7 +364,7 @@ You can also combine "hosts allow" with a separate "hosts deny"
option. If both options are specified then the "hosts allow" option s
checked first and a match results in the client being able to
connect. The "hosts deny" option is then checked and a match means
that the host is rejected. If the host does not match either the
that the host is rejected. If the host does not match either the
"hosts allow" or the "hosts deny" patterns then it is allowed to
connect.
@@ -383,14 +383,14 @@ phase of the transfer. Normally rsync skips the bf(--delete) step if any
I/O errors have occurred in order to prevent disastrous deletion due
to a temporary resource shortage or other I/O error. In some cases this
test is counter productive so you can use this option to turn off this
behavior.
behavior.
dit(bf(ignore nonreadable)) This tells the rsync daemon to completely
ignore files that are not readable by the user. This is useful for
public archives that may have some non-readable files among the
directories, and the sysadmin doesn't want those files to be seen at all.
dit(bf(transfer logging)) The "transfer logging" option enables per-file
dit(bf(transfer logging)) The "transfer logging" option enables per-file
logging of downloads and uploads in a format somewhat similar to that
used by ftp daemons. The daemon always logs the transfer at the end, so
if a transfer is aborted, no mention will be made in the log file.
@@ -412,9 +412,9 @@ rsyncstats.)
The single-character escapes that are understood are as follows:
quote(itemize(
quote(itemization(
it() %a the remote IP address
it() %b the number of bytes actually transferred
it() %b the number of bytes actually transferred
it() %B the permission bits of the file (e.g. rwxrwxrwt)
it() %c the checksum bytes received for this file (only when sending)
it() %f the filename (long form on sender; no trailing "/")
@@ -466,15 +466,18 @@ without the former, instead refuse "delete-*" -- that refuses all the
delete modes without affecting bf(--remove-sent-files).
When an option is refused, the daemon prints an error message and exits.
To prevent all compression, you can use "dont compress = *" (see below)
To prevent all compression when serving files,
you can use "dont compress = *" (see below)
instead of "refuse options = compress" to avoid returning an error to a
client that requests compression.
dit(bf(dont compress)) The "dont compress" option allows you to select
filenames based on wildcard patterns that should not be compressed
during transfer. Compression is expensive in terms of CPU usage so it
when pulling files from the daemon (no analogous option exists to
govern the pushing of files to a daemon).
Compression is expensive in terms of CPU usage, so it
is usually good to not try to compress files that won't compress well,
such as already compressed files.
such as already compressed files.
The "dont compress" option takes a space-separated list of
case-insensitive wildcard patterns. Any source filename matching one
@@ -489,7 +492,7 @@ transfer is aborted before it begins.
The following environment variables will be set, though some are
specific to the pre-xfer or the post-xfer environment:
quote(itemize(
quote(itemization(
it() bf(RSYNC_MODULE_NAME): The name of the module being accessed.
it() bf(RSYNC_MODULE_PATH): The path configured for the module.
it() bf(RSYNC_HOST_ADDR): The accessing host's IP address.
@@ -565,7 +568,7 @@ pid file = /var/run/rsyncd.pid
[rsyncftp]
path = /var/ftp/pub/rsync
comment = rsync ftp area (approx 6 MB)
[sambawww]
path = /public_html/samba
comment = Samba WWW pages (approx 240 MB)
@@ -590,7 +593,7 @@ manpagefiles()
manpageseealso()
rsync(1)
bf(rsync)(1)
manpagediagnostics()
@@ -601,7 +604,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
manpagesection(VERSION)
This man page is current for version 2.6.9pre1 of rsync.
This man page is current for version 2.6.9pre3 of rsync.
manpagesection(CREDITS)
@@ -623,7 +626,7 @@ manpagesection(THANKS)
Thanks to Warren Stanley for his original idea and patch for the rsync
daemon. Thanks to Karsten Thygesen for his many suggestions and
documentation!
documentation!
manpageauthor()
@@ -631,4 +634,4 @@ rsync was written by Andrew Tridgell and Paul Mackerras.
Many people have later contributed to it.
Mailing lists for support and development are available at
url(http://lists.samba.org)(lists.samba.org)
url(http://lists.samba.org)(lists.samba.org)

View File

@@ -44,9 +44,9 @@ makepath "$fromdir/foo"
touch "$fromdir/bar"
checkit "$RSYNC -avv \"$fromdir/\" \"$checkdir/\"" "$fromdir" "$checkdir"
chmod +t "$checkdir"/bar
chmod o+x "$fromdir"/bar
checkit "$RSYNC -avv --chmod=F+t \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
checkit "$RSYNC -avv --chmod=Fo-x \"$fromdir/\" \"$todir/\"" "$checkdir" "$todir"
# Tickle a bug in rsync 2.6.8: if you push a new directory with --perms off to
# a daemon with an incoming chmod, the daemon pretends the directory is a file
@@ -57,7 +57,7 @@ cat >>"$scratchdir/test-rsyncd.conf" <<EOF
[test-incoming-chmod]
path = $todir
read only = no
incoming chmod = F+t
incoming chmod = Fo-x
EOF
RSYNC_CONNECT_PROG="$RSYNC --config=$conf --daemon"

10
tls.c
View File

@@ -74,7 +74,7 @@ static void list_file(const char *fname)
buf.st_mode &= ~0777;
buf.st_mtime = (time_t)0;
buf.st_uid = buf.st_gid = 0;
strcpy(linkbuf, " -> ");
strlcpy(linkbuf, " -> ", sizeof linkbuf);
/* const-cast required for silly UNICOS headers */
len = readlink((char *) fname, linkbuf+4, sizeof(linkbuf) - 4);
if (len == -1)
@@ -91,16 +91,16 @@ static void list_file(const char *fname)
if (buf.st_mtime) {
mt = gmtime(&buf.st_mtime);
sprintf(datebuf, "%04d-%02d-%02d %02d:%02d:%02d",
snprintf(datebuf, sizeof datebuf,
"%04d-%02d-%02d %02d:%02d:%02d",
(int)mt->tm_year + 1900,
(int)mt->tm_mon + 1,
(int)mt->tm_mday,
(int)mt->tm_hour,
(int)mt->tm_min,
(int)mt->tm_sec);
} else {
strcpy(datebuf, " ");
}
} else
strlcpy(datebuf, " ", sizeof datebuf);
/* TODO: Perhaps escape special characters in fname? */

9
tweak_manpage Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/perl -i -p
s{(--\w[-\w]+)}{ $x = $1; $x =~ s/-/\\-/g; $x }eg;
s/(?<!\\)-(['"\d*])/\\-$1/g;
s/ -- / \\-\\- /g;
s#(['"(= /,])-#$1\\-#g;
s/(\\fB)-/$1\\-/g;
s/(\[\w)-(\w\])/$1\\-$2/g;
s{(\\f\(CW.*?\\fP)}{ $x = $1; $x =~ s/(?<!\\)-/\\-/g; $x }eg;
s/(\.\w+)-/$1\\-/g;

View File

@@ -126,12 +126,10 @@ static int is_in_group(gid_t gid)
char *gidbuf = new_array(char, ngroups*21+32);
if (!gidbuf)
out_of_memory("is_in_group");
sprintf(gidbuf, "process has %d gid%s: ",
ngroups, ngroups == 1? "" : "s");
pos = strlen(gidbuf);
pos = snprintf(gidbuf, 32, "process has %d gid%s: ",
ngroups, ngroups == 1? "" : "s");
for (n = 0; n < ngroups; n++) {
sprintf(gidbuf+pos, " %d", (int)gidset[n]);
pos += strlen(gidbuf+pos);
pos += snprintf(gidbuf+pos, 21, " %d", (int)gidset[n]);
}
rprintf(FINFO, "%s\n", gidbuf);
free(gidbuf);

12
util.c
View File

@@ -45,7 +45,7 @@ void set_nonblocking(int fd)
{
int val;
if ((val = fcntl(fd, F_GETFL, 0)) == -1)
if ((val = fcntl(fd, F_GETFL)) == -1)
return;
if (!(val & NONBLOCK_FLAG)) {
val |= NONBLOCK_FLAG;
@@ -58,7 +58,7 @@ void set_blocking(int fd)
{
int val;
if ((val = fcntl(fd, F_GETFL, 0)) == -1)
if ((val = fcntl(fd, F_GETFL)) == -1)
return;
if (val & NONBLOCK_FLAG) {
val &= ~NONBLOCK_FLAG;
@@ -109,13 +109,13 @@ void print_child_argv(char **cmd)
rprintf(FCLIENT, "\n");
}
void out_of_memory(char *str)
NORETURN void out_of_memory(char *str)
{
rprintf(FERROR, "ERROR: out of memory in %s [%s]\n", str, who_am_i());
exit_cleanup(RERR_MALLOC);
}
void overflow_exit(char *str)
NORETURN void overflow_exit(char *str)
{
rprintf(FERROR, "ERROR: buffer overflow in %s [%s]\n", str, who_am_i());
exit_cleanup(RERR_MALLOC);
@@ -359,7 +359,7 @@ int robust_unlink(const char *fname)
/* start where the last one left off to reduce chance of clashes */
start = counter;
do {
sprintf(&path[pos], "%03d", counter);
snprintf(&path[pos], MAX_RENAMES_DIGITS+1, "%03d", counter);
if (++counter >= MAX_RENAMES)
counter = 1;
} while ((rc = access(path, 0)) == 0 && counter != start);
@@ -1115,7 +1115,7 @@ char *human_num(int64 num)
units = 'K';
}
if (units) {
sprintf(bufs[n], "%.2f%c", dnum, units);
snprintf(bufs[n], sizeof bufs[0], "%.2f%c", dnum, units);
return bufs[n];
}
}