Commit 439a198d authored by Wayne Davison's avatar Wayne Davison

Log every connect to the daemon.

parent f041b025
...@@ -268,7 +268,7 @@ static int read_arg_from_pipe(int fd, char *buf, int limit) ...@@ -268,7 +268,7 @@ static int read_arg_from_pipe(int fd, char *buf, int limit)
return bp - buf; return bp - buf;
} }
static int rsync_module(int f_in, int f_out, int i) static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
{ {
int argc = 0; int argc = 0;
int maxargs; int maxargs;
...@@ -277,8 +277,6 @@ static int rsync_module(int f_in, int f_out, int i) ...@@ -277,8 +277,6 @@ static int rsync_module(int f_in, int f_out, int i)
uid_t uid = (uid_t)-2; /* canonically "nobody" */ uid_t uid = (uid_t)-2; /* canonically "nobody" */
gid_t gid = (gid_t)-2; gid_t gid = (gid_t)-2;
char *p, *err_msg = NULL; char *p, *err_msg = NULL;
char *addr = client_addr(f_in);
char *host = client_name(f_in);
char *name = lp_name(i); char *name = lp_name(i);
int use_chroot = lp_use_chroot(i); int use_chroot = lp_use_chroot(i);
int start_glob = 0; int start_glob = 0;
...@@ -731,8 +729,12 @@ int start_daemon(int f_in, int f_out) ...@@ -731,8 +729,12 @@ int start_daemon(int f_in, int f_out)
{ {
char line[1024]; char line[1024];
char *motd; char *motd;
char *addr = client_addr(f_in);
char *host = client_name(f_in);
int i; int i;
rprintf(FLOG, "connect from %s (%s)\n", host, addr);
io_set_sock_fds(f_in, f_out); io_set_sock_fds(f_in, f_out);
if (!lp_load(config_file, 0)) if (!lp_load(config_file, 0))
...@@ -781,8 +783,6 @@ int start_daemon(int f_in, int f_out) ...@@ -781,8 +783,6 @@ int start_daemon(int f_in, int f_out)
return -1; return -1;
if (!*line || strcmp(line, "#list") == 0) { if (!*line || strcmp(line, "#list") == 0) {
char *addr = client_addr(f_in);
char *host = client_name(f_in);
rprintf(FLOG, "module-list request from %s (%s)\n", rprintf(FLOG, "module-list request from %s (%s)\n",
host, addr); host, addr);
send_listing(f_out); send_listing(f_out);
...@@ -796,8 +796,6 @@ int start_daemon(int f_in, int f_out) ...@@ -796,8 +796,6 @@ int start_daemon(int f_in, int f_out)
} }
if ((i = lp_number(line)) < 0) { if ((i = lp_number(line)) < 0) {
char *addr = client_addr(f_in);
char *host = client_name(f_in);
rprintf(FLOG, "unknown module '%s' tried from %s (%s)\n", rprintf(FLOG, "unknown module '%s' tried from %s (%s)\n",
line, host, addr); line, host, addr);
io_printf(f_out, "@ERROR: Unknown module '%s'\n", line); io_printf(f_out, "@ERROR: Unknown module '%s'\n", line);
...@@ -809,7 +807,7 @@ int start_daemon(int f_in, int f_out) ...@@ -809,7 +807,7 @@ int start_daemon(int f_in, int f_out)
#endif #endif
SIGACTION(SIGCHLD, remember_children); SIGACTION(SIGCHLD, remember_children);
return rsync_module(f_in, f_out, i); return rsync_module(f_in, f_out, i, addr, host);
} }
int daemon_main(void) int daemon_main(void)
......
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