summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2019-10-17 11:23:49 +0000
committermillert <millert@openbsd.org>2019-10-17 11:23:49 +0000
commitd04cdf616e902e5e240d92ece196b3ee47bf183b (patch)
treecc97a0040b3c81540f18e03a368edcc98b0ed6a3 /sys
parentsync (diff)
downloadwireguard-openbsd-d04cdf616e902e5e240d92ece196b3ee47bf183b.tar.xz
wireguard-openbsd-d04cdf616e902e5e240d92ece196b3ee47bf183b.zip
Use -1 to indicate an invalid uid/gid, not UID_MAX and GID_MAX.
This is clearer and more consistent with the rest of the kernel. OK deraadt@ sashan@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_pflog.c4
-rw-r--r--sys/net/pf.c14
-rw-r--r--sys/tmpfs/tmpfs_subr.c3
3 files changed, 10 insertions, 11 deletions
diff --git a/sys/net/if_pflog.c b/sys/net/if_pflog.c
index c0cb408a146..e894f412441 100644
--- a/sys/net/if_pflog.c
+++ b/sys/net/if_pflog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pflog.c,v 1.85 2019/09/30 01:53:05 dlg Exp $ */
+/* $OpenBSD: if_pflog.c,v 1.86 2019/10/17 11:23:49 millert Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -265,7 +265,7 @@ pflog_packet(struct pf_pdesc *pd, u_int8_t reason, struct pf_rule *rm,
hdr.uid = pd->lookup.uid;
hdr.pid = pd->lookup.pid;
} else {
- hdr.uid = UID_MAX;
+ hdr.uid = -1;
hdr.pid = NO_PID;
}
hdr.rule_uid = rm->cuid;
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 53205e0e6b1..5865554108a 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.1089 2019/08/29 06:13:46 sashan Exp $ */
+/* $OpenBSD: pf.c,v 1.1090 2019/10/17 11:23:49 millert Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -3055,7 +3055,7 @@ pf_match_port(u_int8_t op, u_int16_t a1, u_int16_t a2, u_int16_t p)
int
pf_match_uid(u_int8_t op, uid_t a1, uid_t a2, uid_t u)
{
- if (u == UID_MAX && op != PF_OP_EQ && op != PF_OP_NE)
+ if (u == -1 && op != PF_OP_EQ && op != PF_OP_NE)
return (0);
return (pf_match(op, a1, a2, u));
}
@@ -3063,7 +3063,7 @@ pf_match_uid(u_int8_t op, uid_t a1, uid_t a2, uid_t u)
int
pf_match_gid(u_int8_t op, gid_t a1, gid_t a2, gid_t g)
{
- if (g == GID_MAX && op != PF_OP_EQ && op != PF_OP_NE)
+ if (g == -1 && op != PF_OP_EQ && op != PF_OP_NE)
return (0);
return (pf_match(op, a1, a2, g));
}
@@ -3225,8 +3225,8 @@ pf_socket_lookup(struct pf_pdesc *pd)
struct inpcbtable *tb;
struct inpcb *inp;
- pd->lookup.uid = UID_MAX;
- pd->lookup.gid = GID_MAX;
+ pd->lookup.uid = -1;
+ pd->lookup.gid = -1;
pd->lookup.pid = NO_PID;
switch (pd->virtual_proto) {
case IPPROTO_TCP:
@@ -6945,8 +6945,8 @@ pf_test(sa_family_t af, int fwdir, struct ifnet *ifp, struct mbuf **m0)
*/
if (fwdir == PF_FWD) {
pd.lookup.done = -1;
- pd.lookup.uid = UID_MAX;
- pd.lookup.gid = GID_MAX;
+ pd.lookup.uid = -1;
+ pd.lookup.gid = -1;
pd.lookup.pid = NO_PID;
}
diff --git a/sys/tmpfs/tmpfs_subr.c b/sys/tmpfs/tmpfs_subr.c
index d92d2f06f3a..757c90c0908 100644
--- a/sys/tmpfs/tmpfs_subr.c
+++ b/sys/tmpfs/tmpfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_subr.c,v 1.22 2018/05/28 16:02:08 visa Exp $ */
+/* $OpenBSD: tmpfs_subr.c,v 1.23 2019/10/17 11:23:49 millert Exp $ */
/* $NetBSD: tmpfs_subr.c,v 1.79 2012/03/13 18:40:50 elad Exp $ */
/*
@@ -139,7 +139,6 @@ tmpfs_alloc_node(tmpfs_mount_t *tmp, enum vtype type, uid_t uid, gid_t gid,
nnode->tn_ctime = nnode->tn_atime;
nnode->tn_mtime = nnode->tn_atime;
- /* XXX pedro: we should check for UID_MAX and GID_MAX instead. */
KASSERT(uid != VNOVAL && gid != VNOVAL && mode != VNOVAL);
nnode->tn_uid = uid;