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
Use a varint when sending the error_code.
[rsync/rsync.git]
/
clientserver.c
diff --git
a/clientserver.c
b/clientserver.c
index
5002959
..
059be75
100644
(file)
--- a/
clientserver.c
+++ b/
clientserver.c
@@
-3,7
+3,7
@@
*
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 2001-2002 Martin Pool <mbp@samba.org>
*
* Copyright (C) 1998-2001 Andrew Tridgell <tridge@samba.org>
* Copyright (C) 2001-2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2002-200
8
Wayne Davison
+ * Copyright (C) 2002-200
9
Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-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().
@@
-405,7
+408,7
@@
static int path_failure(int f_out, const char *dir, BOOL was_chdir)
return -1;
}
return -1;
}
-static int rsync_module(int f_in, int f_out, int i, c
har *addr,
char *host)
+static int rsync_module(int f_in, int f_out, int i, c
onst char *addr, const
char *host)
{
int argc;
char **argv, **orig_argv, **orig_early_argv, *module_chdir;
{
int argc;
char **argv, **orig_argv, **orig_early_argv, *module_chdir;
@@
-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);
@@
-914,7
+922,7
@@
static int load_config(int globals_only)
int start_daemon(int f_in, int f_out)
{
char line[1024];
int start_daemon(int f_in, int f_out)
{
char line[1024];
- char *addr, *host;
+ c
onst c
har *addr, *host;
int i;
io_set_sock_fds(f_in, f_out);
int i;
io_set_sock_fds(f_in, f_out);
@@
-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) {