mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-05-26 07:45:33 -04:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16b49716d5 | ||
|
|
58faa1e8b9 | ||
|
|
9250e9ac23 | ||
|
|
3623d94fe7 | ||
|
|
cbc42b9c16 | ||
|
|
6ff5824c25 | ||
|
|
32de6b7cb4 | ||
|
|
bb853b3205 | ||
|
|
cce44865c1 | ||
|
|
1983198097 | ||
|
|
2a7355fb56 | ||
|
|
3da1dc4d18 | ||
|
|
abfb41e63e | ||
|
|
9d1cd2437c | ||
|
|
f8d2ecd223 | ||
|
|
453914e35b | ||
|
|
3f26e38f86 | ||
|
|
81d1ca0683 | ||
|
|
289ccbd02f | ||
|
|
85d3877be9 | ||
|
|
e203245d76 | ||
|
|
dfbcc4f7ec | ||
|
|
0bcb8b639a | ||
|
|
77f750f167 | ||
|
|
23afe20780 | ||
|
|
e12a6c087c | ||
|
|
6feb7d37df | ||
|
|
81ff413bb0 | ||
|
|
eac858085e | ||
|
|
2ac35b4507 | ||
|
|
3bc319766d | ||
|
|
a689fb1f5f | ||
|
|
b560a96b2c | ||
|
|
51e3c3da85 | ||
|
|
461086bbe7 | ||
|
|
00694610a6 | ||
|
|
8e3a6db842 | ||
|
|
8354cad53e | ||
|
|
317a0e8ca5 | ||
|
|
066ad8c719 | ||
|
|
ec4f644d2f | ||
|
|
4bf342c60f | ||
|
|
a2f733c664 | ||
|
|
3ea74eb388 | ||
|
|
962f8b9004 | ||
|
|
ae189e18de | ||
|
|
5b34561cf7 | ||
|
|
5546dab329 | ||
|
|
6128f56694 | ||
|
|
743f5a30d5 | ||
|
|
a955e93316 | ||
|
|
aca7dd3bff | ||
|
|
bc55aa04df | ||
|
|
f438d5abe0 | ||
|
|
6fe798392b | ||
|
|
6ceb9ea012 | ||
|
|
6900d35cce |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,6 +12,7 @@ config.h.in
|
||||
config.h.in.old
|
||||
config.log
|
||||
config.status
|
||||
aclocal.m4
|
||||
/proto.h
|
||||
/proto.h-tstamp
|
||||
/rsync.1
|
||||
@@ -44,3 +45,4 @@ config.status
|
||||
/testsuite/devices-fake.test
|
||||
/testsuite/xattrs-hlink.test
|
||||
/patches
|
||||
.deps
|
||||
|
||||
27
Makefile.in
27
Makefile.in
@@ -14,6 +14,7 @@ CFLAGS=@CFLAGS@
|
||||
CPPFLAGS=@CPPFLAGS@
|
||||
EXEEXT=@EXEEXT@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
LIBOBJDIR=lib/
|
||||
|
||||
INSTALLCMD=@INSTALL@
|
||||
INSTALLMAN=@INSTALL@
|
||||
@@ -28,7 +29,7 @@ VERSION=@RSYNC_VERSION@
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o
|
||||
|
||||
GENFILES=configure.sh config.h.in proto.h proto.h-tstamp rsync.1 rsyncd.conf.5
|
||||
GENFILES=configure.sh aclocal.m4 config.h.in proto.h proto.h-tstamp rsync.1 rsyncd.conf.5
|
||||
HEADERS=byteorder.h config.h errcode.h proto.h rsync.h ifuncs.h itypes.h inums.h \
|
||||
lib/pool_alloc.h
|
||||
LIBOBJ=lib/wildmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o lib/md5.o \
|
||||
@@ -74,12 +75,12 @@ install: all
|
||||
|
||||
install-ssl-client: rsync-ssl stunnel-rsync
|
||||
-${MKDIR_P} ${DESTDIR}${bindir}
|
||||
${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync-ssl ${DESTDIR}${bindir}
|
||||
${INSTALLCMD} ${INSTALL_STRIP} -m 755 stunnel-rsync ${DESTDIR}${bindir}
|
||||
${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir}
|
||||
${INSTALLCMD} -m 755 stunnel-rsync ${DESTDIR}${bindir}
|
||||
|
||||
install-ssl-daemon: stunnel-rsyncd.conf
|
||||
-${MKDIR_P} ${DESTDIR}/etc/stunnel
|
||||
${INSTALLCMD} ${INSTALL_STRIP} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
|
||||
${INSTALLCMD} -m 644 stunnel-rsyncd.conf ${DESTDIR}/etc/stunnel/rsyncd.conf
|
||||
@if ! ls /etc/rsync-ssl/certs/server.* >/dev/null 2>/dev/null; then \
|
||||
echo "Note that you'll need to install the certificate used by /etc/stunnel/rsyncd.conf"; \
|
||||
fi
|
||||
@@ -138,11 +139,14 @@ t_unsafe$(EXEEXT): $(T_UNSAFE_OBJ)
|
||||
gen: conf proto.h man
|
||||
|
||||
gensend: gen
|
||||
rsync -aivzc $(GENFILES) samba.org:/home/ftp/pub/rsync/generated-files/
|
||||
rsync -aivzc $(GENFILES) $${SAMBA_HOST-samba.org}:/home/ftp/pub/rsync/generated-files/
|
||||
|
||||
conf:
|
||||
cd $(srcdir) && $(MAKE) -f prepare-source.mak conf
|
||||
|
||||
aclocal.m4: $(srcdir)/m4/*.m4
|
||||
aclocal -I $(srcdir)/m4
|
||||
|
||||
configure.sh config.h.in: configure.ac aclocal.m4
|
||||
@if test -f configure.sh; then cp -p configure.sh configure.sh.old; else touch configure.sh.old; fi
|
||||
@if test -f config.h.in; then cp -p config.h.in config.h.in.old; else touch config.h.in.old; fi
|
||||
@@ -303,21 +307,10 @@ installcheck: $(CHECK_PROGS) $(CHECK_SYMLINKS)
|
||||
splint:
|
||||
splint +unixlib +gnuextensions -weak rsync.c
|
||||
|
||||
|
||||
rsync.dvi: doc/rsync.texinfo
|
||||
texi2dvi -o $@ $<
|
||||
|
||||
rsync.ps: rsync.dvi
|
||||
dvips -ta4 -o $@ $<
|
||||
|
||||
rsync.pdf: doc/rsync.texinfo
|
||||
texi2dvi -o $@ --pdf $<
|
||||
|
||||
|
||||
doxygen:
|
||||
cd $(srcdir) && rm dox/html/* && doxygen
|
||||
|
||||
# for maintainers only
|
||||
doxygen-upload:
|
||||
rsync -avzv $(srcdir)/dox/html/ --delete \
|
||||
samba.org:/home/httpd/html/rsync/doxygen/head/
|
||||
$${SAMBA_HOST-samba.org}:/home/httpd/html/rsync/doxygen/head/
|
||||
|
||||
142
NEWS
142
NEWS
@@ -1,115 +1,47 @@
|
||||
NEWS for rsync 3.1.1 (22 Jun 2014)
|
||||
NEWS for rsync 3.1.2 (21 Dec 2015)
|
||||
Protocol: 31 (unchanged)
|
||||
Changes since 3.1.0:
|
||||
Changes since 3.1.1:
|
||||
|
||||
SECURITY FIXES:
|
||||
|
||||
- Make sure that all transferred files use only path names from inside the
|
||||
transfer. This makes it impossible for a malicious sender to try to make
|
||||
the receiver use an unsafe destination path for a transferred file, such
|
||||
as a just-sent symlink.
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- If the receiver gets bogus filenames from the sender (an unexpected
|
||||
leading slash or a ".." infix dir), exit with an error. This prevents a
|
||||
malicious sender from trying to inject filenames that would affect an
|
||||
area outside the destination directories.
|
||||
|
||||
- Fixed a failure to remove the partial-transfer temp file when interrupted
|
||||
(and rsync is not saving the partial files).
|
||||
|
||||
- Changed the chown/group/xattr-set order to avoid losing some security-
|
||||
related xattr info (that would get cleared by a chown).
|
||||
|
||||
- Fixed a bug in the xattr-finding code that could make a non-root-run
|
||||
receiver not able to find some xattr numbers.
|
||||
|
||||
- Fixed a bug in the early daemon protocol where a timeout failed to be
|
||||
honored (e.g. if the remote side fails to send us the initial protocol
|
||||
greeting).
|
||||
|
||||
- Fixed unintended inclusion of commas in file numbers in the daemon log.
|
||||
|
||||
- We once again send the 'f' sub-flag (of -e) to the server side so it
|
||||
knows that we can handle incremental-recursion directory errors properly
|
||||
in older protocols.
|
||||
|
||||
- Fixed an issue with too-aggressive keep-alive messages causing a problem
|
||||
for older rsync versions early in the transfer.
|
||||
|
||||
- Fixed an incorrect message about backup-directory-creation when using
|
||||
--dry-run and the backup dir is not an absolute path.
|
||||
|
||||
- Fixed a bug where a failed deletion and/or a failed sender-side removal
|
||||
would not affect the exit code.
|
||||
|
||||
- Fixed a bug that caused a failure when combining --delete-missing-args
|
||||
with --xattrs and/or --acls.
|
||||
|
||||
- Fixed a strange dir_depth assertion error that was caused by empty-dir
|
||||
removals and/or duplicate files in the transfer.
|
||||
|
||||
- Fixed a problem with --info=progress2's output stats where rsync would
|
||||
only update the stats at the end of each file's transfer. It now uses
|
||||
the data that is flowing for the current file, making the stats more
|
||||
accurate and less jumpy.
|
||||
|
||||
- Fixed an itemize bug that affected the combo of --link-dest, -X, and -n.
|
||||
|
||||
- Fixed a problem with delete messages not appearing in the log file when
|
||||
the user didn't use --verbose.
|
||||
|
||||
- Improve chunked xattr reading for OS X.
|
||||
|
||||
- Removed an attempted hard-link xattr optimization that was causing a
|
||||
transfer failure. This removal is flagged in the compatibility code, so
|
||||
if a better fix can be discovered, we have a way to flip it on again.
|
||||
|
||||
- Fixed a bug when the receiver is not configured to be able to hard link
|
||||
symlimks/devices/special-file items but the sender sent some of these
|
||||
items flagged as hard-linked.
|
||||
|
||||
- We now generate a better error if the buffer overflows in do_mknod().
|
||||
|
||||
- Fixed a problem reading more than 16 ACLs on some OSes.
|
||||
|
||||
- Fixed the reading of the secrets file to avoid an infinite wait when
|
||||
the username is missing.
|
||||
|
||||
- Fixed a parsing problem in the --usermap/--groupmap options when using
|
||||
MIN-MAX numbers.
|
||||
|
||||
- Switched Cygwin back to using socketpair "pipes" to try to speed it up.
|
||||
|
||||
- Added knowledge of a few new options to rrsync.
|
||||
- Change the checksum seed order in the per-block checksums. This prevents
|
||||
someone from trying to create checksum blocks that match in sum but not
|
||||
content.
|
||||
- Fixed a with the per-dir filter files (using -FF) that could trigger an
|
||||
assert failure.
|
||||
- Only skip set_modtime() on a transferred file if the time is exactly
|
||||
right.
|
||||
- Don't create an empty backup dir for a transferred file that doesn't
|
||||
exist yet.
|
||||
- Fixed a bug where --link-dest and --xattrs could cause rsync to exit if
|
||||
a filename had a matching dir of the same name in the alt-dest area.
|
||||
- Allow more than 32 group IDs per user in the daemon's gid=LIST config.
|
||||
- Fix the logging of %b & %c via --log-file (daemon logging was already
|
||||
correct, as was --out-format='%b/%c').
|
||||
- Fix erroneous acceptance of --info=5 & --debug=5 (an empty flag name is
|
||||
not valid).
|
||||
|
||||
ENHANCEMENTS:
|
||||
|
||||
- Tweaked the temp-file naming when --temp-dir=DIR is used: the temp-file
|
||||
names will not get a '.' prepended.
|
||||
|
||||
- Added support for a new-compression idiom that does not compress all the
|
||||
matching data in a transfer. This can help rsync to use less cpu when a
|
||||
transfer has a lot of matching data, and also makes rsync compatible with
|
||||
a non-bundled zlib. See the --new-compress and --old-compress options in
|
||||
the manpage.
|
||||
|
||||
- Added the support/rsync-no-vanished wrapper script.
|
||||
|
||||
- Made configure more prominently mention when we failed to find yodl (in
|
||||
case the user wants to be able to generate manpages from *.yo files).
|
||||
|
||||
- Have manpage mention how a daemon's max-verbosity setting affects info
|
||||
and debug options. Also added more clarification on backslash removals
|
||||
for excludes that contain wildcards.
|
||||
|
||||
- Have configure check if for the attr lib (for getxattr) for those systems
|
||||
that need to link against it explicitly.
|
||||
|
||||
- Change the early dir-creation logic to only use that idiom in an
|
||||
inc-recursive copy that is preserving directory times. e.g. using
|
||||
--omit-dir-times will avoid these early directories being created.
|
||||
|
||||
- Fix a bug in cmp_time() that would return a wrong result if the 2 times
|
||||
differed by an amount greater than what a time_t can hold.
|
||||
- Added "(DRY RUN)" info to the --debug=exit output line.
|
||||
- Use usleep() for our msleep() function if it is available.
|
||||
- Added a few extra long-option names to rrsync script, which will make
|
||||
BackupPC happier.
|
||||
- Made configure choose to use linux xattrs on netbsd (rather than not
|
||||
supporting xattrs).
|
||||
- Added -wo (write-only) option to rrsync support script.
|
||||
- Misc. manpage tweaks.
|
||||
|
||||
DEVELOPER RELATED:
|
||||
|
||||
- We now include an example systemd file (in packaging/systemd).
|
||||
|
||||
- Tweaked configure to make sure that any intended use of the included popt
|
||||
and/or zlib code is put early in the CFLAGS.
|
||||
- Fixed a bug with the Makefile's use of INSTALL_STRIP.
|
||||
- Improve a test in the suite that could get an erroneous timestamp error.
|
||||
- Tweaks for newer versions of git in the packaging tools.
|
||||
- Improved the m4 generation rules and some autoconf idioms.
|
||||
|
||||
117
OLDNEWS
117
OLDNEWS
@@ -1,3 +1,119 @@
|
||||
NEWS for rsync 3.1.1 (22 Jun 2014)
|
||||
Protocol: 31 (unchanged)
|
||||
Changes since 3.1.0:
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- If the receiver gets bogus filenames from the sender (an unexpected
|
||||
leading slash or a ".." infix dir), exit with an error. This prevents a
|
||||
malicious sender from trying to inject filenames that would affect an
|
||||
area outside the destination directories.
|
||||
|
||||
- Fixed a failure to remove the partial-transfer temp file when interrupted
|
||||
(and rsync is not saving the partial files).
|
||||
|
||||
- Changed the chown/group/xattr-set order to avoid losing some security-
|
||||
related xattr info (that would get cleared by a chown).
|
||||
|
||||
- Fixed a bug in the xattr-finding code that could make a non-root-run
|
||||
receiver not able to find some xattr numbers.
|
||||
|
||||
- Fixed a bug in the early daemon protocol where a timeout failed to be
|
||||
honored (e.g. if the remote side fails to send us the initial protocol
|
||||
greeting).
|
||||
|
||||
- Fixed unintended inclusion of commas in file numbers in the daemon log.
|
||||
|
||||
- We once again send the 'f' sub-flag (of -e) to the server side so it
|
||||
knows that we can handle incremental-recursion directory errors properly
|
||||
in older protocols.
|
||||
|
||||
- Fixed an issue with too-aggressive keep-alive messages causing a problem
|
||||
for older rsync versions early in the transfer.
|
||||
|
||||
- Fixed an incorrect message about backup-directory-creation when using
|
||||
--dry-run and the backup dir is not an absolute path.
|
||||
|
||||
- Fixed a bug where a failed deletion and/or a failed sender-side removal
|
||||
would not affect the exit code.
|
||||
|
||||
- Fixed a bug that caused a failure when combining --delete-missing-args
|
||||
with --xattrs and/or --acls.
|
||||
|
||||
- Fixed a strange dir_depth assertion error that was caused by empty-dir
|
||||
removals and/or duplicate files in the transfer.
|
||||
|
||||
- Fixed a problem with --info=progress2's output stats where rsync would
|
||||
only update the stats at the end of each file's transfer. It now uses
|
||||
the data that is flowing for the current file, making the stats more
|
||||
accurate and less jumpy.
|
||||
|
||||
- Fixed an itemize bug that affected the combo of --link-dest, -X, and -n.
|
||||
|
||||
- Fixed a problem with delete messages not appearing in the log file when
|
||||
the user didn't use --verbose.
|
||||
|
||||
- Improve chunked xattr reading for OS X.
|
||||
|
||||
- Removed an attempted hard-link xattr optimization that was causing a
|
||||
transfer failure. This removal is flagged in the compatibility code, so
|
||||
if a better fix can be discovered, we have a way to flip it on again.
|
||||
|
||||
- Fixed a bug when the receiver is not configured to be able to hard link
|
||||
symlimks/devices/special-file items but the sender sent some of these
|
||||
items flagged as hard-linked.
|
||||
|
||||
- We now generate a better error if the buffer overflows in do_mknod().
|
||||
|
||||
- Fixed a problem reading more than 16 ACLs on some OSes.
|
||||
|
||||
- Fixed the reading of the secrets file to avoid an infinite wait when
|
||||
the username is missing.
|
||||
|
||||
- Fixed a parsing problem in the --usermap/--groupmap options when using
|
||||
MIN-MAX numbers.
|
||||
|
||||
- Switched Cygwin back to using socketpair "pipes" to try to speed it up.
|
||||
|
||||
- Added knowledge of a few new options to rrsync.
|
||||
|
||||
ENHANCEMENTS:
|
||||
|
||||
- Tweaked the temp-file naming when --temp-dir=DIR is used: the temp-file
|
||||
names will not get a '.' prepended.
|
||||
|
||||
- Added support for a new-compression idiom that does not compress all the
|
||||
matching data in a transfer. This can help rsync to use less cpu when a
|
||||
transfer has a lot of matching data, and also makes rsync compatible with
|
||||
a non-bundled zlib. See the --new-compress and --old-compress options in
|
||||
the manpage.
|
||||
|
||||
- Added the support/rsync-no-vanished wrapper script.
|
||||
|
||||
- Made configure more prominently mention when we failed to find yodl (in
|
||||
case the user wants to be able to generate manpages from *.yo files).
|
||||
|
||||
- Have manpage mention how a daemon's max-verbosity setting affects info
|
||||
and debug options. Also added more clarification on backslash removals
|
||||
for excludes that contain wildcards.
|
||||
|
||||
- Have configure check if for the attr lib (for getxattr) for those systems
|
||||
that need to link against it explicitly.
|
||||
|
||||
- Change the early dir-creation logic to only use that idiom in an
|
||||
inc-recursive copy that is preserving directory times. e.g. using
|
||||
--omit-dir-times will avoid these early directories being created.
|
||||
|
||||
- Fix a bug in cmp_time() that would return a wrong result if the 2 times
|
||||
differed by an amount greater than what a time_t can hold.
|
||||
|
||||
DEVELOPER RELATED:
|
||||
|
||||
- We now include an example systemd file (in packaging/systemd).
|
||||
|
||||
- Tweaked configure to make sure that any intended use of the included popt
|
||||
and/or zlib code is put early in the CFLAGS.
|
||||
|
||||
NEWS for rsync 3.1.0 (28 Sep 2013)
|
||||
Protocol: 31 (changed)
|
||||
Changes since 3.0.9:
|
||||
@@ -3534,6 +3650,7 @@ Changes since 2.4.6:
|
||||
|
||||
Partial Protocol History
|
||||
RELEASE DATE VER. DATE OF COMMIT* PROTOCOL
|
||||
21 Dec 2015 3.1.2 31
|
||||
22 Jun 2014 3.1.1 31
|
||||
28 Sep 2013 3.1.0 31 Aug 2008 31
|
||||
23 Sep 2011 3.0.9 30
|
||||
|
||||
2
access.c
2
access.c
@@ -2,7 +2,7 @@
|
||||
* Routines to authenticate access to a daemon (hosts allow/deny).
|
||||
*
|
||||
* Copyright (C) 1998 Andrew Tridgell
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
|
||||
2
acls.c
2
acls.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2006-2014 Wayne Davison
|
||||
* Copyright (C) 2006-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Support rsync daemon authentication.
|
||||
*
|
||||
* Copyright (C) 1998-2000 Andrew Tridgell
|
||||
* Copyright (C) 2002-2014 Wayne Davison
|
||||
* Copyright (C) 2002-2015 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
|
||||
@@ -279,17 +279,18 @@ char *auth_server(int f_in, int f_out, int module, const char *host,
|
||||
/* See if authorizing user is a real user, and if so, see
|
||||
* if it is in a group that matches tok+1 wildmat. */
|
||||
if (auth_uid_groups_cnt < 0) {
|
||||
gid_t gid_list[64];
|
||||
item_list gid_list = EMPTY_ITEM_LIST;
|
||||
uid_t auth_uid;
|
||||
auth_uid_groups_cnt = sizeof gid_list / sizeof (gid_t);
|
||||
if (!user_to_uid(line, &auth_uid, False)
|
||||
|| getallgroups(auth_uid, gid_list, &auth_uid_groups_cnt) != NULL)
|
||||
|| getallgroups(auth_uid, &gid_list) != NULL)
|
||||
auth_uid_groups_cnt = 0;
|
||||
else {
|
||||
gid_t *gid_array = gid_list.items;
|
||||
auth_uid_groups_cnt = gid_list.count;
|
||||
if ((auth_uid_groups = new_array(char *, auth_uid_groups_cnt)) == NULL)
|
||||
out_of_memory("auth_server");
|
||||
for (j = 0; j < auth_uid_groups_cnt; j++)
|
||||
auth_uid_groups[j] = gid_to_group(gid_list[j]);
|
||||
auth_uid_groups[j] = gid_to_group(gid_array[j]);
|
||||
}
|
||||
}
|
||||
for (j = 0; j < auth_uid_groups_cnt; j++) {
|
||||
|
||||
33
backup.c
33
backup.c
@@ -2,7 +2,7 @@
|
||||
* Backup handling code.
|
||||
*
|
||||
* Copyright (C) 1999 Andrew Tridgell
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -157,6 +157,18 @@ static BOOL copy_valid_path(const char *fname)
|
||||
char *get_backup_name(const char *fname)
|
||||
{
|
||||
if (backup_dir) {
|
||||
static int initialized = 0;
|
||||
if (!initialized) {
|
||||
int ret;
|
||||
if (backup_dir_len > 1)
|
||||
backup_dir_buf[backup_dir_len-1] = '\0';
|
||||
ret = make_path(backup_dir_buf, 0);
|
||||
if (backup_dir_len > 1)
|
||||
backup_dir_buf[backup_dir_len-1] = '/';
|
||||
if (ret < 0)
|
||||
return NULL;
|
||||
initialized = 1;
|
||||
}
|
||||
/* copy fname into backup_dir_buf while validating the dirs. */
|
||||
if (copy_valid_path(fname))
|
||||
return backup_dir_buf;
|
||||
@@ -208,23 +220,24 @@ static inline int link_or_rename(const char *from, const char *to,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Hard-link, rename, or copy an item to the backup name. Returns 2 if item
|
||||
* was duplicated into backup area, 1 if item was moved, or 0 for failure.*/
|
||||
/* Hard-link, rename, or copy an item to the backup name. Returns 0 for
|
||||
* failure, 1 if item was moved, 2 if item was duplicated or hard linked
|
||||
* into backup area, or 3 if item doesn't exist or isn't a regular file. */
|
||||
int make_backup(const char *fname, BOOL prefer_rename)
|
||||
{
|
||||
stat_x sx;
|
||||
struct file_struct *file;
|
||||
int save_preserve_xattrs;
|
||||
char *buf = get_backup_name(fname);
|
||||
char *buf;
|
||||
int ret = 0;
|
||||
|
||||
if (!buf)
|
||||
return 0;
|
||||
|
||||
init_stat_x(&sx);
|
||||
/* Return success if no file to keep. */
|
||||
if (x_lstat(fname, &sx.st, NULL) < 0)
|
||||
return 1;
|
||||
return 3;
|
||||
|
||||
if (!(buf = get_backup_name(fname)))
|
||||
return 0;
|
||||
|
||||
/* Try a hard-link or a rename first. Using rename is not atomic, but
|
||||
* is more efficient than forcing a copy for larger files when no hard-
|
||||
@@ -244,7 +257,7 @@ int make_backup(const char *fname, BOOL prefer_rename)
|
||||
|
||||
/* Fall back to making a copy. */
|
||||
if (!(file = make_file(fname, NULL, &sx.st, 0, NO_FILTERS)))
|
||||
return 1; /* the file could have disappeared */
|
||||
return 3; /* the file could have disappeared */
|
||||
|
||||
#ifdef SUPPORT_ACLS
|
||||
if (preserve_acls && !S_ISLNK(file->mode)) {
|
||||
@@ -299,7 +312,7 @@ int make_backup(const char *fname, BOOL prefer_rename)
|
||||
#ifdef SUPPORT_XATTRS
|
||||
uncache_tmp_xattrs();
|
||||
#endif
|
||||
return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* Copy to backup tree if a file. */
|
||||
|
||||
2
batch.c
2
batch.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1999 Weiss
|
||||
* Copyright (C) 2004 Chris Shoemaker
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Simple byteorder handling.
|
||||
*
|
||||
* Copyright (C) 1992-1995 Andrew Tridgell
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
2
case_N.h
2
case_N.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Allow an arbitrary sequence of case labels.
|
||||
*
|
||||
* Copyright (C) 2006-2014 Wayne Davison
|
||||
* Copyright (C) 2006-2015 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
|
||||
|
||||
19
checksum.c
19
checksum.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
extern int checksum_seed;
|
||||
extern int protocol_version;
|
||||
extern int proper_seed_order;
|
||||
|
||||
/*
|
||||
a simple 32 bit checksum that can be upadted from either end
|
||||
@@ -54,10 +55,18 @@ void get_checksum2(char *buf, int32 len, char *sum)
|
||||
if (protocol_version >= 30) {
|
||||
uchar seedbuf[4];
|
||||
md5_begin(&m);
|
||||
md5_update(&m, (uchar *)buf, len);
|
||||
if (checksum_seed) {
|
||||
SIVALu(seedbuf, 0, checksum_seed);
|
||||
md5_update(&m, seedbuf, 4);
|
||||
if (proper_seed_order) {
|
||||
if (checksum_seed) {
|
||||
SIVALu(seedbuf, 0, checksum_seed);
|
||||
md5_update(&m, seedbuf, 4);
|
||||
}
|
||||
md5_update(&m, (uchar *)buf, len);
|
||||
} else {
|
||||
md5_update(&m, (uchar *)buf, len);
|
||||
if (checksum_seed) {
|
||||
SIVALu(seedbuf, 0, checksum_seed);
|
||||
md5_update(&m, seedbuf, 4);
|
||||
}
|
||||
}
|
||||
md5_result(&m, (uchar *)sum);
|
||||
} else {
|
||||
|
||||
2
chmod.c
2
chmod.c
@@ -2,7 +2,7 @@
|
||||
* Implement the core of the --chmod option.
|
||||
*
|
||||
* Copyright (C) 2002 Scott Howard
|
||||
* Copyright (C) 2005-2014 Wayne Davison
|
||||
* Copyright (C) 2005-2015 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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "rsync.h"
|
||||
|
||||
extern int dry_run;
|
||||
extern int am_server;
|
||||
extern int am_daemon;
|
||||
extern int am_receiver;
|
||||
@@ -232,8 +233,9 @@ NORETURN void _exit_cleanup(int code, const char *file, int line)
|
||||
if (DEBUG_GTE(EXIT, 1)) {
|
||||
rprintf(FINFO,
|
||||
"[%s] _exit_cleanup(code=%d, file=%s, line=%d): "
|
||||
"about to call exit(%d)\n",
|
||||
who_am_i(), first_code, exit_file, exit_line, exit_code);
|
||||
"about to call exit(%d)%s\n",
|
||||
who_am_i(), first_code, exit_file, exit_line, exit_code,
|
||||
dry_run ? " (DRY RUN)" : "");
|
||||
}
|
||||
|
||||
/* FALLTHROUGH */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1992-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2002-2014 Wayne Davison
|
||||
* Copyright (C) 2002-2015 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 2001-2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2002-2014 Wayne Davison
|
||||
* Copyright (C) 2002-2015 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
|
||||
@@ -60,8 +60,6 @@ extern char *iconv_opt;
|
||||
extern iconv_t ic_send, ic_recv;
|
||||
#endif
|
||||
|
||||
#define MAX_GID_LIST 32
|
||||
|
||||
char *auth_user;
|
||||
int read_only = 0;
|
||||
int module_id = -1;
|
||||
@@ -81,8 +79,7 @@ static int rl_nulls = 0;
|
||||
static struct sigaction sigact;
|
||||
#endif
|
||||
|
||||
static gid_t gid_list[MAX_GID_LIST];
|
||||
static int gid_count = 0;
|
||||
static item_list gid_list = EMPTY_ITEM_LIST;
|
||||
|
||||
/* Used when "reverse lookup" is off. */
|
||||
const char undetermined_hostname[] = "UNDETERMINED";
|
||||
@@ -438,18 +435,14 @@ static int path_failure(int f_out, const char *dir, BOOL was_chdir)
|
||||
|
||||
static int add_a_group(int f_out, const char *gname)
|
||||
{
|
||||
gid_t gid;
|
||||
gid_t gid, *gid_p;
|
||||
if (!group_to_gid(gname, &gid, True)) {
|
||||
rprintf(FLOG, "Invalid gid %s\n", gname);
|
||||
io_printf(f_out, "@ERROR: invalid gid %s\n", gname);
|
||||
return -1;
|
||||
}
|
||||
if (gid_count == MAX_GID_LIST) {
|
||||
rprintf(FLOG, "Too many groups specified via gid parameter.\n");
|
||||
io_printf(f_out, "@ERROR: too many groups\n");
|
||||
return -1;
|
||||
}
|
||||
gid_list[gid_count++] = gid;
|
||||
gid_p = EXPAND_ITEM_LIST(&gid_list, gid_t, -32);
|
||||
*gid_p = gid;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -457,8 +450,7 @@ static int add_a_group(int f_out, const char *gname)
|
||||
static int want_all_groups(int f_out, uid_t uid)
|
||||
{
|
||||
const char *err;
|
||||
gid_count = MAX_GID_LIST;
|
||||
if ((err = getallgroups(uid, gid_list, &gid_count)) != NULL) {
|
||||
if ((err = getallgroups(uid, &gid_list)) != NULL) {
|
||||
rsyserr(FLOG, errno, "%s", err);
|
||||
io_printf(f_out, "@ERROR: %s\n", err);
|
||||
return -1;
|
||||
@@ -469,14 +461,15 @@ static int want_all_groups(int f_out, uid_t uid)
|
||||
static struct passwd *want_all_groups(int f_out, uid_t uid)
|
||||
{
|
||||
struct passwd *pw;
|
||||
gid_t *gid_p;
|
||||
if ((pw = getpwuid(uid)) == NULL) {
|
||||
rsyserr(FLOG, errno, "getpwuid failed");
|
||||
io_printf(f_out, "@ERROR: getpwuid failed\n");
|
||||
return NULL;
|
||||
}
|
||||
/* Start with the default group and initgroups() will add the reset. */
|
||||
gid_count = 1;
|
||||
gid_list[0] = pw->pw_gid;
|
||||
/* Start with the default group and initgroups() will add the rest. */
|
||||
gid_p = EXPAND_ITEM_LIST(&gid_list, gid_t, -32);
|
||||
*gid_p = pw->pw_gid;
|
||||
return pw;
|
||||
}
|
||||
#endif
|
||||
@@ -818,15 +811,16 @@ static int rsync_module(int f_in, int f_out, int i, const char *addr, const char
|
||||
}
|
||||
}
|
||||
|
||||
if (gid_count) {
|
||||
if (setgid(gid_list[0])) {
|
||||
rsyserr(FLOG, errno, "setgid %ld failed", (long)gid_list[0]);
|
||||
if (gid_list.count) {
|
||||
gid_t *gid_array = gid_list.items;
|
||||
if (setgid(gid_array[0])) {
|
||||
rsyserr(FLOG, errno, "setgid %ld failed", (long)gid_array[0]);
|
||||
io_printf(f_out, "@ERROR: setgid failed\n");
|
||||
return -1;
|
||||
}
|
||||
#ifdef HAVE_SETGROUPS
|
||||
/* Set the group(s) we want to be active. */
|
||||
if (setgroups(gid_count, gid_list)) {
|
||||
if (setgroups(gid_list.count, gid_array)) {
|
||||
rsyserr(FLOG, errno, "setgroups failed");
|
||||
io_printf(f_out, "@ERROR: setgroups failed\n");
|
||||
return -1;
|
||||
|
||||
9
compat.c
9
compat.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) Andrew Tridgell 1996
|
||||
* Copyright (C) Paul Mackerras 1996
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
@@ -27,6 +27,7 @@ int inc_recurse = 0;
|
||||
int compat_flags = 0;
|
||||
int use_safe_inc_flist = 0;
|
||||
int want_xattr_optim = 0;
|
||||
int proper_seed_order = 0;
|
||||
|
||||
extern int am_server;
|
||||
extern int am_sender;
|
||||
@@ -78,6 +79,7 @@ int filesfrom_convert = 0;
|
||||
#define CF_SYMLINK_ICONV (1<<2)
|
||||
#define CF_SAFE_FLIST (1<<3)
|
||||
#define CF_AVOID_XATTR_OPTIM (1<<4)
|
||||
#define CF_CHKSUM_SEED_FIX (1<<5)
|
||||
|
||||
static const char *client_info;
|
||||
|
||||
@@ -271,12 +273,15 @@ void setup_protocol(int f_out,int f_in)
|
||||
compat_flags |= CF_SAFE_FLIST;
|
||||
if (local_server || strchr(client_info, 'x') != NULL)
|
||||
compat_flags |= CF_AVOID_XATTR_OPTIM;
|
||||
if (local_server || strchr(client_info, 'C') != NULL)
|
||||
compat_flags |= CF_CHKSUM_SEED_FIX;
|
||||
write_byte(f_out, compat_flags);
|
||||
} else
|
||||
compat_flags = read_byte(f_in);
|
||||
/* The inc_recurse var MUST be set to 0 or 1. */
|
||||
inc_recurse = compat_flags & CF_INC_RECURSE ? 1 : 0;
|
||||
want_xattr_optim = protocol_version >= 31 && !(compat_flags & CF_AVOID_XATTR_OPTIM);
|
||||
proper_seed_order = compat_flags & CF_CHKSUM_SEED_FIX ? 1 : 0;
|
||||
if (am_sender) {
|
||||
receiver_symlink_times = am_server
|
||||
? strchr(client_info, 'L') != NULL
|
||||
@@ -328,7 +333,7 @@ void setup_protocol(int f_out,int f_in)
|
||||
|
||||
if (am_server) {
|
||||
if (!checksum_seed)
|
||||
checksum_seed = time(NULL);
|
||||
checksum_seed = time(NULL) ^ (getpid() << 6);
|
||||
write_int(f_out, checksum_seed);
|
||||
} else {
|
||||
checksum_seed = read_int(f_in);
|
||||
|
||||
200
configure.ac
200
configure.ac
@@ -1,20 +1,25 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT()
|
||||
AC_INIT([rsync],[3.1.2],[http://rsync.samba.org/bugzilla.html])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_SRCDIR([byteorder.h])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_PREREQ(2.60)
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
RSYNC_VERSION=3.1.1
|
||||
AC_SUBST(RSYNC_VERSION)
|
||||
AC_MSG_NOTICE([Configuring rsync $RSYNC_VERSION])
|
||||
AC_SUBST(RSYNC_VERSION, $PACKAGE_VERSION)
|
||||
AC_MSG_NOTICE([Configuring rsync $PACKAGE_VERSION])
|
||||
|
||||
AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$RSYNC_VERSION"], [rsync release version])
|
||||
AC_DEFINE_UNQUOTED(RSYNC_VERSION, ["$PACKAGE_VERSION"], [rsync release version])
|
||||
|
||||
LDFLAGS=${LDFLAGS-""}
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl define the directory for replacement function since AC_LIBOBJ does not
|
||||
dnl officially support subdirs and fails with automake
|
||||
AC_CONFIG_LIBOBJ_DIR([lib])
|
||||
|
||||
# We must decide this before testing the compiler.
|
||||
|
||||
# Please allow this to default to yes, so that your users have more
|
||||
@@ -22,8 +27,7 @@ AC_CANONICAL_HOST
|
||||
|
||||
AC_MSG_CHECKING([whether to include debugging symbols])
|
||||
AC_ARG_ENABLE(debug,
|
||||
AC_HELP_STRING([--disable-debug],
|
||||
[disable debugging symbols and features]))
|
||||
AS_HELP_STRING([--disable-debug],[disable debugging symbols and features]))
|
||||
|
||||
if test x"$enable_debug" = x"no"; then
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -42,6 +46,7 @@ AC_PROG_INSTALL
|
||||
AC_PROG_MKDIR_P
|
||||
AC_PROG_CC_STDC
|
||||
AC_SUBST(SHELL)
|
||||
AC_PATH_PROG([PERL], [perl])
|
||||
|
||||
AC_DEFINE([_GNU_SOURCE], 1,
|
||||
[Define _GNU_SOURCE so that we get all necessary prototypes])
|
||||
@@ -51,8 +56,7 @@ if test x"$ac_cv_prog_cc_stdc" = x"no"; then
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(profile,
|
||||
AC_HELP_STRING([--enable-profile],
|
||||
[turn on CPU profiling]))
|
||||
AS_HELP_STRING([--enable-profile],[turn on CPU profiling]))
|
||||
if test x"$enable_profile" = x"yes"; then
|
||||
CFLAGS="$CFLAGS -pg"
|
||||
fi
|
||||
@@ -60,8 +64,7 @@ fi
|
||||
|
||||
# Specifically, this turns on panic_action handling.
|
||||
AC_ARG_ENABLE(maintainer-mode,
|
||||
AC_HELP_STRING([--enable-maintainer-mode],
|
||||
[turn on extra debug features]))
|
||||
AS_HELP_STRING([--enable-maintainer-mode],[turn on extra debug features]))
|
||||
if test x"$enable_maintainer_mode" = x"yes"; then
|
||||
CFLAGS="$CFLAGS -DMAINTAINER_MODE"
|
||||
fi
|
||||
@@ -77,26 +80,26 @@ if test x"$GCC" = x"yes"; then
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(included-popt,
|
||||
AC_HELP_STRING([--with-included-popt], [use bundled popt library, not from system]))
|
||||
AS_HELP_STRING([--with-included-popt],[use bundled popt library, not from system]))
|
||||
|
||||
AC_ARG_WITH(included-zlib,
|
||||
AC_HELP_STRING([--with-included-zlib], [use bundled zlib library, not from system]))
|
||||
AS_HELP_STRING([--with-included-zlib],[use bundled zlib library, not from system]))
|
||||
|
||||
AC_ARG_WITH(protected-args,
|
||||
AC_HELP_STRING([--with-protected-args], [make --protected-args option the default]))
|
||||
AS_HELP_STRING([--with-protected-args],[make --protected-args option the default]))
|
||||
if test x"$with_protected_args" = x"yes"; then
|
||||
AC_DEFINE_UNQUOTED(RSYNC_USE_PROTECTED_ARGS, 1, [Define to 1 if --protected-args should be the default])
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(rsync-path,
|
||||
AC_HELP_STRING([--with-rsync-path=PATH], [set default --rsync-path to PATH (default: rsync)]),
|
||||
AS_HELP_STRING([--with-rsync-path=PATH],[set default --rsync-path to PATH (default: rsync)]),
|
||||
[ RSYNC_PATH="$with_rsync_path" ],
|
||||
[ RSYNC_PATH="rsync" ])
|
||||
|
||||
AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])
|
||||
|
||||
AC_ARG_WITH(rsyncd-conf,
|
||||
AC_HELP_STRING([--with-rsyncd-conf=PATH], [set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
|
||||
AS_HELP_STRING([--with-rsyncd-conf=PATH],[set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
|
||||
[ if test ! -z "$with_rsyncd_conf" ; then
|
||||
case $with_rsyncd_conf in
|
||||
yes|no)
|
||||
@@ -117,7 +120,7 @@ AC_ARG_WITH(rsyncd-conf,
|
||||
AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server])
|
||||
|
||||
AC_ARG_WITH(rsh,
|
||||
AC_HELP_STRING([--with-rsh=CMD], [set remote shell command to CMD (default: ssh)]))
|
||||
AS_HELP_STRING([--with-rsh=CMD],[set remote shell command to CMD (default: ssh)]))
|
||||
|
||||
AC_CHECK_PROG(HAVE_REMSH, remsh, 1, 0)
|
||||
if test x$HAVE_REMSH = x1; then
|
||||
@@ -143,8 +146,7 @@ AC_PATH_PROG(SHELL_PATH, sh, /bin/sh, [/usr/xpg4/bin$PATH_SEPARATOR$PATH])
|
||||
AC_PATH_PROG(FAKEROOT_PATH, fakeroot, /usr/bin/fakeroot, [/usr/xpg4/bin$PATH_SEPARATOR$PATH])
|
||||
|
||||
AC_ARG_WITH(nobody-group,
|
||||
AC_HELP_STRING([--with-nobody-group=GROUP],
|
||||
[set the default unprivileged group (default nobody or nogroup)]),
|
||||
AS_HELP_STRING([--with-nobody-group=GROUP],[set the default unprivileged group (default nobody or nogroup)]),
|
||||
[ NOBODY_GROUP="$with_nobody_group" ])
|
||||
|
||||
if test x"$with_nobody_group" = x; then
|
||||
@@ -165,7 +167,7 @@ AC_DEFINE_UNQUOTED(NOBODY_GROUP, "$NOBODY_GROUP", [unprivileged group for unpriv
|
||||
# arrgh. libc in some old debian version screwed up the largefile
|
||||
# stuff, getting byte range locking wrong
|
||||
AC_CACHE_CHECK([for broken largefile support],rsync_cv_HAVE_BROKEN_LARGEFILE,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
@@ -197,8 +199,7 @@ int main(void)
|
||||
unlink(tpl);
|
||||
exit(WEXITSTATUS(status));
|
||||
}
|
||||
],
|
||||
rsync_cv_HAVE_BROKEN_LARGEFILE=yes,rsync_cv_HAVE_BROKEN_LARGEFILE=no,rsync_cv_HAVE_BROKEN_LARGEFILE=cross)])
|
||||
]])],[rsync_cv_HAVE_BROKEN_LARGEFILE=yes],[rsync_cv_HAVE_BROKEN_LARGEFILE=no],[rsync_cv_HAVE_BROKEN_LARGEFILE=cross])])
|
||||
if test x"$rsync_cv_HAVE_BROKEN_LARGEFILE" != x"yes"; then
|
||||
AC_SYS_LARGEFILE
|
||||
fi
|
||||
@@ -208,8 +209,7 @@ ipv6lib=none
|
||||
ipv6trylibc=yes
|
||||
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
AC_HELP_STRING([--disable-ipv6],
|
||||
[do not even try to use IPv6]))
|
||||
AS_HELP_STRING([--disable-ipv6],[do not even try to use IPv6]))
|
||||
if test x"$enable_ipv6" != x"no"; then
|
||||
AC_MSG_CHECKING([ipv6 stack type])
|
||||
for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta cygwin; do
|
||||
@@ -320,8 +320,7 @@ fi
|
||||
|
||||
dnl Do you want to disable use of locale functions
|
||||
AC_ARG_ENABLE([locale],
|
||||
AC_HELP_STRING([--disable-locale],
|
||||
[disable locale features]))
|
||||
AS_HELP_STRING([--disable-locale],[disable locale features]))
|
||||
AH_TEMPLATE([CONFIG_LOCALE],
|
||||
[Undefine if you do not want locale features. By default this is defined.])
|
||||
if test x"$enable_locale" != x"no"; then
|
||||
@@ -352,7 +351,7 @@ AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h \
|
||||
AC_HEADER_MAJOR
|
||||
|
||||
AC_CACHE_CHECK([if makedev takes 3 args],rsync_cv_MAKEDEV_TAKES_3_ARGS,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/types.h>
|
||||
#ifdef MAJOR_IN_MKDEV
|
||||
#include <sys/mkdev.h>
|
||||
@@ -370,8 +369,7 @@ int main(void)
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
||||
],
|
||||
rsync_cv_MAKEDEV_TAKES_3_ARGS=yes,rsync_cv_MAKEDEV_TAKES_3_ARGS=no,rsync_cv_MAKEDEV_TAKES_3_ARGS=no)])
|
||||
]])],[rsync_cv_MAKEDEV_TAKES_3_ARGS=yes],[rsync_cv_MAKEDEV_TAKES_3_ARGS=no],[rsync_cv_MAKEDEV_TAKES_3_ARGS=no])])
|
||||
if test x"$rsync_cv_MAKEDEV_TAKES_3_ARGS" = x"yes"; then
|
||||
AC_DEFINE(MAKEDEV_TAKES_3_ARGS, 1, [Define to 1 if makedev() takes 3 args])
|
||||
fi
|
||||
@@ -390,9 +388,13 @@ AC_CHECK_SIZEOF(off64_t)
|
||||
AC_CHECK_SIZEOF(time_t)
|
||||
|
||||
AC_C_INLINE
|
||||
AC_C_LONG_DOUBLE
|
||||
|
||||
AC_TYPE_SIGNAL
|
||||
AC_TYPE_LONG_DOUBLE_WIDER
|
||||
ac_cv_c_long_double=$ac_cv_type_long_double_wider
|
||||
if test $ac_cv_c_long_double = yes; then
|
||||
AC_DEFINE([HAVE_LONG_DOUBLE],[1],[Define to 1 if the type `long double' works and has more range or precision than `double'.])
|
||||
fi
|
||||
|
||||
AC_TYPE_UID_T
|
||||
AC_CHECK_TYPES([mode_t,off_t,size_t,pid_t,id_t])
|
||||
AC_TYPE_GETGROUPS
|
||||
@@ -412,8 +414,7 @@ AC_CHECK_MEMBERS([struct stat.st_rdev,
|
||||
TYPE_SOCKLEN_T
|
||||
|
||||
AC_CACHE_CHECK([for errno in errno.h],rsync_cv_errno, [
|
||||
AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
|
||||
rsync_cv_errno=yes,rsync_cv_have_errno_decl=no)])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], [[int i = errno]])],[rsync_cv_errno=yes],[rsync_cv_have_errno_decl=no])])
|
||||
if test x"$rsync_cv_errno" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ERRNO_DECL, 1, [Define to 1 if errno is declared in errno.h])
|
||||
fi
|
||||
@@ -464,7 +465,7 @@ AC_SEARCH_LIBS(libiconv_open, iconv)
|
||||
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
@@ -476,7 +477,7 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
||||
]], [[]])],[am_cv_proto_iconv_arg1=""],[am_cv_proto_iconv_arg1="const"])
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
@@ -486,8 +487,7 @@ AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
|
||||
dnl AC_MSG_NOTICE([Looking in libraries: $LIBS])
|
||||
|
||||
AC_CHECK_FUNCS(inet_ntop, , [AC_LIBOBJ(lib/inet_ntop)])
|
||||
AC_CHECK_FUNCS(inet_pton, , [AC_LIBOBJ(lib/inet_pton)])
|
||||
AC_REPLACE_FUNCS([inet_ntop inet_pton])
|
||||
|
||||
AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
|
||||
AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/types.h>
|
||||
@@ -506,23 +506,19 @@ AC_CACHE_CHECK([whether defines needed by getaddrinfo exist],
|
||||
#endif],
|
||||
rsync_cv_HAVE_GETADDR_DEFINES=yes,
|
||||
rsync_cv_HAVE_GETADDR_DEFINES=no)])
|
||||
if test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"; then
|
||||
AS_IF([test x"$rsync_cv_HAVE_GETADDR_DEFINES" = x"yes" -a x"$ac_cv_type_struct_addrinfo" = x"yes"],[
|
||||
# Tru64 UNIX has getaddrinfo() but has it renamed in libc as
|
||||
# something else so we must include <netdb.h> to get the
|
||||
# redefinition.
|
||||
AC_CHECK_FUNCS(getaddrinfo, ,
|
||||
[AC_MSG_CHECKING([for getaddrinfo by including <netdb.h>])
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>],[getaddrinfo(NULL, NULL, NULL, NULL);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
#include <netdb.h>]], [[getaddrinfo(NULL, NULL, NULL, NULL);]])],[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_GETADDRINFO, 1,
|
||||
[Define to 1 if you have the "getaddrinfo" function and required types.])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_LIBOBJ(lib/getaddrinfo)])])
|
||||
else
|
||||
AC_LIBOBJ(lib/getaddrinfo)
|
||||
fi
|
||||
[Define to 1 if you have the "getaddrinfo" function and required types.])],[AC_MSG_RESULT([no])
|
||||
AC_LIBOBJ([getaddrinfo])])])
|
||||
],[AC_LIBOBJ([getaddrinfo])])
|
||||
|
||||
AC_CHECK_MEMBER([struct sockaddr.sa_len],
|
||||
[ AC_DEFINE(HAVE_SOCKADDR_LEN, 1, [Do we have sockaddr.sa_len?]) ],
|
||||
@@ -602,7 +598,7 @@ AC_CHECK_FUNCS(waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
|
||||
setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
|
||||
seteuid strerror putenv iconv_open locale_charset nl_langinfo getxattr \
|
||||
extattr_get_link sigaction sigprocmask setattrlist getgrouplist \
|
||||
initgroups utimensat posix_fallocate attropen setvbuf)
|
||||
initgroups utimensat posix_fallocate attropen setvbuf usleep)
|
||||
|
||||
dnl cygwin iconv.h defines iconv_open as libiconv_open
|
||||
if test x"$ac_cv_func_iconv_open" != x"yes"; then
|
||||
@@ -612,19 +608,15 @@ fi
|
||||
dnl Preallocation stuff (also fallocate, posix_fallocate function tests above):
|
||||
|
||||
AC_CACHE_CHECK([for useable fallocate],rsync_cv_have_fallocate,[
|
||||
AC_TRY_LINK([#include <fcntl.h>
|
||||
#include <sys/types.h>],
|
||||
[fallocate(0, 0, 0, 0);],
|
||||
rsync_cv_have_fallocate=yes,rsync_cv_have_fallocate=no)])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>
|
||||
#include <sys/types.h>]], [[fallocate(0, 0, 0, 0);]])],[rsync_cv_have_fallocate=yes],[rsync_cv_have_fallocate=no])])
|
||||
if test x"$rsync_cv_have_fallocate" = x"yes"; then
|
||||
AC_DEFINE(HAVE_FALLOCATE, 1, [Define to 1 if you have the fallocate function and it compiles and links without error])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for SYS_fallocate],rsync_cv_have_sys_fallocate,[
|
||||
AC_TRY_COMPILE([#include <sys/syscall.h>
|
||||
#include <sys/types.h>],
|
||||
[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);],
|
||||
rsync_cv_have_sys_fallocate=yes,rsync_cv_have_sys_fallocate=no)])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/syscall.h>
|
||||
#include <sys/types.h>]], [[syscall(SYS_fallocate, 0, 0, (loff_t)0, (loff_t)0);]])],[rsync_cv_have_sys_fallocate=yes],[rsync_cv_have_sys_fallocate=no])])
|
||||
if test x"$rsync_cv_have_sys_fallocate" = x"yes"; then
|
||||
AC_DEFINE(HAVE_SYS_FALLOCATE, 1, [Define to 1 if you have the SYS_fallocate syscall number])
|
||||
fi
|
||||
@@ -651,8 +643,7 @@ if test $ac_cv_func_getpgrp = yes; then
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(iconv-open,
|
||||
AC_HELP_STRING([--disable-iconv-open],
|
||||
[disable all use of iconv_open() function]),
|
||||
AS_HELP_STRING([--disable-iconv-open],[disable all use of iconv_open() function]),
|
||||
[], [enable_iconv_open=$ac_cv_func_iconv_open])
|
||||
|
||||
if test x"$enable_iconv_open" != x"no"; then
|
||||
@@ -660,8 +651,7 @@ if test x"$enable_iconv_open" != x"no"; then
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(iconv,
|
||||
AC_HELP_STRING([--disable-iconv],
|
||||
[disable rsync's --iconv option]),
|
||||
AS_HELP_STRING([--disable-iconv],[disable rsync's --iconv option]),
|
||||
[], [enable_iconv=$enable_iconv_open])
|
||||
AH_TEMPLATE([ICONV_OPTION],
|
||||
[Define if you want the --iconv option. Specifing a value will set the
|
||||
@@ -676,7 +666,7 @@ if test x"$enable_iconv" != x"no"; then
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symlink,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@@ -688,14 +678,13 @@ AC_CACHE_CHECK([whether chown() modifies symlinks],rsync_cv_chown_modifies_symli
|
||||
if (symlink("conftest.no-such", dangling_symlink) < 0) abort();
|
||||
if (chown(dangling_symlink, getuid(), getgid()) < 0 && errno == ENOENT) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_chown_modifies_symlink=yes,rsync_cv_chown_modifies_symlink=no,rsync_cv_chown_modifies_symlink=no)])
|
||||
}]])],[rsync_cv_chown_modifies_symlink=yes],[rsync_cv_chown_modifies_symlink=no],[rsync_cv_chown_modifies_symlink=no])])
|
||||
if test $rsync_cv_chown_modifies_symlink = yes; then
|
||||
AC_DEFINE(CHOWN_MODIFIES_SYMLINK, 1, [Define to 1 if chown modifies symlinks.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_symlink,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@@ -708,14 +697,13 @@ AC_CACHE_CHECK([whether link() can hard-link symlinks],rsync_cv_can_hardlink_sym
|
||||
unlink(FILENAME "2");
|
||||
if (link(FILENAME, FILENAME "2") < 0) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_can_hardlink_symlink=yes,rsync_cv_can_hardlink_symlink=no,rsync_cv_can_hardlink_symlink=no)])
|
||||
}]])],[rsync_cv_can_hardlink_symlink=yes],[rsync_cv_can_hardlink_symlink=no],[rsync_cv_can_hardlink_symlink=no])])
|
||||
if test $rsync_cv_can_hardlink_symlink = yes; then
|
||||
AC_DEFINE(CAN_HARDLINK_SYMLINK, 1, [Define to 1 if link() can hard-link symlinks.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlink_special,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#if HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@@ -728,27 +716,25 @@ AC_CACHE_CHECK([whether link() can hard-link special files],rsync_cv_can_hardlin
|
||||
unlink(FILENAME "2");
|
||||
if (link(FILENAME, FILENAME "2") < 0) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_can_hardlink_special=yes,rsync_cv_can_hardlink_special=no,rsync_cv_can_hardlink_special=no)])
|
||||
}]])],[rsync_cv_can_hardlink_special=yes],[rsync_cv_can_hardlink_special=no],[rsync_cv_can_hardlink_special=no])])
|
||||
if test $rsync_cv_can_hardlink_special = yes; then
|
||||
AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
main() {
|
||||
int fd[2];
|
||||
exit((socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != -1) ? 0 : 1);
|
||||
}],
|
||||
rsync_cv_HAVE_SOCKETPAIR=yes,rsync_cv_HAVE_SOCKETPAIR=no,rsync_cv_HAVE_SOCKETPAIR=cross)])
|
||||
}]])],[rsync_cv_HAVE_SOCKETPAIR=yes],[rsync_cv_HAVE_SOCKETPAIR=no],[rsync_cv_HAVE_SOCKETPAIR=cross])])
|
||||
if test x"$rsync_cv_HAVE_SOCKETPAIR" = x"yes"; then
|
||||
AC_DEFINE(HAVE_SOCKETPAIR, 1, [Define to 1 if you have the "socketpair" function])
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(getpass, , [AC_LIBOBJ(lib/getpass)])
|
||||
AC_REPLACE_FUNCS([getpass])
|
||||
|
||||
if test x"$with_included_popt" != x"yes"; then
|
||||
AC_CHECK_LIB(popt, poptGetContext, , [with_included_popt=yes])
|
||||
@@ -799,43 +785,37 @@ else
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for unsigned char],rsync_cv_SIGNED_CHAR_OK,[
|
||||
AC_TRY_COMPILE([],[signed char *s = ""],
|
||||
rsync_cv_SIGNED_CHAR_OK=yes,rsync_cv_SIGNED_CHAR_OK=no)])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[signed char *s = ""]])],[rsync_cv_SIGNED_CHAR_OK=yes],[rsync_cv_SIGNED_CHAR_OK=no])])
|
||||
if test x"$rsync_cv_SIGNED_CHAR_OK" = x"yes"; then
|
||||
AC_DEFINE(SIGNED_CHAR_OK, 1, [Define to 1 if "signed char" is a valid type])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for broken readdir],rsync_cv_HAVE_BROKEN_READDIR,[
|
||||
AC_TRY_RUN([#include <sys/types.h>
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
|
||||
if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
|
||||
di->d_name[0] == 0) exit(0); exit(1);} ],
|
||||
rsync_cv_HAVE_BROKEN_READDIR=yes,rsync_cv_HAVE_BROKEN_READDIR=no,rsync_cv_HAVE_BROKEN_READDIR=cross)])
|
||||
di->d_name[0] == 0) exit(0); exit(1);} ]])],[rsync_cv_HAVE_BROKEN_READDIR=yes],[rsync_cv_HAVE_BROKEN_READDIR=no],[rsync_cv_HAVE_BROKEN_READDIR=cross])])
|
||||
if test x"$rsync_cv_HAVE_BROKEN_READDIR" = x"yes"; then
|
||||
AC_DEFINE(HAVE_BROKEN_READDIR, 1, [Define to 1 if readdir() is broken])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for utimbuf],rsync_cv_HAVE_STRUCT_UTIMBUF,[
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <utime.h>],
|
||||
[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
|
||||
rsync_cv_HAVE_STRUCT_UTIMBUF=yes,rsync_cv_HAVE_STRUCT_UTIMBUF=no)])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <utime.h>]], [[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));]])],[rsync_cv_HAVE_STRUCT_UTIMBUF=yes],[rsync_cv_HAVE_STRUCT_UTIMBUF=no])])
|
||||
if test x"$rsync_cv_HAVE_STRUCT_UTIMBUF" = x"yes"; then
|
||||
AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if you have the "struct utimbuf" type])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([if gettimeofday takes tz argument],rsync_cv_HAVE_GETTIMEOFDAY_TZ,[
|
||||
AC_TRY_COMPILE([#include <sys/time.h>
|
||||
#include <unistd.h>],
|
||||
[struct timeval tv; exit(gettimeofday(&tv, NULL));],
|
||||
rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes,rsync_cv_HAVE_GETTIMEOFDAY_TZ=no)])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/time.h>
|
||||
#include <unistd.h>]], [[struct timeval tv; exit(gettimeofday(&tv, NULL));]])],[rsync_cv_HAVE_GETTIMEOFDAY_TZ=yes],[rsync_cv_HAVE_GETTIMEOFDAY_TZ=no])])
|
||||
if test x"$rsync_cv_HAVE_GETTIMEOFDAY_TZ" != x"no"; then
|
||||
AC_DEFINE(HAVE_GETTIMEOFDAY_TZ, 1, [Define to 1 if gettimeofday() takes a time-zone arg])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
void foo(const char *format, ...) {
|
||||
@@ -853,15 +833,14 @@ void foo(const char *format, ...) {
|
||||
exit(0);
|
||||
}
|
||||
main() { foo("hello"); }
|
||||
],
|
||||
rsync_cv_HAVE_C99_VSNPRINTF=yes,rsync_cv_HAVE_C99_VSNPRINTF=no,rsync_cv_HAVE_C99_VSNPRINTF=cross)])
|
||||
]])],[rsync_cv_HAVE_C99_VSNPRINTF=yes],[rsync_cv_HAVE_C99_VSNPRINTF=no],[rsync_cv_HAVE_C99_VSNPRINTF=cross])])
|
||||
if test x"$rsync_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
|
||||
AC_DEFINE(HAVE_C99_VSNPRINTF, 1, [Define to 1 if vsprintf has a C99-compatible return value])
|
||||
fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([for secure mkstemp],rsync_cv_HAVE_SECURE_MKSTEMP,[
|
||||
AC_TRY_RUN([#include <stdlib.h>
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
@@ -874,10 +853,7 @@ main() {
|
||||
if (fstat(fd, &st) != 0) exit(1);
|
||||
if ((st.st_mode & 0777) != 0600) exit(1);
|
||||
exit(0);
|
||||
}],
|
||||
rsync_cv_HAVE_SECURE_MKSTEMP=yes,
|
||||
rsync_cv_HAVE_SECURE_MKSTEMP=no,
|
||||
rsync_cv_HAVE_SECURE_MKSTEMP=cross)])
|
||||
}]])],[rsync_cv_HAVE_SECURE_MKSTEMP=yes],[rsync_cv_HAVE_SECURE_MKSTEMP=no],[rsync_cv_HAVE_SECURE_MKSTEMP=cross])])
|
||||
if test x"$rsync_cv_HAVE_SECURE_MKSTEMP" = x"yes"; then
|
||||
case $host_os in
|
||||
hpux*)
|
||||
@@ -894,29 +870,27 @@ fi
|
||||
|
||||
|
||||
AC_CACHE_CHECK([if mknod creates FIFOs],rsync_cv_MKNOD_CREATES_FIFOS,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
main() { int rc, ec; char *fn = "fifo-test";
|
||||
unlink(fn); rc = mknod(fn,S_IFIFO,0600); ec = errno; unlink(fn);
|
||||
if (rc) {printf("(%d %d) ",rc,ec); return ec;}
|
||||
return 0;}],
|
||||
rsync_cv_MKNOD_CREATES_FIFOS=yes,rsync_cv_MKNOD_CREATES_FIFOS=no,rsync_cv_MKNOD_CREATES_FIFOS=cross)])
|
||||
return 0;}]])],[rsync_cv_MKNOD_CREATES_FIFOS=yes],[rsync_cv_MKNOD_CREATES_FIFOS=no],[rsync_cv_MKNOD_CREATES_FIFOS=cross])])
|
||||
if test x"$rsync_cv_MKNOD_CREATES_FIFOS" = x"yes"; then
|
||||
AC_DEFINE(MKNOD_CREATES_FIFOS, 1, [Define to 1 if mknod() can create FIFOs.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([if mknod creates sockets],rsync_cv_MKNOD_CREATES_SOCKETS,[
|
||||
AC_TRY_RUN([
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
main() { int rc, ec; char *fn = "sock-test";
|
||||
unlink(fn); rc = mknod(fn,S_IFSOCK,0600); ec = errno; unlink(fn);
|
||||
if (rc) {printf("(%d %d) ",rc,ec); return ec;}
|
||||
return 0;}],
|
||||
rsync_cv_MKNOD_CREATES_SOCKETS=yes,rsync_cv_MKNOD_CREATES_SOCKETS=no,rsync_cv_MKNOD_CREATES_SOCKETS=cross)])
|
||||
return 0;}]])],[rsync_cv_MKNOD_CREATES_SOCKETS=yes],[rsync_cv_MKNOD_CREATES_SOCKETS=no],[rsync_cv_MKNOD_CREATES_SOCKETS=cross])])
|
||||
if test x"$rsync_cv_MKNOD_CREATES_SOCKETS" = x"yes"; then
|
||||
AC_DEFINE(MKNOD_CREATES_SOCKETS, 1, [Define to 1 if mknod() can create sockets.])
|
||||
fi
|
||||
@@ -963,8 +937,7 @@ AC_CHECK_FUNCS(_acl __acl _facl __facl)
|
||||
|
||||
AC_MSG_CHECKING([whether to support ACLs])
|
||||
AC_ARG_ENABLE(acl-support,
|
||||
AC_HELP_STRING([--disable-acl-support],
|
||||
[disable ACL support]))
|
||||
AS_HELP_STRING([--disable-acl-support],[disable ACL support]))
|
||||
|
||||
if test x"$enable_acl_support" = x"no"; then
|
||||
AC_MSG_RESULT(no)
|
||||
@@ -1010,20 +983,16 @@ else
|
||||
AC_MSG_RESULT(running tests:)
|
||||
AC_CHECK_LIB(acl,acl_get_file)
|
||||
AC_CACHE_CHECK([for ACL support],samba_cv_HAVE_POSIX_ACLS,[
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/acl.h>],
|
||||
[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);],
|
||||
samba_cv_HAVE_POSIX_ACLS=yes,samba_cv_HAVE_POSIX_ACLS=no)])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <sys/acl.h>]], [[ acl_t acl; int entry_id; acl_entry_t *entry_p; return acl_get_entry( acl, entry_id, entry_p);]])],[samba_cv_HAVE_POSIX_ACLS=yes],[samba_cv_HAVE_POSIX_ACLS=no])])
|
||||
AC_MSG_CHECKING(ACL test results)
|
||||
if test x"$samba_cv_HAVE_POSIX_ACLS" = x"yes"; then
|
||||
AC_MSG_RESULT(Using posix ACLs)
|
||||
AC_DEFINE(HAVE_POSIX_ACLS, 1, [true if you have posix ACLs])
|
||||
AC_DEFINE(SUPPORT_ACLS, 1)
|
||||
AC_CACHE_CHECK([for acl_get_perm_np],samba_cv_HAVE_ACL_GET_PERM_NP,[
|
||||
AC_TRY_LINK([#include <sys/types.h>
|
||||
#include <sys/acl.h>],
|
||||
[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);],
|
||||
samba_cv_HAVE_ACL_GET_PERM_NP=yes,samba_cv_HAVE_ACL_GET_PERM_NP=no)])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
|
||||
#include <sys/acl.h>]], [[ acl_permset_t permset_d; acl_perm_t perm; return acl_get_perm_np( permset_d, perm);]])],[samba_cv_HAVE_ACL_GET_PERM_NP=yes],[samba_cv_HAVE_ACL_GET_PERM_NP=no])])
|
||||
if test x"$samba_cv_HAVE_ACL_GET_PERM_NP" = x"yes"; then
|
||||
AC_DEFINE(HAVE_ACL_GET_PERM_NP, 1, [true if you have acl_get_perm_np])
|
||||
fi
|
||||
@@ -1042,8 +1011,7 @@ fi
|
||||
# check for extended attribute support
|
||||
AC_MSG_CHECKING(whether to support extended attributes)
|
||||
AC_ARG_ENABLE(xattr-support,
|
||||
AC_HELP_STRING([--disable-xattr-support],
|
||||
[disable extended attributes]),
|
||||
AS_HELP_STRING([--disable-xattr-support],[disable extended attributes]),
|
||||
[], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link$ac_cv_func_attropen" in
|
||||
*yes*) enable_xattr_support=maybe ;;
|
||||
*) enable_xattr_support=no ;;
|
||||
@@ -1054,9 +1022,9 @@ if test x"$enable_xattr_support" = x"no"; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
case "$host_os" in
|
||||
*linux*)
|
||||
*linux*|*netbsd*)
|
||||
AC_MSG_RESULT(Using Linux xattrs)
|
||||
AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs])
|
||||
AC_DEFINE(HAVE_LINUX_XATTRS, 1, [True if you have Linux xattrs (or equivalent)])
|
||||
AC_DEFINE(SUPPORT_XATTRS, 1)
|
||||
AC_DEFINE(NO_SYMLINK_USER_XATTRS, 1, [True if symlinks do not support user xattrs])
|
||||
AC_CHECK_LIB(attr,getxattr)
|
||||
@@ -1093,7 +1061,7 @@ if test x"$enable_acl_support" = x"no" -o x"$enable_xattr_support" = x"no" -o x"
|
||||
AC_MSG_CHECKING([whether $CC supports -Wno-unused-parameter])
|
||||
OLD_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Wno-unused-parameter"
|
||||
AC_TRY_LINK([#include <stdio.h>], [printf("hello\n");], [rsync_warn_flag=yes], [rsync_warn_flag=no])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("hello\n");]])],[rsync_warn_flag=yes],[rsync_warn_flag=no])
|
||||
AC_MSG_RESULT([$rsync_warn_flag])
|
||||
if test x"$rsync_warn_flag" = x"no"; then
|
||||
CFLAGS="$OLD_CFLAGS"
|
||||
|
||||
2
delete.c
2
delete.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Error codes returned by rsync.
|
||||
*
|
||||
* Copyright (C) 1998-2000 Andrew Tridgell
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
143
exclude.c
143
exclude.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -100,52 +100,44 @@ static int mergelist_size = 0;
|
||||
|
||||
static void teardown_mergelist(filter_rule *ex)
|
||||
{
|
||||
int j;
|
||||
|
||||
if (!ex->u.mergelist)
|
||||
return;
|
||||
|
||||
if (DEBUG_GTE(FILTER, 2)) {
|
||||
rprintf(FINFO, "[%s] deactivating mergelist #%d%s\n",
|
||||
who_am_i(), mergelist_cnt - 1,
|
||||
ex->u.mergelist->debug_type);
|
||||
}
|
||||
|
||||
/* We should deactivate mergelists in LIFO order. */
|
||||
assert(mergelist_cnt > 0);
|
||||
assert(ex == mergelist_parents[mergelist_cnt - 1]);
|
||||
|
||||
/* The parent_dirscan filters should have been freed. */
|
||||
assert(ex->u.mergelist->parent_dirscan_head == NULL);
|
||||
|
||||
free(ex->u.mergelist->debug_type);
|
||||
free(ex->u.mergelist);
|
||||
mergelist_cnt--;
|
||||
|
||||
for (j = 0; j < mergelist_cnt; j++) {
|
||||
if (mergelist_parents[j] == ex) {
|
||||
mergelist_parents[j] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (mergelist_cnt && mergelist_parents[mergelist_cnt-1] == NULL)
|
||||
mergelist_cnt--;
|
||||
}
|
||||
|
||||
static void free_filter(filter_rule *ex)
|
||||
{
|
||||
if (ex->rflags & FILTRULE_PERDIR_MERGE)
|
||||
teardown_mergelist(ex);
|
||||
free(ex->pattern);
|
||||
free(ex);
|
||||
}
|
||||
|
||||
static void free_filters(filter_rule *head)
|
||||
static void free_filters(filter_rule *ent)
|
||||
{
|
||||
filter_rule *rev_head = NULL;
|
||||
|
||||
/* Reverse the list so we deactivate mergelists in the proper LIFO
|
||||
* order. */
|
||||
while (head) {
|
||||
filter_rule *next = head->next;
|
||||
head->next = rev_head;
|
||||
rev_head = head;
|
||||
head = next;
|
||||
}
|
||||
|
||||
while (rev_head) {
|
||||
filter_rule *prev = rev_head->next;
|
||||
/* Tear down mergelists here, not in free_filter, so that we
|
||||
* affect only real filter lists and not temporarily allocated
|
||||
* filters. */
|
||||
if (rev_head->rflags & FILTRULE_PERDIR_MERGE)
|
||||
teardown_mergelist(rev_head);
|
||||
free_filter(rev_head);
|
||||
rev_head = prev;
|
||||
while (ent) {
|
||||
filter_rule *next = ent->next;
|
||||
free_filter(ent);
|
||||
ent = next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +244,10 @@ static void add_rule(filter_rule_list *listp, const char *pat, unsigned int pat_
|
||||
* add it again. */
|
||||
for (i = 0; i < mergelist_cnt; i++) {
|
||||
filter_rule *ex = mergelist_parents[i];
|
||||
const char *s = strrchr(ex->pattern, '/');
|
||||
const char *s;
|
||||
if (!ex)
|
||||
continue;
|
||||
s = strrchr(ex->pattern, '/');
|
||||
if (s)
|
||||
s++;
|
||||
else
|
||||
@@ -264,9 +259,8 @@ static void add_rule(filter_rule_list *listp, const char *pat, unsigned int pat_
|
||||
}
|
||||
}
|
||||
|
||||
if (!(lp = new_array(filter_rule_list, 1)))
|
||||
if (!(lp = new_array0(filter_rule_list, 1)))
|
||||
out_of_memory("add_rule");
|
||||
lp->head = lp->tail = lp->parent_dirscan_head = NULL;
|
||||
if (asprintf(&lp->debug_type, " [per-dir %s]", cp) < 0)
|
||||
out_of_memory("add_rule");
|
||||
rule->u.mergelist = lp;
|
||||
@@ -297,16 +291,23 @@ static void add_rule(filter_rule_list *listp, const char *pat, unsigned int pat_
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_filter_list(filter_rule_list *listp)
|
||||
/* This frees any non-inherited items, leaving just inherited items on the list. */
|
||||
static void pop_filter_list(filter_rule_list *listp)
|
||||
{
|
||||
if (listp->tail) {
|
||||
/* Truncate any inherited items from the local list. */
|
||||
listp->tail->next = NULL;
|
||||
/* Now free everything that is left. */
|
||||
free_filters(listp->head);
|
||||
}
|
||||
filter_rule *inherited;
|
||||
|
||||
listp->head = listp->tail = NULL;
|
||||
if (!listp->tail)
|
||||
return;
|
||||
|
||||
inherited = listp->tail->next;
|
||||
|
||||
/* Truncate any inherited items from the local list. */
|
||||
listp->tail->next = NULL;
|
||||
/* Now free everything that is left. */
|
||||
free_filters(listp->head);
|
||||
|
||||
listp->head = inherited;
|
||||
listp->tail = NULL;
|
||||
}
|
||||
|
||||
/* This returns an expanded (absolute) filename for the merge-file name if
|
||||
@@ -457,8 +458,6 @@ static BOOL setup_merge_file(int mergelist_num, filter_rule *ex,
|
||||
strlcpy(y, save, MAXPATHLEN);
|
||||
while ((*x++ = *y++) != '/') {}
|
||||
}
|
||||
/* Save current head for freeing when the mergelist becomes inactive. */
|
||||
lp->parent_dirscan_head = lp->head;
|
||||
parent_dirscan = False;
|
||||
if (DEBUG_GTE(FILTER, 2)) {
|
||||
rprintf(FINFO, "[%s] completed parent_dirscan for mergelist #%d%s\n",
|
||||
@@ -501,15 +500,20 @@ void *push_local_filters(const char *dir, unsigned int dirlen)
|
||||
|
||||
push->mergelist_cnt = mergelist_cnt;
|
||||
for (i = 0; i < mergelist_cnt; i++) {
|
||||
memcpy(&push->mergelists[i], mergelist_parents[i]->u.mergelist,
|
||||
sizeof (filter_rule_list));
|
||||
filter_rule *ex = mergelist_parents[i];
|
||||
if (!ex)
|
||||
continue;
|
||||
memcpy(&push->mergelists[i], ex->u.mergelist, sizeof (filter_rule_list));
|
||||
}
|
||||
|
||||
/* Note: parse_filter_file() might increase mergelist_cnt, so keep
|
||||
* this loop separate from the above loop. */
|
||||
for (i = 0; i < mergelist_cnt; i++) {
|
||||
filter_rule *ex = mergelist_parents[i];
|
||||
filter_rule_list *lp = ex->u.mergelist;
|
||||
filter_rule_list *lp;
|
||||
if (!ex)
|
||||
continue;
|
||||
lp = ex->u.mergelist;
|
||||
|
||||
if (DEBUG_GTE(FILTER, 2)) {
|
||||
rprintf(FINFO, "[%s] pushing mergelist #%d%s\n",
|
||||
@@ -553,44 +557,38 @@ void pop_local_filters(void *mem)
|
||||
|
||||
for (i = mergelist_cnt; i-- > 0; ) {
|
||||
filter_rule *ex = mergelist_parents[i];
|
||||
filter_rule_list *lp = ex->u.mergelist;
|
||||
filter_rule_list *lp;
|
||||
if (!ex)
|
||||
continue;
|
||||
lp = ex->u.mergelist;
|
||||
|
||||
if (DEBUG_GTE(FILTER, 2)) {
|
||||
rprintf(FINFO, "[%s] popping mergelist #%d%s\n",
|
||||
who_am_i(), i, lp->debug_type);
|
||||
}
|
||||
|
||||
clear_filter_list(lp);
|
||||
|
||||
if (i >= old_mergelist_cnt) {
|
||||
/* This mergelist does not exist in the state to be
|
||||
* restored. Free its parent_dirscan list to clean up
|
||||
* any per-dir mergelists defined there so we don't
|
||||
* crash trying to restore nonexistent state for them
|
||||
* below. (Counterpart to setup_merge_file call in
|
||||
* push_local_filters. Must be done here, not in
|
||||
* free_filter, for LIFO order.) */
|
||||
pop_filter_list(lp);
|
||||
if (i >= old_mergelist_cnt && lp->head) {
|
||||
/* This mergelist does not exist in the state to be restored, but it
|
||||
* still has inherited rules. This can sometimes happen if a per-dir
|
||||
* merge file calls setup_merge_file() in push_local_filters() and that
|
||||
* leaves some inherited rules that aren't in the pushed list state. */
|
||||
if (DEBUG_GTE(FILTER, 2)) {
|
||||
rprintf(FINFO, "[%s] freeing parent_dirscan filters of mergelist #%d%s\n",
|
||||
who_am_i(), i, ex->u.mergelist->debug_type);
|
||||
}
|
||||
free_filters(lp->parent_dirscan_head);
|
||||
lp->parent_dirscan_head = NULL;
|
||||
pop_filter_list(lp);
|
||||
}
|
||||
}
|
||||
|
||||
/* If we cleaned things up properly, the only still-active mergelists
|
||||
* should be those with a state to be restored. */
|
||||
assert(mergelist_cnt == old_mergelist_cnt);
|
||||
if (!pop)
|
||||
return; /* No state to restore. */
|
||||
|
||||
if (!pop) {
|
||||
/* No state to restore. */
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < mergelist_cnt; i++) {
|
||||
memcpy(mergelist_parents[i]->u.mergelist, &pop->mergelists[i],
|
||||
sizeof (filter_rule_list));
|
||||
for (i = 0; i < old_mergelist_cnt; i++) {
|
||||
filter_rule *ex = mergelist_parents[i];
|
||||
if (!ex)
|
||||
continue;
|
||||
memcpy(ex->u.mergelist, &pop->mergelists[i], sizeof (filter_rule_list));
|
||||
}
|
||||
|
||||
free(pop);
|
||||
@@ -872,7 +870,7 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
|
||||
switch (ch) {
|
||||
case ':':
|
||||
rule->rflags |= FILTRULE_PERDIR_MERGE
|
||||
| FILTRULE_FINISH_SETUP;
|
||||
| FILTRULE_FINISH_SETUP;
|
||||
/* FALL THROUGH */
|
||||
case '.':
|
||||
rule->rflags |= FILTRULE_MERGE_FILE;
|
||||
@@ -1093,7 +1091,8 @@ void parse_filter_str(filter_rule_list *listp, const char *rulestr,
|
||||
"[%s] clearing filter list%s\n",
|
||||
who_am_i(), listp->debug_type);
|
||||
}
|
||||
clear_filter_list(listp);
|
||||
pop_filter_list(listp);
|
||||
listp->head = NULL;
|
||||
goto free_continue;
|
||||
}
|
||||
|
||||
|
||||
2
fileio.c
2
fileio.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1998 Andrew Tridgell
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
|
||||
52
flist.c
52
flist.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2002-2014 Wayne Davison
|
||||
* Copyright (C) 2002-2015 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
|
||||
@@ -2435,8 +2435,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
|
||||
return flist;
|
||||
}
|
||||
|
||||
struct file_list *recv_file_list(int f)
|
||||
struct file_list *recv_file_list(int f, int dir_ndx)
|
||||
{
|
||||
const char *good_dirname = NULL;
|
||||
struct file_list *flist;
|
||||
int dstart, flags;
|
||||
int64 start_read;
|
||||
@@ -2492,6 +2493,23 @@ struct file_list *recv_file_list(int f)
|
||||
flist_expand(flist, 1);
|
||||
file = recv_file_entry(f, flist, flags);
|
||||
|
||||
if (inc_recurse) {
|
||||
static const char empty_dir[] = "\0";
|
||||
const char *cur_dir = file->dirname ? file->dirname : empty_dir;
|
||||
if (relative_paths && *cur_dir == '/')
|
||||
cur_dir++;
|
||||
if (cur_dir != good_dirname) {
|
||||
const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir;
|
||||
if (strcmp(cur_dir, d) != 0) {
|
||||
rprintf(FERROR,
|
||||
"ABORTING due to invalid path from sender: %s/%s\n",
|
||||
cur_dir, file->basename);
|
||||
exit_cleanup(RERR_PROTOCOL);
|
||||
}
|
||||
good_dirname = cur_dir;
|
||||
}
|
||||
}
|
||||
|
||||
if (S_ISREG(file->mode)) {
|
||||
/* Already counted */
|
||||
} else if (S_ISDIR(file->mode)) {
|
||||
@@ -2615,7 +2633,7 @@ void recv_additional_file_list(int f)
|
||||
rprintf(FINFO, "[%s] receiving flist for dir %d\n",
|
||||
who_am_i(), ndx);
|
||||
}
|
||||
flist = recv_file_list(f);
|
||||
flist = recv_file_list(f, ndx);
|
||||
flist->parent_ndx = ndx;
|
||||
}
|
||||
}
|
||||
@@ -2671,6 +2689,34 @@ int flist_find(struct file_list *flist, struct file_struct *f)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Search for a name in the file list. You must specify want_dir_match as:
|
||||
* 1=match directories, 0=match non-directories, or -1=match either. */
|
||||
int flist_find_name(struct file_list *flist, const char *fname, int want_dir_match)
|
||||
{
|
||||
struct { /* We have to create a temporary file_struct for the search. */
|
||||
struct file_struct f;
|
||||
char name_space[MAXPATHLEN];
|
||||
} t;
|
||||
char fbuf[MAXPATHLEN];
|
||||
const char *slash = strrchr(fname, '/');
|
||||
const char *basename = slash ? slash+1 : fname;
|
||||
|
||||
memset(&t.f, 0, FILE_STRUCT_LEN);
|
||||
memcpy((void *)t.f.basename, basename, strlen(basename)+1);
|
||||
|
||||
if (slash) {
|
||||
strlcpy(fbuf, fname, slash - fname + 1);
|
||||
t.f.dirname = fbuf;
|
||||
} else
|
||||
t.f.dirname = NULL;
|
||||
|
||||
t.f.mode = want_dir_match > 0 ? S_IFDIR : S_IFREG;
|
||||
|
||||
if (want_dir_match < 0)
|
||||
return flist_find_ignore_dirness(flist, &t.f);
|
||||
return flist_find(flist, &t.f);
|
||||
}
|
||||
|
||||
/* Search for an identically-named item in the file list. Differs from
|
||||
* flist_find in that an item that agrees with "f" in directory-ness is
|
||||
* preferred but one that does not is still found. */
|
||||
|
||||
38
generator.c
38
generator.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -895,23 +895,21 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
||||
} while (basis_dir[++j] != NULL);
|
||||
|
||||
if (!match_level)
|
||||
return -1;
|
||||
goto got_nothing_for_ya;
|
||||
|
||||
if (j != best_match) {
|
||||
j = best_match;
|
||||
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
|
||||
if (link_stat(cmpbuf, &sxp->st, 0) < 0)
|
||||
return -1;
|
||||
goto got_nothing_for_ya;
|
||||
}
|
||||
|
||||
if (match_level == 3 && !copy_dest) {
|
||||
if (find_exact_for_existing) {
|
||||
if (link_dest && real_st.st_dev == sxp->st.st_dev && real_st.st_ino == sxp->st.st_ino)
|
||||
return -1;
|
||||
if (do_unlink(fname) < 0 && errno != ENOENT) {
|
||||
sxp->st = real_st;
|
||||
return -1;
|
||||
}
|
||||
if (do_unlink(fname) < 0 && errno != ENOENT)
|
||||
goto got_nothing_for_ya;
|
||||
}
|
||||
#ifdef SUPPORT_HARD_LINKS
|
||||
if (link_dest) {
|
||||
@@ -935,10 +933,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (find_exact_for_existing) {
|
||||
sxp->st = real_st;
|
||||
return -1;
|
||||
}
|
||||
if (find_exact_for_existing)
|
||||
goto got_nothing_for_ya;
|
||||
|
||||
if (match_level >= 2) {
|
||||
#ifdef SUPPORT_HARD_LINKS
|
||||
@@ -946,7 +942,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
||||
#endif
|
||||
if (!dry_run && copy_altdest_file(cmpbuf, fname, file) < 0) {
|
||||
if (find_exact_for_existing) /* Can get here via hard-link failure */
|
||||
sxp->st = real_st;
|
||||
goto got_nothing_for_ya;
|
||||
return -1;
|
||||
}
|
||||
if (itemizing)
|
||||
@@ -966,6 +962,10 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
|
||||
}
|
||||
|
||||
return FNAMECMP_BASIS_DIR_LOW + j;
|
||||
|
||||
got_nothing_for_ya:
|
||||
sxp->st = real_st;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This is only called for non-regular files. We return -2 if we've finished
|
||||
@@ -1177,6 +1177,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
||||
int itemizing, enum logcode code, int f_out)
|
||||
{
|
||||
static const char *parent_dirname = "";
|
||||
static struct file_struct *prior_dir_file = NULL;
|
||||
/* Missing dir not created due to --dry-run; will still be scanned. */
|
||||
static struct file_struct *dry_missing_dir = NULL;
|
||||
/* Missing dir whose contents are skipped altogether due to
|
||||
@@ -1256,6 +1257,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
||||
const char *dn = file->dirname ? file->dirname : ".";
|
||||
dry_missing_dir = NULL;
|
||||
if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) {
|
||||
/* Each parent dir must be in the file list or the flist data is bad.
|
||||
* Optimization: most of the time the parent dir will be the last dir
|
||||
* this function was asked to process in the file list. */
|
||||
if (!inc_recurse
|
||||
&& (*dn != '.' || dn[1]) /* Avoid an issue with --relative and the "." dir. */
|
||||
&& (prior_dir_file && strcmp(dn, f_name(prior_dir_file, NULL)) != 0)
|
||||
&& flist_find_name(cur_flist, dn, 1) < 0) {
|
||||
rprintf(FERROR,
|
||||
"ABORTING due to invalid path from sender: %s/%s\n",
|
||||
dn, file->basename);
|
||||
exit_cleanup(RERR_PROTOCOL);
|
||||
}
|
||||
if (relative_paths && !implied_dirs
|
||||
&& do_stat(dn, &sx.st) < 0) {
|
||||
if (dry_run)
|
||||
@@ -1467,6 +1480,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
|
||||
else
|
||||
change_local_filter_dir(fname, strlen(fname), F_DEPTH(file));
|
||||
}
|
||||
prior_dir_file = file;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* `id -G` on Linux, but it's too hard to find a portable equivalent.
|
||||
*
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 Wayne Davison
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 3 as
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Routines to provide a memory-efficient hashtable.
|
||||
*
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
2
hlink.c
2
hlink.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
|
||||
2
ifuncs.h
2
ifuncs.h
@@ -1,6 +1,6 @@
|
||||
/* Inline functions for rsync.
|
||||
*
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
2
inums.h
2
inums.h
@@ -1,6 +1,6 @@
|
||||
/* Inline functions for rsync.
|
||||
*
|
||||
* Copyright (C) 2008-2014 Wayne Davison
|
||||
* Copyright (C) 2008-2015 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
|
||||
|
||||
6
io.c
6
io.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2001 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -1685,7 +1685,7 @@ void wait_for_receiver(void)
|
||||
rprintf(FINFO, "[%s] receiving flist for dir %d\n",
|
||||
who_am_i(), ndx);
|
||||
}
|
||||
flist = recv_file_list(iobuf.in_fd);
|
||||
flist = recv_file_list(iobuf.in_fd, ndx);
|
||||
flist->parent_ndx = ndx;
|
||||
#ifdef SUPPORT_HARD_LINKS
|
||||
if (preserve_hard_links)
|
||||
@@ -2283,7 +2283,7 @@ void io_printf(int fd, const char *format, ...)
|
||||
if (len < 0)
|
||||
exit_cleanup(RERR_PROTOCOL);
|
||||
|
||||
if (len > (int)sizeof buf) {
|
||||
if (len >= (int)sizeof buf) {
|
||||
rprintf(FERROR, "io_printf() was too long for the buffer.\n");
|
||||
exit_cleanup(RERR_PROTOCOL);
|
||||
}
|
||||
|
||||
2
io.h
2
io.h
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
2
itypes.h
2
itypes.h
@@ -1,6 +1,6 @@
|
||||
/* Inline functions for rsync.
|
||||
*
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1998 Andrew Tridgell
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* An implementation of MD4 designed for use in the SMB authentication protocol.
|
||||
*
|
||||
* Copyright (C) 1997-1998 Andrew Tridgell
|
||||
* Copyright (C) 2005-2014 Wayne Davison
|
||||
* Copyright (C) 2005-2015 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
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unix SMB/CIFS implementation.
|
||||
* Based on the Samba ACL support code.
|
||||
* Copyright (C) Jeremy Allison 2000.
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 Wayne Davison
|
||||
*
|
||||
* The permission functions have been changed to get/set all bits via
|
||||
* one call. Some functions that rsync doesn't need were also removed.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Version 2.2.x
|
||||
* Portable SMB ACL interface
|
||||
* Copyright (C) Jeremy Allison 2000
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Extended attribute support for rsync.
|
||||
*
|
||||
* Copyright (C) 2004 Red Hat, Inc.
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 Wayne Davison
|
||||
* Written by Jay Fenlason.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* and Karl Auer. Some of the changes are:
|
||||
*
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison <wayned@samba.org>
|
||||
* Copyright (C) 2003-2015 Wayne Davison <wayned@samba.org>
|
||||
*/
|
||||
|
||||
/* Load parameters.
|
||||
|
||||
15
log.c
15
log.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 2000-2001 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -656,21 +656,10 @@ static void log_formatted(enum logcode code, const char *format, const char *op,
|
||||
n = auth_user;
|
||||
break;
|
||||
case 'b':
|
||||
if (!(iflags & ITEM_TRANSFER))
|
||||
b = 0;
|
||||
else if (am_sender)
|
||||
b = total_data_written - initial_data_written;
|
||||
else
|
||||
b = total_data_read - initial_data_read;
|
||||
strlcat(fmt, "s", sizeof fmt);
|
||||
snprintf(buf2, sizeof buf2, fmt,
|
||||
do_big_num(b, humanize, NULL));
|
||||
n = buf2;
|
||||
break;
|
||||
case 'c':
|
||||
if (!(iflags & ITEM_TRANSFER))
|
||||
b = 0;
|
||||
else if (!am_sender)
|
||||
else if ((!!am_sender) ^ (*p == 'c'))
|
||||
b = total_data_written - initial_data_written;
|
||||
else
|
||||
b = total_data_read - initial_data_read;
|
||||
|
||||
22
m4/have_type.m4
Normal file
22
m4/have_type.m4
Normal file
@@ -0,0 +1,22 @@
|
||||
dnl AC_HAVE_TYPE(TYPE,INCLUDES)
|
||||
AC_DEFUN([AC_HAVE_TYPE], [
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
cv=`echo "$1" | sed 'y%./+- %__p__%'`
|
||||
AC_MSG_CHECKING(for $1)
|
||||
AC_CACHE_VAL([ac_cv_type_$cv],
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_INCLUDES_DEFAULT
|
||||
$2]],
|
||||
[[$1 foo;]])],
|
||||
[eval "ac_cv_type_$cv=yes"],
|
||||
[eval "ac_cv_type_$cv=no"]))dnl
|
||||
ac_foo=`eval echo \\$ac_cv_type_$cv`
|
||||
AC_MSG_RESULT($ac_foo)
|
||||
if test "$ac_foo" = yes; then
|
||||
ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
|
||||
if false; then
|
||||
AC_CHECK_TYPES($1)
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
|
||||
fi
|
||||
])
|
||||
@@ -1,27 +1,3 @@
|
||||
dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
|
||||
dnl if the cache file is inconsistent with the current host,
|
||||
dnl target and build system types, execute CMD or print a default
|
||||
dnl error message.
|
||||
AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
|
||||
AC_REQUIRE([AC_CANONICAL_SYSTEM])
|
||||
AC_MSG_CHECKING([config.cache system type])
|
||||
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_host_system_type" != x"$host"; } ||
|
||||
{ test x"${ac_cv_build_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_build_system_type" != x"$build"; } ||
|
||||
{ test x"${ac_cv_target_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_target_system_type" != x"$target"; }; then
|
||||
AC_MSG_RESULT([different])
|
||||
ifelse($#, 1, [$1],
|
||||
[AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
|
||||
else
|
||||
AC_MSG_RESULT([same])
|
||||
fi
|
||||
ac_cv_host_system_type="$host"
|
||||
ac_cv_build_system_type="$build"
|
||||
ac_cv_target_system_type="$target"
|
||||
])
|
||||
|
||||
dnl Check for socklen_t: historically on BSD it is an int, and in
|
||||
dnl POSIX 1g it is a type of its own, but some platforms use different
|
||||
dnl types for the argument to getsockopt, getpeername, etc. So we
|
||||
@@ -67,26 +43,3 @@ AC_DEFUN([TYPE_SOCKLEN_T],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
])
|
||||
|
||||
dnl AC_HAVE_TYPE(TYPE,INCLUDES)
|
||||
AC_DEFUN([AC_HAVE_TYPE], [
|
||||
AC_REQUIRE([AC_HEADER_STDC])
|
||||
cv=`echo "$1" | sed 'y%./+- %__p__%'`
|
||||
AC_MSG_CHECKING(for $1)
|
||||
AC_CACHE_VAL([ac_cv_type_$cv],
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
AC_INCLUDES_DEFAULT
|
||||
$2]],
|
||||
[[$1 foo;]])],
|
||||
[eval "ac_cv_type_$cv=yes"],
|
||||
[eval "ac_cv_type_$cv=no"]))dnl
|
||||
ac_foo=`eval echo \\$ac_cv_type_$cv`
|
||||
AC_MSG_RESULT($ac_foo)
|
||||
if test "$ac_foo" = yes; then
|
||||
ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
|
||||
if false; then
|
||||
AC_CHECK_TYPES($1)
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
|
||||
fi
|
||||
])
|
||||
23
m4/validate_cache_system_type.m4
Normal file
23
m4/validate_cache_system_type.m4
Normal file
@@ -0,0 +1,23 @@
|
||||
dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
|
||||
dnl if the cache file is inconsistent with the current host,
|
||||
dnl target and build system types, execute CMD or print a default
|
||||
dnl error message.
|
||||
AC_DEFUN([AC_VALIDATE_CACHE_SYSTEM_TYPE], [
|
||||
AC_REQUIRE([AC_CANONICAL_SYSTEM])
|
||||
AC_MSG_CHECKING([config.cache system type])
|
||||
if { test x"${ac_cv_host_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_host_system_type" != x"$host"; } ||
|
||||
{ test x"${ac_cv_build_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_build_system_type" != x"$build"; } ||
|
||||
{ test x"${ac_cv_target_system_type+set}" = x"set" &&
|
||||
test x"$ac_cv_target_system_type" != x"$target"; }; then
|
||||
AC_MSG_RESULT([different])
|
||||
ifelse($#, 1, [$1],
|
||||
[AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
|
||||
else
|
||||
AC_MSG_RESULT([same])
|
||||
fi
|
||||
ac_cv_host_system_type="$host"
|
||||
ac_cv_build_system_type="$build"
|
||||
ac_cv_target_system_type="$target"
|
||||
])
|
||||
39
main.c
39
main.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -76,6 +76,7 @@ extern size_t bwlimit_writemax;
|
||||
extern unsigned int module_dirlen;
|
||||
extern BOOL flist_receiving_enabled;
|
||||
extern BOOL shutting_down;
|
||||
extern int backup_dir_len;
|
||||
extern int basis_dir_cnt;
|
||||
extern struct stats stats;
|
||||
extern char *stdout_format;
|
||||
@@ -850,13 +851,25 @@ static int do_recv(int f_in, int f_out, char *local_name)
|
||||
}
|
||||
|
||||
if (backup_dir) {
|
||||
int ret = make_path(backup_dir_buf, MKP_DROP_NAME); /* drops trailing slash */
|
||||
if (ret < 0)
|
||||
exit_cleanup(RERR_SYNTAX);
|
||||
if (ret)
|
||||
rprintf(FINFO, "Created backup_dir %s\n", backup_dir_buf);
|
||||
else if (INFO_GTE(BACKUP, 1))
|
||||
STRUCT_STAT st;
|
||||
int ret;
|
||||
if (backup_dir_len > 1)
|
||||
backup_dir_buf[backup_dir_len-1] = '\0';
|
||||
ret = do_stat(backup_dir_buf, &st);
|
||||
if (ret != 0 || !S_ISDIR(st.st_mode)) {
|
||||
if (ret == 0) {
|
||||
rprintf(FERROR, "The backup-dir is not a directory: %s\n", backup_dir_buf);
|
||||
exit_cleanup(RERR_SYNTAX);
|
||||
}
|
||||
if (errno != ENOENT) {
|
||||
rprintf(FERROR, "Failed to stat %s: %s\n", backup_dir_buf, strerror(errno));
|
||||
exit_cleanup(RERR_FILEIO);
|
||||
}
|
||||
rprintf(FINFO, "(new) backup_dir is %s\n", backup_dir_buf);
|
||||
} else if (INFO_GTE(BACKUP, 1))
|
||||
rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf);
|
||||
if (backup_dir_len > 1)
|
||||
backup_dir_buf[backup_dir_len-1] = '/';
|
||||
}
|
||||
|
||||
io_flush(FULL_FLUSH);
|
||||
@@ -1009,7 +1022,7 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
|
||||
filesfrom_fd = -1;
|
||||
}
|
||||
|
||||
flist = recv_file_list(f_in);
|
||||
flist = recv_file_list(f_in, -1);
|
||||
if (!flist) {
|
||||
rprintf(FERROR,"server_recv: recv_file_list error\n");
|
||||
exit_cleanup(RERR_FILESELECT);
|
||||
@@ -1183,7 +1196,7 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
|
||||
|
||||
if (write_batch && !am_server)
|
||||
start_write_batch(f_in);
|
||||
flist = recv_file_list(f_in);
|
||||
flist = recv_file_list(f_in, -1);
|
||||
if (inc_recurse && file_total == 1)
|
||||
recv_additional_file_list(f_in);
|
||||
|
||||
@@ -1411,12 +1424,12 @@ static int start_client(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
static RETSIGTYPE sigusr1_handler(UNUSED(int val))
|
||||
static void sigusr1_handler(UNUSED(int val))
|
||||
{
|
||||
exit_cleanup(RERR_SIGNAL1);
|
||||
}
|
||||
|
||||
static RETSIGTYPE sigusr2_handler(UNUSED(int val))
|
||||
static void sigusr2_handler(UNUSED(int val))
|
||||
{
|
||||
if (!am_server)
|
||||
output_summary();
|
||||
@@ -1426,7 +1439,7 @@ static RETSIGTYPE sigusr2_handler(UNUSED(int val))
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
RETSIGTYPE remember_children(UNUSED(int val))
|
||||
void remember_children(UNUSED(int val))
|
||||
{
|
||||
#ifdef WNOHANG
|
||||
int cnt, status;
|
||||
@@ -1487,7 +1500,7 @@ const char *get_panic_action(void)
|
||||
* should just look at the environment variable, but I'm a bit leery
|
||||
* of a signal sending us into a busy loop.
|
||||
**/
|
||||
static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig))
|
||||
static void rsync_panic_handler(UNUSED(int whatsig))
|
||||
{
|
||||
char cmd_buf[300];
|
||||
int ret, pid_int = getpid();
|
||||
|
||||
2
match.c
2
match.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
38
options.c
38
options.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 2000, 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2002-2014 Wayne Davison
|
||||
* Copyright (C) 2002-2015 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
|
||||
@@ -411,16 +411,17 @@ static void parse_output_words(struct output_struct *words, short *levels,
|
||||
const char *s;
|
||||
int j, len, lev;
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
while (*str) {
|
||||
for ( ; str; str = s) {
|
||||
if ((s = strchr(str, ',')) != NULL)
|
||||
len = s++ - str;
|
||||
else
|
||||
len = strlen(str);
|
||||
while (len && isDigit(str+len-1))
|
||||
len--;
|
||||
if (!len)
|
||||
continue;
|
||||
if (!isDigit(str)) {
|
||||
while (len && isDigit(str+len-1))
|
||||
len--;
|
||||
}
|
||||
lev = isDigit(str+len) ? atoi(str+len) : 1;
|
||||
if (lev > MAX_OUT_LEVEL)
|
||||
lev = MAX_OUT_LEVEL;
|
||||
@@ -448,9 +449,6 @@ static void parse_output_words(struct output_struct *words, short *levels,
|
||||
words[j].help, len, str);
|
||||
exit_cleanup(RERR_SYNTAX);
|
||||
}
|
||||
if (!s)
|
||||
break;
|
||||
str = s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,7 +611,7 @@ static void print_rsync_version(enum logcode f)
|
||||
|
||||
rprintf(f, "%s version %s protocol version %d%s\n",
|
||||
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION, subprotocol);
|
||||
rprintf(f, "Copyright (C) 1996-2014 by Andrew Tridgell, Wayne Davison, and others.\n");
|
||||
rprintf(f, "Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others.\n");
|
||||
rprintf(f, "Web site: http://rsync.samba.org/\n");
|
||||
rprintf(f, "Capabilities:\n");
|
||||
rprintf(f, " %d-bit files, %d-bit inums, %d-bit timestamps, %d-bit long ints,\n",
|
||||
@@ -2480,9 +2478,11 @@ void server_options(char **args, int *argc_p)
|
||||
* but checking the pre-negotiated value allows the user to use a
|
||||
* --protocol=29 override to avoid the use of this -eFLAGS opt. */
|
||||
if (protocol_version >= 30) {
|
||||
/* Use "eFlags" alias so that cull_options doesn't think that these are no-arg option letters. */
|
||||
#define eFlags argstr
|
||||
/* We make use of the -e option to let the server know about
|
||||
* any pre-release protocol version && some behavior flags. */
|
||||
argstr[x++] = 'e';
|
||||
eFlags[x++] = 'e';
|
||||
#if SUBPROTOCOL_VERSION != 0
|
||||
if (protocol_version == PROTOCOL_VERSION) {
|
||||
x += snprintf(argstr+x, sizeof argstr - x,
|
||||
@@ -2490,17 +2490,19 @@ void server_options(char **args, int *argc_p)
|
||||
PROTOCOL_VERSION, SUBPROTOCOL_VERSION);
|
||||
} else
|
||||
#endif
|
||||
argstr[x++] = '.';
|
||||
eFlags[x++] = '.';
|
||||
if (allow_inc_recurse)
|
||||
argstr[x++] = 'i';
|
||||
eFlags[x++] = 'i';
|
||||
#ifdef CAN_SET_SYMLINK_TIMES
|
||||
argstr[x++] = 'L'; /* symlink time-setting support */
|
||||
eFlags[x++] = 'L'; /* symlink time-setting support */
|
||||
#endif
|
||||
#ifdef ICONV_OPTION
|
||||
argstr[x++] = 's'; /* symlink iconv translation support */
|
||||
eFlags[x++] = 's'; /* symlink iconv translation support */
|
||||
#endif
|
||||
argstr[x++] = 'f'; /* flist I/O-error safety support */
|
||||
argstr[x++] = 'x'; /* xattr hardlink optimization not desired */
|
||||
eFlags[x++] = 'f'; /* flist I/O-error safety support */
|
||||
eFlags[x++] = 'x'; /* xattr hardlink optimization not desired */
|
||||
eFlags[x++] = 'C'; /* support checksum seed order fix */
|
||||
#undef eFlags
|
||||
}
|
||||
|
||||
if (x >= (int)sizeof argstr) { /* Not possible... */
|
||||
|
||||
@@ -6,12 +6,23 @@ use strict;
|
||||
|
||||
our %short_no_arg;
|
||||
our %short_with_num;
|
||||
our %long_opt = (
|
||||
our %long_opt = ( # These include some extra long-args that BackupPC uses:
|
||||
'block-size' => 1,
|
||||
'daemon' => -1,
|
||||
'debug' => 1,
|
||||
'fake-super' => 0,
|
||||
'fuzzy' => 0,
|
||||
'group' => 0,
|
||||
'hard-links' => 0,
|
||||
'ignore-times' => 0,
|
||||
'info' => 1,
|
||||
'links' => 0,
|
||||
'log-file' => 3,
|
||||
'one-file-system' => 0,
|
||||
'owner' => 0,
|
||||
'perms' => 0,
|
||||
'recursive' => 0,
|
||||
'times' => 0,
|
||||
);
|
||||
our $last_long_opt;
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ sub check_git_status
|
||||
my($fatal_unless_clean, $subdir) = @_;
|
||||
$subdir = '.' unless defined $subdir;
|
||||
my $status = `cd '$subdir' && git status`;
|
||||
my $is_clean = $status =~ /\nnothing to commit \(working directory clean\)/;
|
||||
my($cur_branch) = $status =~ /^# On branch (.+)\n/;
|
||||
my $is_clean = $status =~ /\nnothing to commit.+working directory clean/;
|
||||
my($cur_branch) = $status =~ /^(?:# )?On branch (.+)\n/;
|
||||
if ($fatal_unless_clean && !$is_clean) {
|
||||
if ($subdir eq '.') {
|
||||
$subdir = '';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Summary: A fast, versatile, remote (and local) file-copying tool
|
||||
Name: rsync
|
||||
Version: 3.1.1
|
||||
Version: 3.1.2
|
||||
%define fullversion %{version}
|
||||
Release: 1
|
||||
%define srcdir src
|
||||
@@ -91,8 +91,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /etc/rsync-ssl/certs
|
||||
|
||||
%changelog
|
||||
* Sun Jun 22 2014 Wayne Davison <wayned@samba.org>
|
||||
Released 3.1.1.
|
||||
* Mon Dec 21 2015 Wayne Davison <wayned@samba.org>
|
||||
Released 3.1.2.
|
||||
|
||||
* Fri Mar 21 2008 Wayne Davison <wayned@samba.org>
|
||||
Added installation of /etc/xinetd.d/rsync file and some commented-out
|
||||
|
||||
@@ -16,6 +16,7 @@ use Date::Format;
|
||||
|
||||
# Where the local copy of /home/ftp/pub/rsync/dev/nightly should be updated.
|
||||
our $dest = $ENV{HOME} . '/samba-rsync-ftp/dev/nightly';
|
||||
our $samba_host = $ENV{SAMBA_HOST} || 'samba.org';
|
||||
our $nightly_symlink = "$dest/rsync-HEAD.tar.gz";
|
||||
|
||||
our($make_tar, $upload, $help_opt);
|
||||
@@ -39,8 +40,8 @@ if ($make_tar) {
|
||||
open(IN, '-|', 'git status') or die $!;
|
||||
my $status = join('', <IN>);
|
||||
close IN;
|
||||
die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/;
|
||||
die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/;
|
||||
die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit.+working directory clean/;
|
||||
die "The checkout is not on the master branch.\n" unless $status =~ /^(?:# )?On branch master\n/;
|
||||
system "make $gen_target" and die "make $gen_target failed!\n";
|
||||
|
||||
my @extra_files;
|
||||
@@ -59,13 +60,13 @@ if ($make_tar) {
|
||||
my $confversion;
|
||||
open(IN, '<', 'configure.ac') or die "Unable to open configure.ac: $!\n";
|
||||
while (<IN>) {
|
||||
if (/^RSYNC_VERSION=(.*)/) {
|
||||
if (/^AC_INIT\(\[rsync\],\s*\[(\d.+?)\]/) {
|
||||
$confversion = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion;
|
||||
die "Unable to find AC_INIT with version in configure.ac\n" unless defined $confversion;
|
||||
|
||||
open(IN, '<', 'OLDNEWS') or die "Unable to open OLDNEWS: $!\n";
|
||||
$_ = <IN>;
|
||||
@@ -156,7 +157,7 @@ if ($upload) {
|
||||
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/dev/nightly";
|
||||
system "rsync$opt -aviHP --delete-after . $samba_host\:/home/ftp/pub/rsync/dev/nightly";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
@@ -23,6 +23,8 @@ my $make_gen_cmd = 'make -f prepare-source.mak conf && ./config.status && make g
|
||||
);
|
||||
&usage if $help_opt;
|
||||
|
||||
$ENV{GIT_MERGE_AUTOEDIT} = 'no';
|
||||
|
||||
if (defined $incl_generated_files) {
|
||||
$patches_dir = $incl_generated_files if $incl_generated_files ne '';
|
||||
$incl_generated_files = 1;
|
||||
|
||||
@@ -67,13 +67,13 @@ check_git_state($master_branch, 1, 1);
|
||||
my $confversion;
|
||||
open(IN, '<', 'configure.ac') or die $!;
|
||||
while (<IN>) {
|
||||
if (/^RSYNC_VERSION=(.*)/) {
|
||||
if (/^AC_INIT\(\[rsync\],\s*\[(\d.+?)\]/) {
|
||||
$confversion = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
die "Unable to find RSYNC_VERSION in configure.ac\n" unless defined $confversion;
|
||||
die "Unable to find AC_INIT with version in configure.ac\n" unless defined $confversion;
|
||||
|
||||
open(IN, '<', 'OLDNEWS') or die $!;
|
||||
$_ = <IN>;
|
||||
@@ -202,8 +202,8 @@ foreach my $fn (@tweak_files) {
|
||||
undef $/; $_ = <IN>; $/ = "\n";
|
||||
close IN;
|
||||
if ($fn =~ /configure/) {
|
||||
s/^RSYNC_VERSION=.*/RSYNC_VERSION=$version/m
|
||||
or die "Unable to update RSYNC_VERSION in $fn\n";
|
||||
s/^(AC_INIT\(\[rsync\],\s*\[)\d.+?(\])/$1$version$2/m
|
||||
or die "Unable to update AC_INIT with version in $fn\n";
|
||||
} elsif ($fn =~ /\.spec/) {
|
||||
while (my($str, $val) = each %specvars) {
|
||||
s/^\Q$str\E .*/$str $val/m
|
||||
|
||||
2
pipe.c
2
pipe.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
|
||||
@@ -27,9 +27,9 @@ for action in "${@}"; do
|
||||
;;
|
||||
fetch)
|
||||
if perl --version >/dev/null 2>/dev/null; then
|
||||
files='c*'
|
||||
files='[ca]*'
|
||||
else
|
||||
files='[cp]*'
|
||||
files='[cap]*'
|
||||
fi
|
||||
rsync -pvz rsync://rsync.samba.org/rsyncftp/generated-files/"$files" .
|
||||
;;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
conf: configure.sh config.h.in
|
||||
|
||||
aclocal.m4:
|
||||
aclocal -I m4
|
||||
|
||||
configure.sh: configure.ac aclocal.m4
|
||||
autoconf -o configure.sh
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -672,8 +672,7 @@ int recv_files(int f_in, int f_out, char *local_name)
|
||||
}
|
||||
}
|
||||
|
||||
if (!log_before_transfer)
|
||||
remember_initial_stats();
|
||||
remember_initial_stats();
|
||||
|
||||
if (!do_xfers) { /* log the transfer */
|
||||
log_item(FCLIENT, file, iflags, NULL);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A pre-compilation helper program to aid in the creation of rounding.h.
|
||||
*
|
||||
* Copyright (C) 2007-2014 Wayne Davison
|
||||
* Copyright (C) 2007-2015 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
|
||||
|
||||
12
rsync.c
12
rsync.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -364,7 +364,7 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
|
||||
}
|
||||
/* Send all the data we read for this flist to the generator. */
|
||||
start_flist_forward(ndx);
|
||||
flist = recv_file_list(f_in);
|
||||
flist = recv_file_list(f_in, ndx);
|
||||
flist->parent_ndx = ndx;
|
||||
stop_flist_forward();
|
||||
}
|
||||
@@ -548,7 +548,11 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
||||
|| (!(preserve_times & PRESERVE_LINK_TIMES) && S_ISLNK(sxp->st.st_mode)))
|
||||
flags |= ATTRS_SKIP_MTIME;
|
||||
if (!(flags & ATTRS_SKIP_MTIME)
|
||||
&& cmp_time(sxp->st.st_mtime, file->modtime) != 0) {
|
||||
&& (sxp->st.st_mtime != file->modtime
|
||||
#ifdef ST_MTIME_NSEC
|
||||
|| (NSEC_BUMP(file) && (uint32)sxp->st.ST_MTIME_NSEC != F_MOD_NSEC(file))
|
||||
#endif
|
||||
)) {
|
||||
int ret = set_modtime(fname, file->modtime, F_MOD_NSEC(file), sxp->st.st_mode);
|
||||
if (ret < 0) {
|
||||
rsyserr(FERROR_XFER, errno, "failed to set times on %s",
|
||||
@@ -601,7 +605,7 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
|
||||
}
|
||||
|
||||
/* This is only called for SIGINT, SIGHUP, and SIGTERM. */
|
||||
RETSIGTYPE sig_int(int sig_num)
|
||||
void sig_int(int sig_num)
|
||||
{
|
||||
/* KLUGE: if the user hits Ctrl-C while ssh is prompting
|
||||
* for a password, then our cleanup's sending of a SIGUSR1
|
||||
|
||||
3
rsync.h
3
rsync.h
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 1996, 2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -892,7 +892,6 @@ typedef struct filter_struct {
|
||||
typedef struct filter_list_struct {
|
||||
filter_rule *head;
|
||||
filter_rule *tail;
|
||||
filter_rule *parent_dirscan_head;
|
||||
char *debug_type;
|
||||
} filter_rule_list;
|
||||
|
||||
|
||||
15
rsync.yo
15
rsync.yo
@@ -1,5 +1,5 @@
|
||||
mailto(rsync-bugs@samba.org)
|
||||
manpage(rsync)(1)(22 Jun 2014)()()
|
||||
manpage(rsync)(1)(21 Dec 2015)()()
|
||||
manpagename(rsync)(a fast, versatile, remote (and local) file-copying tool)
|
||||
manpagesynopsis()
|
||||
|
||||
@@ -571,7 +571,9 @@ directly to stderr rather than to send messages to the client side via the
|
||||
protocol (which normally outputs info messages via stdout). This is mainly
|
||||
intended for debugging in order to avoid changing the data sent via the
|
||||
protocol, since the extra protocol data can change what is being tested.
|
||||
Keep in mind that a daemon connection does not have a stderr channel to send
|
||||
The option does not affect the remote side of a transfer without using
|
||||
bf(--remote-option) -- e.g. bf(-M--msgs2stderr).
|
||||
Also keep in mind that a daemon connection does not have a stderr channel to send
|
||||
messages back to the client side, so if you are doing any daemon-transfer
|
||||
debugging using this option, you should start up a daemon using bf(--no-detach)
|
||||
so that you can see the stderr output on the daemon side.
|
||||
@@ -864,6 +866,11 @@ Implies bf(--inplace),
|
||||
but does not conflict with bf(--sparse) (since it is always extending a
|
||||
file's length).
|
||||
|
||||
The use of bf(--append) can be dangerous if you aren't 100% sure that the files
|
||||
that are longer have only grown by the appending of data onto the end. You
|
||||
should thus use include/exclude/filter rules to ensure that such a transfer is
|
||||
only affecting files that you know to be growing via appended data.
|
||||
|
||||
dit(bf(--append-verify)) This works just like the bf(--append) option, but
|
||||
the existing data on the receiving side is included in the full-file
|
||||
checksum verification step, which will cause a file to be resent if the
|
||||
@@ -2449,7 +2456,7 @@ transfer that may be interrupted.
|
||||
|
||||
There is also a bf(--info=progress2) option that outputs statistics based
|
||||
on the whole transfer, rather than individual files. Use this flag without
|
||||
outputting a filename (e.g. avoid bf(-v) or specify bf(--info=name0) if you
|
||||
outputting a filename (e.g. avoid bf(-v) or specify bf(--info=name0)) if you
|
||||
want to see how the transfer is doing without scrolling the screen with a
|
||||
lot of names. (You don't need to specify the bf(--progress) option in
|
||||
order to use bf(--info=progress2).)
|
||||
@@ -3403,7 +3410,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
|
||||
|
||||
manpagesection(VERSION)
|
||||
|
||||
This man page is current for version 3.1.1 of rsync.
|
||||
This man page is current for version 3.1.2 of rsync.
|
||||
|
||||
manpagesection(INTERNAL OPTIONS)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
mailto(rsync-bugs@samba.org)
|
||||
manpage(rsyncd.conf)(5)(22 Jun 2014)()()
|
||||
manpage(rsyncd.conf)(5)(21 Dec 2015)()()
|
||||
manpagename(rsyncd.conf)(configuration file for rsync in daemon mode)
|
||||
manpagesynopsis()
|
||||
|
||||
@@ -74,6 +74,8 @@ manpagesection(GLOBAL PARAMETERS)
|
||||
|
||||
The first parameters in the file (before a [module] header) are the
|
||||
global parameters.
|
||||
Rsync also allows for the use of a "[global]" module name to indicate the
|
||||
start of one or more global-parameter sections (the name must be lower case).
|
||||
|
||||
You may also include any module parameters in the global part of the
|
||||
config file in which case the supplied value will override the
|
||||
@@ -136,6 +138,8 @@ The module name cannot contain a slash or a closing square bracket. If the
|
||||
name contains whitespace, each internal sequence of whitespace will be
|
||||
changed into a single space, while leading or trailing whitespace will be
|
||||
discarded.
|
||||
Also, the name cannot be "global" as that exact name indicates that
|
||||
global parameters follow (see above).
|
||||
|
||||
As with GLOBAL PARAMETERS, you may use references to environment variables in
|
||||
the values of parameters. See the GLOBAL PARAMETERS section for more details.
|
||||
@@ -193,22 +197,16 @@ args if rsync believes they would escape the module hierarchy.
|
||||
The default for "use chroot" is true, and is the safer choice (especially
|
||||
if the module is not read-only).
|
||||
|
||||
When this parameter is enabled, rsync will not attempt to map users and groups
|
||||
by name (by default), but instead copy IDs as though bf(--numeric-ids) had
|
||||
been specified. In order to enable name-mapping, rsync needs to be able to
|
||||
use the standard library functions for looking up names and IDs (i.e.
|
||||
code(getpwuid()), code(getgrgid()), code(getpwname()), and code(getgrnam())).
|
||||
This means the rsync
|
||||
process in the chroot hierarchy will need to have access to the resources
|
||||
used by these library functions (traditionally /etc/passwd and
|
||||
/etc/group, but perhaps additional dynamic libraries as well).
|
||||
When this parameter is enabled, the "numeric-ids" option will also default to
|
||||
being enabled (disabling name lookups). See below for what a chroot needs in
|
||||
order for name lookups to succeed.
|
||||
|
||||
If you copy the necessary resources into the module's chroot area, you
|
||||
If you copy library resources into the module's chroot area, you
|
||||
should protect them through your OS's normal user/group or ACL settings (to
|
||||
prevent the rsync module's user from being able to change them), and then
|
||||
hide them from the user's view via "exclude" (see how in the discussion of
|
||||
that parameter). At that point it will be safe to enable the mapping of users
|
||||
and groups by name using the "numeric ids" daemon parameter (see below).
|
||||
and groups by name using this "numeric ids" daemon parameter.
|
||||
|
||||
Note also that you are free to setup custom user/group information in the
|
||||
chroot area that is different from your normal system. For example, you
|
||||
@@ -220,11 +218,16 @@ the daemon from trying to load any user/group-related files or libraries.
|
||||
This enabling makes the transfer behave as if the client had passed
|
||||
the bf(--numeric-ids) command-line option. By default, this parameter is
|
||||
enabled for chroot modules and disabled for non-chroot modules.
|
||||
Also keep in mind that uid/gid preservation requires the module to be
|
||||
running as root (see "uid") or for "fake super" to be configured.
|
||||
|
||||
A chroot-enabled module should not have this parameter enabled unless you've
|
||||
taken steps to ensure that the module has the necessary resources it needs
|
||||
to translate names, and that it is not possible for a user to change those
|
||||
resources.
|
||||
resources. That includes being the code being able to call functions like
|
||||
code(getpwuid()), code(getgrgid()), code(getpwname()), and code(getgrnam())).
|
||||
You should test what libraries and config files are required for your OS
|
||||
and get those setup before starting to test name mapping in rsync.
|
||||
|
||||
dit(bf(munge symlinks)) This parameter tells rsync to modify
|
||||
all symlinks in the same way as the (non-daemon-affecting)
|
||||
@@ -901,7 +904,7 @@ url(http://rsync.samba.org/)(http://rsync.samba.org/)
|
||||
|
||||
manpagesection(VERSION)
|
||||
|
||||
This man page is current for version 3.1.1 of rsync.
|
||||
This man page is current for version 3.1.2 of rsync.
|
||||
|
||||
manpagesection(CREDITS)
|
||||
|
||||
|
||||
10
sender.c
10
sender.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -143,11 +143,12 @@ void successful_send(int ndx)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
|
||||
if (S_ISREG(file->mode) /* Symlinks & devices don't need this check: */
|
||||
&& (st.st_size != F_LENGTH(file) || st.st_mtime != file->modtime
|
||||
#ifdef ST_MTIME_NSEC
|
||||
|| (NSEC_BUMP(file) && (uint32)st.ST_MTIME_NSEC != F_MOD_NSEC(file))
|
||||
#endif
|
||||
) {
|
||||
)) {
|
||||
rprintf(FERROR_XFER, "ERROR: Skipping sender remove for changed file: %s\n", fname);
|
||||
return;
|
||||
}
|
||||
@@ -319,8 +320,7 @@ void send_files(int f_in, int f_out)
|
||||
stats.xferred_files++;
|
||||
stats.total_transferred_size += F_LENGTH(file);
|
||||
|
||||
if (!log_before_transfer)
|
||||
remember_initial_stats();
|
||||
remember_initial_stats();
|
||||
|
||||
if (!do_xfers) { /* log the transfer */
|
||||
log_item(FCLIENT, file, iflags, NULL);
|
||||
|
||||
6
socket.c
6
socket.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1992-2001 Andrew Tridgell <tridge@samba.org>
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -161,7 +161,7 @@ int try_bind_local(int s, int ai_family, int ai_socktype,
|
||||
}
|
||||
|
||||
/* connect() timeout handler based on alarm() */
|
||||
static RETSIGTYPE contimeout_handler(UNUSED(int val))
|
||||
static void contimeout_handler(UNUSED(int val))
|
||||
{
|
||||
connect_timeout = -1;
|
||||
}
|
||||
@@ -529,7 +529,7 @@ int is_a_socket(int fd)
|
||||
}
|
||||
|
||||
|
||||
static RETSIGTYPE sigchld_handler(UNUSED(int val))
|
||||
static void sigchld_handler(UNUSED(int val))
|
||||
{
|
||||
#ifdef WNOHANG
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0) {}
|
||||
|
||||
@@ -15,11 +15,21 @@ use constant RSYNC => '/usr/bin/rsync';
|
||||
use constant LOGFILE => 'rrsync.log';
|
||||
|
||||
my $Usage = <<EOM;
|
||||
Use 'command="$0 [-ro] SUBDIR"'
|
||||
Use 'command="$0 [-ro|-wo] SUBDIR"'
|
||||
in front of lines in $ENV{HOME}/.ssh/authorized_keys
|
||||
EOM
|
||||
|
||||
our $ro = (@ARGV && $ARGV[0] eq '-ro') ? shift : ''; # -ro = Read-Only
|
||||
# Handle the -ro and -wo options.
|
||||
our $only = '';
|
||||
while (@ARGV && $ARGV[0] =~ /^-([rw])o$/) {
|
||||
my $r_or_w = $1;
|
||||
if ($only && $only ne $r_or_w) {
|
||||
die "$0: the -ro and -wo options conflict.\n";
|
||||
}
|
||||
$only = $r_or_w;
|
||||
shift;
|
||||
}
|
||||
|
||||
our $subdir = shift;
|
||||
die "$0: No subdirectory specified\n$Usage" unless defined $subdir;
|
||||
$subdir = abs_path($subdir);
|
||||
@@ -31,7 +41,7 @@ die "$0: Restricted directory does not exist!\n" if $subdir ne '/' && !-d $subdi
|
||||
# command="rrsync logs/client" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAzGhEeNlPr...
|
||||
# command="rrsync -ro results" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAmkHG1WCjC...
|
||||
#
|
||||
# Format of the envrionment variables set by sshd:
|
||||
# Format of the environment variables set by sshd:
|
||||
# SSH_ORIGINAL_COMMAND=rsync --server -vlogDtpr --partial . ARG # push
|
||||
# SSH_ORIGINAL_COMMAND=rsync --server --sender -vlogDtpr --partial . ARGS # pull
|
||||
# SSH_CONNECTION=client_addr client_port server_port
|
||||
@@ -41,7 +51,8 @@ die "$0: Not invoked via sshd\n$Usage" unless defined $command;
|
||||
die "$0: SSH_ORIGINAL_COMMAND='$command' is not rsync\n" unless $command =~ s/^rsync\s+//;
|
||||
die "$0: --server option is not first\n" unless $command =~ /^--server\s/;
|
||||
our $am_sender = $command =~ /^--server\s+--sender\s/; # Restrictive on purpose!
|
||||
die "$0 -ro: sending to read-only server not allowed\n" if $ro && !$am_sender;
|
||||
die "$0 sending to read-only server not allowed\n" if $only eq 'r' && !$am_sender;
|
||||
die "$0 reading from write-only server not allowed\n" if $only eq 'w' && $am_sender;
|
||||
|
||||
### START of options data produced by the cull_options script. ###
|
||||
|
||||
@@ -60,6 +71,7 @@ our $short_with_num = 'B'; # DO NOT REMOVE ANY
|
||||
our %long_opt = (
|
||||
'append' => 0,
|
||||
'backup-dir' => 2,
|
||||
'block-size' => 1,
|
||||
'bwlimit' => 1,
|
||||
'checksum-seed' => 1,
|
||||
'compare-dest' => 2,
|
||||
@@ -82,14 +94,18 @@ our %long_opt = (
|
||||
'force' => 0,
|
||||
'from0' => 0,
|
||||
'fuzzy' => 0,
|
||||
'group' => 0,
|
||||
'groupmap' => 1,
|
||||
'hard-links' => 0,
|
||||
'iconv' => 1,
|
||||
'ignore-errors' => 0,
|
||||
'ignore-existing' => 0,
|
||||
'ignore-missing-args' => 0,
|
||||
'ignore-times' => 0,
|
||||
'info' => 1,
|
||||
'inplace' => 0,
|
||||
'link-dest' => 2,
|
||||
'links' => 0,
|
||||
'list-only' => 0,
|
||||
'log-file' => 3,
|
||||
'log-format' => 1,
|
||||
@@ -103,12 +119,16 @@ our %long_opt = (
|
||||
'no-relative' => 0,
|
||||
'no-specials' => 0,
|
||||
'numeric-ids' => 0,
|
||||
'one-file-system' => 0,
|
||||
'only-write-batch' => 1,
|
||||
'owner' => 0,
|
||||
'partial' => 0,
|
||||
'partial-dir' => 2,
|
||||
'perms' => 0,
|
||||
'preallocate' => 0,
|
||||
'remove-sent-files' => $ro ? -1 : 0,
|
||||
'remove-source-files' => $ro ? -1 : 0,
|
||||
'recursive' => 0,
|
||||
'remove-sent-files' => $only eq 'r' ? -1 : 0,
|
||||
'remove-source-files' => $only eq 'r' ? -1 : 0,
|
||||
'safe-links' => 0,
|
||||
'sender' => 0,
|
||||
'server' => 0,
|
||||
@@ -120,6 +140,7 @@ our %long_opt = (
|
||||
'super' => 0,
|
||||
'temp-dir' => 2,
|
||||
'timeout' => 1,
|
||||
'times' => 0,
|
||||
'use-qsort' => 0,
|
||||
'usermap' => 1,
|
||||
);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (C) 1998 Andrew Tridgell
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
2
t_stub.c
2
t_stub.c
@@ -3,7 +3,7 @@
|
||||
* functions, so that module test harnesses can run standalone.
|
||||
*
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Test harness for unsafe_symlink(). Not linked into rsync itself.
|
||||
*
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
|
||||
# Build some hardlinks
|
||||
|
||||
mygrps="`rsync_getgroups`" || fail "Can't get groups"
|
||||
mygrps="`rsync_getgroups`" || test_fail "Can't get groups"
|
||||
mkdir "$fromdir"
|
||||
|
||||
for g in $mygrps
|
||||
do
|
||||
name="$fromdir/foo-$g"
|
||||
date > "$name"
|
||||
chgrp "$g" "$name" || fail "Can't chgrp"
|
||||
chgrp "$g" "$name" || test_fail "Can't chgrp"
|
||||
done
|
||||
sleep 2
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ mkdir "$fromdir"
|
||||
name1="$fromdir/name1"
|
||||
name2="$fromdir/name2"
|
||||
echo "This is the file" > "$name1"
|
||||
ln -s "$name1" "$name2" || fail "can't create symlink"
|
||||
ln -s "$name1" "$name2" || test_fail "can't create symlink"
|
||||
|
||||
outfile="$scratchdir/rsync.out"
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ name3="$fromdir/name3"
|
||||
name4="$fromdir/name4"
|
||||
echo "This is the file" > "$name1"
|
||||
ln "$name1" "$name2" || test_skipped "Can't create hardlink"
|
||||
ln "$name2" "$name3" || fail "Can't create hardlink"
|
||||
cp "$name2" "$name4" || fail "Can't copy file"
|
||||
ln "$name2" "$name3" || test_fail "Can't create hardlink"
|
||||
cp "$name2" "$name4" || test_fail "Can't copy file"
|
||||
cat $srcdir/*.c >"$fromdir/text"
|
||||
|
||||
checkit "$RSYNC -aHivv --debug=HLINK5 '$fromdir/' '$todir/'" "$fromdir" "$todir"
|
||||
@@ -67,7 +67,7 @@ checkit "$RSYNC -aHivv --debug=HLINK5 --copy-dest='$todir' '$fromdir/' '$chkdir/
|
||||
|
||||
# Create a hard link that has only one part in the hierarchy.
|
||||
echo "This is another file" >"$fromdir/solo"
|
||||
ln "$fromdir/solo" "$chkdir/solo" || fail "Can't create hardlink"
|
||||
ln "$fromdir/solo" "$chkdir/solo" || test_fail "Can't create hardlink"
|
||||
|
||||
# Make sure that the checksum data doesn't slide due to an HLINK_BUMP() change.
|
||||
$RSYNC -aHivc --debug=HLINK5 "$fromdir/" "$chkdir/" | tee "$outfile"
|
||||
|
||||
@@ -33,6 +33,8 @@ runtest "basic relative" 'checkit "$RSYNC -avR ./$deepstr \"$todir\"" "$chkdir"
|
||||
|
||||
ln $deepstr/filelist $deepstr/dir
|
||||
ln ../chk/$deepstr/filelist ../chk/$deepstr/dir
|
||||
# Work around time rounding/truncating issue by touching both dirs.
|
||||
touch -r $deepstr/dir $deepstr/dir ../chk/$deepstr/dir
|
||||
runtest "hard links" 'checkit "$RSYNC -avHR ./$deepstr/ \"$todir\"" "$chkdir" "$todir"'
|
||||
|
||||
cp "$deepdir/text" "$todir/$deepstr/ThisShouldGo"
|
||||
|
||||
2
tls.c
2
tls.c
@@ -2,7 +2,7 @@
|
||||
* Trivial ls for comparing two directories after running an rsync.
|
||||
*
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
2
token.c
2
token.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Simple utility used only by the test harness.
|
||||
*
|
||||
* Copyright (C) 2002 Martin Pool
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
52
uidlist.c
52
uidlist.c
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 1996 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2004-2014 Wayne Davison
|
||||
* Copyright (C) 2004-2015 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
|
||||
@@ -524,25 +524,49 @@ void parse_name_map(char *map, BOOL usernames)
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETGROUPLIST
|
||||
const char *getallgroups(uid_t uid, gid_t *gid_list, int *size_ptr)
|
||||
const char *getallgroups(uid_t uid, item_list *gid_list)
|
||||
{
|
||||
struct passwd *pw;
|
||||
gid_t *gid_array;
|
||||
int size;
|
||||
|
||||
if ((pw = getpwuid(uid)) == NULL)
|
||||
return "getpwuid failed";
|
||||
|
||||
gid_list->count = 0; /* We're overwriting any items in the list */
|
||||
EXPAND_ITEM_LIST(gid_list, gid_t, 32);
|
||||
size = gid_list->malloced;
|
||||
|
||||
/* Get all the process's groups, with the pw_gid group first. */
|
||||
if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list, size_ptr) < 0)
|
||||
return "getgrouplist failed";
|
||||
/* Paranoia: is the default group not first in the list? */
|
||||
if (gid_list[0] != pw->pw_gid) {
|
||||
int j;
|
||||
for (j = 0; j < *size_ptr; j++) {
|
||||
if (gid_list[j] == pw->pw_gid) {
|
||||
gid_list[j] = gid_list[0];
|
||||
gid_list[0] = pw->pw_gid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list->items, &size) < 0) {
|
||||
if (size > (int)gid_list->malloced) {
|
||||
gid_list->count = gid_list->malloced;
|
||||
EXPAND_ITEM_LIST(gid_list, gid_t, size);
|
||||
if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list->items, &size) < 0)
|
||||
size = -1;
|
||||
} else
|
||||
size = -1;
|
||||
if (size < 0)
|
||||
return "getgrouplist failed";
|
||||
}
|
||||
gid_list->count = size;
|
||||
gid_array = gid_list->items;
|
||||
|
||||
/* Paranoia: is the default group not first in the list? */
|
||||
if (gid_array[0] != pw->pw_gid) {
|
||||
int j;
|
||||
for (j = 1; j < size; j++) {
|
||||
if (gid_array[j] == pw->pw_gid)
|
||||
break;
|
||||
}
|
||||
if (j == size) { /* The default group wasn't found! */
|
||||
EXPAND_ITEM_LIST(gid_list, gid_t, size+1);
|
||||
gid_array = gid_list->items;
|
||||
}
|
||||
gid_array[j] = gid_array[0];
|
||||
gid_array[0] = pw->pw_gid;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
24
util.c
24
util.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -190,7 +190,7 @@ int make_path(char *fname, int flags)
|
||||
|
||||
if (flags & MKP_DROP_NAME) {
|
||||
end = strrchr(fname, '/');
|
||||
if (!end)
|
||||
if (!end || end == fname)
|
||||
return 0;
|
||||
*end = '\0';
|
||||
} else
|
||||
@@ -210,8 +210,10 @@ int make_path(char *fname, int flags)
|
||||
ret++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (errno != ENOENT) {
|
||||
if (errno != EEXIST)
|
||||
STRUCT_STAT st;
|
||||
if (errno != EEXIST || (do_stat(fname, &st) == 0 && !S_ISDIR(st.st_mode)))
|
||||
ret = -ret - 1;
|
||||
break;
|
||||
}
|
||||
@@ -1603,6 +1605,14 @@ int flist_ndx_pop(flist_ndx_list *lp)
|
||||
return ndx;
|
||||
}
|
||||
|
||||
/* Make sure there is room for one more item in the item list. If there
|
||||
* is not, expand the list as indicated by the value of "incr":
|
||||
* - if incr < 0 then increase the malloced size by -1 * incr
|
||||
* - if incr >= 0 then either make the malloced size equal to "incr"
|
||||
* or (if that's not large enough) double the malloced size
|
||||
* After the size check, the list's count is incremented by 1 and a pointer
|
||||
* to the "new" list item is returned.
|
||||
*/
|
||||
void *expand_item_list(item_list *lp, size_t item_size,
|
||||
const char *desc, int incr)
|
||||
{
|
||||
@@ -1613,10 +1623,12 @@ void *expand_item_list(item_list *lp, size_t item_size,
|
||||
if (incr < 0)
|
||||
new_size += -incr; /* increase slowly */
|
||||
else if (new_size < (size_t)incr)
|
||||
new_size += incr;
|
||||
else
|
||||
new_size = incr;
|
||||
else if (new_size)
|
||||
new_size *= 2;
|
||||
if (new_size < lp->malloced)
|
||||
else
|
||||
new_size = 1;
|
||||
if (new_size <= lp->malloced)
|
||||
overflow_exit("expand_item_list");
|
||||
/* Using _realloc_array() lets us pass the size, not a type. */
|
||||
new_ptr = _realloc_array(lp->items, item_size, new_size);
|
||||
|
||||
10
util2.c
10
util2.c
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 1996-2000 Andrew Tridgell
|
||||
* Copyright (C) 1996 Paul Mackerras
|
||||
* Copyright (C) 2001, 2002 Martin Pool <mbp@samba.org>
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
@@ -35,6 +35,9 @@ extern int checksum_len;
|
||||
**/
|
||||
int msleep(int t)
|
||||
{
|
||||
#ifdef HAVE_USLEEP
|
||||
usleep(t*1000);
|
||||
#else
|
||||
int tdiff = 0;
|
||||
struct timeval tval, t1, t2;
|
||||
|
||||
@@ -48,11 +51,12 @@ int msleep(int t)
|
||||
select(0,NULL,NULL, NULL, &tval);
|
||||
|
||||
gettimeofday(&t2, NULL);
|
||||
if (t2.tv_sec < t1.tv_sec)
|
||||
t1 = t2; /* Time went backwards, so start over. */
|
||||
tdiff = (t2.tv_sec - t1.tv_sec)*1000 +
|
||||
(t2.tv_usec - t1.tv_usec)/1000;
|
||||
if (tdiff < 0)
|
||||
t1 = t2; /* Time went backwards, so start over. */
|
||||
}
|
||||
#endif
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Test suite for the wildmatch code.
|
||||
*
|
||||
* Copyright (C) 2003-2014 Wayne Davison
|
||||
* Copyright (C) 2003-2015 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
|
||||
|
||||
2
xattrs.c
2
xattrs.c
@@ -3,7 +3,7 @@
|
||||
* Written by Jay Fenlason, vaguely based on the ACLs patch.
|
||||
*
|
||||
* Copyright (C) 2004 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2014 Wayne Davison
|
||||
* Copyright (C) 2006-2015 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
|
||||
|
||||
Reference in New Issue
Block a user