X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/b3bf9b9df95137a3a43248be9599d919b04877af..11ef77b76aa0837851bc1c808921c5bacaa3d464:/clientserver.c diff --git a/clientserver.c b/clientserver.c index 09fd315a..1bc5b9ac 100644 --- a/clientserver.c +++ b/clientserver.c @@ -81,6 +81,9 @@ static int rl_nulls = 0; static struct sigaction sigact; #endif +/* Used when "reverse lookup" is off. */ +const char undetermined_hostname[] = "UNDETERMINED"; + /** * Run a client connected to an rsyncd. The alternative to this * function for remote-shell connections is do_cmd(). @@ -427,6 +430,11 @@ static int rsync_module(int f_in, int f_out, int i, char *addr, char *host) iconv_opt = NULL; #endif + /* If reverse lookup is disabled globally but enabled for this module, + * we need to do it now before the access check. */ + if (host == undetermined_hostname && lp_reverse_lookup(i)) + host = client_name(f_in); + if (!allow_access(addr, host, lp_hosts_allow(i), lp_hosts_deny(i))) { rprintf(FLOG, "rsync denied on module %s from %s (%s)\n", name, host, addr); @@ -927,7 +935,7 @@ int start_daemon(int f_in, int f_out) exit_cleanup(RERR_SYNTAX); addr = client_addr(f_in); - host = client_name(f_in); + host = lp_reverse_lookup(-1) ? client_name(f_in) : undetermined_hostname; rprintf(FLOG, "connect from %s (%s)\n", host, addr); if (!am_server) {