X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/85096e5eda83525eadddc9c6b1bc8135ac22e54a..5214a41bbae94607b196b199b483710e1babf292:/daemon-forward-lookup.diff diff --git a/daemon-forward-lookup.diff b/daemon-forward-lookup.diff index 8339da5..802d10b 100644 --- a/daemon-forward-lookup.diff +++ b/daemon-forward-lookup.diff @@ -8,37 +8,34 @@ To use this patch, run these commands for a successful build: ./configure (optional if already run) make +based-on: 24079e988fc31af4eba56cd2701fdc5a4154980d diff --git a/access.c b/access.c --- a/access.c +++ b/access.c -@@ -210,6 +210,42 @@ static int match_address(char *addr, char *tok) +@@ -210,6 +210,38 @@ static int match_address(const char *addr, const char *tok) return ret; } -+static int match_hostlookup(char *addr, char *tok) ++static int match_hostlookup(const char *addr, const char *tok) +{ + struct hostent *hp = NULL; + unsigned int i, len; -+ char *p; ++ const char *p; + -+ if ((p = strchr(tok,'/')) != NULL) { -+ *p = '\0'; ++ if ((p = strchr(tok,'/')) != NULL) + len = p - tok; -+ } else ++ else + len = strlen(tok); + + /* Fail quietly (hp left NULL) if tok is an address, not a hostname. */ +#ifdef INET6 -+ if (strchr(tok, ':') != NULL) { ++ if (strcspn(tok, ":/") != len) { + ; + } else +#endif + if (strspn(tok, ".0123456789") != len) + hp = gethostbyname(tok); + -+ if (p) -+ *p = '/'; -+ + if (!hp) + return 0; + @@ -51,11 +48,11 @@ diff --git a/access.c b/access.c + return 0; +} + - static int access_match(char *list, char *addr, char *host) + static int access_match(const char *list, const char *addr, const char *host) { char *tok; -@@ -223,7 +259,7 @@ static int access_match(char *list, char *addr, char *host) - strlower(host); +@@ -221,7 +253,7 @@ static int access_match(const char *list, const char *addr, const char *host) + strlower(list2); for (tok = strtok(list2, " ,\t"); tok; tok = strtok(NULL, " ,\t")) { - if (match_hostname(host, tok) || match_address(addr, tok)) {