summaryrefslogtreecommitdiff
path: root/lib/libwrap/misc.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-10-14 00:56:17 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-10-14 00:56:17 +0000
commitf6091bbe12538b3e722800dcd3e43cf014dc17e6 (patch)
tree0061ec9397b880b94546484b17273eac081d654d /lib/libwrap/misc.c
parentea55ada60b971559c0cd36421576ee1f0502d9a3 (diff)
tcp wrapper support for IPv6. from netbsd.
TODO: scoped address support may need more consideration (we are taking safer side now - rejects too much).
Diffstat (limited to 'lib/libwrap/misc.c')
-rw-r--r--lib/libwrap/misc.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/libwrap/misc.c b/lib/libwrap/misc.c
index 69e7ac1c086..3ba0caaf023 100644
--- a/lib/libwrap/misc.c
+++ b/lib/libwrap/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.3 1999/06/06 15:34:44 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.4 2000/10/14 00:56:15 itojun Exp $ */
/*
* Misc routines that are used by tcpd and by tcpdchk.
@@ -10,7 +10,7 @@
#if 0
static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29";
#else
-static char rcsid[] = "$OpenBSD: misc.c,v 1.3 1999/06/06 15:34:44 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.4 2000/10/14 00:56:15 itojun Exp $";
#endif
#endif
@@ -60,11 +60,35 @@ char *split_at(string, delimiter)
char *string;
int delimiter;
{
+#if 0
char *cp;
if ((cp = strchr(string, delimiter)) != 0)
*cp++ = 0;
return (cp);
+#else
+ char *cp;
+ int bracket;
+
+ bracket = 0;
+ for (cp = string; cp && *cp; cp++) {
+ switch (*cp) {
+ case '[':
+ bracket++;
+ break;
+ case ']':
+ bracket--;
+ break;
+ default:
+ if (bracket == 0 && *cp == delimiter) {
+ *cp++ = 0;
+ return cp;
+ }
+ break;
+ }
+ }
+ return NULL;
+#endif
}
/* dot_quad_addr_new - convert dotted quad to internal form */