summaryrefslogtreecommitdiff
path: root/access.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2009-01-15 00:14:51 -0800
committerWayne Davison <wayned@samba.org>2009-01-15 00:23:07 -0800
commitdf694f72ed3faf6d0738f95f9539dfde970ffcf9 (patch)
tree0abe5ee45496f0440c7e55a7788716d3bab49e30 /access.c
parent11ef77b76aa0837851bc1c808921c5bacaa3d464 (diff)
downloadrsync-df694f72ed3faf6d0738f95f9539dfde970ffcf9.tar.gz
rsync-df694f72ed3faf6d0738f95f9539dfde970ffcf9.tar.bz2
rsync-df694f72ed3faf6d0738f95f9539dfde970ffcf9.zip
Change some args from "char *" to "const char *" in order to get rid of
a compiler warning that was just introduced. Also avoids changing the host string to lower-case in access.c (by using iwildmatch()).
Diffstat (limited to 'access.c')
-rw-r--r--access.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/access.c b/access.c
index 772ec27b..9a023dec 100644
--- a/access.c
+++ b/access.c
@@ -20,14 +20,14 @@
#include "rsync.h"
-static int match_hostname(char *host, char *tok)
+static int match_hostname(const char *host, const char *tok)
{
if (!host || !*host)
return 0;
- return wildmatch(tok, host);
+ return iwildmatch(tok, host);
}
-static int match_binary(char *b1, char *b2, char *mask, int addrlen)
+static int match_binary(const char *b1, const char *b2, const char *mask, int addrlen)
{
int i;
@@ -56,7 +56,7 @@ static void make_mask(char *mask, int plen, int addrlen)
return;
}
-static int match_address(char *addr, char *tok)
+static int match_address(const char *addr, const char *tok)
{
char *p;
struct addrinfo hints, *resa, *rest;
@@ -210,7 +210,7 @@ static int match_address(char *addr, char *tok)
return ret;
}
-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;
char *list2 = strdup(list);
@@ -219,8 +219,6 @@ static int access_match(char *list, char *addr, char *host)
out_of_memory("access_match");
strlower(list2);
- if (host)
- strlower(host);
for (tok = strtok(list2, " ,\t"); tok; tok = strtok(NULL, " ,\t")) {
if (match_hostname(host, tok) || match_address(addr, tok)) {
@@ -233,7 +231,8 @@ static int access_match(char *list, char *addr, char *host)
return 0;
}
-int allow_access(char *addr, char *host, char *allow_list, char *deny_list)
+int allow_access(const char *addr, const char *host,
+ const char *allow_list, const char *deny_list)
{
if (allow_list && !*allow_list)
allow_list = NULL;