Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added the "reverse lookup" daemon-config parameter.
[rsync/rsync.git]
/
clientserver.c
diff --git
a/clientserver.c
b/clientserver.c
index
09fd315
..
1bc5b9a
100644
(file)
--- a/
clientserver.c
+++ b/
clientserver.c
@@
-81,6
+81,9
@@
static int rl_nulls = 0;
static struct sigaction sigact;
#endif
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().
/**
* 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
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);
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);
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) {
rprintf(FLOG, "connect from %s (%s)\n", host, addr);
if (!am_server) {