Commit f7c3a250 authored by Wayne Davison's avatar Wayne Davison

Change rsyncd.conf &merge directive to match *.inc.

This allows the same rsyncd.d directory to be used for a set
of merge files (*.inc) and a set of include files (*.conf).
parent 6da6b02b
...@@ -428,6 +428,7 @@ static int name_cmp(const void *n1, const void *n2) ...@@ -428,6 +428,7 @@ static int name_cmp(const void *n1, const void *n2)
static int include_config(char *include, int manage_globals) static int include_config(char *include, int manage_globals)
{ {
STRUCT_STAT sb; STRUCT_STAT sb;
char *match = manage_globals ? "*.conf" : "*.inc";
int ret; int ret;
if (do_stat(include, &sb) < 0) { if (do_stat(include, &sb) < 0) {
...@@ -457,7 +458,7 @@ static int include_config(char *include, int manage_globals) ...@@ -457,7 +458,7 @@ static int include_config(char *include, int manage_globals)
while ((di = readdir(d)) != NULL) { while ((di = readdir(d)) != NULL) {
char *dname = d_name(di); char *dname = d_name(di);
if (!wildmatch("*.conf", dname)) if (!wildmatch(match, dname))
continue; continue;
bpp = EXPAND_ITEM_LIST(&conf_list, char *, 32); bpp = EXPAND_ITEM_LIST(&conf_list, char *, 32);
pathjoin(buf, sizeof buf, include, dname); pathjoin(buf, sizeof buf, include, dname);
......
...@@ -756,7 +756,8 @@ parameters in a module started in another file, can affect the defaults for ...@@ -756,7 +756,8 @@ parameters in a module started in another file, can affect the defaults for
other files, etc. other files, etc.
When an bf(&include) or bf(&merge) directive refers to a directory, it will read When an bf(&include) or bf(&merge) directive refers to a directory, it will read
in all the bf(*.conf) files contained inside that directory (without any in all the bf(*.conf) or bf(*.inc) files (respectively) that are contained inside
that directory (without any
recursive scanning), with the files sorted into alpha order. So, if you have a recursive scanning), with the files sorted into alpha order. So, if you have a
directory named "rsyncd.d" with the files "foo.conf", "bar.conf", and directory named "rsyncd.d" with the files "foo.conf", "bar.conf", and
"baz.conf" inside it, this directive: "baz.conf" inside it, this directive:
...@@ -773,17 +774,25 @@ except that it adjusts as files are added and removed from the directory. ...@@ -773,17 +774,25 @@ except that it adjusts as files are added and removed from the directory.
The advantage of the bf(&include) directive is that you can define one or more The advantage of the bf(&include) directive is that you can define one or more
modules in a separate file without worrying about unintended side-effects modules in a separate file without worrying about unintended side-effects
between the self-contained module files. For instance, this is a useful between the self-contained module files.
/etc/rsyncd.conf file:
The advantage of the bf(&merge) directive is that you can load config snippets
that can be included into multiple module definitions, and you can also set
global values that will affect connections (such as bf(motd file)), or globals
that will affect other include files.
For example, this is a useful /etc/rsyncd.conf file:
verb( port = 873 verb( port = 873
log file = /var/log/rsync.log log file = /var/log/rsync.log
pid file = /var/lock/rsync.lock pid file = /var/lock/rsync.lock
&merge /etc/rsyncd.d
&include /etc/rsyncd.d ) &include /etc/rsyncd.d )
The advantage of the bf(&merge) directive is that you can load config snippets This file merges any /etc/rsyncd.d/*.inc files, and then includes any
that can be included into multiple module definitions. /etc/rsyncd.d/*.conf files, which each include file being isolated from
the reset (so that each include's globals don't affect any others).
manpagesection(AUTHENTICATION STRENGTH) manpagesection(AUTHENTICATION STRENGTH)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment