Annotation of embedaddon/rsync/patches/slp.diff, revision 1.1
1.1 ! misho 1: This adds Service Location Protocol support.
! 2:
! 3: To use this patch, run these commands for a successful build:
! 4:
! 5: patch -p1 <patches/slp.diff
! 6: ./prepare-source
! 7: ./configure --enable-slp
! 8: make
! 9:
! 10: TODO: the configure changes should abort if the user requests --enable-slp
! 11: and we can't honor that request.
! 12:
! 13: based-on: e94bad1c156fc3910f24e2b3b71a81b0b0bdeb70
! 14: diff --git a/Makefile.in b/Makefile.in
! 15: --- a/Makefile.in
! 16: +++ b/Makefile.in
! 17: @@ -16,6 +16,8 @@ CXX=@CXX@
! 18: CXXFLAGS=@CXXFLAGS@
! 19: EXEEXT=@EXEEXT@
! 20: LDFLAGS=@LDFLAGS@
! 21: +LIBSLP=@LIBSLP@
! 22: +SLPOBJ=@SLPOBJ@
! 23: LIBOBJDIR=lib/
! 24:
! 25: INSTALLCMD=@INSTALL@
! 26: @@ -45,7 +47,7 @@ OBJS1=flist.o rsync.o generator.o receiver.o cleanup.o sender.o exclude.o \
! 27: OBJS2=options.o io.o compat.o hlink.o token.o uidlist.o socket.o hashtable.o \
! 28: usage.o fileio.o batch.o clientname.o chmod.o acls.o xattrs.o
! 29: OBJS3=progress.o pipe.o @ASM@
! 30: -DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o
! 31: +DAEMON_OBJ = params.o loadparm.o clientserver.o access.o connection.o authenticate.o $(SLPOBJ)
! 32: popt_OBJS=popt/findme.o popt/popt.o popt/poptconfig.o \
! 33: popt/popthelp.o popt/poptparse.o
! 34: OBJS=$(OBJS1) $(OBJS2) $(OBJS3) @SIMD@ $(DAEMON_OBJ) $(LIBOBJ) @BUILD_ZLIB@ @BUILD_POPT@
! 35: @@ -94,7 +96,7 @@ install-strip:
! 36: $(MAKE) INSTALL_STRIP='-s' install
! 37:
! 38: rsync$(EXEEXT): $(OBJS)
! 39: - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
! 40: + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(LIBSLP)
! 41:
! 42: $(OBJS): $(HEADERS)
! 43: $(CHECK_OBJS): $(HEADERS)
! 44: diff --git a/clientserver.c b/clientserver.c
! 45: --- a/clientserver.c
! 46: +++ b/clientserver.c
! 47: @@ -1456,6 +1456,13 @@ int daemon_main(void)
! 48: * address too. In fact, why not just do getnameinfo on the
! 49: * local address??? */
! 50:
! 51: +#ifdef HAVE_LIBSLP
! 52: + if (lp_use_slp() && register_services()) {
! 53: + rprintf(FINFO,
! 54: + "Couldn't register with service discovery protocol, continuing anyway\n");
! 55: + }
! 56: +#endif
! 57: +
! 58: start_accept_loop(rsync_port, start_daemon);
! 59: return -1;
! 60: }
! 61: diff --git a/configure.ac b/configure.ac
! 62: --- a/configure.ac
! 63: +++ b/configure.ac
! 64: @@ -1018,6 +1018,29 @@ if test $rsync_cv_can_hardlink_special = yes; then
! 65: AC_DEFINE(CAN_HARDLINK_SPECIAL, 1, [Define to 1 if link() can hard-link special files.])
! 66: fi
! 67:
! 68: +AC_ARG_ENABLE(slp, [ --disable-slp turn off SLP support, defaults to on])
! 69: +AC_ARG_WITH(openslp-libs, [ --with-openslp-libs set directory for OpenSLP library],
! 70: + LDFLAGS="-L$withval $LDFLAGS"
! 71: + DSOFLAGS="-L$withval $DSOFLAGS",)
! 72: +AC_ARG_WITH(openslp-includes, [ --with-openslp-includes set directory for OpenSLP includes],
! 73: + CFLAGS="-I$withval $CFLAGS"
! 74: + CXXFLAGS="-I$withval $CXXFLAGS"
! 75: + CPPFLAGS="-I$withval $CPPFLAGS",)
! 76: +
! 77: +LIBSLP=""
! 78: +SLPOBJ=""
! 79: +
! 80: +if test x$enable_slp != xno; then
! 81: + AC_CHECK_HEADER(slp.h,
! 82: + AC_CHECK_LIB(slp, SLPOpen,
! 83: + AC_DEFINE(HAVE_LIBSLP, 1, [Define to 1 for SLP support])
! 84: + SLPOBJ="srvreg.o srvloc.o"
! 85: + LIBSLP="-lslp"))
! 86: +fi
! 87: +
! 88: +AC_SUBST(LIBSLP)
! 89: +AC_SUBST(SLPOBJ)
! 90: +
! 91: AC_CACHE_CHECK([for working socketpair],rsync_cv_HAVE_SOCKETPAIR,[
! 92: AC_RUN_IFELSE([AC_LANG_SOURCE([[
! 93: #include <sys/types.h>
! 94: diff --git a/daemon-parm.txt b/daemon-parm.txt
! 95: --- a/daemon-parm.txt
! 96: +++ b/daemon-parm.txt
! 97: @@ -10,8 +10,10 @@ STRING socket_options NULL
! 98:
! 99: INTEGER listen_backlog 5
! 100: INTEGER rsync_port|port 0
! 101: +INTEGER slp_refresh 0
! 102:
! 103: BOOL proxy_protocol False
! 104: +BOOL use_slp False
! 105:
! 106: Locals: =================================================================
! 107:
! 108: diff --git a/main.c b/main.c
! 109: --- a/main.c
! 110: +++ b/main.c
! 111: @@ -1405,6 +1405,22 @@ static int start_client(int argc, char *argv[])
! 112:
! 113: if (!read_batch) { /* for read_batch, NO source is specified */
! 114: char *path = check_for_hostspec(argv[0], &shell_machine, &rsync_port);
! 115: +
! 116: + if (shell_machine && !shell_machine[0]) {
! 117: +#ifdef HAVE_LIBSLP
! 118: + /* User entered just rsync:// URI */
! 119: + if (lp_use_slp()) {
! 120: + print_service_list();
! 121: + exit_cleanup(0);
! 122: + }
! 123: + rprintf(FINFO, "SLP is disabled, cannot browse\n");
! 124: + exit_cleanup(RERR_SYNTAX);
! 125: +#else /* No SLP, die here */
! 126: + rprintf(FINFO, "No SLP support, cannot browse\n");
! 127: + exit_cleanup(RERR_SYNTAX);
! 128: +#endif
! 129: + }
! 130: +
! 131: if (path) { /* source is remote */
! 132: char *dummy_host;
! 133: int dummy_port = 0;
! 134: diff --git a/rsync.1.md b/rsync.1.md
! 135: --- a/rsync.1.md
! 136: +++ b/rsync.1.md
! 137: @@ -149,7 +149,19 @@ rsync daemon by leaving off the module name:
! 138:
! 139: > rsync somehost.mydomain.com::
! 140:
! 141: -See the following section for more details.
! 142: +And, if Service Location Protocol is available, the following will list the
! 143: +available rsync servers:
! 144: +
! 145: +> rsync rsync://
! 146: +
! 147: +See the following section for even more usage details.
! 148: +
! 149: +One more thing, if Service Location Protocol is available, the following will
! 150: +list the available rsync servers:
! 151: +
! 152: +> rsync rsync://
! 153: +
! 154: +See the following section for even more usage details.
! 155:
! 156: # ADVANCED USAGE
! 157:
! 158: diff --git a/rsync.h b/rsync.h
! 159: --- a/rsync.h
! 160: +++ b/rsync.h
! 161: @@ -224,6 +224,10 @@
! 162: #define SIGNIFICANT_ITEM_FLAGS (~(\
! 163: ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
! 164:
! 165: +/* this is the minimum we'll use, irrespective of config setting */
! 166: +/* definitely don't set to less than about 30 seconds */
! 167: +#define SLP_MIN_TIMEOUT 120
! 168: +
! 169: #define CFN_KEEP_DOT_DIRS (1<<0)
! 170: #define CFN_KEEP_TRAILING_SLASH (1<<1)
! 171: #define CFN_DROP_TRAILING_DOT_DIR (1<<2)
! 172: diff --git a/rsyncd.conf b/rsyncd.conf
! 173: new file mode 100644
! 174: --- /dev/null
! 175: +++ b/rsyncd.conf
! 176: @@ -0,0 +1 @@
! 177: +slp refresh = 300
! 178: diff --git a/rsyncd.conf.5.md b/rsyncd.conf.5.md
! 179: --- a/rsyncd.conf.5.md
! 180: +++ b/rsyncd.conf.5.md
! 181: @@ -136,6 +136,21 @@ a literal % into a value is to use %%.
! 182: You can override the default backlog value when the daemon listens for
! 183: connections. It defaults to 5.
! 184:
! 185: +0. `use slp`
! 186: +
! 187: + You can enable Service Location Protocol support by enabling this global
! 188: + parameter. The default is "false".
! 189: +
! 190: +0. `slp refresh`
! 191: +
! 192: + This parameter is used to determine how long service advertisements are
! 193: + valid (measured in seconds), and is only applicable if you have Service
! 194: + Location Protocol support compiled in. If this is not set or is set to
! 195: + zero, then service advertisements never time out. If this is set to less
! 196: + than 120 seconds, then 120 seconds is used. If it is set to more than
! 197: + 65535, then 65535 is used (which is a limitation of SLP). Using 3600
! 198: + (one hour) is a good number if you tend to change your configuration.
! 199: +
! 200: # MODULE PARAMETERS
! 201:
! 202: After the global parameters you should define a number of modules, each module
! 203: @@ -1168,6 +1183,7 @@ A more sophisticated example would be:
! 204: > max connections = 4
! 205: > syslog facility = local5
! 206: > pid file = /var/run/rsyncd.pid
! 207: +> slp refresh = 3600
! 208: >
! 209: > [ftp]
! 210: > path = /var/ftp/./pub
! 211: diff --git a/socket.c b/socket.c
! 212: --- a/socket.c
! 213: +++ b/socket.c
! 214: @@ -534,6 +534,16 @@ void start_accept_loop(int port, int (*fn)(int, int))
! 215: {
! 216: fd_set deffds;
! 217: int *sp, maxfd, i;
! 218: +#ifdef HAVE_LIBSLP
! 219: + time_t next_slp_refresh;
! 220: + short slp_timeout = lp_use_slp() ? lp_slp_refresh() : 0;
! 221: + if (slp_timeout) {
! 222: + if (slp_timeout < SLP_MIN_TIMEOUT)
! 223: + slp_timeout = SLP_MIN_TIMEOUT;
! 224: + /* re-register before slp times out */
! 225: + slp_timeout -= 15;
! 226: + }
! 227: +#endif
! 228:
! 229: #ifdef HAVE_SIGACTION
! 230: sigact.sa_flags = SA_NOCLDSTOP;
! 231: @@ -561,14 +571,25 @@ void start_accept_loop(int port, int (*fn)(int, int))
! 232: maxfd = sp[i];
! 233: }
! 234:
! 235: +#ifdef HAVE_LIBSLP
! 236: + next_slp_refresh = time(NULL) + slp_timeout;
! 237: +#endif
! 238: +
! 239: /* now accept incoming connections - forking a new process
! 240: * for each incoming connection */
! 241: while (1) {
! 242: fd_set fds;
! 243: pid_t pid;
! 244: int fd;
! 245: + int sel_ret;
! 246: struct sockaddr_storage addr;
! 247: socklen_t addrlen = sizeof addr;
! 248: +#ifdef HAVE_LIBSLP
! 249: + struct timeval slp_tv;
! 250: +
! 251: + slp_tv.tv_sec = 10;
! 252: + slp_tv.tv_usec = 0;
! 253: +#endif
! 254:
! 255: /* close log file before the potentially very long select so
! 256: * file can be trimmed by another process instead of growing
! 257: @@ -581,7 +602,18 @@ void start_accept_loop(int port, int (*fn)(int, int))
! 258: fds = deffds;
! 259: #endif
! 260:
! 261: - if (select(maxfd + 1, &fds, NULL, NULL, NULL) < 1)
! 262: +#ifdef HAVE_LIBSLP
! 263: + sel_ret = select(maxfd + 1, &fds, NULL, NULL,
! 264: + slp_timeout ? &slp_tv : NULL);
! 265: + if (sel_ret == 0 && slp_timeout && time(NULL) > next_slp_refresh) {
! 266: + rprintf(FINFO, "Service registration expired, refreshing it\n");
! 267: + register_services();
! 268: + next_slp_refresh = time(NULL) + slp_timeout;
! 269: + }
! 270: +#else
! 271: + sel_ret = select(maxfd + 1, &fds, NULL, NULL, NULL);
! 272: +#endif
! 273: + if (sel_ret < 1)
! 274: continue;
! 275:
! 276: for (i = 0, fd = -1; sp[i] >= 0; i++) {
! 277: diff --git a/srvloc.c b/srvloc.c
! 278: new file mode 100644
! 279: --- /dev/null
! 280: +++ b/srvloc.c
! 281: @@ -0,0 +1,103 @@
! 282: +/* -*- c-file-style: "linux"; -*-
! 283: +
! 284: + Copyright (C) 2002 by Brad Hards <bradh@frogmouth.net>
! 285: +
! 286: + This program is free software; you can redistribute it and/or modify
! 287: + it under the terms of the GNU General Public License as published by
! 288: + the Free Software Foundation; either version 2 of the License, or
! 289: + (at your option) any later version.
! 290: +
! 291: + This program is distributed in the hope that it will be useful,
! 292: + but WITHOUT ANY WARRANTY; without even the implied warranty of
! 293: + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 294: + GNU General Public License for more details.
! 295: +
! 296: + You should have received a copy of the GNU General Public License
! 297: + along with this program; if not, write to the Free Software
! 298: + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! 299: +*/
! 300: +
! 301: +/* This file implements the service location functionality */
! 302: +/* Basically, it uses normal Service Location Protocol API */
! 303: +
! 304: +/* It is really a cheap hack - just to show how it might work
! 305: + in a real application.
! 306: +*/
! 307: +
! 308: +#include "rsync.h"
! 309: +
! 310: +#include <slp.h>
! 311: +#include <stdio.h>
! 312: +#include <string.h>
! 313: +
! 314: +/* This one just prints out the attributes */
! 315: +static SLPBoolean getAttrCallback(UNUSED(SLPHandle hslp), const char *attrlist,
! 316: + SLPError errcode, UNUSED(void *cookie))
! 317: +{
! 318: + char *cleanstr;
! 319: +
! 320: + if (errcode == SLP_OK) {
! 321: + if (!strcmp(attrlist, "(comment=)"))
! 322: + rprintf(FINFO, "\t(No description)\n");
! 323: + else {
! 324: + cleanstr = strrchr(attrlist, ')') ;
! 325: + *cleanstr = ' '; /* remove last ')' */
! 326: + rprintf(FINFO, "\t%s\n", strchr(attrlist, '=') + 1);
! 327: + }
! 328: + }
! 329: + return SLP_FALSE;
! 330: +}
! 331: +
! 332: +static SLPBoolean getSLPSrvURLCallback(UNUSED(SLPHandle hslp),
! 333: + const char *srvurl, UNUSED(unsigned short lifetime),
! 334: + SLPError errcode, void *cookie)
! 335: +{
! 336: + SLPError result;
! 337: + SLPHandle attrhslp;
! 338: +
! 339: + if (errcode == SLP_OK) {
! 340: + /* chop service: off the front */
! 341: + rprintf(FINFO, " %s ", (strchr(srvurl, ':') + 1));
! 342: + /* check for any attributes */
! 343: + if (SLPOpen("en", SLP_FALSE,&attrhslp) == SLP_OK) {
! 344: + result = SLPFindAttrs(attrhslp, srvurl,
! 345: + "", /* return all attributes */
! 346: + "", /* use configured scopes */
! 347: + getAttrCallback, NULL);
! 348: + if (result != SLP_OK) {
! 349: + rprintf(FERROR, "errorcode: %i\n",result);
! 350: + }
! 351: + SLPClose(attrhslp);
! 352: + }
! 353: + *(SLPError*)cookie = SLP_OK;
! 354: + } else
! 355: + *(SLPError*)cookie = errcode;
! 356: +
! 357: + /* Return SLP_TRUE because we want to be called again
! 358: + * if more services were found. */
! 359: +
! 360: + return SLP_TRUE;
! 361: +}
! 362: +
! 363: +int print_service_list(void)
! 364: +{
! 365: + SLPError err;
! 366: + SLPError callbackerr;
! 367: + SLPHandle hslp;
! 368: +
! 369: + err = SLPOpen("en",SLP_FALSE,&hslp);
! 370: + if (err != SLP_OK) {
! 371: + rprintf(FERROR, "Error opening slp handle %i\n", err);
! 372: + return err;
! 373: + }
! 374: +
! 375: + SLPFindSrvs(hslp, "rsync",
! 376: + 0, /* use configured scopes */
! 377: + 0, /* no attr filter */
! 378: + getSLPSrvURLCallback, &callbackerr);
! 379: +
! 380: + /* Now that we're done using slp, close the slp handle */
! 381: + SLPClose(hslp);
! 382: +
! 383: + return 0;
! 384: +}
! 385: diff --git a/srvreg.c b/srvreg.c
! 386: new file mode 100644
! 387: --- /dev/null
! 388: +++ b/srvreg.c
! 389: @@ -0,0 +1,128 @@
! 390: +/* -*- c-file-style: "linux"; -*-
! 391: +
! 392: + Copyright (C) 2002 by Brad Hards <bradh@frogmouth.net>
! 393: +
! 394: + This program is free software; you can redistribute it and/or modify
! 395: + it under the terms of the GNU General Public License as published by
! 396: + the Free Software Foundation; either version 2 of the License, or
! 397: + (at your option) any later version.
! 398: +
! 399: + This program is distributed in the hope that it will be useful,
! 400: + but WITHOUT ANY WARRANTY; without even the implied warranty of
! 401: + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! 402: + GNU General Public License for more details.
! 403: +
! 404: + You should have received a copy of the GNU General Public License
! 405: + along with this program; if not, write to the Free Software
! 406: + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
! 407: +*/
! 408: +
! 409: +/* This file implements the service registration functionality */
! 410: +
! 411: +/* Basically, it uses normal Service Location Protocol API */
! 412: +
! 413: +#include "rsync.h"
! 414: +#include "slp.h"
! 415: +#include "netdb.h"
! 416: +
! 417: +extern int rsync_port;
! 418: +
! 419: +static void slp_callback(UNUSED(SLPHandle hslp), SLPError errcode, void *cookie)
! 420: +{
! 421: + /* return the error code in the cookie */
! 422: + *(SLPError*)cookie = errcode;
! 423: +
! 424: + /* You could do something else here like print out
! 425: + * the errcode, etc. Remember, as a general rule,
! 426: + * do not try to do too much in a callback because
! 427: + * it is being executed by the same thread that is
! 428: + * reading slp packets from the wire. */
! 429: +}
! 430: +
! 431: +int register_services(void)
! 432: +{
! 433: + SLPError err, callbackerr;
! 434: + SLPHandle hslp;
! 435: + int n;
! 436: + int i;
! 437: + char srv[120];
! 438: + char attr[120];
! 439: + char localhost[256];
! 440: + extern char *config_file;
! 441: + short timeout;
! 442: + struct addrinfo aih, *ai = 0;
! 443: +
! 444: + if (!lp_load(config_file, 0)) {
! 445: + exit_cleanup(RERR_SYNTAX);
! 446: + }
! 447: +
! 448: + n = lp_num_modules();
! 449: +
! 450: + if (0 == lp_slp_refresh())
! 451: + timeout = SLP_LIFETIME_MAXIMUM; /* don't expire, ever */
! 452: + else if (SLP_MIN_TIMEOUT > lp_slp_refresh())
! 453: + timeout = SLP_MIN_TIMEOUT; /* use a reasonable minimum */
! 454: + else if (SLP_LIFETIME_MAXIMUM <= lp_slp_refresh())
! 455: + timeout = (SLP_LIFETIME_MAXIMUM - 1); /* as long as possible */
! 456: + else
! 457: + timeout = lp_slp_refresh();
! 458: +
! 459: + rprintf(FINFO, "rsyncd registering %d service%s with slpd for %d seconds:\n", n, ((n==1)? "":"s"), timeout);
! 460: + err = SLPOpen("en",SLP_FALSE,&hslp);
! 461: + if (err != SLP_OK) {
! 462: + rprintf(FINFO, "Error opening slp handle %i\n",err);
! 463: + return err;
! 464: + }
! 465: + if (gethostname(localhost, sizeof localhost)) {
! 466: + rprintf(FINFO, "Could not get hostname: %s\n", strerror(errno));
! 467: + return err;
! 468: + }
! 469: + memset(&aih, 0, sizeof aih);
! 470: + aih.ai_family = PF_UNSPEC;
! 471: + aih.ai_flags = AI_CANONNAME;
! 472: + if (0 != (err = getaddrinfo(localhost, 0, &aih, &ai)) || !ai) {
! 473: + rprintf(FINFO, "Could not resolve hostname: %s\n", gai_strerror(err));
! 474: + return err;
! 475: + }
! 476: + /* Register each service with SLP */
! 477: + for (i = 0; i < n; i++) {
! 478: + if (!lp_list(i))
! 479: + continue;
! 480: +
! 481: + snprintf(srv, sizeof srv, "service:rsync://%s:%d/%s",
! 482: + ai->ai_canonname,
! 483: + rsync_port,
! 484: + lp_name(i));
! 485: + rprintf(FINFO, " %s\n", srv);
! 486: + if (lp_comment(i)) {
! 487: + snprintf(attr, sizeof attr, "(comment=%s)",
! 488: + lp_comment(i));
! 489: + }
! 490: + err = SLPReg(hslp,
! 491: + srv, /* service to register */
! 492: + timeout,
! 493: + 0, /* this is ignored */
! 494: + attr, /* attributes */
! 495: + SLP_TRUE, /* new registration - don't change this */
! 496: + slp_callback, /* callback */
! 497: + &callbackerr);
! 498: +
! 499: + /* err may contain an error code that occurred as the slp library
! 500: + * _prepared_ to make the call. */
! 501: + if (err != SLP_OK || callbackerr != SLP_OK)
! 502: + rprintf(FINFO, "Error registering service with slp %i\n", err);
! 503: +
! 504: + /* callbackerr may contain an error code (that was assigned through
! 505: + * the callback cookie) that occurred as slp packets were sent on
! 506: + * the wire. */
! 507: + if (callbackerr != SLP_OK)
! 508: + rprintf(FINFO, "Error registering service with slp %i\n",callbackerr);
! 509: + }
! 510: +
! 511: + /* Now that we're done using slp, close the slp handle */
! 512: + freeaddrinfo(ai);
! 513: + SLPClose(hslp);
! 514: +
! 515: + /* refresh is done in main select loop */
! 516: + return 0;
! 517: +}
! 518: diff --git a/usage.c b/usage.c
! 519: --- a/usage.c
! 520: +++ b/usage.c
! 521: @@ -131,6 +131,11 @@ static void print_info_flags(enum logcode f)
! 522: #endif
! 523: "crtimes",
! 524:
! 525: +#ifndef HAVE_LIBSLP
! 526: + "no "
! 527: +#endif
! 528: + "SLP",
! 529: +
! 530: "*Optimizations",
! 531:
! 532: #ifndef HAVE_SIMD
! 533: diff -Nurp a/config.h.in b/config.h.in
! 534: --- a/config.h.in
! 535: +++ b/config.h.in
! 536: @@ -243,6 +243,9 @@
! 537: /* Define to 1 if you have the `sec' library (-lsec). */
! 538: #undef HAVE_LIBSEC
! 539:
! 540: +/* Define to 1 for SLP support */
! 541: +#undef HAVE_LIBSLP
! 542: +
! 543: /* Define to 1 if you have the `socket' library (-lsocket). */
! 544: #undef HAVE_LIBSOCKET
! 545:
! 546: diff -Nurp a/configure.sh b/configure.sh
! 547: --- a/configure.sh
! 548: +++ b/configure.sh
! 549: @@ -631,6 +631,8 @@ BUILD_POPT
! 550: CC_SHOBJ_FLAG
! 551: OBJ_RESTORE
! 552: OBJ_SAVE
! 553: +SLPOBJ
! 554: +LIBSLP
! 555: ALLOCA
! 556: LIBOBJS
! 557: ASM
! 558: @@ -731,6 +733,9 @@ enable_zstd
! 559: enable_lz4
! 560: enable_iconv_open
! 561: enable_iconv
! 562: +enable_slp
! 563: +with_openslp_libs
! 564: +with_openslp_includes
! 565: enable_acl_support
! 566: enable_xattr_support
! 567: '
! 568: @@ -1386,6 +1391,7 @@ Optional Features:
! 569: --disable-lz4 disable LZ4 compression
! 570: --disable-iconv-open disable all use of iconv_open() function
! 571: --disable-iconv disable rsync's --iconv option
! 572: + --disable-slp turn off SLP support, defaults to on
! 573: --disable-acl-support disable ACL support
! 574: --disable-xattr-support disable extended attributes
! 575:
! 576: @@ -1402,6 +1408,8 @@ Optional Packages:
! 577: --with-nobody-group=GROUP
! 578: set the default unprivileged group (default nobody
! 579: or nogroup)
! 580: + --with-openslp-libs set directory for OpenSLP library
! 581: + --with-openslp-includes set directory for OpenSLP includes
! 582:
! 583: Some influential environment variables:
! 584: CC C compiler command
! 585: @@ -9146,6 +9154,85 @@ $as_echo "#define CAN_HARDLINK_SPECIAL 1
! 586:
! 587: fi
! 588:
! 589: +# Check whether --enable-slp was given.
! 590: +if test "${enable_slp+set}" = set; then :
! 591: + enableval=$enable_slp;
! 592: +fi
! 593: +
! 594: +
! 595: +# Check whether --with-openslp-libs was given.
! 596: +if test "${with_openslp_libs+set}" = set; then :
! 597: + withval=$with_openslp_libs; LDFLAGS="-L$withval $LDFLAGS"
! 598: + DSOFLAGS="-L$withval $DSOFLAGS"
! 599: +fi
! 600: +
! 601: +
! 602: +# Check whether --with-openslp-includes was given.
! 603: +if test "${with_openslp_includes+set}" = set; then :
! 604: + withval=$with_openslp_includes; CFLAGS="-I$withval $CFLAGS"
! 605: + CXXFLAGS="-I$withval $CXXFLAGS"
! 606: + CPPFLAGS="-I$withval $CPPFLAGS"
! 607: +fi
! 608: +
! 609: +
! 610: +LIBSLP=""
! 611: +SLPOBJ=""
! 612: +
! 613: +if test x$enable_slp != xno; then
! 614: + ac_fn_c_check_header_mongrel "$LINENO" "slp.h" "ac_cv_header_slp_h" "$ac_includes_default"
! 615: +if test "x$ac_cv_header_slp_h" = xyes; then :
! 616: + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SLPOpen in -lslp" >&5
! 617: +$as_echo_n "checking for SLPOpen in -lslp... " >&6; }
! 618: +if ${ac_cv_lib_slp_SLPOpen+:} false; then :
! 619: + $as_echo_n "(cached) " >&6
! 620: +else
! 621: + ac_check_lib_save_LIBS=$LIBS
! 622: +LIBS="-lslp $LIBS"
! 623: +cat confdefs.h - <<_ACEOF >conftest.$ac_ext
! 624: +/* end confdefs.h. */
! 625: +
! 626: +/* Override any GCC internal prototype to avoid an error.
! 627: + Use char because int might match the return type of a GCC
! 628: + builtin and then its argument prototype would still apply. */
! 629: +#ifdef __cplusplus
! 630: +extern "C"
! 631: +#endif
! 632: +char SLPOpen ();
! 633: +int
! 634: +main ()
! 635: +{
! 636: +return SLPOpen ();
! 637: + ;
! 638: + return 0;
! 639: +}
! 640: +_ACEOF
! 641: +if ac_fn_c_try_link "$LINENO"; then :
! 642: + ac_cv_lib_slp_SLPOpen=yes
! 643: +else
! 644: + ac_cv_lib_slp_SLPOpen=no
! 645: +fi
! 646: +rm -f core conftest.err conftest.$ac_objext \
! 647: + conftest$ac_exeext conftest.$ac_ext
! 648: +LIBS=$ac_check_lib_save_LIBS
! 649: +fi
! 650: +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_slp_SLPOpen" >&5
! 651: +$as_echo "$ac_cv_lib_slp_SLPOpen" >&6; }
! 652: +if test "x$ac_cv_lib_slp_SLPOpen" = xyes; then :
! 653: +
! 654: +$as_echo "#define HAVE_LIBSLP 1" >>confdefs.h
! 655: +
! 656: + SLPOBJ="srvreg.o srvloc.o"
! 657: + LIBSLP="-lslp"
! 658: +fi
! 659: +
! 660: +fi
! 661: +
! 662: +
! 663: +fi
! 664: +
! 665: +
! 666: +
! 667: +
! 668: { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working socketpair" >&5
! 669: $as_echo_n "checking for working socketpair... " >&6; }
! 670: if ${rsync_cv_HAVE_SOCKETPAIR+:} false; then :
! 671: diff -Nurp a/rsync.1 b/rsync.1
! 672: --- a/rsync.1
! 673: +++ b/rsync.1
! 674: @@ -182,7 +182,27 @@ rsync somehost.mydomain.com::
! 675: .fi
! 676: .RE
! 677: .P
! 678: -See the following section for more details.
! 679: +And, if Service Location Protocol is available, the following will list the
! 680: +available rsync servers:
! 681: +.RS 4
! 682: +.P
! 683: +.nf
! 684: +rsync rsync://
! 685: +.fi
! 686: +.RE
! 687: +.P
! 688: +See the following section for even more usage details.
! 689: +.P
! 690: +One more thing, if Service Location Protocol is available, the following will
! 691: +list the available rsync servers:
! 692: +.RS 4
! 693: +.P
! 694: +.nf
! 695: +rsync rsync://
! 696: +.fi
! 697: +.RE
! 698: +.P
! 699: +See the following section for even more usage details.
! 700: .P
! 701: .SH "ADVANCED USAGE"
! 702: .P
! 703: diff -Nurp a/rsync.1.html b/rsync.1.html
! 704: --- a/rsync.1.html
! 705: +++ b/rsync.1.html
! 706: @@ -160,7 +160,20 @@ rsync daemon by leaving off the module n
! 707: <pre><code>rsync somehost.mydomain.com::
! 708: </code></pre>
! 709: </blockquote>
! 710: -<p>See the following section for more details.</p>
! 711: +<p>And, if Service Location Protocol is available, the following will list the
! 712: +available rsync servers:</p>
! 713: +<blockquote>
! 714: +<pre><code>rsync rsync://
! 715: +</code></pre>
! 716: +</blockquote>
! 717: +<p>See the following section for even more usage details.</p>
! 718: +<p>One more thing, if Service Location Protocol is available, the following will
! 719: +list the available rsync servers:</p>
! 720: +<blockquote>
! 721: +<pre><code>rsync rsync://
! 722: +</code></pre>
! 723: +</blockquote>
! 724: +<p>See the following section for even more usage details.</p>
! 725: <h1>ADVANCED USAGE</h1>
! 726: <p>The syntax for requesting multiple files from a remote host is done by
! 727: specifying additional remote-host args in the same style as the first, or with
! 728: diff -Nurp a/rsyncd.conf.5 b/rsyncd.conf.5
! 729: --- a/rsyncd.conf.5
! 730: +++ b/rsyncd.conf.5
! 731: @@ -132,6 +132,17 @@ can also be specified via the \fB\-\-soc
! 732: .IP "\fBlisten\ backlog\fP"
! 733: You can override the default backlog value when the daemon listens for
! 734: connections. It defaults to 5.
! 735: +.IP "\fBuse\ slp\fP"
! 736: +You can enable Service Location Protocol support by enabling this global
! 737: +parameter. The default is "false".
! 738: +.IP "\fBslp\ refresh\fP"
! 739: +This parameter is used to determine how long service advertisements are
! 740: +valid (measured in seconds), and is only applicable if you have Service
! 741: +Location Protocol support compiled in. If this is not set or is set to
! 742: +zero, then service advertisements never time out. If this is set to less
! 743: +than 120 seconds, then 120 seconds is used. If it is set to more than
! 744: +65535, then 65535 is used (which is a limitation of SLP). Using 3600
! 745: +(one hour) is a good number if you tend to change your configuration.
! 746: .P
! 747: .SH "MODULE PARAMETERS"
! 748: .P
! 749: @@ -1198,6 +1209,7 @@ use chroot = yes
! 750: max connections = 4
! 751: syslog facility = local5
! 752: pid file = /var/run/rsyncd.pid
! 753: +slp refresh = 3600
! 754:
! 755: [ftp]
! 756: path = /var/ftp/./pub
! 757: diff -Nurp a/rsyncd.conf.5.html b/rsyncd.conf.5.html
! 758: --- a/rsyncd.conf.5.html
! 759: +++ b/rsyncd.conf.5.html
! 760: @@ -140,6 +140,21 @@ can also be specified via the <code>--so
! 761: <p>You can override the default backlog value when the daemon listens for
! 762: connections. It defaults to 5.</p>
! 763: </dd>
! 764: +
! 765: +<dt><code>use slp</code></dt><dd>
! 766: +<p>You can enable Service Location Protocol support by enabling this global
! 767: +parameter. The default is "false".</p>
! 768: +</dd>
! 769: +
! 770: +<dt><code>slp refresh</code></dt><dd>
! 771: +<p>This parameter is used to determine how long service advertisements are
! 772: +valid (measured in seconds), and is only applicable if you have Service
! 773: +Location Protocol support compiled in. If this is not set or is set to
! 774: +zero, then service advertisements never time out. If this is set to less
! 775: +than 120 seconds, then 120 seconds is used. If it is set to more than
! 776: +65535, then 65535 is used (which is a limitation of SLP). Using 3600
! 777: +(one hour) is a good number if you tend to change your configuration.</p>
! 778: +</dd>
! 779: </dl>
! 780: <h1>MODULE PARAMETERS</h1>
! 781: <p>After the global parameters you should define a number of modules, each module
! 782: @@ -1113,6 +1128,7 @@ use chroot = yes
! 783: max connections = 4
! 784: syslog facility = local5
! 785: pid file = /var/run/rsyncd.pid
! 786: +slp refresh = 3600
! 787:
! 788: [ftp]
! 789: path = /var/ftp/./pub
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>