summaryrefslogtreecommitdiff
path: root/usr.sbin/authpf
diff options
context:
space:
mode:
authorDaniel Hartmeier <dhartmei@cvs.openbsd.org>2004-01-13 17:31:16 +0000
committerDaniel Hartmeier <dhartmei@cvs.openbsd.org>2004-01-13 17:31:16 +0000
commit0054b3917d71ca53862d0948ed0ea41f6bc85ce5 (patch)
treeb1e8bbf05e98ce6a35ceab38030ec7100793ba6a /usr.sbin/authpf
parentca67d0062f00bb1e87cb343ebf1faa5c6ea1d784 (diff)
handle ruleset names containing usernames, fixes PR 3627, ok Bob
Diffstat (limited to 'usr.sbin/authpf')
-rw-r--r--usr.sbin/authpf/authpf.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.sbin/authpf/authpf.c b/usr.sbin/authpf/authpf.c
index b48c2a32f2c..618a21cc456 100644
--- a/usr.sbin/authpf/authpf.c
+++ b/usr.sbin/authpf/authpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: authpf.c,v 1.73 2003/12/15 07:11:31 mcbride Exp $ */
+/* $OpenBSD: authpf.c,v 1.74 2004/01/13 17:31:15 dhartmei Exp $ */
/*
* Copyright (C) 1998 - 2002 Bob Beck (beck@openbsd.org).
@@ -549,15 +549,20 @@ remove_stale_rulesets(void)
mnr = prs.nr;
nr = 0;
while (nr < mnr) {
- char *s;
+ char *s, *t;
pid_t pid;
prs.nr = nr;
if (ioctl(dev, DIOCGETRULESET, &prs))
return (1);
errno = 0;
- pid = strtoul(prs.name, &s, 10);
- if (!prs.name[0] || errno || *s)
+ if ((t = strchr(prs.name, '(')) == NULL)
+ t = prs.name;
+ else
+ t++;
+ pid = strtoul(t, &s, 10);
+ if (!prs.name[0] || errno ||
+ (*s && (t == prs.name || *s != ')')))
return (1);
if (kill(pid, 0) && errno != EPERM) {
int i;