OBS User unknown 2008-03-11 16:58:40 +00:00 committed by Git OBS Bridge
parent f54019c0de
commit 1467ba6906
13 changed files with 156 additions and 1518 deletions

View File

@ -1,8 +0,0 @@
--- rsync.h~ 2007-08-17 14:46:24.000000000 +0200
+++ rsync.h 2007-08-17 14:46:24.000000000 +0200
@@ -927,3 +927,5 @@
#ifdef MAINTAINER_MODE
const char *get_panic_action(void);
#endif
+
+#undef HAVE_LUTIMES

View File

@ -1,340 +0,0 @@
--- rsync-2.6.9/clientserver.c 2006-10-23 17:36:42.000000000 -0700
+++ ./clientserver.c 2007-11-26 21:32:53.000000000 -0800
@@ -55,6 +55,7 @@ extern struct filter_list_struct server_
char *auth_user;
int read_only = 0;
int module_id = -1;
+int munge_symlinks = 0;
struct chmod_mode_struct *daemon_chmod_modes;
/* Length of lp_path() string when in daemon mode & not chrooted, else 0. */
@@ -524,6 +525,18 @@ static int rsync_module(int f_in, int f_
sanitize_paths = 1;
}
+ if ((munge_symlinks = lp_munge_symlinks(i)) < 0)
+ munge_symlinks = !use_chroot;
+ if (munge_symlinks) {
+ STRUCT_STAT st;
+ if (stat(SYMLINK_PREFIX, &st) == 0 && S_ISDIR(st.st_mode)) {
+ rprintf(FLOG, "Symlink munging is unsupported when a %s directory exists.\n",
+ SYMLINK_PREFIX);
+ io_printf(f_out, "@ERROR: daemon security issue -- contact admin\n", name);
+ exit_cleanup(RERR_UNSUPPORTED);
+ }
+ }
+
if (am_root) {
/* XXXX: You could argue that if the daemon is started
* by a non-root user and they explicitly specify a
--- rsync-2.6.9/flist.c 2006-10-13 18:17:36.000000000 -0700
+++ ./flist.c 2007-11-27 12:56:25.000000000 -0800
@@ -53,6 +53,7 @@ extern int copy_links;
extern int copy_unsafe_links;
extern int protocol_version;
extern int sanitize_paths;
+extern int munge_symlinks;
extern struct stats stats;
extern struct file_list *the_file_list;
@@ -174,6 +175,11 @@ static int readlink_stat(const char *pat
}
return do_stat(path, stp);
}
+ if (munge_symlinks && am_sender && llen > SYMLINK_PREFIX_LEN
+ && strncmp(linkbuf, SYMLINK_PREFIX, SYMLINK_PREFIX_LEN) == 0) {
+ memmove(linkbuf, linkbuf + SYMLINK_PREFIX_LEN,
+ llen - SYMLINK_PREFIX_LEN + 1);
+ }
}
return 0;
#else
@@ -591,6 +597,8 @@ static struct file_struct *receive_file_
linkname_len - 1);
overflow_exit("receive_file_entry");
}
+ if (munge_symlinks)
+ linkname_len += SYMLINK_PREFIX_LEN;
}
else
#endif
@@ -658,10 +666,17 @@ static struct file_struct *receive_file_
#ifdef SUPPORT_LINKS
if (linkname_len) {
file->u.link = bp;
+ if (munge_symlinks) {
+ strlcpy(bp, SYMLINK_PREFIX, linkname_len);
+ bp += SYMLINK_PREFIX_LEN;
+ linkname_len -= SYMLINK_PREFIX_LEN;
+ }
read_sbuf(f, bp, linkname_len - 1);
- if (sanitize_paths)
+ if (sanitize_paths && !munge_symlinks) {
sanitize_path(bp, bp, "", lastdir_depth, NULL);
- bp += linkname_len;
+ bp += strlen(bp) + 1;
+ } else
+ bp += linkname_len;
}
#endif
--- rsync-2.6.9/loadparm.c 2006-10-12 23:49:44.000000000 -0700
+++ ./loadparm.c 2007-11-26 11:46:46.000000000 -0800
@@ -153,6 +153,7 @@ typedef struct
BOOL ignore_errors;
BOOL ignore_nonreadable;
BOOL list;
+ BOOL munge_symlinks;
BOOL read_only;
BOOL strict_modes;
BOOL transfer_logging;
@@ -200,6 +201,7 @@ static service sDefault =
/* ignore_errors; */ False,
/* ignore_nonreadable; */ False,
/* list; */ True,
+ /* munge_symlinks; */ (BOOL)-1,
/* read_only; */ True,
/* strict_modes; */ True,
/* transfer_logging; */ False,
@@ -313,6 +315,7 @@ static struct parm_struct parm_table[] =
{"log format", P_STRING, P_LOCAL, &sDefault.log_format, NULL,0},
{"max connections", P_INTEGER,P_LOCAL, &sDefault.max_connections, NULL,0},
{"max verbosity", P_INTEGER,P_LOCAL, &sDefault.max_verbosity, NULL,0},
+ {"munge symlinks", P_BOOL, P_LOCAL, &sDefault.munge_symlinks, NULL,0},
{"name", P_STRING, P_LOCAL, &sDefault.name, NULL,0},
{"outgoing chmod", P_STRING, P_LOCAL, &sDefault.outgoing_chmod, NULL,0},
{"path", P_PATH, P_LOCAL, &sDefault.path, NULL,0},
@@ -415,6 +418,7 @@ FN_LOCAL_INTEGER(lp_timeout, timeout)
FN_LOCAL_BOOL(lp_ignore_errors, ignore_errors)
FN_LOCAL_BOOL(lp_ignore_nonreadable, ignore_nonreadable)
FN_LOCAL_BOOL(lp_list, list)
+FN_LOCAL_BOOL(lp_munge_symlinks, munge_symlinks)
FN_LOCAL_BOOL(lp_read_only, read_only)
FN_LOCAL_BOOL(lp_strict_modes, strict_modes)
FN_LOCAL_BOOL(lp_transfer_logging, transfer_logging)
--- rsync-2.6.9/proto.h 2006-11-06 20:39:47.000000000 -0800
+++ ./proto.h 2007-11-27 13:15:23.000000000 -0800
@@ -176,6 +176,7 @@ int lp_timeout(int );
BOOL lp_ignore_errors(int );
BOOL lp_ignore_nonreadable(int );
BOOL lp_list(int );
+BOOL lp_munge_symlinks(int );
BOOL lp_read_only(int );
BOOL lp_strict_modes(int );
BOOL lp_transfer_logging(int );
--- rsync-2.6.9/rsync.h 2006-10-23 20:31:30.000000000 -0700
+++ ./rsync.h 2007-11-26 21:34:11.000000000 -0800
@@ -33,6 +33,9 @@
#define DEFAULT_LOCK_FILE "/var/run/rsyncd.lock"
#define URL_PREFIX "rsync://"
+#define SYMLINK_PREFIX "/rsyncd-munged/"
+#define SYMLINK_PREFIX_LEN ((int)sizeof SYMLINK_PREFIX - 1)
+
#define BACKUP_SUFFIX "~"
/* a non-zero CHAR_OFFSET makes the rolling sum stronger, but is
--- rsync-2.6.9/rsyncd.conf.5 2006-11-06 20:39:52.000000000 -0800
+++ ./rsyncd.conf.5 2007-11-27 13:15:23.000000000 -0800
@@ -145,12 +145,15 @@ the advantage of extra protection agains
holes, but it has the disadvantages of requiring super-user privileges,
of not being able to follow symbolic links that are either absolute or outside
of the new root path, and of complicating the preservation of usernames and groups
-(see below)\&. When "use chroot" is false, for security reasons,
-symlinks may only be relative paths pointing to other files within the root
-path, and leading slashes are removed from most absolute paths (options
-such as \fB\-\-backup\-dir\fP, \fB\-\-compare\-dest\fP, etc\&. interpret an absolute path as
-rooted in the module\&'s "path" dir, just as if chroot was specified)\&.
-The default for "use chroot" is true\&.
+(see below)\&. When "use chroot" is false, rsync will: (1) munge symlinks by
+default for security reasons (see "munge symlinks" for a way to turn this
+off, but only if you trust your users), (2) substitute leading slashes in
+absolute paths with the module\&'s path (so that options such as
+\fB\-\-backup\-dir\fP, \fB\-\-compare\-dest\fP, etc\&. interpret an absolute path as
+rooted in the module\&'s "path" dir), and (3) trim "\&.\&." path elements from
+args if rsync believes they would escape the chroot\&.
+The default for "use chroot" is true, and is the safer choice (especially
+if the module is not read-only)\&.
.IP
In order to preserve usernames and groupnames, rsync needs to be able to
use the standard library functions for looking up names and IDs (i\&.e\&.
@@ -181,6 +184,41 @@ access to some of the excluded files ins
do this automatically, but you might as well specify both to be extra
sure)\&.
.IP
+.IP "\fBmunge symlinks\fP"
+The "munge symlinks" option tells rsync to modify
+all incoming symlinks in a way that makes them unusable but recoverable
+(see below)\&. This should help protect your files from user trickery when
+your daemon module is writable\&. The default is disabled when "use chroot"
+is on and enabled when "use chroot" is off\&.
+.IP
+If you disable this option on a daemon that is not read-only, there
+are tricks that a user can play with uploaded symlinks to access
+daemon-excluded items (if your module has any), and, if "use chroot"
+is off, rsync can even be tricked into showing or changing data that
+is outside the module\&'s path (as access-permissions allow)\&.
+.IP
+The way rsync disables the use of symlinks is to prefix each one with
+the string "/rsyncd-munged/"\&. This prevents the links from being used
+as long as that directory does not exist\&. When this option is enabled,
+rsync will refuse to run if that path is a directory or a symlink to
+a directory\&. When using the "munge symlinks" option in a chroot area,
+you should add this path to the exclude setting for the module so that
+the user can\&'t try to create it\&.
+.IP
+Note: rsync makes no attempt to verify that any pre-existing symlinks in
+the hierarchy are as safe as you want them to be\&. If you setup an rsync
+daemon on a new area or locally add symlinks, you can manually protect your
+symlinks from being abused by prefixing "/rsyncd-munged/" to the start of
+every symlink\&'s value\&. There is a perl script in the support directory
+of the source code named "munge-symlinks" that can be used to add or remove
+this prefix from your symlinks\&.
+.IP
+When this option is disabled on a writable module and "use chroot" is off,
+incoming symlinks will be modified to drop a leading slash and to remove "\&.\&."
+path elements that rsync believes will allow a symlink to escape the module\&'s
+hierarchy\&. There are tricky ways to work around this, though, so you had
+better trust your users if you choose this combination of options\&.
+.IP
.IP "\fBmax connections\fP"
The "max connections" option allows you to
specify the maximum number of simultaneous connections you will allow\&.
--- rsync-2.6.9/rsyncd.conf.yo 2006-11-06 20:39:47.000000000 -0800
+++ ./rsyncd.conf.yo 2007-11-27 13:14:07.000000000 -0800
@@ -129,12 +129,15 @@ the advantage of extra protection agains
holes, but it has the disadvantages of requiring super-user privileges,
of not being able to follow symbolic links that are either absolute or outside
of the new root path, and of complicating the preservation of usernames and groups
-(see below). When "use chroot" is false, for security reasons,
-symlinks may only be relative paths pointing to other files within the root
-path, and leading slashes are removed from most absolute paths (options
-such as bf(--backup-dir), bf(--compare-dest), etc. interpret an absolute path as
-rooted in the module's "path" dir, just as if chroot was specified).
-The default for "use chroot" is true.
+(see below). When "use chroot" is false, rsync will: (1) munge symlinks by
+default for security reasons (see "munge symlinks" for a way to turn this
+off, but only if you trust your users), (2) substitute leading slashes in
+absolute paths with the module's path (so that options such as
+bf(--backup-dir), bf(--compare-dest), etc. interpret an absolute path as
+rooted in the module's "path" dir), and (3) trim ".." path elements from
+args if rsync believes they would escape the chroot.
+The default for "use chroot" is true, and is the safer choice (especially
+if the module is not read-only).
In order to preserve usernames and groupnames, rsync needs to be able to
use the standard library functions for looking up names and IDs (i.e.
@@ -158,6 +161,40 @@ access to some of the excluded files ins
do this automatically, but you might as well specify both to be extra
sure).
+dit(bf(munge symlinks)) The "munge symlinks" option tells rsync to modify
+all incoming symlinks in a way that makes them unusable but recoverable
+(see below). This should help protect your files from user trickery when
+your daemon module is writable. The default is disabled when "use chroot"
+is on and enabled when "use chroot" is off.
+
+If you disable this option on a daemon that is not read-only, there
+are tricks that a user can play with uploaded symlinks to access
+daemon-excluded items (if your module has any), and, if "use chroot"
+is off, rsync can even be tricked into showing or changing data that
+is outside the module's path (as access-permissions allow).
+
+The way rsync disables the use of symlinks is to prefix each one with
+the string "/rsyncd-munged/". This prevents the links from being used
+as long as that directory does not exist. When this option is enabled,
+rsync will refuse to run if that path is a directory or a symlink to
+a directory. When using the "munge symlinks" option in a chroot area,
+you should add this path to the exclude setting for the module so that
+the user can't try to create it.
+
+Note: rsync makes no attempt to verify that any pre-existing symlinks in
+the hierarchy are as safe as you want them to be. If you setup an rsync
+daemon on a new area or locally add symlinks, you can manually protect your
+symlinks from being abused by prefixing "/rsyncd-munged/" to the start of
+every symlink's value. There is a perl script in the support directory
+of the source code named "munge-symlinks" that can be used to add or remove
+this prefix from your symlinks.
+
+When this option is disabled on a writable module and "use chroot" is off,
+incoming symlinks will be modified to drop a leading slash and to remove ".."
+path elements that rsync believes will allow a symlink to escape the module's
+hierarchy. There are tricky ways to work around this, though, so you had
+better trust your users if you choose this combination of options.
+
dit(bf(max connections)) The "max connections" option allows you to
specify the maximum number of simultaneous connections you will allow.
Any clients connecting when the maximum has been reached will receive a
--- rsync-2.6.9/support/munge-symlinks 1969-12-31 16:00:00.000000000 -0800
+++ ./support/munge-symlinks 2007-11-26 22:04:26.000000000 -0800
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+# This script will either prefix all symlink values with the string
+# "/rsyncd-munged/" or remove that prefix.
+
+use strict;
+use Getopt::Long;
+
+my $SYMLINK_PREFIX = '/rsyncd-munged/';
+
+my $munge_opt;
+
+&GetOptions(
+ 'munge' => sub { $munge_opt = 1 },
+ 'unmunge' => sub { $munge_opt = 0 },
+ 'all' => \( my $all_opt ),
+ 'help|h' => \( my $help_opt ),
+) or &usage;
+
+&usage if $help_opt || !defined $munge_opt;
+
+my $munged_re = $all_opt ? qr/^($SYMLINK_PREFIX)+(?=.)/ : qr/^$SYMLINK_PREFIX(?=.)/;
+
+push(@ARGV, '.') unless @ARGV;
+
+open(PIPE, '-|', 'find', @ARGV, '-type', 'l') or die $!;
+
+while (<PIPE>) {
+ chomp;
+ my $lnk = readlink($_) or next;
+ if ($munge_opt) {
+ next if !$all_opt && $lnk =~ /$munged_re/;
+ $lnk =~ s/^/$SYMLINK_PREFIX/;
+ } else {
+ next unless $lnk =~ s/$munged_re//;
+ }
+ if (!unlink($_)) {
+ warn "Unable to unlink symlink: $_ ($!)\n";
+ } elsif (!symlink($lnk, $_)) {
+ warn "Unable to recreate symlink: $_ -> $lnk ($!)\n";
+ } else {
+ print "$_ -> $lnk\n";
+ }
+}
+
+close PIPE;
+exit;
+
+sub usage
+{
+ die <<EOT;
+Usage: munge-symlinks --munge|--unmunge [--all] [DIR|SYMLINK...]
+
+--munge Add the $SYMLINK_PREFIX prefix to symlinks if not already
+ present, or always when combined with --all.
+--unmunge Remove one $SYMLINK_PREFIX prefix from symlinks or all
+ such prefixes with --all.
+
+See the "munge symlinks" option in the rsyncd.conf manpage for more details.
+EOT
+}
--- rsync-2.6.9/testsuite/rsync.fns 2006-05-30 11:26:17.000000000 -0700
+++ ./testsuite/rsync.fns 2007-11-26 11:49:35.000000000 -0800
@@ -231,6 +231,7 @@ build_rsyncd_conf() {
pid file = $pidfile
use chroot = no
+munge symlinks = no
hosts allow = localhost 127.0.0.1 $hostname
log file = $logfile
log format = %i %h [%a] %m (%u) %l %f%L

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e0cb263baec4c112af4dbb1f4cf8a323e9d30ad57e2d37192862cba9ee637c70
size 634337

3
rsync-3.0.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce2982106a95000376eaf4f17c9776415bce10a6f85463590397150c48e6469f
size 629028

View File

@ -1,45 +0,0 @@
--- flist.c 2007/09/10 14:55:19 1.5
+++ flist.c 2007/09/10 15:30:23
@@ -998,7 +998,7 @@
file->mode = tweak_mode(file->mode, chmod_modes);
#ifdef SUPPORT_ACLS
- if (preserve_acls) {
+ if (preserve_acls && f >= 0) {
sx.st.st_mode = file->mode;
sx.acc_acl = sx.def_acl = NULL;
if (get_acl(fname, &sx) < 0)
@@ -1006,7 +1006,7 @@
}
#endif
#ifdef SUPPORT_XATTRS
- if (preserve_xattrs) {
+ if (preserve_xattrs && f >= 0) {
sx.xattr = NULL;
if (get_xattr(fname, &sx) < 0)
return NULL;
@@ -1021,20 +1021,20 @@
flist->files[flist->count++] = file;
send_file_entry(file, f);
#ifdef SUPPORT_ACLS
- if (preserve_acls)
+ if (preserve_acls && f >= 0)
send_acl(&sx, f);
#endif
#ifdef SUPPORT_XATTRS
- if (preserve_xattrs)
+ if (preserve_xattrs && f >= 0)
send_xattr(&sx, f);
#endif
} else {
#ifdef SUPPORT_ACLS
- if (preserve_acls)
+ if (preserve_acls && f >= 0)
free_acl(&sx);
#endif
#ifdef SUPPORT_XATTRS
- if (preserve_xattrs)
+ if (preserve_xattrs && f >= 0)
free_xattr(&sx);
#endif
}

View File

@ -1,10 +0,0 @@
--- hlink.c 2007/11/08 15:44:15 1.3
+++ hlink.c 2007/11/08 15:44:52
@@ -299,6 +299,7 @@
statx sx;
STRUCT_STAT st;
int statret, ndx = master;
+ memset(&sx,0,sizeof(sx));
file->F_HLINDEX = FINISHED_LINK;
if (link_stat(f_name(file, hlink1), &st, 0) < 0)

View File

@ -1,60 +0,0 @@
--- rsync-2.6.9.orig/sender.c 2006-09-20 03:53:32.000000000 +0200
+++ rsync-2.6.9/sender.c 2007-07-25 15:33:05.000000000 +0200
@@ -123,6 +123,7 @@
char fname[MAXPATHLEN];
struct file_struct *file;
unsigned int offset;
+ size_t l = 0;
if (ndx < 0 || ndx >= the_file_list->count)
return;
@@ -133,6 +134,20 @@
file->dir.root, "/", NULL);
} else
offset = 0;
+
+ l = offset + 1;
+ if (file) {
+ if (file->dirname)
+ l += strlen(file->dirname);
+ if (file->basename)
+ l += strlen(file->basename);
+ }
+
+ if (l >= sizeof(fname)) {
+ rprintf(FERROR, "Overlong pathname\n");
+ exit_cleanup(RERR_FILESELECT);
+ }
+
f_name(file, fname + offset);
if (remove_source_files) {
if (do_unlink(fname) == 0) {
@@ -224,6 +239,7 @@
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int f_xfer = write_batch < 0 ? batch_fd : f_out;
int i, j;
+ size_t l = 0;
if (verbose > 2)
rprintf(FINFO, "send_files starting\n");
@@ -259,6 +275,20 @@
fname[offset++] = '/';
} else
offset = 0;
+
+ l = offset + 1;
+ if (file) {
+ if (file->dirname)
+ l += strlen(file->dirname);
+ if (file->basename)
+ l += strlen(file->basename);
+ }
+
+ if (l >= sizeof(fname)) {
+ rprintf(FERROR, "Overlong pathname\n");
+ exit_cleanup(RERR_FILESELECT);
+ }
+
fname2 = f_name(file, fname + offset);
if (verbose > 2)

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:54988c2886e40a13b551bd96d76ca795c55c793048cee8dcfbc4f10a10fef831
size 94183

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Tue Mar 11 01:23:13 CET 2008 - ro@suse.de
- update to version 3.0.0 (shortened, more details see NEWS file)
- The handling of implied directories when using --relative has changed to
send them as directories (e.g. no implied dir is ever sent as a symlink).
- Requesting a remote file-listing without specifying -r (--recursive) now
sends the -d (--dirs) option to the remote rsync rather than sending -r
along with an extra exclude of /*/*.
- In --dry-run mode, the last line of the verbose summary text is output
with a "(DRY RUN)" suffix to help remind you that no updates were made.
Similarly, --only-write-batch outputs "(BATCH ONLY)".
- A writable rsync daemon with "use chroot" disabled now defaults to a
symlink-munging behavior designed to make symlinks safer while also
allowing absolute symlinks to be stored and retrieved.
- Starting up an extra copy of an rsync daemon will not clobber the pidfile
for the running daemon -- if the pidfile exists, the new daemon will exit
with an error.
- re-applied patches from upstream kit:
- acls.diff,xattrs.diff,slp.diff
- removed patches:
- rsync-overlong.patch (upstream code cleaned up)
- lutimes-hack.diff (should not be needed any more)
- rsync-fix_fuzzy.patch (fixed upstream)
- rsync-hlink_crash.patch (upstream cleaned up)
- munge-symlinks-2.6.9.diff (integrated upstream)
-------------------------------------------------------------------
Tue Dec 4 18:07:36 CET 2007 - ro@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package rsync (Version 2.6.9)
# spec file for package rsync (Version 3.0.0)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@ -10,6 +10,7 @@
# norootforbuild
Name: rsync
BuildRequires: libacl-devel libpng openslp-devel
%if 0%{?suse_version} > 1020
@ -18,27 +19,21 @@ BuildRequires: texlive-latex
BuildRequires: te_ams te_latex
%endif
BuildRequires: popt-devel zlib-devel
License: GPL v2 or later
License: GPL v3 or later
Group: Productivity/Networking/Other
PreReq: %fillup_prereq %insserv_prereq sed grep
AutoReqProv: on
Version: 2.6.9
Release: 87
Version: 3.0.0
Release: 1
Summary: Replacement for RCP/mirror that has Many More Features
Source: samba.org/ftp/rsync/rsync-%{version}.tar.bz2
Source1: logrotate.rsync
Source2: rsync.xinetd
Source3: rsyncd.rc
Source4: rsyncd.conf
Source5: rsyncd.secrets
Patch1: slp-fix.diff
Patch2: slp.diff
Source1: samba.org/ftp/rsync/rsync-patches-%{version}.tar.bz2
Source2: logrotate.rsync
Source3: rsync.xinetd
Source4: rsyncd.rc
Source5: rsyncd.conf
Source6: rsyncd.secrets
Patch3: system-zlib.diff
Patch4: rsync-overlong.patch
Patch5: lutimes-hack.diff
Patch6: rsync-fix_fuzzy.patch
Patch7: rsync-hlink_crash.patch
Patch8: munge-symlinks-2.6.9.diff
Url: http://rsync.samba.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%define with_system_zlib 0
@ -62,24 +57,14 @@ Authors:
Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>
%prep
%setup -q
%setup -q -b 1
%if %with_system_zlib
rm -f zlib/*.h
%patch3
%endif
cp configure configure.orig
patch -p1 < patches/acls.diff
patch -p1 < patches/xattrs.diff
cp configure.orig configure
#patch -p1 < patches/slp.diff
%patch2 -p1
%patch1
%patch4 -p1
%patch5
%patch6
%patch7
%patch8
cp configure.orig configure
patch -p1 < patches/slp.diff
%build
autoheader
@ -111,11 +96,11 @@ install -d $RPM_BUILD_ROOT/etc/xinetd.d
install -d $RPM_BUILD_ROOT/usr/sbin
ln -sf ../bin/rsync $RPM_BUILD_ROOT/usr/sbin/rsyncd
install -m 755 support/rsyncstats $RPM_BUILD_ROOT/usr/bin
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/logrotate.d/rsync
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/xinetd.d/rsync
install -m 755 %{SOURCE3} $RPM_BUILD_ROOT/etc/init.d/rsyncd
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/etc/rsyncd.conf
install -m 600 %{SOURCE5} $RPM_BUILD_ROOT/etc/rsyncd.secrets
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/logrotate.d/rsync
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/xinetd.d/rsync
install -m 755 %{SOURCE4} $RPM_BUILD_ROOT/etc/init.d/rsyncd
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/etc/rsyncd.conf
install -m 600 %{SOURCE6} $RPM_BUILD_ROOT/etc/rsyncd.secrets
ln -sf ../../etc/init.d/rsyncd $RPM_BUILD_ROOT/usr/sbin/rcrsyncd
%preun
@ -147,50 +132,74 @@ fi
%doc COPYING NEWS README tech_report.ps tech_report.tex
%changelog
* Tue Dec 04 2007 - ro@suse.de
* Tue Mar 11 2008 ro@suse.de
- update to version 3.0.0 (shortened, more details see NEWS file)
- The handling of implied directories when using --relative has changed to
send them as directories (e.g. no implied dir is ever sent as a symlink).
- Requesting a remote file-listing without specifying -r (--recursive) now
sends the -d (--dirs) option to the remote rsync rather than sending -r
along with an extra exclude of /*/*.
- In --dry-run mode, the last line of the verbose summary text is output
with a "(DRY RUN)" suffix to help remind you that no updates were made.
Similarly, --only-write-batch outputs "(BATCH ONLY)".
- A writable rsync daemon with "use chroot" disabled now defaults to a
symlink-munging behavior designed to make symlinks safer while also
allowing absolute symlinks to be stored and retrieved.
- Starting up an extra copy of an rsync daemon will not clobber the pidfile
for the running daemon -- if the pidfile exists, the new daemon will exit
with an error.
- re-applied patches from upstream kit:
- acls.diff,xattrs.diff,slp.diff
- removed patches:
- rsync-overlong.patch (upstream code cleaned up)
- lutimes-hack.diff (should not be needed any more)
- rsync-fix_fuzzy.patch (fixed upstream)
- rsync-hlink_crash.patch (upstream cleaned up)
- munge-symlinks-2.6.9.diff (integrated upstream)
* Tue Dec 04 2007 ro@suse.de
- added munge-symlinks patch (#345507) CVE-2007-6199
* Thu Nov 08 2007 - ro@suse.de
* Thu Nov 08 2007 ro@suse.de
- fix uninitialized struct sx in hlink.c:hard_link_cluster
to prevent crash when using acls (#338358)
* Fri Sep 14 2007 - ro@suse.de
* Fri Sep 14 2007 ro@suse.de
- fix (#300526) restart will start standalone rsync if running
under xinetd
- use a pid file for rsyncd in init script so that rcrsyncd
will not show status running for an rsync started by xinetd
- insert "pid file" entry into rsyncd.conf if not present
* Wed Sep 12 2007 - dmueller@suse.de
* Wed Sep 12 2007 dmueller@suse.de
- build parallel
- fix hardlinks accross partition
* Mon Sep 10 2007 - ro@suse.de
* Mon Sep 10 2007 ro@suse.de
- fix abort in rsync when acls and fuzzy are used together
(#306263)
* Fri Aug 17 2007 - cthiel@suse.de
* Fri Aug 17 2007 cthiel@suse.de
- added lutimes-hack.diff to work around a glibc bug in lutimes.c
* Thu Aug 02 2007 - ro@suse.de
* Thu Aug 02 2007 ro@suse.de
- protect from overlong filenames (#294073) CVE-2007-4091
* Mon May 14 2007 - mrueckert@suse.de
* Mon May 14 2007 mrueckert@suse.de
- make build work on older distros again.
* Tue May 08 2007 - dmueller@suse.de
* Tue May 08 2007 dmueller@suse.de
- use builtin zlib copy again
* Mon May 07 2007 - dmueller@suse.de
* Tue May 08 2007 dmueller@suse.de
- update to 2.6.9:
* several important bugfixes
* new features, see included NEWS file
- build against system zlib instead of own zlib copy
- build against system popt instead of own popt copy
* Wed Apr 18 2007 - aj@suse.de
* Wed Apr 18 2007 aj@suse.de
- Use texlive for building.
* Tue Sep 12 2006 - ro@suse.de
* Tue Sep 12 2006 ro@suse.de
- apply fix for xattr.diff from rsync mailing list
* Tue Aug 22 2006 - ro@suse.de
* Tue Aug 22 2006 ro@suse.de
- apply patches/xattr.diff as well (fate#300565)
* Thu Aug 10 2006 - dmueller@suse.de
* Thu Aug 10 2006 dmueller@suse.de
- fix rc script error code when there's an error in the config
file (#198406)
* Wed Jun 21 2006 - ro@suse.de
* Wed Jun 21 2006 ro@suse.de
- added tag-3 patch from cvs (will be in 2.6.9)
to avoid aborts with "unexpected tag 3"
* Mon Jun 12 2006 - ro@suse.de
* Mon Jun 12 2006 ro@suse.de
- update to version 2.6.8
- use slp patch as included upstream
- several bugfixes
@ -198,141 +207,141 @@ fi
- special files as pipes now printed as "S", no longer "D"
- escaping of unreadable chars has changed
- new --append, --min-size and --prune-empty-dirs options
* Tue Apr 18 2006 - ro@suse.de
* Tue Apr 18 2006 ro@suse.de
- ignore testsuite failure on s390x (filesystem mtimes)
* Wed Jan 25 2006 - mls@suse.de
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Jan 19 2006 - schwab@suse.de
* Thu Jan 19 2006 schwab@suse.de
- Don't strip binaries.
* Fri Oct 14 2005 - ro@suse.de
* Fri Oct 14 2005 ro@suse.de
- fix problem in configure to re-enable ACLs (#128323)
* Tue Aug 02 2005 - ro@suse.de
* Tue Aug 02 2005 ro@suse.de
- added acl-fix.patch from wayne to make testsuite pass with acls
* Fri Jul 29 2005 - ro@suse.de
* Fri Jul 29 2005 ro@suse.de
- update to 2.6.6
* Mon Jun 06 2005 - ro@suse.de
* Mon Jun 06 2005 ro@suse.de
- update to 2.6.5
- use acl patch as shipped in rsync/patches directory
* Fri Feb 18 2005 - mmj@suse.de
* Fri Feb 18 2005 mmj@suse.de
- Glibc doesn't cache the timezone as much as it used to, so export
the TZ variable after doing chroot. [#49878]
* Thu Feb 10 2005 - ro@suse.de
* Thu Feb 10 2005 ro@suse.de
- added libpng to neededforbuild (for tetex)
* Wed Dec 01 2004 - ro@suse.de
* Wed Dec 01 2004 ro@suse.de
- re-register before SLP really times out
* Wed Dec 01 2004 - ro@suse.de
* Wed Dec 01 2004 ro@suse.de
- re-worked slp.diff
do not use a timer but hook into central select call
* Thu Nov 11 2004 - ro@suse.de
* Thu Nov 11 2004 ro@suse.de
- update to 2.6.3 final
* Mon Aug 16 2004 - bk@suse.de
* Mon Aug 16 2004 bk@suse.de
- updated to 2.6.3-pre1, which is currently in release-testing
(and includes a security fix)
* Fri Jul 23 2004 - ro@suse.de
* Fri Jul 23 2004 ro@suse.de
- fixing problems apparently introduced with the update to 2.6.2:
- fix from cvs to not abort trying to create already created
backup directories (#42780)
- fix from cvs to avoid crash on large trees (#42933)
* Mon May 10 2004 - ro@suse.de
* Mon May 10 2004 ro@suse.de
- update to 2.6.2 / ported patches
- fixes a problem with non-chroot modules
* Thu Apr 01 2004 - mls@suse.de
* Thu Apr 01 2004 mls@suse.de
- fix hostname calculation in slp registration code
* Tue Mar 16 2004 - ro@suse.de
* Tue Mar 16 2004 ro@suse.de
- add -4 and -6 options to manpage (#36144)
* Tue Jan 13 2004 - ro@suse.de
* Tue Jan 13 2004 ro@suse.de
- update to version 2.6.0
* Thu Dec 04 2003 - ro@suse.de
* Thu Dec 04 2003 ro@suse.de
- update to real 2.5.7
* Thu Dec 04 2003 - okir@suse.de
* Thu Dec 04 2003 okir@suse.de
- fix heap overflow (#33478)
* Sun Nov 23 2003 - adrian@suse.de
* Sun Nov 23 2003 adrian@suse.de
- add patch for SLP support, based on Brad Hards demo implementation
* Thu Nov 06 2003 - schwab@suse.de
* Thu Nov 06 2003 schwab@suse.de
- Fix quoting in configure script.
* Fri Oct 24 2003 - ro@suse.de
* Fri Oct 24 2003 ro@suse.de
- added make test
- added acl patch, build with acl support
* Fri Oct 17 2003 - ro@suse.de
* Fri Oct 17 2003 ro@suse.de
- don't build as root
* Mon Aug 18 2003 - ro@suse.de
* Mon Aug 18 2003 ro@suse.de
- added stop_on_removal and restart_on_update macro calls
* Tue May 13 2003 - ro@suse.de
* Tue May 13 2003 ro@suse.de
- use defattr
* Wed Mar 05 2003 - ro@suse.de
* Wed Mar 05 2003 ro@suse.de
- add xinetd-config to filelist
* Tue Jan 28 2003 - ro@suse.de
* Tue Jan 28 2003 ro@suse.de
- update to 2.5.6
- can combine ssh and daemon access
- supports URL like syntax rsync://
- IPv6 support in hosts.allow/deny
- recursive hang fixed upstream
* Fri Jan 24 2003 - ro@suse.de
* Fri Jan 24 2003 ro@suse.de
- added xinetd-config snippet
* Wed Jan 15 2003 - ro@suse.de
* Wed Jan 15 2003 ro@suse.de
- added logrotate config
* Tue Oct 08 2002 - ro@suse.de
* Tue Oct 08 2002 ro@suse.de
- fix recursive hangup in server process on broken pipe
* Wed Aug 14 2002 - poeml@suse.de
* Wed Aug 14 2002 poeml@suse.de
- fix comment in init script
* Thu Aug 01 2002 - ro@suse.de
* Thu Aug 01 2002 ro@suse.de
- use BuildRoot
- added PreReqs
* Mon Jul 22 2002 - kukuk@suse.de
* Mon Jul 22 2002 kukuk@suse.de
- Don't source /etc/rc.config in init script [Bug 17123]
* Mon Jun 17 2002 - ro@suse.de
* Mon Jun 17 2002 ro@suse.de
- update to 2.5.5
setgroups patch removed, has been integrated
zfree patch removed, rsync has current zlib fixes
unsigned patch removed, has been integrated
* Wed Mar 06 2002 - okir@suse.de
* Wed Mar 06 2002 okir@suse.de
- applied setgroups security fix
* Fri Feb 08 2002 - okir@suse.de
* Fri Feb 08 2002 okir@suse.de
- applied zlib security fix
* Wed Feb 06 2002 - ro@suse.de
* Wed Feb 06 2002 ro@suse.de
- make rsyncd a hardlink (#13041)
* Fri Feb 01 2002 - ro@suse.de
* Fri Feb 01 2002 ro@suse.de
- added patch for segmentation fault
* Mon Jan 21 2002 - draht@suse.de
* Mon Jan 21 2002 draht@suse.de
- corrected diff for log.c
* Mon Jan 21 2002 - ro@suse.de
* Mon Jan 21 2002 ro@suse.de
- applied security patch for various signed/unsigned fixes
* Fri Dec 14 2001 - ro@suse.de
* Fri Dec 14 2001 ro@suse.de
- removed START_RSYNCD
* Tue Aug 28 2001 - ro@suse.de
* Tue Aug 28 2001 ro@suse.de
- on uninstall, call insserv to cleanup
* Tue Aug 28 2001 - ro@suse.de
* Tue Aug 28 2001 ro@suse.de
- added rc-script and rc-config variable START_RSYNCD
if someone wants to run rsyncd standalone (w/o inetd) (#9496)
* Mon Sep 25 2000 - ro@suse.de
* Mon Sep 25 2000 ro@suse.de
- sorted
* Wed Sep 13 2000 - aj@suse.de
* Wed Sep 13 2000 aj@suse.de
- Work with LFS; fix spec file to not print while building.
* Mon Sep 11 2000 - ro@suse.de
* Mon Sep 11 2000 ro@suse.de
- update to 2.4.6
* Fri Aug 18 2000 - ro@suse.de
* Fri Aug 18 2000 ro@suse.de
- update to 2.4.4
* Thu Jan 20 2000 - aj@suse.de
* Thu Jan 20 2000 aj@suse.de
- rsync 2.3.2, install man pages -> /usr/share/man.
* Mon Sep 13 1999 - bs@suse.de
* Mon Sep 13 1999 bs@suse.de
- ran old prepare_spec on spec file to switch to new prepare_spec.
* Fri Aug 13 1999 - fehr@suse.de
* Fri Aug 13 1999 fehr@suse.de
- update to 2.3.1
- added rsyncstats shell script
* Thu Dec 17 1998 - ro@suse.de
* Thu Dec 17 1998 ro@suse.de
- update to 2.2.1
* Sat Nov 28 1998 - bs@suse.de
* Sat Nov 28 1998 bs@suse.de
- added symlink /usr/sbin/rsyncd (to let it work with tcpd)
- added example configs
* Tue Nov 24 1998 - ro@suse.de
* Tue Nov 24 1998 ro@suse.de
- update to 2.2.0
* Sat Sep 19 1998 - ro@suse.de
* Sat Sep 19 1998 ro@suse.de
- defined _GNU_SOURCE where getopt_long is needed
* Mon Aug 24 1998 - ro@suse.de
* Mon Aug 24 1998 ro@suse.de
- update to 2.1.0
added manpage for rsyncd.conf
* Tue May 12 1998 - ro@suse.de
* Tue May 12 1998 ro@suse.de
- update to 1.7.4
generate tech_report.ps from tex-src
* Mon Nov 10 1997 - kfr@suse.de
* Mon Nov 10 1997 kfr@suse.de
- first version for S.u.S.E. (1.6.3)

View File

@ -1,13 +0,0 @@
--- options.c
+++ options.c
@@ -245,8 +245,8 @@ static void print_rsync_version(enum log
rprintf(f, "Capabilities: %d-bit files, %ssocketpairs, %shard links, %ssymlinks,\n",
(int) (sizeof (OFF_T) * 8), got_socketpair, hardlinks, links);
- rprintf(f, " batchfiles, %sinplace, %sIPv6, %sACLs, %sxattrs,\n",
- have_inplace, ipv6, acls, xattrs);
+ rprintf(f, " batchfiles, %sinplace, %sIPv6, %sACLs, %sxattrs, %sSLP\n",
+ have_inplace, ipv6, acls, xattrs, slp);
/* Note that this field may not have type ino_t. It depends
* on the complicated interaction between largefile feature

926
slp.diff
View File

@ -1,926 +0,0 @@
This adds Service Location Protocol support.
To use this patch, run these commands for a successful build:
patch -p1 <patches/slp.diff
./prepare-source
./configure --enable-slp
make
TODO: the configure changes should abort if the user requests --enable-slp
and we can't honor that request.
--- old/Makefile.in
+++ new/Makefile.in
@@ -13,6 +13,8 @@ CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@
EXEEXT=@EXEEXT@
LDFLAGS=@LDFLAGS@
+LIBSLP=@LIBSLP@
+SLPOBJ=@SLPOBJ@
INSTALLCMD=@INSTALL@
INSTALLMAN=@INSTALL@
@@ -36,7 +38,7 @@ OBJS1=rsync.o generator.o receiver.o cle
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \
fileio.o batch.o clientname.o chmod.o
OBJS3=progress.o pipe.o
-DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
+DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o $(SLPOBJ)
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
@@ -70,7 +72,7 @@ install-strip:
$(MAKE) INSTALL_STRIP='-s' install
rsync$(EXEEXT): $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(LIBSLP)
$(OBJS): $(HEADERS)
--- old/clientserver.c
+++ new/clientserver.c
@@ -849,6 +849,13 @@ int daemon_main(void)
* address too. In fact, why not just do inet_ntop on the
* local address??? */
+#ifdef HAVE_LIBSLP
+ if (register_services()) {
+ rprintf(FINFO,
+ "Couldn't register with service discovery protocol, continuing anyway\n");
+ }
+#endif
+
if (((pid_file = lp_pid_file()) != NULL) && (*pid_file != '\0')) {
char pidbuf[16];
int fd;
--- old/configure.in
+++ new/configure.in
@@ -592,6 +592,29 @@ if test $rsync_cv_can_hardlink_special =
AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
fi
+AC_ARG_ENABLE(slp, [ --disable-slp turn off SLP support, defaults to on])
+AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
+ LDFLAGS="-L$withval $LDFLAGS"
+ DSOFLAGS="-L$withval $DSOFLAGS",)
+AC_ARG_WITH(openslp-includes, [ --with-openslp-includes set directory for OpenSLP includes],
+ CFLAGS="-I$withval $CFLAGS"
+ CXXFLAGS="-I$withval $CXXFLAGS"
+ CPPFLAGS="-I$withval $CPPFLAGS",)
+
+LIBSLP=""
+SLPOBJ=""
+
+if test x$enable_slp != xno; then
+ AC_CHECK_HEADER(slp.h,
+ AC_CHECK_LIB(slp, SLPOpen,
+ AC_DEFINE(HAVE_LIBSLP, 1, [Define to 1 for SLP support])
+ SLPOBJ="srvreg.o srvloc.o"
+ LIBSLP="-lslp"))
+fi
+
+AC_SUBST(LIBSLP)
+AC_SUBST(SLPOBJ)
+
AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
AC_TRY_RUN([
#include <sys/types.h>
--- old/loadparm.c
+++ new/loadparm.c
@@ -108,6 +108,9 @@ typedef struct
char *socket_options;
int rsync_port;
+#ifdef HAVE_LIBSLP
+ int slp_refresh;
+#endif
} global;
static global Globals;
@@ -291,6 +294,9 @@ static struct parm_struct parm_table[] =
{"motd file", P_STRING, P_GLOBAL,&Globals.motd_file, NULL,0},
{"pid file", P_STRING, P_GLOBAL,&Globals.pid_file, NULL,0},
{"port", P_INTEGER,P_GLOBAL,&Globals.rsync_port, NULL,0},
+#ifdef HAVE_LIBSLP
+ {"slp refresh", P_INTEGER,P_GLOBAL,&Globals.slp_refresh, NULL,0},
+#endif
{"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
{"auth users", P_STRING, P_LOCAL, &sDefault.auth_users, NULL,0},
@@ -381,6 +387,9 @@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options)
FN_GLOBAL_INTEGER(lp_rsync_port, &Globals.rsync_port)
+#ifdef HAVE_LIBSLP
+FN_GLOBAL_INTEGER(lp_slp_refresh, &Globals.slp_refresh)
+#endif
FN_LOCAL_STRING(lp_auth_users, auth_users)
FN_LOCAL_STRING(lp_comment, comment)
--- old/main.c
+++ new/main.c
@@ -1058,6 +1058,18 @@ static int start_client(int argc, char *
if (!read_batch) { /* for read_batch, NO source is specified */
shell_path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
+
+ if (shell_machine && !shell_machine[0]) {
+#ifdef HAVE_LIBSLP
+ /* User entered just rsync:// URI */
+ print_service_list();
+ exit_cleanup(0);
+#else /* No SLP, die here */
+ rprintf(FINFO, "No SLP support, cannot browse\n");
+ exit_cleanup(RERR_SYNTAX);
+#endif
+ }
+
if (shell_path) { /* source is remote */
char *dummy1;
int dummy2;
--- old/options.c
+++ new/options.c
@@ -201,6 +201,7 @@ static void print_rsync_version(enum log
char const *hardlinks = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
+ char const *slp = "no ";
STRUCT_STAT *dumstat;
#ifdef HAVE_SOCKETPAIR
@@ -223,6 +224,10 @@ static void print_rsync_version(enum log
ipv6 = "";
#endif
+#if HAVE_LIBSLP
+ slp = "";
+#endif
+
rprintf(f, "%s version %s protocol version %d\n",
RSYNC_NAME, RSYNC_VERSION, PROTOCOL_VERSION);
rprintf(f, "Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.\n");
--- old/rsync.h
+++ new/rsync.h
@@ -157,6 +157,9 @@
#define SIGNIFICANT_ITEM_FLAGS (~(\
ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
+/* this is the minimum we'll use, irrespective of config setting */
+/* definately don't set to less than about 30 seconds */
+#define SLP_MIN_TIMEOUT 120
/* Log-message categories. Only FERROR and FINFO get sent over the socket,
* but FLOG and FSOCKERR can be sent over the receiver -> generator pipe.
--- old/rsync.yo
+++ new/rsync.yo
@@ -139,7 +139,12 @@ particular rsync daemon by leaving off t
quote(tt(rsync somehost.mydomain.com::))
-See the following section for more details.
+And, if Service Location Protocol is available, the following will list the
+available rsync servers:
+
+quote(tt(rsync rsync://))
+
+See the following section for even more usage details.
manpagesection(ADVANCED USAGE)
--- old/rsyncd.conf
+++ new/rsyncd.conf
@@ -0,0 +1,3 @@
+
+slp refresh = 300
+
--- old/rsyncd.conf.yo
+++ new/rsyncd.conf.yo
@@ -103,6 +103,15 @@ details on some of the options you may b
special socket options are set. These settings are superseded by the
bf(--sockopts) command-line option.
+dit(bf(slp refresh)) This option is used to determine how long service
+advertisements are valid (measured in seconds), and is only applicable if
+you have Service Location Protocol support compiled in. If this option is
+not set or is set to zero, then service advertisements never time out. If
+this is set to less than 120 seconds, then 120 seconds is used. If it is
+set to more than 65535, then 65535 is used (which is a limitation of SLP).
+Using 3600 (one hour) is a good number if you tend to change your
+configuration.
+
enddit()
@@ -556,6 +565,7 @@ use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd.pid
+slp refresh = 3600
[ftp]
path = /var/ftp/pub
--- old/socket.c
+++ new/socket.c
@@ -466,6 +466,16 @@ void start_accept_loop(int port, int (*f
{
fd_set deffds;
int *sp, maxfd, i;
+#ifdef HAVE_LIBSLP
+ time_t next_slp_refresh;
+ short slp_timeout = lp_slp_refresh();
+ if (slp_timeout) {
+ if (slp_timeout < SLP_MIN_TIMEOUT)
+ slp_timeout = SLP_MIN_TIMEOUT;
+ /* re-register before slp times out */
+ slp_timeout -= 15;
+ }
+#endif
#ifdef HAVE_SIGACTION
sigact.sa_flags = SA_NOCLDSTOP;
@@ -494,14 +504,25 @@ void start_accept_loop(int port, int (*f
maxfd = sp[i];
}
+#ifdef HAVE_LIBSLP
+ next_slp_refresh = time(NULL) + slp_timeout;
+#endif
+
/* now accept incoming connections - forking a new process
* for each incoming connection */
while (1) {
fd_set fds;
pid_t pid;
int fd;
+ int sel_ret;
struct sockaddr_storage addr;
socklen_t addrlen = sizeof addr;
+#ifdef HAVE_LIBSLP
+ struct timeval slp_tv;
+
+ slp_tv.tv_sec = 10;
+ slp_tv.tv_usec = 0;
+#endif
/* close log file before the potentially very long select so
* file can be trimmed by another process instead of growing
@@ -513,8 +534,18 @@ void start_accept_loop(int port, int (*f
#else
fds = deffds;
#endif
-
- if (select(maxfd + 1, &fds, NULL, NULL, NULL) != 1)
+#ifdef HAVE_LIBSLP
+ sel_ret = select(maxfd + 1, &fds, NULL, NULL,
+ slp_timeout ? &slp_tv : NULL);
+ if (sel_ret == 0 && slp_timeout && time(NULL) > next_slp_refresh) {
+ rprintf(FINFO, "Service registration expired, refreshing it\n");
+ register_services();
+ next_slp_refresh = time(NULL) + slp_timeout;
+ }
+#else
+ sel_ret = select(maxfd + 1, &fds, NULL, NULL, NULL);
+#endif
+ if (sel_ret != 1)
continue;
for (i = 0, fd = -1; sp[i] >= 0; i++) {
--- old/srvloc.c
+++ new/srvloc.c
@@ -0,0 +1,103 @@
+/* -*- c-file-style: "linux"; -*-
+
+ Copyright (C) 2002 by Brad Hards <bradh@frogmouth.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* This file implements the service location functionality */
+/* Basically, it uses normal Service Location Protocol API */
+
+/* It is really a cheap hack - just to show how it might work
+ in a real application.
+*/
+
+#include "rsync.h"
+
+#include <slp.h>
+#include <stdio.h>
+#include <string.h>
+
+/* This one just prints out the attributes */
+static SLPBoolean getAttrCallback(UNUSED(SLPHandle hslp), const char *attrlist,
+ SLPError errcode, UNUSED(void *cookie))
+{
+ char *cleanstr;
+
+ if (errcode == SLP_OK) {
+ if (!strcmp(attrlist, "(comment=)"))
+ rprintf(FINFO, "\t(No description)\n");
+ else {
+ cleanstr = strrchr(attrlist, ')') ;
+ *cleanstr = ' '; /* remove last ')' */
+ rprintf(FINFO, "\t%s\n", strchr(attrlist, '=') + 1);
+ }
+ }
+ return SLP_FALSE;
+}
+
+static SLPBoolean getSLPSrvURLCallback(UNUSED(SLPHandle hslp),
+ const char *srvurl, UNUSED(unsigned short lifetime),
+ SLPError errcode, void *cookie)
+{
+ SLPError result;
+ SLPHandle attrhslp;
+
+ if (errcode == SLP_OK) {
+ /* chop service: off the front */
+ rprintf(FINFO, " %s ", (strchr(srvurl, ':') + 1));
+ /* check for any attributes */
+ if (SLPOpen("en", SLP_FALSE,&attrhslp) == SLP_OK) {
+ result = SLPFindAttrs(attrhslp, srvurl,
+ "", /* return all attributes */
+ "", /* use configured scopes */
+ getAttrCallback, NULL);
+ if (result != SLP_OK) {
+ rprintf(FERROR, "errorcode: %i\n",result);
+ }
+ SLPClose(attrhslp);
+ }
+ *(SLPError*)cookie = SLP_OK;
+ } else
+ *(SLPError*)cookie = errcode;
+
+ /* Return SLP_TRUE because we want to be called again
+ * if more services were found. */
+
+ return SLP_TRUE;
+}
+
+int print_service_list(void)
+{
+ SLPError err;
+ SLPError callbackerr;
+ SLPHandle hslp;
+
+ err = SLPOpen("en",SLP_FALSE,&hslp);
+ if (err != SLP_OK) {
+ rprintf(FERROR, "Error opening slp handle %i\n", err);
+ return err;
+ }
+
+ SLPFindSrvs(hslp, "rsync",
+ 0, /* use configured scopes */
+ 0, /* no attr filter */
+ getSLPSrvURLCallback, &callbackerr);
+
+ /* Now that we're done using slp, close the slp handle */
+ SLPClose(hslp);
+
+ return 0;
+}
--- old/srvreg.c
+++ new/srvreg.c
@@ -0,0 +1,128 @@
+/* -*- c-file-style: "linux"; -*-
+
+ Copyright (C) 2002 by Brad Hards <bradh@frogmouth.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* This file implements the service registration functionality */
+
+/* Basically, it uses normal Service Location Protocol API */
+
+#include "rsync.h"
+#include "slp.h"
+#include "netdb.h"
+
+extern int rsync_port;
+
+static void slp_callback(UNUSED(SLPHandle hslp), SLPError errcode, void *cookie)
+{
+ /* return the error code in the cookie */
+ *(SLPError*)cookie = errcode;
+
+ /* You could do something else here like print out
+ * the errcode, etc. Remember, as a general rule,
+ * do not try to do too much in a callback because
+ * it is being executed by the same thread that is
+ * reading slp packets from the wire. */
+}
+
+int register_services(void)
+{
+ SLPError err, callbackerr;
+ SLPHandle hslp;
+ int n;
+ int i;
+ char srv[120];
+ char attr[120];
+ char localhost[256];
+ extern char *config_file;
+ short timeout;
+ struct addrinfo aih, *ai = 0;
+
+ if (!lp_load(config_file, 0)) {
+ exit_cleanup(RERR_SYNTAX);
+ }
+
+ n = lp_numservices();
+
+ if (0 == lp_slp_refresh())
+ timeout = SLP_LIFETIME_MAXIMUM; /* don't expire, ever */
+ else if (SLP_MIN_TIMEOUT > lp_slp_refresh())
+ timeout = SLP_MIN_TIMEOUT; /* use a reasonable minimum */
+ else if (SLP_LIFETIME_MAXIMUM <= lp_slp_refresh())
+ timeout = (SLP_LIFETIME_MAXIMUM - 1); /* as long as possible */
+ else
+ timeout = lp_slp_refresh();
+
+ rprintf(FINFO, "rsyncd registering %d service%s with slpd for %d seconds:\n", n, ((n==1)? "":"s"), timeout);
+ err = SLPOpen("en",SLP_FALSE,&hslp);
+ if (err != SLP_OK) {
+ rprintf(FINFO, "Error opening slp handle %i\n",err);
+ return err;
+ }
+ if (gethostname(localhost, sizeof localhost)) {
+ rprintf(FINFO, "Could not get hostname: %s\n", strerror(errno));
+ return err;
+ }
+ memset(&aih, 0, sizeof aih);
+ aih.ai_family = PF_UNSPEC;
+ aih.ai_flags = AI_CANONNAME;
+ if (0 != (err = getaddrinfo(localhost, 0, &aih, &ai)) || !ai) {
+ rprintf(FINFO, "Could not resolve hostname: %s\n", gai_strerror(err));
+ return err;
+ }
+ /* Register each service with SLP */
+ for (i = 0; i < n; i++) {
+ if (!lp_list(i))
+ continue;
+
+ snprintf(srv, sizeof srv, "service:rsync://%s:%d/%s",
+ ai->ai_canonname,
+ rsync_port,
+ lp_name(i));
+ rprintf(FINFO, " %s\n", srv);
+ if (lp_comment(i)) {
+ snprintf(attr, sizeof attr, "(comment=%s)",
+ lp_comment(i));
+ }
+ err = SLPReg(hslp,
+ srv, /* service to register */
+ timeout,
+ 0, /* this is ignored */
+ attr, /* attributes */
+ SLP_TRUE, /* new registration - don't change this */
+ slp_callback, /* callback */
+ &callbackerr);
+
+ /* err may contain an error code that occurred as the slp library
+ * _prepared_ to make the call. */
+ if (err != SLP_OK || callbackerr != SLP_OK)
+ rprintf(FINFO, "Error registering service with slp %i\n", err);
+
+ /* callbackerr may contain an error code (that was assigned through
+ * the callback cookie) that occurred as slp packets were sent on
+ * the wire. */
+ if (callbackerr != SLP_OK)
+ rprintf(FINFO, "Error registering service with slp %i\n",callbackerr);
+ }
+
+ /* Now that we're done using slp, close the slp handle */
+ freeaddrinfo(ai);
+ SLPClose(hslp);
+
+ /* refresh is done in main select loop */
+ return 0;
+}
--- old/proto.h
+++ new/proto.h
@@ -145,6 +145,7 @@ char *lp_motd_file(void);
char *lp_pid_file(void);
char *lp_socket_options(void);
int lp_rsync_port(void);
+int lp_slp_refresh(void);
char *lp_auth_users(int );
char *lp_comment(int );
char *lp_dont_compress(int );
@@ -246,6 +247,8 @@ void start_accept_loop(int port, int (*f
void set_socket_options(int fd, char *options);
void become_daemon(void);
int sock_exec(const char *prog);
+int print_service_list(void);
+int register_services(void);
int do_unlink(const char *fname);
int do_symlink(const char *fname1, const char *fname2);
int do_link(const char *fname1, const char *fname2);
--- old/configure
+++ new/configure
@@ -664,6 +664,8 @@ INSTALL_DATA
HAVE_REMSH
LIBOBJS
ALLOCA
+LIBSLP
+SLPOBJ
OBJ_SAVE
OBJ_RESTORE
CC_SHOBJ_FLAG
@@ -1258,6 +1260,7 @@ Optional Features:
--disable-largefile omit support for large files
--disable-ipv6 don't even try to use IPv6
--disable-locale turn off locale features
+ --disable-slp turn off SLP support, defaults to on
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1270,6 +1273,8 @@ Optional Packages:
--with-nobody-group=GROUP
set the default unprivileged group (default nobody
or nogroup)
+ --with-openslp-libs set directory for OpenSLP library
+ --with-openslp-includes set directory for OpenSLP includes
Some influential environment variables:
CC C compiler command
@@ -13999,6 +14004,276 @@ _ACEOF
fi
+# Check whether --enable-slp was given.
+if test "${enable_slp+set}" = set; then
+ enableval=$enable_slp;
+fi
+
+
+# Check whether --with-openslp-libs was given.
+if test "${with_openslp_libs+set}" = set; then
+ withval=$with_openslp_libs; LDFLAGS="-L$withval $LDFLAGS"
+ DSOFLAGS="-L$withval $DSOFLAGS"
+fi
+
+
+# Check whether --with-openslp-includes was given.
+if test "${with_openslp_includes+set}" = set; then
+ withval=$with_openslp_includes; CFLAGS="-I$withval $CFLAGS"
+ CXXFLAGS="-I$withval $CXXFLAGS"
+ CPPFLAGS="-I$withval $CPPFLAGS"
+fi
+
+
+LIBSLP=""
+SLPOBJ=""
+
+if test x$enable_slp != xno; then
+ if test "${ac_cv_header_slp_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for slp.h" >&5
+echo $ECHO_N "checking for slp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_slp_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_slp_h" >&5
+echo "${ECHO_T}$ac_cv_header_slp_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking slp.h usability" >&5
+echo $ECHO_N "checking slp.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <slp.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking slp.h presence" >&5
+echo $ECHO_N "checking slp.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <slp.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: slp.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: slp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: slp.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: slp.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: slp.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: slp.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: slp.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: slp.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: slp.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: slp.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: slp.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: slp.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: slp.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: slp.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: slp.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: slp.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for slp.h" >&5
+echo $ECHO_N "checking for slp.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_slp_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_slp_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_slp_h" >&5
+echo "${ECHO_T}$ac_cv_header_slp_h" >&6; }
+
+fi
+if test $ac_cv_header_slp_h = yes; then
+ { echo "$as_me:$LINENO: checking for SLPOpen in -lslp" >&5
+echo $ECHO_N "checking for SLPOpen in -lslp... $ECHO_C" >&6; }
+if test "${ac_cv_lib_slp_SLPOpen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lslp $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SLPOpen ();
+int
+main ()
+{
+return SLPOpen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_slp_SLPOpen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_slp_SLPOpen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_slp_SLPOpen" >&5
+echo "${ECHO_T}$ac_cv_lib_slp_SLPOpen" >&6; }
+if test $ac_cv_lib_slp_SLPOpen = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBSLP 1
+_ACEOF
+
+ SLPOBJ="srvreg.o srvloc.o"
+ LIBSLP="-lslp"
+fi
+
+fi
+
+
+fi
+
+
+
+
{ echo "$as_me:$LINENO: checking for working socketpair" >&5
echo $ECHO_N "checking for working socketpair... $ECHO_C" >&6; }
if test "${rsync_cv_HAVE_SOCKETPAIR+set}" = set; then
@@ -15483,6 +15758,8 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim
HAVE_REMSH!$HAVE_REMSH$ac_delim
LIBOBJS!$LIBOBJS$ac_delim
ALLOCA!$ALLOCA$ac_delim
+LIBSLP!$LIBSLP$ac_delim
+SLPOBJ!$SLPOBJ$ac_delim
OBJ_SAVE!$OBJ_SAVE$ac_delim
OBJ_RESTORE!$OBJ_RESTORE$ac_delim
CC_SHOBJ_FLAG!$CC_SHOBJ_FLAG$ac_delim
@@ -15490,7 +15767,7 @@ BUILD_POPT!$BUILD_POPT$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
--- old/config.h.in
+++ new/config.h.in
@@ -161,6 +161,9 @@
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
+/* Define to 1 for SLP support */
+#undef HAVE_LIBSLP
+
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
--- old/rsync.1
+++ new/rsync.1
@@ -168,7 +168,15 @@ particular rsync daemon by leaving off t
.RE
.PP
-See the following section for more details\&.
+And, if Service Location Protocol is available, the following will list the
+available rsync servers:
+.PP
+.RS
+\f(CWrsync rsync://\fP
+.RE
+
+.PP
+See the following section for even more usage details\&.
.PP
.SH "ADVANCED USAGE"
--- old/rsyncd.conf.5
+++ new/rsyncd.conf.5
@@ -120,6 +120,16 @@ details on some of the options you may b
special socket options are set\&. These settings are superseded by the
\fB\-\-sockopts\fP command-line option\&.
.IP
+.IP "\fBslp refresh\fP"
+This option is used to determine how long service
+advertisements are valid (measured in seconds), and is only applicable if
+you have Service Location Protocol support compiled in\&. If this option is
+not set or is set to zero, then service advertisements never time out\&. If
+this is set to less than 120 seconds, then 120 seconds is used\&. If it is
+set to more than 65535, then 65535 is used (which is a limitation of SLP)\&.
+Using 3600 (one hour) is a good number if you tend to change your
+configuration\&.
+.IP
.SH "MODULE OPTIONS"
.PP
@@ -663,6 +673,7 @@ use chroot = no
max connections = 4
syslog facility = local5
pid file = /var/run/rsyncd\&.pid
+slp refresh = 3600
[ftp]
path = /var/ftp/pub

View File

@ -1,18 +1,18 @@
--- Makefile.in
+++ Makefile.in
@@ -41,7 +41,8 @@ OBJS3=progress.o pipe.o
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o $(SLPOBJ)
@@ -40,7 +40,8 @@
DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
popt/popthelp.o popt/poptparse.o
-OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) $(ZLIBOBJ) @BUILD_POPT@
+OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_POPT@
+LIBS += -lz
TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o
TLS_OBJ = tls.o syscall.o lib/compat.o lib/snprintf.o lib/permstring.o lib/sysxattrs.o @BUILD_POPT@
--- batch.c
+++ batch.c
@@ -21,7 +21,7 @@
@@ -20,7 +20,7 @@
*/
#include "rsync.h"
@ -24,8 +24,8 @@
--- options.c
+++ options.c
@@ -22,7 +22,7 @@
#include "rsync.h"
#include "ifuncs.h"
#include <popt.h>
-#include "zlib/zlib.h"
+#include <zlib.h>
@ -35,9 +35,9 @@
--- token.c
+++ token.c
@@ -21,7 +21,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
-#include "zlib/zlib.h"
+#include <zlib.h>