char *auth_user;
extern int sanitize_paths;
extern int filesfrom_fd;
+extern struct exclude_struct **server_exclude_list;
+extern char *exclude_path_prefix;
/**
* Run a client connected to an rsyncd. The alternative to this
rprintf(FINFO, "opening tcp connection to %s port %d\n",
host, rsync_port);
}
- fd = open_socket_out_wrapped (host, rsync_port, bind_address,
- default_af_hint);
+ fd = open_socket_out_wrapped(host, rsync_port, bind_address,
+ default_af_hint);
if (fd == -1) {
exit_cleanup(RERR_SOCKETIO);
}
} else {
rprintf(FERROR,"max connections (%d) reached\n",
lp_max_connections(i));
- io_printf(f_out, "@ERROR: max connections (%d) reached - try again later\n", lp_max_connections(i));
+ io_printf(f_out, "@ERROR: max connections (%d) reached - try again later\n",
+ lp_max_connections(i));
}
return -1;
}
/* TODO: Perhaps take a list of gids, and make them into the
* supplementary groups. */
+ exclude_path_prefix = use_chroot? "" : lp_path(i);
+
p = lp_include_from(i);
- add_exclude_file(p, 1, 1);
+ add_exclude_file(&server_exclude_list, p, MISSING_FATAL, ADD_INCLUDE);
p = lp_include(i);
- add_include_line(p);
+ add_exclude_line(&server_exclude_list, p, ADD_INCLUDE);
p = lp_exclude_from(i);
- add_exclude_file(p, 1, 0);
+ add_exclude_file(&server_exclude_list, p, MISSING_FATAL, ADD_EXCLUDE);
p = lp_exclude(i);
- add_exclude_line(p);
+ add_exclude_line(&server_exclude_list, p, ADD_EXCLUDE);
+
+ exclude_path_prefix = NULL;
log_init();
}
if (am_root) {
-#ifdef HAVE_SETGROUPS
- /* Get rid of any supplementary groups this process
- * might have inheristed. */
- if (setgroups(0, NULL)) {
- rsyserr(FERROR, errno, "setgroups failed");
- io_printf(f_out, "@ERROR: setgroups failed\n");
- return -1;
- }
-#endif
-
/* XXXX: You could argue that if the daemon is started
* by a non-root user and they explicitly specify a
* gid, then we should try to change to that gid --
io_printf(f_out, "@ERROR: setgid failed\n");
return -1;
}
+#ifdef HAVE_SETGROUPS
+ /* Get rid of any supplementary groups this process
+ * might have inheristed. */
+ if (setgroups(1, &gid)) {
+ rsyserr(FERROR, errno, "setgroups failed");
+ io_printf(f_out, "@ERROR: setgroups failed\n");
+ return -1;
+ }
+#endif
if (setuid(uid)) {
rsyserr(FERROR, errno, "setuid %d failed", (int) uid);
start_accept_loop(rsync_port, start_daemon);
return -1;
}
-