summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-10-19 12:55:32 +0000
committernicm <nicm@openbsd.org>2015-10-19 12:55:32 +0000
commit750c39c0497914e2380b03e278b5dd9b163debe7 (patch)
tree894f55c04e983622ea2ab327b1c5f33197b559a7
parentStop checking for RTF_UP directly, call rtisvalid(9) instead. (diff)
downloadwireguard-openbsd-750c39c0497914e2380b03e278b5dd9b163debe7.tar.xz
wireguard-openbsd-750c39c0497914e2380b03e278b5dd9b163debe7.zip
Print vnode type for sendfd/recvfd not file type, ok semarie
-rw-r--r--sys/kern/kern_pledge.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/kern_pledge.c b/sys/kern/kern_pledge.c
index da0737821a4..9bee9f336fd 100644
--- a/sys/kern/kern_pledge.c
+++ b/sys/kern/kern_pledge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_pledge.c,v 1.55 2015/10/18 20:15:10 deraadt Exp $ */
+/* $OpenBSD: kern_pledge.c,v 1.56 2015/10/19 12:55:32 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -738,7 +738,7 @@ pledge_aftersyscall(struct proc *p, int code, int error)
int
pledge_recvfd_check(struct proc *p, struct file *fp)
{
- struct vnode *vp;
+ struct vnode *vp = NULL;
char *vtypes[] = { VTYPE_NAMES };
if ((p->p_p->ps_flags & PS_PLEDGE) == 0)
@@ -759,7 +759,7 @@ pledge_recvfd_check(struct proc *p, struct file *fp)
return (0);
break;
}
- printf("recvfd type %d %s\n", fp->f_type, vtypes[fp->f_type]);
+ printf("recvfd type %d %s\n", fp->f_type, vp ? vtypes[vp->v_type] : "");
return pledge_fail(p, EPERM, PLEDGE_RECVFD);
}
@@ -769,7 +769,7 @@ pledge_recvfd_check(struct proc *p, struct file *fp)
int
pledge_sendfd_check(struct proc *p, struct file *fp)
{
- struct vnode *vp;
+ struct vnode *vp = NULL;
char *vtypes[] = { VTYPE_NAMES };
if ((p->p_p->ps_flags & PS_PLEDGE) == 0)
@@ -786,12 +786,12 @@ pledge_sendfd_check(struct proc *p, struct file *fp)
return (0);
case DTYPE_VNODE:
vp = (struct vnode *)fp->f_data;
-
+
if (vp->v_type != VDIR)
return (0);
break;
}
- printf("sendfd type %d %s\n", fp->f_type, vtypes[fp->f_type]);
+ printf("sendfd type %d %s\n", fp->f_type, vp ? vtypes[vp->v_type] : "");
return pledge_fail(p, EPERM, PLEDGE_SENDFD);
}