Skip to content

Commit

Permalink
Change some args from "char *" to "const char *" in order to get rid of
Browse files Browse the repository at this point in the history
a compiler warning that was just introduced.  Also avoids changing the
host string to lower-case in access.c (by using iwildmatch()).
  • Loading branch information
Wayne Davison committed Jan 15, 2009
1 parent 11ef77b commit df694f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions access.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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)) {
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions clientserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static int path_failure(int f_out, const char *dir, BOOL was_chdir)
return -1;
}

static int rsync_module(int f_in, int f_out, int i, char *addr, char *host)
static int rsync_module(int f_in, int f_out, int i, const char *addr, const char *host)
{
int argc;
char **argv, **orig_argv, **orig_early_argv, *module_chdir;
Expand Down Expand Up @@ -922,7 +922,7 @@ static int load_config(int globals_only)
int start_daemon(int f_in, int f_out)
{
char line[1024];
char *addr, *host;
const char *addr, *host;
int i;

io_set_sock_fds(f_in, f_out);
Expand Down

0 comments on commit df694f7

Please sign in to comment.