aboutsummaryrefslogtreecommitdiffstats
path: root/clientserver.c
diff options
context:
space:
mode:
authorMatt McCutchen <matt@mattmccutchen.net>2009-01-15 00:07:05 -0800
committerWayne Davison <wayned@samba.org>2009-01-15 00:22:36 -0800
commit11ef77b76aa0837851bc1c808921c5bacaa3d464 (patch)
tree62251663df6c511149e9fb34bcb18c919c87f9e8 /clientserver.c
parentabd32c9585158286d5b1800e5476477da18c48dc (diff)
downloadandroid_external_rsync-11ef77b76aa0837851bc1c808921c5bacaa3d464.tar.gz
android_external_rsync-11ef77b76aa0837851bc1c808921c5bacaa3d464.tar.bz2
android_external_rsync-11ef77b76aa0837851bc1c808921c5bacaa3d464.zip
Added the "reverse lookup" daemon-config parameter.
Diffstat (limited to 'clientserver.c')
-rw-r--r--clientserver.c10
1 files changed, 9 insertions, 1 deletions
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) {