[Patch] rsync-2.6.2: Allow 'port = N' in rsyncd.conf

Demian M. Nave dnave at psc.edu
Tue Sep 28 17:59:45 GMT 2004


Hi,

If anyone is interested, the included patch to rsync-2.6.2 allows you to 
specify the port number for an rsync server as a global option in 
rsyncd.conf with 'port = <N>' (where <N> is your favorite port number).

Note that this parameter only takes effect when the server is started, not 
when clients connect.  Also, specifying the port in rsyncd.conf takes 
precedence over --port on the command line, which seems to match the 
precedence of other server parameters.

Cheers,
Demian

-- 
 Demian M. Nave | dnave at psc.edu | www.psc.edu/~dnave | Ph 412 268-4574
 Pgh. Supercomputing Ctr.  | 4400 Fifth Avenue | Pittsburgh, PA 15213
 | "Our scientific powers have outrun our spiritual powers; we have guided
 | missles and mis-guided men."  - Martin Luther King
-------------- next part --------------
Only in rsync-dmn/lib: dummy
diff --unified -r rsync-2.6.2/loadparm.c rsync-dmn/loadparm.c
--- rsync-2.6.2/loadparm.c	Wed Feb  4 02:31:29 2004
+++ rsync-dmn/loadparm.c	Tue Sep 28 12:56:51 2004
@@ -104,6 +104,7 @@
 	char *socket_options;
 	int syslog_facility;
 	int max_verbosity;
+	int rsync_port;
 } global;
 
 static global Globals;
@@ -269,6 +270,7 @@
   {"log file",         P_STRING,  P_GLOBAL, &Globals.log_file,      NULL,  0},
   {"pid file",         P_STRING,  P_GLOBAL, &Globals.pid_file,      NULL,  0},
   {"max verbosity",    P_INTEGER, P_GLOBAL, &Globals.max_verbosity, NULL,  0},
+  {"port",             P_INTEGER, P_GLOBAL, &Globals.rsync_port,    NULL,  0},
 
   {"timeout",          P_INTEGER, P_LOCAL,  &sDefault.timeout,     NULL,  0},
   {"max connections",  P_INTEGER, P_LOCAL,  &sDefault.max_connections,NULL, 0},
@@ -350,6 +352,7 @@
 FN_GLOBAL_STRING(lp_socket_options, &Globals.socket_options)
 FN_GLOBAL_INTEGER(lp_syslog_facility, &Globals.syslog_facility)
 FN_GLOBAL_INTEGER(lp_max_verbosity, &Globals.max_verbosity)
+FN_GLOBAL_INTEGER(lp_rsync_port, &Globals.rsync_port)
 
 FN_LOCAL_STRING(lp_name, name)
 FN_LOCAL_STRING(lp_comment, comment)
diff --unified -r rsync-2.6.2/main.c rsync-dmn/main.c
--- rsync-2.6.2/main.c	Mon Feb  9 22:54:47 2004
+++ rsync-dmn/main.c	Tue Sep 28 12:58:28 2004
@@ -57,6 +57,7 @@
 extern char *rsync_path;
 extern char *shell_cmd;
 extern struct file_list *batch_flist;
+extern char* config_file;
 
 
 /* there's probably never more than at most 2 outstanding child processes,
@@ -1000,6 +1001,14 @@
 		 * code here, rather than relying on getopt. */
 		option_error();
 		exit_cleanup(RERR_SYNTAX);
+	}
+
+	if (!lp_load(config_file, 1)) {
+		exit_cleanup(RERR_SYNTAX);
+	}
+
+	if(lp_rsync_port() != 0) {
+		rsync_port = lp_rsync_port();
 	}
 
 	signal(SIGINT,SIGNAL_CAST sig_int);
Only in rsync-dmn/popt: dummy
Only in rsync-dmn/zlib: dummy


More information about the rsync mailing list