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
Mention the (anticipated) 2.6.3 release date.
[rsync/rsync.git]
/
access.c
diff --git
a/access.c
b/access.c
index
710a1af
..
cba3cc5
100644
(file)
--- a/
access.c
+++ b/
access.c
@@
-27,7
+27,7
@@
static int match_hostname(char *host, char *tok)
{
if (!host || !*host) return 0;
static int match_hostname(char *host, char *tok)
{
if (!host || !*host) return 0;
- return
(fnmatch(tok, host, 0) == 0
);
+ return
wildmatch(tok, host
);
}
static int match_binary(char *b1, char *b2, char *mask, int addrlen)
}
static int match_binary(char *b1, char *b2, char *mask, int addrlen)
@@
-86,12
+86,15
@@
static int match_address(char *addr, char *tok)
len = strlen(tok);
/* Fail quietly if tok is a hostname (not an address) */
len = strlen(tok);
/* Fail quietly if tok is a hostname (not an address) */
- if (strspn(tok, ".
/
0123456789") != len
+ if (strspn(tok, ".0123456789") != len
#ifdef INET6
#ifdef INET6
- && strspn(tok, "/0123456789:ABCDEFabcdef") != len
- && !strchr(tok, '%')
+ && strchr(tok, ':') == NULL
#endif
#endif
- ) return 0;
+ ) {
+ if (p)
+ *p = '/';
+ return 0;
+ }
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
@@
-100,17
+103,18
@@
static int match_address(char *addr, char *tok)
hints.ai_flags = AI_NUMERICHOST;
#endif
hints.ai_flags = AI_NUMERICHOST;
#endif
- gai = getaddrinfo(addr, NULL, &hints, &resa);
- if (gai) return 0;
+ if (getaddrinfo(addr, NULL, &hints, &resa) != 0) {
+ if (p)
+ *p = '/';
+ return 0;
+ }
gai = getaddrinfo(tok, NULL, &hints, &rest);
if (p)
*p++ = '/';
gai = getaddrinfo(tok, NULL, &hints, &rest);
if (p)
*p++ = '/';
- if (gai) {
- rprintf(FERROR,
- "error matching address %s: %s\n",
- tok,
- gai_strerror(gai));
+ if (gai != 0) {
+ rprintf(FLOG, "error matching address %s: %s\n",
+ tok, gai_strerror(gai));
freeaddrinfo(resa);
return 0;
}
freeaddrinfo(resa);
return 0;
}
@@
-153,7
+157,7
@@
static int match_address(char *addr, char *tok)
}
#endif
default:
}
#endif
default:
- rprintf(F
ERROR,
"unknown family %u\n", rest->ai_family);
+ rprintf(F
LOG,
"unknown family %u\n", rest->ai_family);
ret = 0;
goto out;
}
ret = 0;
goto out;
}
@@
-170,14
+174,14
@@
static int match_address(char *addr, char *tok)
#ifdef HAVE_STRTOL
bits = strtol(p, &ep, 10);
if (!*p || *ep) {
#ifdef HAVE_STRTOL
bits = strtol(p, &ep, 10);
if (!*p || *ep) {
- rprintf(F
ERROR,
"malformed mask in %s\n", tok);
+ rprintf(F
LOG,
"malformed mask in %s\n", tok);
ret = 0;
goto out;
}
#else
for (pp = (unsigned char *)p; *pp; pp++) {
if (!isascii(*pp) || !isdigit(*pp)) {
ret = 0;
goto out;
}
#else
for (pp = (unsigned char *)p; *pp; pp++) {
if (!isascii(*pp) || !isdigit(*pp)) {
- rprintf(F
ERROR,
"malformed mask in %s\n", tok);
+ rprintf(F
LOG,
"malformed mask in %s\n", tok);
ret = 0;
goto out;
}
ret = 0;
goto out;
}
@@
-189,7
+193,7
@@
static int match_address(char *addr, char *tok)
goto out;
}
if (bits < 0 || bits > (addrlen << 3)) {
goto out;
}
if (bits < 0 || bits > (addrlen << 3)) {
- rprintf(F
ERROR,
"malformed mask in %s\n", tok);
+ rprintf(F
LOG,
"malformed mask in %s\n", tok);
ret = 0;
goto out;
}
ret = 0;
goto out;
}