+ p = lp_filter(i);
+ add_filter(&server_filter_list, p,
+ XFLG_WORD_SPLIT | XFLG_ABS_PATH);
+
+ p = lp_include_from(i);
+ add_filter_file(&server_filter_list, p,
+ XFLG_FATAL_ERRORS | XFLG_ABS_PATH | XFLG_DEF_INCLUDE);
+
+ p = lp_include(i);
+ add_filter(&server_filter_list, p,
+ XFLG_WORD_SPLIT | XFLG_ABS_PATH | XFLG_DEF_INCLUDE);
+
+ p = lp_exclude_from(i);
+ add_filter_file(&server_filter_list, p,
+ XFLG_FATAL_ERRORS | XFLG_ABS_PATH | XFLG_DEF_EXCLUDE);
+
+ p = lp_exclude(i);
+ add_filter(&server_filter_list, p,
+ XFLG_WORD_SPLIT | XFLG_ABS_PATH | XFLG_DEF_EXCLUDE);
+
+ 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");
+ return -1;
+ }
+
+ if (!push_dir("/")) {
+ rsyserr(FLOG, errno, "chdir %s failed\n", lp_path(i));
+ io_printf(f_out, "@ERROR: chdir failed\n");
+ return -1;
+ }
+
+ } else {
+ if (!push_dir(lp_path(i))) {
+ rsyserr(FLOG, errno, "chdir %s failed\n", lp_path(i));
+ io_printf(f_out, "@ERROR: chdir failed\n");
+ return -1;
+ }
+ sanitize_paths = 1;