summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2002-01-24 09:42:52 +0000
committerMartin Pool <mbp@samba.org>2002-01-24 09:42:52 +0000
commit0d9582499579ffc8507e56d60b28f0efc44f5f65 (patch)
tree6f8618a1113569efe73396dbdd1e20b832518d55
parentbbc09ffba9ffc29381e72249df5375e60e9d5463 (diff)
downloadrsync-0d9582499579ffc8507e56d60b28f0efc44f5f65.tar.gz
Verbose messages for spoof check... doesn't work on old linux libc?
-rw-r--r--socket.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/socket.c b/socket.c
index efdeecf5..545c0f82 100644
--- a/socket.c
+++ b/socket.c
@@ -715,10 +715,11 @@ int check_name(int fd,
{
struct addrinfo hints, *res, *res0;
int error;
+ int ss_family = get_sockaddr_family(ss);
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
- hints.ai_flags = get_sockaddr_family(ss);
+ hints.ai_flags = ss_family;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo(name_buf, port_buf, &hints, &res0);
if (error) {
@@ -733,14 +734,39 @@ int check_name(int fd,
/* We expect that one of the results will be the same as ss. */
for (res = res0; res; res = res->ai_next) {
- if (res->ai_family != get_sockaddr_family(ss))
+ if (res->ai_family != ss_family) {
+ rprintf(FERROR,
+ "check_name: response family %d != %d\n",
+ res->ai_family, ss_family);
continue;
- if (res->ai_addrlen != ss_len)
+ }
+ if (res->ai_addrlen != ss_len) {
+ rprintf(FERROR,
+ "check_name: addrlen %d != %d\n",
+ res->ai_addrlen, ss_len);
continue;
- if (memcmp(res->ai_addr, ss, res->ai_addrlen) == 0)
+ }
+ if (memcmp(res->ai_addr, ss, res->ai_addrlen) == 0) {
+ rprintf(FERROR,
+ "check_name: %d bytes of address identical\n",
+ res->ai_addrlen);
break;
+ } else{
+ rprintf(FERROR,
+ "check_name: %d bytes of address NOT identical\n",
+ res->ai_addrlen);
+ }
}
+ if (!res0) {
+ /* We hit the end of the list without finding an
+ * address that was the same as ss. */
+ rprintf(FERROR, RSYNC_NAME
+ ": no known address for \"%s\": "
+ "spoofed address?\n",
+ name_buf);
+ strcpy(name_buf, default_name);
+ }
if (res == NULL) {
/* We hit the end of the list without finding an
* address that was the same as ss. */