Skip to content

Moving to rsyncd.conf from /etc to hermetic-usr pattern. #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions clientserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1261,10 +1261,16 @@ static void send_listing(int fd)
static int load_config(int globals_only)
{
if (!config_file) {
if (am_daemon < 0 && am_root <= 0)
if (am_daemon < 0 && am_root <= 0) {
config_file = RSYNCD_USERCONF;
else
} else {
config_file = RSYNCD_SYSCONF;
#ifdef RSYNCD_DISTCONF
STRUCT_STAT st;
if (do_stat(RSYNCD_SYSCONF, &st) != 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is odd - do_stat() returns 0 on finding the file. So you are using the file only if it doesn't exist?

Copy link
Author

@schubi2 schubi2 Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is odd - do_stat() returns 0 on finding the file. So you are using the file only if it doesn't exist?

Yes, then RSYNCD_DISTCONF will be used. So, how it should be changed ?

Regarding testing: openSUSE is using this patch since Nov 29 12:34:30 UTC 2023 without any problem:
Changelog:
Wed Nov 29 12:34:30 UTC 2023 - Stefan Schubert [email protected]

  • Moved rsyncd.conf and rsyncd.secrets to /usr/etc.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is odd - do_stat() returns 0 on finding the file. So you are using the file only if it doesn't exist?

Let me try to explain it again:

RSYNCD_DISTCONF = "/usr/etc/rsyncd.conf"
RSYNCD_SYSCONF "/etc/rsyncd.conf"

RSYNCD_DISTCONF comes from the distribution and is included by e.g. a RPM.
RSYNCD_SYSCONF is a user changed file and MUST NOT be overwritten by a package update and has more priority than RSYNCD_DISTCONF.
So if RSYNCD_SYSCONF is not there the default RSYNCD_DISTCONF will be take for parsing.

config_file = RSYNCD_DISTCONF;
#endif
}
}
return lp_load(config_file, globals_only);
}
Expand Down
24 changes: 22 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ AC_ARG_WITH(rsync-path,
AC_DEFINE_UNQUOTED(RSYNC_PATH, "$RSYNC_PATH", [location of rsync on remote machine])

AC_ARG_WITH(rsyncd-conf,
AS_HELP_STRING([--with-rsyncd-conf=PATH],[set configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
AS_HELP_STRING([--with-rsyncd-conf=PATH],[set user/admin defined configuration file for rsync server to PATH (default: /etc/rsyncd.conf)]),
[ if test ! -z "$with_rsyncd_conf" ; then
case $with_rsyncd_conf in
yes|no)
Expand All @@ -193,7 +193,27 @@ AC_ARG_WITH(rsyncd-conf,
fi ],
[ RSYNCD_SYSCONF="/etc/rsyncd.conf" ])

AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of configuration file for rsync server])
AC_DEFINE_UNQUOTED(RSYNCD_SYSCONF, "$RSYNCD_SYSCONF", [location of user/admin defined configuration file for rsync server])

AC_ARG_WITH(rsyncd-distconf,
AS_HELP_STRING([--with-rsyncd-distconf=PATH],[set vendor configuration file for rsync server to PATH (default: not set)]),
[ if test ! -z "$with_rsyncd_distconf" ; then
case $with_rsyncd_distconf in
yes|no)
RSYNCD_DISTCONF="/usr/etc/rsyncd.conf"
;;
/*)
RSYNCD_DISTCONF="$with_rsyncd_distconf"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-rsyncd-distconf=PATH)
;;
esac
fi
],
[])

AC_DEFINE_UNQUOTED(RSYNCD_DISTCONF, "$RSYNCD_DISTCONF", [location of vendor configuration file for rsync server])

AC_ARG_WITH(rsh,
AS_HELP_STRING([--with-rsh=CMD],[set remote shell command to CMD (default: ssh)]))
Expand Down
2 changes: 1 addition & 1 deletion rsyncd.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ The /etc/rsyncd.secrets file would look something like this:

## FILES

/etc/rsyncd.conf or rsyncd.conf
rsyncd.conf or /etc/rsyncd.conf or /usr/etc/rsyncd.conf

## SEE ALSO

Expand Down