[Rsync-patches] [PATCH 3/3] Daemon: Don't reverse-lookup [...]
Matt McCutchen <matt at mattmccutchen.net>
Wed Jan 14 01:41:12 PST 2009
Oops, this is not as simple as I thought! For the %h escape,
log_formatted calls client_{name,addr} with fd 0 (which isn't the
socket), counting on the calls in start_daemon to have forced the
initialization of the client name and address. With my patch, this is
no longer the case when "hosts allow" and "hosts deny" are unspecified.
But by a wild stroke of luck, the right answer is obtained: am_server is
on by the time any transfer logging is done, so client_name re-parses
the IP address string cached by client_addr.
I don't think it's acceptable to rely on this working. Two possible
approaches for a real fix:
- Still do the reverse lookup on the first call to log_formatted, but
redesign clientname.c to save the fd. Laziest, but may result in an
unexpected delay when logging the first file transfer.
- Detect at the beginning of rsync_module that the log format contains
%h, and do the reverse lookup then. Needs an ad-hoc check in
rsync_module, but it is not necessary to change clientname.c (though it
could still use a redesign!).
Wayne, which one do you prefer?
For now I've moved the patch series from master to wip/reverse-lookup in
my repository.
--
Matt
More information about the rsync-patches
mailing list