[Rsync-patches] [PATCH 1/3] access_match: Don't mutate the passed hostname.

Matt McCutchen <matt at mattmccutchen.net>
Tue Jan 13 22:12:23 PST 2009


This resulted in the following bogus-looking log output:

2009/01/14 01:08:25 [15314] connect from UNKNOWN (192.168.1.46)
2009/01/14 01:08:26 [15319] rsync on module/ from user at unknown (192.168.1.46)
---
 access.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/access.c b/access.c
index 772ec27..32ab216 100644
--- a/access.c
+++ b/access.c
@@ -214,13 +214,16 @@ static int access_match(char *list, char *addr, char *host)
 {
 	char *tok;
 	char *list2 = strdup(list);
+	char *host2;
 
 	if (!list2)
 		out_of_memory("access_match");
 
-	strlower(list2);
-	if (host)
-		strlower(host);
+	if (host) {
+		host2 = strdup(host);
+		strlower(host2);
+	} else
+		host2 = NULL;
 
 	for (tok = strtok(list2, " ,\t"); tok; tok = strtok(NULL, " ,\t")) {
 		if (match_hostname(host, tok) || match_address(addr, tok)) {
-- 
1.6.1.86.g57f37





More information about the rsync-patches mailing list