Matt McCutchen's Web Site
/
rsync
/
rsync-patches.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
614291b
)
The code now compiles if slp is disabled.
author
Wayne Davison
<wayned@samba.org>
Thu, 9 Feb 2006 03:54:28 +0000
(
03:54
+0000)
committer
Wayne Davison
<wayned@samba.org>
Thu, 9 Feb 2006 03:54:28 +0000
(
03:54
+0000)
slp.diff
patch
|
blob
|
blame
|
history
diff --git
a/slp.diff
b/slp.diff
index
3a9e5ee
..
ae9c0ad
100644
(file)
--- a/
slp.diff
+++ b/
slp.diff
@@
-6,6
+6,9
@@
After applying this patch, run these commands for a successful build:
./configure --enable-slp
make
./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
@@ -12,6 +12,8 @@ CFLAGS=@CFLAGS@
--- old/Makefile.in
+++ new/Makefile.in
@@ -12,6 +12,8 @@ CFLAGS=@CFLAGS@
@@
-85,27
+88,33
@@
After applying this patch, run these commands for a successful build:
#include <sys/types.h>
--- old/loadparm.c
+++ new/loadparm.c
#include <sys/types.h>
--- old/loadparm.c
+++ new/loadparm.c
-@@ -105,6 +105,
7
@@ typedef struct
+@@ -105,6 +105,
9
@@ typedef struct
char *socket_options;
int rsync_port;
char *socket_options;
int rsync_port;
++#ifdef HAVE_LIBSLP
+ int slp_refresh;
+ int slp_refresh;
++#endif
int syslog_facility;
} global;
int syslog_facility;
} global;
-@@ -286,6 +28
7,7
@@ static struct parm_struct parm_table[] =
+@@ -286,6 +28
9,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},
{"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},
+ {"slp refresh", P_INTEGER,P_GLOBAL,&Globals.slp_refresh, NULL,0},
++#endif
{"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
{"syslog facility", P_ENUM, P_GLOBAL,&Globals.syslog_facility,enum_facilities,0},
{"socket options", P_STRING, P_GLOBAL,&Globals.socket_options, NULL,0},
{"syslog facility", P_ENUM, P_GLOBAL,&Globals.syslog_facility,enum_facilities,0},
-@@ -379,6 +38
1,7
@@ FN_GLOBAL_STRING(lp_pid_file, &Globals.p
+@@ -379,6 +38
5,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)
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)
+FN_GLOBAL_INTEGER(lp_slp_refresh, &Globals.slp_refresh)
++#endif
FN_GLOBAL_INTEGER(lp_syslog_facility, &Globals.syslog_facility)
FN_LOCAL_STRING(lp_auth_users, auth_users)
FN_GLOBAL_INTEGER(lp_syslog_facility, &Globals.syslog_facility)
FN_LOCAL_STRING(lp_auth_users, auth_users)
@@
-225,10
+234,11
@@
After applying this patch, run these commands for a successful build:
path = /var/ftp/pub
--- old/socket.c
+++ new/socket.c
path = /var/ftp/pub
--- old/socket.c
+++ new/socket.c
-@@ -447,6 +447,1
4
@@ void start_accept_loop(int port, int (*f
+@@ -447,6 +447,1
6
@@ void start_accept_loop(int port, int (*f
{
fd_set deffds;
int *sp, maxfd, i;
{
fd_set deffds;
int *sp, maxfd, i;
++#ifdef HAVE_LIBSLP
+ time_t next_slp_refresh;
+ short slp_timeout = lp_slp_refresh();
+ if (slp_timeout) {
+ time_t next_slp_refresh;
+ short slp_timeout = lp_slp_refresh();
+ if (slp_timeout) {
@@
-237,14
+247,17
@@
After applying this patch, run these commands for a successful build:
+ /* re-register before slp times out */
+ slp_timeout -= 15;
+ }
+ /* re-register before slp times out */
+ slp_timeout -= 15;
+ }
++#endif
#ifdef HAVE_SIGACTION
sigact.sa_flags = SA_NOCLDSTOP;
#ifdef HAVE_SIGACTION
sigact.sa_flags = SA_NOCLDSTOP;
-@@ -475,14 +48
3,20
@@ void start_accept_loop(int port, int (*f
+@@ -475,14 +48
5,25
@@ void start_accept_loop(int port, int (*f
maxfd = sp[i];
}
maxfd = sp[i];
}
++#ifdef HAVE_LIBSLP
+ next_slp_refresh = time(NULL) + slp_timeout;
+ next_slp_refresh = time(NULL) + slp_timeout;
++#endif
+
/* now accept incoming connections - forking a new process
* for each incoming connection */
+
/* now accept incoming connections - forking a new process
* for each incoming connection */
@@
-253,33
+266,41
@@
After applying this patch, run these commands for a successful build:
pid_t pid;
int fd;
+ int sel_ret;
pid_t pid;
int fd;
+ int sel_ret;
-+ struct timeval slp_tv;
struct sockaddr_storage addr;
socklen_t addrlen = sizeof addr;
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;
+ 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
/* close log file before the potentially very long select so
* file can be trimmed by another process instead of growing
-@@ -494,8 +5
08,13
@@ void start_accept_loop(int port, int (*f
+@@ -494,8 +5
15,18
@@ void start_accept_loop(int port, int (*f
#else
fds = deffds;
#endif
-
- if (select(maxfd + 1, &fds, NULL, NULL, NULL) != 1)
#else
fds = deffds;
#endif
-
- if (select(maxfd + 1, &fds, NULL, NULL, NULL) != 1)
-+ sel_ret = select(maxfd + 1, &fds, NULL, NULL, slp_timeout ? &slp_tv: NULL);
++#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;
+ }
+ 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
+ if (sel_ret != 1)
continue;
for (i = 0, fd = -1; sp[i] >= 0; i++) {
--- old/srvloc.c
+++ new/srvloc.c
-@@ -0,0 +1,10
5
@@
+@@ -0,0 +1,10
3
@@
+/* -*- c-file-style: "linux"; -*-
+
+ Copyright (C) 2002 by Brad Hards <bradh@frogmouth.net>
+/* -*- c-file-style: "linux"; -*-
+
+ Copyright (C) 2002 by Brad Hards <bradh@frogmouth.net>
@@
-319,9
+340,9
@@
After applying this patch, run these commands for a successful build:
+ char *cleanstr;
+
+ if (errcode == SLP_OK) {
+ char *cleanstr;
+
+ if (errcode == SLP_OK) {
-+ if (!strcmp(attrlist, "(comment=)"))
{
++ if (!strcmp(attrlist, "(comment=)"))
+ rprintf(FINFO, "\t(No description)\n");
+ rprintf(FINFO, "\t(No description)\n");
-+
}
else {
++ else {
+ cleanstr = strrchr(attrlist, ')') ;
+ *cleanstr = ' '; /* remove last ')' */
+ rprintf(FINFO, "\t%s\n", strchr(attrlist, '=') + 1);
+ cleanstr = strrchr(attrlist, ')') ;
+ *cleanstr = ' '; /* remove last ')' */
+ rprintf(FINFO, "\t%s\n", strchr(attrlist, '=') + 1);
@@
-330,9
+351,9
@@
After applying this patch, run these commands for a successful build:
+ return SLP_FALSE;
+}
+
+ return SLP_FALSE;
+}
+
-+
SLPBoolean getSLPSrvURLCallback(UNUSED(SLPHandle hslp), const char *srvurl
,
-+
UNUSED(unsigned short lifetime), SLPError errcode
,
-+
void *cookie)
++
static SLPBoolean getSLPSrvURLCallback(UNUSED(SLPHandle hslp)
,
++
const char *srvurl, UNUSED(unsigned short lifetime)
,
++
SLPError errcode,
void *cookie)
+{
+ SLPError result;
+ SLPHandle attrhslp;
+{
+ SLPError result;
+ SLPHandle attrhslp;
@@
-352,10
+373,8
@@
After applying this patch, run these commands for a successful build:
+ SLPClose(attrhslp);
+ }
+ *(SLPError*)cookie = SLP_OK;
+ SLPClose(attrhslp);
+ }
+ *(SLPError*)cookie = SLP_OK;
-+ } else
{
++ } else
+ *(SLPError*)cookie = errcode;
+ *(SLPError*)cookie = errcode;
-+ }
-+
+
+ /* Return SLP_TRUE because we want to be called again
+ * if more services were found. */
+
+ /* Return SLP_TRUE because we want to be called again
+ * if more services were found. */