The patches for 3.2.4pre1.
[rsync.git/patches.git] / slp.diff
index e7dafb95be54947138c4326500b98bb6fe56c643..2ab4de6468c5cc2c3d8452180ecbc8c55b7316a0 100644 (file)
--- a/slp.diff
+++ b/slp.diff
@@ -10,11 +10,11 @@ To use this patch, run these commands for a successful build:
 TODO: the configure changes should abort if the user requests --enable-slp
 and we can't honor that request.
 
-based-on: a1cc50ba96d212c0647a91bf56e3de25eb35bd56
+based-on: 3e44bbd3132c22f7ce1ae48c0ce262f237473038
 diff --git a/Makefile.in b/Makefile.in
 --- a/Makefile.in
 +++ b/Makefile.in
-@@ -16,6 +16,8 @@ CXX=@CXX@
+@@ -17,6 +17,8 @@ CXX=@CXX@
  CXXFLAGS=@CXXFLAGS@
  EXEEXT=@EXEEXT@
  LDFLAGS=@LDFLAGS@
@@ -23,33 +23,33 @@ diff --git a/Makefile.in b/Makefile.in
  LIBOBJDIR=lib/
  
  INSTALLCMD=@INSTALL@
-@@ -45,7 +47,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
+@@ -46,7 +48,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
  OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
-       fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
- OBJS3=progress.o pipe.o @ASM@
+       usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
+ OBJS3=progress.o pipe.o @ASM@ @SIMD@
 -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) @SIMD@ $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
-@@ -94,7 +96,7 @@ install-strip:
+ OBJS=$(OBJS1) $(OBJS2) $(OBJS3) $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
+@@ -99,7 +101,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)
- $(CHECK_OBJS): $(HEADERS)
+ rrsync: support/rrsync
+       cp -p $(srcdir)/support/rrsync rrsync
 diff --git a/clientserver.c b/clientserver.c
 --- a/clientserver.c
 +++ b/clientserver.c
-@@ -1405,6 +1405,13 @@ int daemon_main(void)
+@@ -1490,6 +1490,13 @@ int daemon_main(void)
         * address too.  In fact, why not just do getnameinfo on the
         * local address??? */
  
 +#ifdef HAVE_LIBSLP
