ext2_vnops.c (8fa03d08ca9964ed8e30528edb7f9da8d723deeb) ext2_vnops.c (e09c00cadad669aaa347eb4064b4ebb068798bcf)
1/*-
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*-
8 * Copyright (c) 1982, 1986, 1989, 1993

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

397 */
398 if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
399 (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
400 (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
401 ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
402 return (EINVAL);
403 }
404 if (vap->va_flags != VNOVAL) {
1/*-
2 * modified for EXT2FS support in Lites 1.1
3 *
4 * Aug 1995, Godmar Back (gback@cs.utah.edu)
5 * University of Utah, Department of Computer Science
6 */
7/*-
8 * Copyright (c) 1982, 1986, 1989, 1993

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

397 */
398 if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
399 (vap->va_fsid != VNOVAL) || (vap->va_fileid != VNOVAL) ||
400 (vap->va_blocksize != VNOVAL) || (vap->va_rdev != VNOVAL) ||
401 ((int)vap->va_bytes != VNOVAL) || (vap->va_gen != VNOVAL)) {
402 return (EINVAL);
403 }
404 if (vap->va_flags != VNOVAL) {
405 /* Disallow flags not supported by ext2fs. */
406 if(vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP))
407 return (EOPNOTSUPP);
408
409 if (vp->v_mount->mnt_flag & MNT_RDONLY)
410 return (EROFS);
405 if (vp->v_mount->mnt_flag & MNT_RDONLY)
406 return (EROFS);
407 /* Disallow flags not supported by ext2fs. */
408 if(vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP))
409 return(EOPNOTSUPP);
411 /*
412 * Callers may only modify the file flags on objects they
413 * have VADMIN rights for.
414 */
415 if ((error = VOP_ACCESS(vp, VADMIN, cred, td)))
416 return (error);
417 /*
418 * Unprivileged processes and privileged processes in

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

426 & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) {
427 error = securelevel_gt(cred, 0);
428 if (error)
429 return (error);
430 }
431 ip->i_flags = vap->va_flags;
432 } else {
433 if (ip->i_flags
410 /*
411 * Callers may only modify the file flags on objects they
412 * have VADMIN rights for.
413 */
414 if ((error = VOP_ACCESS(vp, VADMIN, cred, td)))
415 return (error);
416 /*
417 * Unprivileged processes and privileged processes in

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

425 & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) {
426 error = securelevel_gt(cred, 0);
427 if (error)
428 return (error);
429 }
430 ip->i_flags = vap->va_flags;
431 } else {
432 if (ip->i_flags
434 & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
435 (vap->va_flags & UF_SETTABLE) != vap->va_flags)
433 & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND))
436 return (EPERM);
437 ip->i_flags &= SF_SETTABLE;
434 return (EPERM);
435 ip->i_flags &= SF_SETTABLE;
438 ip->i_flags |= (vap->va_flags & UF_SETTABLE);
439 }
440 ip->i_flag |= IN_CHANGE;
441 if (vap->va_flags & (IMMUTABLE | APPEND))
442 return (0);
443 }
444 if (ip->i_flags & (IMMUTABLE | APPEND))
445 return (EPERM);
446 /*

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

889 if ((error = ext2_update(fvp, 1)) != 0) {
890 VOP_UNLOCK(fvp, 0);
891 goto bad;
892 }
893
894 /*
895 * If ".." must be changed (ie the directory gets a new
896 * parent) then the source directory must not be in the
436 }
437 ip->i_flag |= IN_CHANGE;
438 if (vap->va_flags & (IMMUTABLE | APPEND))
439 return (0);
440 }
441 if (ip->i_flags & (IMMUTABLE | APPEND))
442 return (EPERM);
443 /*

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

886 if ((error = ext2_update(fvp, 1)) != 0) {
887 VOP_UNLOCK(fvp, 0);
888 goto bad;
889 }
890
891 /*
892 * If ".." must be changed (ie the directory gets a new
893 * parent) then the source directory must not be in the
897 * directory hierarchy above the target, as this would
894 * directory heirarchy above the target, as this would
898 * orphan everything below the source directory. Also
899 * the user must have write permission in the source so
900 * as to be able to change "..". We must repeat the call
901 * to namei, as the parent directory is unlocked by the
902 * call to checkpath().
903 */
904 error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
905 VOP_UNLOCK(fvp, 0);

--- 774 unchanged lines hidden ---
895 * orphan everything below the source directory. Also
896 * the user must have write permission in the source so
897 * as to be able to change "..". We must repeat the call
898 * to namei, as the parent directory is unlocked by the
899 * call to checkpath().
900 */
901 error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
902 VOP_UNLOCK(fvp, 0);

--- 774 unchanged lines hidden ---