+ /* TODO: If we're not root, but the configuration requests
+ * that we change to some uid other than the current one, then
+ * log a warning. */
+
+ /* TODO: Perhaps take a list of gids, and make them into the
+ * supplementary groups. */
+
+ exclude_path_prefix = use_chroot? "" : lp_path(i);
+ if (*exclude_path_prefix == '/' && !exclude_path_prefix[1])
+ exclude_path_prefix = "";
+
+ p = lp_include_from(i);
+ add_exclude_file(&server_exclude_list, p,
+ XFLG_FATAL_ERRORS | XFLG_DEF_INCLUDE);
+
+ p = lp_include(i);
+ add_exclude(&server_exclude_list, p,
+ XFLG_WORD_SPLIT | XFLG_DEF_INCLUDE);
+
+ p = lp_exclude_from(i);
+ add_exclude_file(&server_exclude_list, p,
+ XFLG_FATAL_ERRORS);
+
+ p = lp_exclude(i);
+ add_exclude(&server_exclude_list, p, XFLG_WORD_SPLIT);
+
+ exclude_path_prefix = NULL;
+
+ log_init();
+
+ if (use_chroot) {
+ /*
+ * XXX: The 'use chroot' flag is a fairly reliable
+ * source of confusion, because it fails under two
+ * important circumstances: running as non-root,
+ * running on Win32 (or possibly others). On the
+ * other hand, if you are running as root, then it
+ * might be better to always use chroot.
+ *
+ * So, perhaps if we can't chroot we should just issue
+ * a warning, unless a "require chroot" flag is set,
+ * in which case we fail.
+ */
+ if (chroot(lp_path(i))) {
+ rsyserr(FLOG, errno, "chroot %s failed", lp_path(i));
+ io_printf(f_out, "@ERROR: chroot failed\n");