-+      if (register_services()) {
++      if (lp_use_slp() && register_services()) {
 +              rprintf(FINFO,
 +                  "Couldn't register with service discovery protocol, continuing anyway\n");
 +      }
@@ -61,7 +61,7 @@ diff --git a/clientserver.c b/clientserver.c
 diff --git a/configure.ac b/configure.ac
 --- a/configure.ac
 +++ b/configure.ac
-@@ -976,6 +976,29 @@ if test $rsync_cv_can_hardlink_special = yes; then
+@@ -1008,6 +1008,29 @@ 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
  
@@ -90,22 +90,25 @@ diff --git a/configure.ac b/configure.ac
 +
  AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
  AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <sys/types.h>
+ #ifdef HAVE_SYS_TYPES_H
 diff --git a/daemon-parm.txt b/daemon-parm.txt
 --- a/daemon-parm.txt
 +++ b/daemon-parm.txt
-@@ -10,6 +10,7 @@ STRING       socket_options          NULL
+@@ -10,8 +10,10 @@ STRING      socket_options          NULL
  
  INTEGER       listen_backlog          5
- INTEGER       rsync_port              0
+ INTEGER       rsync_port|port         0
 +INTEGER       slp_refresh             0
  
  BOOL  proxy_protocol          False
++BOOL  use_slp                 False
+ Locals: =================================================================
  
 diff --git a/main.c b/main.c
 --- a/main.c
 +++ b/main.c
-@@ -1362,6 +1362,18 @@ static int start_client(int argc, char *argv[])
+@@ -1404,6 +1404,22 @@ static int start_client(int argc, char *argv[])
  
        if (!read_batch) { /* for read_batch, NO source is specified */
                char *path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
@@ -113,8 +116,12 @@ diff --git a/main.c b/main.c
 +              if (shell_machine && !shell_machine[0]) {
 +#ifdef HAVE_LIBSLP
 +                      /* User entered just rsync:// URI */
-+                      print_service_list();
-+                      exit_cleanup(0);
++                      if (lp_use_slp()) {
++                              print_service_list();
++                              exit_cleanup(0);
++                      }
++                      rprintf(FINFO, "SLP is disabled, cannot browse\n");
++                      exit_cleanup(RERR_SYNTAX);
 +#else /* No SLP, die here */
 +                      rprintf(FINFO, "No SLP support, cannot browse\n");
 +                      exit_cleanup(RERR_SYNTAX);
@@ -124,42 +131,34 @@ diff --git a/main.c b/main.c
                if (path) { /* source is remote */
                        char *dummy_host;
                        int dummy_port = 0;
-diff --git a/options.c b/options.c
---- a/options.c
-+++ b/options.c
-@@ -664,6 +664,11 @@ static void print_info_flags(enum logcode f)
- #endif
-                       "prealloc",
-+#ifndef HAVE_LIBSLP
-+              "no "
-+#endif
-+                      "SLP",
-+
-       "*Optimizations",
- #ifndef HAVE_SIMD
 diff --git a/rsync.1.md b/rsync.1.md
 --- a/rsync.1.md
 +++ b/rsync.1.md
-@@ -151,6 +151,13 @@ rsync daemon by leaving off the module name:
+@@ -149,7 +149,19 @@ rsync daemon by leaving off the module name:
  
- See the following section for more details.
+ >     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:
++
++>     rsync rsync://
++
++See the following section for even more usage details.
++
 +One more thing, if Service Location Protocol is available, the following will
 +list the available rsync servers:
 +
 +>     rsync rsync://
 +
 +See the following section for even more usage details.
-+
  # ADVANCED USAGE
  
- The syntax for requesting multiple files from a remote host is done by
 diff --git a/rsync.h b/rsync.h
 --- a/rsync.h
 +++ b/rsync.h
-@@ -221,6 +221,10 @@
+@@ -236,6 +236,10 @@
  #define SIGNIFICANT_ITEM_FLAGS (~(\
        ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
  
@@ -179,10 +178,15 @@ new file mode 100644
 diff --git a/rsyncd.conf.5.md b/rsyncd.conf.5.md
 --- a/rsyncd.conf.5.md
 +++ b/rsyncd.conf.5.md
-@@ -136,6 +136,16 @@ a literal % into a value is to use %%.
+@@ -136,6 +136,21 @@ a literal % into a value is to use %%.
      You can override the default backlog value when the daemon listens for
      connections.  It defaults to 5.
  
++0.  `use slp`
++
++    You can enable Service Location Protocol support by enabling this global
++    parameter.  The default is "false".
++
 +0.  `slp refresh`
 +
 +    This parameter is used to determine how long service advertisements are
@@ -196,6 +200,14 @@ diff --git a/rsyncd.conf.5.md b/rsyncd.conf.5.md
  # MODULE PARAMETERS
  
  After the global parameters you should define a number of modules, each module
+@@ -1173,6 +1188,7 @@ A more sophisticated example would be:
+ > max connections = 4
+ > syslog facility = local5
+ > pid file = /var/run/rsyncd.pid
++> slp refresh = 3600
+ >
+ > [ftp]
+ >         path = /var/ftp/./pub
 diff --git a/socket.c b/socket.c
 --- a/socket.c
 +++ b/socket.c
@@ -205,7 +217,7 @@ diff --git a/socket.c b/socket.c
        int *sp, maxfd, i;
 +#ifdef HAVE_LIBSLP
 +      time_t next_slp_refresh;
-+      short slp_timeout = lp_slp_refresh();
++      short slp_timeout = lp_use_slp() ? lp_slp_refresh() : 0;
 +      if (slp_timeout) {
 +              if (slp_timeout < SLP_MIN_TIMEOUT)
 +                      slp_timeout = SLP_MIN_TIMEOUT;
@@ -503,3 +515,18 @@ new file mode 100644
 +      /* refresh is done in main select loop */
 +      return 0;
 +}
+diff --git a/usage.c b/usage.c
+--- a/usage.c
++++ b/usage.c
+@@ -137,6 +137,11 @@ static void print_info_flags(enum logcode f)
+ #endif
+                       "crtimes",
++#ifndef HAVE_LIBSLP
++              "no "
++#endif
++                      "SLP",
++
+       "*Optimizations",
+ #ifndef HAVE_SIMD