mac_process.c (cd72f2180bfff020d03180e6eba1c3a0e0125468) mac_process.c (48e3128b34dad9618402f1f4095f7655e779843c)
1/*-
2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
3 * Copyright (c) 2001 Ilmar S. Habibulin
4 * Copyright (c) 2001, 2002 Networks Associates Technology, Inc.
5 * All rights reserved.
6 *
7 * This software was developed by Robert Watson and Ilmar Habibulin for the
8 * TrustedBSD Project.

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

3206 error = fget(td, uap->fd, &fp);
3207 if (error)
3208 goto out;
3209
3210 label_type = fp->f_type;
3211 switch (fp->f_type) {
3212 case DTYPE_FIFO:
3213 case DTYPE_VNODE:
1/*-
2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
3 * Copyright (c) 2001 Ilmar S. Habibulin
4 * Copyright (c) 2001, 2002 Networks Associates Technology, Inc.
5 * All rights reserved.
6 *
7 * This software was developed by Robert Watson and Ilmar Habibulin for the
8 * TrustedBSD Project.

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

3206 error = fget(td, uap->fd, &fp);
3207 if (error)
3208 goto out;
3209
3210 label_type = fp->f_type;
3211 switch (fp->f_type) {
3212 case DTYPE_FIFO:
3213 case DTYPE_VNODE:
3214 vp = fp->un_data.vnode;
3214 vp = fp->f_data;
3215
3216 mac_init_vnode_label(&intlabel);
3217
3218 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
3219 mac_copy_vnode_label(&vp->v_label, &intlabel);
3220 VOP_UNLOCK(vp, 0, td);
3221
3222 break;
3223 case DTYPE_PIPE:
3215
3216 mac_init_vnode_label(&intlabel);
3217
3218 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
3219 mac_copy_vnode_label(&vp->v_label, &intlabel);
3220 VOP_UNLOCK(vp, 0, td);
3221
3222 break;
3223 case DTYPE_PIPE:
3224 pipe = fp->un_data.pipe;
3224 pipe = fp->f_data;
3225
3226 mac_init_pipe_label(&intlabel);
3227
3228 PIPE_LOCK(pipe);
3229 mac_copy_pipe_label(pipe->pipe_label, &intlabel);
3230 PIPE_UNLOCK(pipe);
3231 break;
3232 default:

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

3414 case DTYPE_VNODE:
3415 mac_init_vnode_label(&intlabel);
3416 error = mac_internalize_vnode_label(&intlabel, buffer);
3417 if (error) {
3418 mac_destroy_vnode_label(&intlabel);
3419 break;
3420 }
3421
3225
3226 mac_init_pipe_label(&intlabel);
3227
3228 PIPE_LOCK(pipe);
3229 mac_copy_pipe_label(pipe->pipe_label, &intlabel);
3230 PIPE_UNLOCK(pipe);
3231 break;
3232 default:

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

3414 case DTYPE_VNODE:
3415 mac_init_vnode_label(&intlabel);
3416 error = mac_internalize_vnode_label(&intlabel, buffer);
3417 if (error) {
3418 mac_destroy_vnode_label(&intlabel);
3419 break;
3420 }
3421
3422 vp = fp->un_data.vnode;
3422 vp = fp->f_data;
3423 error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
3424 if (error != 0) {
3425 mac_destroy_vnode_label(&intlabel);
3426 break;
3427 }
3428
3429 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
3430 error = vn_setlabel(vp, &intlabel, td->td_ucred);
3431 VOP_UNLOCK(vp, 0, td);
3432 vn_finished_write(mp);
3433
3434 mac_destroy_vnode_label(&intlabel);
3435 break;
3436
3437 case DTYPE_PIPE:
3438 mac_init_pipe_label(&intlabel);
3439 error = mac_internalize_pipe_label(&intlabel, buffer);
3440 if (error == 0) {
3423 error = vn_start_write(vp, &mp, V_WAIT | PCATCH);
3424 if (error != 0) {
3425 mac_destroy_vnode_label(&intlabel);
3426 break;
3427 }
3428
3429 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
3430 error = vn_setlabel(vp, &intlabel, td->td_ucred);
3431 VOP_UNLOCK(vp, 0, td);
3432 vn_finished_write(mp);
3433
3434 mac_destroy_vnode_label(&intlabel);
3435 break;
3436
3437 case DTYPE_PIPE:
3438 mac_init_pipe_label(&intlabel);
3439 error = mac_internalize_pipe_label(&intlabel, buffer);
3440 if (error == 0) {
3441 pipe = fp->un_data.pipe;
3441 pipe = fp->f_data;
3442 PIPE_LOCK(pipe);
3443 error = mac_pipe_label_set(td->td_ucred, pipe,
3444 &intlabel);
3445 PIPE_UNLOCK(pipe);
3446 }
3447
3448 mac_destroy_pipe_label(&intlabel);
3449 break;

--- 232 unchanged lines hidden ---
3442 PIPE_LOCK(pipe);
3443 error = mac_pipe_label_set(td->td_ucred, pipe,
3444 &intlabel);
3445 PIPE_UNLOCK(pipe);
3446 }
3447
3448 mac_destroy_pipe_label(&intlabel);
3449 break;

--- 232 unchanged lines hidden ---