Deleted Added
full compact
opensolaris_policy.c (197861) opensolaris_policy.c (209962)
1/*-
2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c 197861 2009-10-08 16:05:17Z pjd $");
28__FBSDID("$FreeBSD: head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c 209962 2010-07-12 23:49:04Z mm $");
29
30#include <sys/param.h>
31#include <sys/priv.h>
32#include <sys/vnode.h>
33#include <sys/mntent.h>
34#include <sys/mount.h>
35#include <sys/stat.h>
36#include <sys/jail.h>

--- 197 unchanged lines hidden (view full) ---

234int
235secpolicy_vnode_create_gid(struct ucred *cred)
236{
237
238 return (EPERM);
239}
240
241int
29
30#include <sys/param.h>
31#include <sys/priv.h>
32#include <sys/vnode.h>
33#include <sys/mntent.h>
34#include <sys/mount.h>
35#include <sys/stat.h>
36#include <sys/jail.h>

--- 197 unchanged lines hidden (view full) ---

234int
235secpolicy_vnode_create_gid(struct ucred *cred)
236{
237
238 return (EPERM);
239}
240
241int
242secpolicy_vnode_setids_setgids(struct vnode *vp, struct ucred *cred, gid_t gid)
242secpolicy_vnode_setids_setgids(vnode_t *vp, struct ucred *cred, gid_t gid)
243{
243{
244
245 if (groupmember(gid, cred))
246 return (0);
247 if (secpolicy_fs_owner(vp->v_mount, cred) == 0)
248 return (0);
249 return (priv_check_cred(cred, PRIV_VFS_SETGID, 0));
250}
251
252int

--- 108 unchanged lines hidden (view full) ---

361secpolicy_xvattr(struct vnode *vp, xvattr_t *xvap, uid_t owner, cred_t *cr,
362 vtype_t vtype)
363{
364
365 if (secpolicy_fs_owner(vp->v_mount, cr) == 0)
366 return (0);
367 return (priv_check_cred(cr, PRIV_VFS_SYSFLAGS, 0));
368}
244 if (groupmember(gid, cred))
245 return (0);
246 if (secpolicy_fs_owner(vp->v_mount, cred) == 0)
247 return (0);
248 return (priv_check_cred(cred, PRIV_VFS_SETGID, 0));
249}
250
251int

--- 108 unchanged lines hidden (view full) ---

360secpolicy_xvattr(struct vnode *vp, xvattr_t *xvap, uid_t owner, cred_t *cr,
361 vtype_t vtype)
362{
363
364 if (secpolicy_fs_owner(vp->v_mount, cr) == 0)
365 return (0);
366 return (priv_check_cred(cr, PRIV_VFS_SYSFLAGS, 0));
367}
368
369int
370secpolicy_smb(cred_t *cr)
371{
372
373 return (priv_check_cred(cr, PRIV_NETSMB, 0));
374}