mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-05-29 09:17:21 -04:00
Compare commits
66 Commits
v2.6.9pre1
...
v2.6.9pre3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbb95d3d24 | ||
|
|
d9126a861f | ||
|
|
b4768a1397 | ||
|
|
47b032e97f | ||
|
|
50dfd5b4fe | ||
|
|
1de02c273d | ||
|
|
9ce7fc3887 | ||
|
|
dc1f7b9ea3 | ||
|
|
ee7cf95b13 | ||
|
|
492fc3536d | ||
|
|
5e61bdb4d5 | ||
|
|
f964ac5eee | ||
|
|
c55b39afad | ||
|
|
a27463a9a2 | ||
|
|
590eb6c02d | ||
|
|
0d7a6b4906 | ||
|
|
b4f0287197 | ||
|
|
8d6386809e | ||
|
|
230328a30a | ||
|
|
5819d6b14a | ||
|
|
7b4a40ed70 | ||
|
|
f210dcadf4 | ||
|
|
178a1d2048 | ||
|
|
a4b4e0770b | ||
|
|
2a6e35db31 | ||
|
|
e3794138d8 | ||
|
|
fdd10da6f7 | ||
|
|
5f12a07bff | ||
|
|
6a4a1d0cb0 | ||
|
|
434c40986d | ||
|
|
8ee6857702 | ||
|
|
721ddc903f | ||
|
|
154c345db0 | ||
|
|
25f637a334 | ||
|
|
2356d73bb4 | ||
|
|
4968423e71 | ||
|
|
99eba67585 | ||
|
|
5abe03d6e8 | ||
|
|
83078af5b0 | ||
|
|
185aa5b0e5 | ||
|
|
cabd60fdce | ||
|
|
10944395bf | ||
|
|
204f4f4d09 | ||
|
|
c9bce0b8f8 | ||
|
|
deee574b11 | ||
|
|
55410368e5 | ||
|
|
e4fdf1debe | ||
|
|
1580899c1d | ||
|
|
f863b76300 | ||
|
|
5e1ec06f09 | ||
|
|
36e2ea6068 | ||
|
|
f4164b73b4 | ||
|
|
9ef506a2b2 | ||
|
|
b1b54199ef | ||
|
|
33394b769d | ||
|
|
011e85a5e3 | ||
|
|
d5dcb6f775 | ||
|
|
0c25dedf31 | ||
|
|
6105464b79 | ||
|
|
4d51f0db79 | ||
|
|
ff530f04a0 | ||
|
|
e8b21fe406 | ||
|
|
71cb9df386 | ||
|
|
f97c2d4a9b | ||
|
|
b8a6dae038 | ||
|
|
969f7ed5b7 |
33
NEWS
33
NEWS
@@ -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
80
case_N.h
Normal 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
154
cleanup.c
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
26
clientname.c
26
clientname.c
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
|
||||
16
exclude.c
16
exclude.c
@@ -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
43
flist.c
@@ -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;
|
||||
}
|
||||
|
||||
23
generator.c
23
generator.c
@@ -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
10
hlink.c
@@ -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;
|
||||
}
|
||||
|
||||
10
lib/compat.c
10
lib/compat.c
@@ -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
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
53
loadparm.c
53
loadparm.c
@@ -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
9
log.c
@@ -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
4
main.c
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
17
options.c
17
options.c
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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($_);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
18
receiver.c
18
receiver.c
@@ -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);
|
||||
|
||||
6
rsync.h
6
rsync.h
@@ -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__)
|
||||
|
||||
|
||||
44
rsync.yo
44
rsync.yo
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
10
tls.c
@@ -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
9
tweak_manpage
Executable 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;
|
||||
@@ -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
12
util.c
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user