1 /*- 2 * Copyright (c) 2006 nCircle Network Security, Inc. 3 * All rights reserved. 4 * 5 * This software was developed by Robert N. M. Watson for the TrustedBSD 6 * Project under contract to nCircle Network Security, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, NCIRCLE NETWORK SECURITY, 21 * INC., OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * $FreeBSD$ 30 */ 31 32 #define UID_ROOT 0 33 #define UID_OWNER 100 34 #define UID_OTHER 200 35 #define UID_THIRD 300 36 37 #define GID_WHEEL 0 38 #define GID_OWNER 100 39 #define GID_OTHER 200 40 41 #define KENV_VAR_NAME "test" 42 #define KENV_VAR_VALUE "test" 43 44 /* 45 * Library routines used by many tests. 46 */ 47 void assert_root(void); 48 void setup_file(char *fpathp, uid_t uid, gid_t gid, mode_t mode); 49 void set_creds(uid_t uid, gid_t gid); 50 void set_euid(uid_t uid); 51 void restore_creds(void); 52 53 /* 54 * Tests for specific privileges. 55 */ 56 void priv_acct(void); 57 void priv_adjtime(void); 58 void priv_clock_settime(void); 59 void priv_io(void); 60 void priv_kenv_set(void); 61 void priv_kenv_unset(void); 62 void priv_proc_setlogin(void); 63 void priv_proc_setrlimit(void); 64 void priv_sched_rtprio(void); 65 void priv_sched_setpriority(void); 66 void priv_settimeofday(void); 67 void priv_sysctl_write(void); 68 void priv_vfs_admin(void); 69 void priv_vfs_chown(void); 70 void priv_vfs_chroot(void); 71 void priv_vfs_clearsugid(void); 72 void priv_vfs_extattr_system(void); 73 void priv_vfs_fhopen(void); 74 void priv_vfs_fhstat(void); 75 void priv_vfs_fhstatfs(void); 76 void priv_vfs_generation(void); 77 void priv_vfs_getfh(void); 78 void priv_vfs_read(void); 79 void priv_vfs_setgid(void); 80 void priv_vfs_stickyfile(void); 81 void priv_vfs_write(void); 82 void priv_vm_madv_protect(void); 83 void priv_vm_mlock(void); 84 void priv_vm_munlock(void); 85 86 /* 87 * Tests for more complex access control logic involving more than one 88 * privilege, or privilege combined with DAC. 89 */ 90 void test_utimes(void); 91