diff options
author | 2002-06-22 02:13:08 +0000 | |
---|---|---|
committer | 2002-06-22 02:13:08 +0000 | |
commit | 2cab24aa6be95edf147d8769d70362d1c9a9eea7 (patch) | |
tree | d8f945d61528b0590bc60854948278af068dba28 /lib/libwrap | |
parent | correct comment (diff) | |
download | wireguard-openbsd-2cab24aa6be95edf147d8769d70362d1c9a9eea7.tar.xz wireguard-openbsd-2cab24aa6be95edf147d8769d70362d1c9a9eea7.zip |
use strtok_r() instead of strtok(); millert ok
Diffstat (limited to 'lib/libwrap')
-rw-r--r-- | lib/libwrap/hosts_access.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/libwrap/hosts_access.c b/lib/libwrap/hosts_access.c index 1043d6d811f..f172cffbc0e 100644 --- a/lib/libwrap/hosts_access.c +++ b/lib/libwrap/hosts_access.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hosts_access.c,v 1.8 2002/06/07 03:32:04 itojun Exp $ */ +/* $OpenBSD: hosts_access.c,v 1.9 2002/06/22 02:13:12 deraadt Exp $ */ /* * This module implements a simple access control language that is based on @@ -23,7 +23,7 @@ #if 0 static char sccsid[] = "@(#) hosts_access.c 1.21 97/02/12 02:13:22"; #else -static char rcsid[] = "$OpenBSD: hosts_access.c,v 1.8 2002/06/07 03:32:04 itojun Exp $"; +static char rcsid[] = "$OpenBSD: hosts_access.c,v 1.9 2002/06/22 02:13:12 deraadt Exp $"; #endif #endif @@ -199,7 +199,7 @@ char *list; struct request_info *request; int (*match_fn)(char *, struct request_info *); { - char *tok; + char *tok, *last; int l; /* @@ -209,7 +209,8 @@ int (*match_fn)(char *, struct request_info *); * the match is affected by any exceptions. */ - for (tok = strtok(list, sep); tok != 0; tok = strtok((char *) 0, sep)) { + for (tok = strtok_r(list, sep, &last); tok != 0; + tok = strtok_r(NULL, sep, &last)) { if (STR_EQ(tok, "EXCEPT")) /* EXCEPT: give up */ return (NO); l = strlen(tok); @@ -218,9 +219,9 @@ int (*match_fn)(char *, struct request_info *); tok++; } if (match_fn(tok, request)) { /* YES: look for exceptions */ - while ((tok = strtok((char *) 0, sep)) && STR_NE(tok, "EXCEPT")) + while ((tok = strtok_r(NULL, sep, &last)) && STR_NE(tok, "EXCEPT")) /* VOID */ ; - return (tok == 0 || list_match((char *) 0, request, match_fn) == 0); + return (tok == 0 || list_match(NULL, request, match_fn) == 0); } } return (NO); @@ -280,7 +281,7 @@ struct host_info *host; static char mydomain[MAXHOSTNAMELEN]; if (mydomain[0] == '\0') getdomainname(mydomain, sizeof(mydomain)); - return (innetgr(tok + 1, eval_hostname(host), (char *) 0, mydomain)); + return (innetgr(tok + 1, eval_hostname(host), NULL, mydomain)); #else tcpd_warn("netgroup support is disabled"); /* not tcpd_jump() */ return (NO); |