vfs_lookup.c (50477) | vfs_lookup.c (51649) |
---|---|
1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 | 1/* 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_lookup.c 8.4 (Berkeley) 2/16/94 |
39 * $FreeBSD: head/sys/kern/vfs_lookup.c 50477 1999-08-28 01:08:13Z peter $ | 39 * $FreeBSD: head/sys/kern/vfs_lookup.c 51649 1999-09-25 14:14:21Z phk $ |
40 */ 41 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/namei.h> 47#include <sys/vnode.h> --- 77 unchanged lines hidden (view full) --- 125 if (KTRPOINT(cnp->cn_proc, KTR_NAMEI)) 126 ktrnamei(cnp->cn_proc->p_tracep, cnp->cn_pnbuf); 127#endif 128 129 /* 130 * Get starting point for the translation. 131 */ 132 ndp->ni_rootdir = fdp->fd_rdir; | 40 */ 41 42#include "opt_ktrace.h" 43 44#include <sys/param.h> 45#include <sys/systm.h> 46#include <sys/namei.h> 47#include <sys/vnode.h> --- 77 unchanged lines hidden (view full) --- 125 if (KTRPOINT(cnp->cn_proc, KTR_NAMEI)) 126 ktrnamei(cnp->cn_proc->p_tracep, cnp->cn_pnbuf); 127#endif 128 129 /* 130 * Get starting point for the translation. 131 */ 132 ndp->ni_rootdir = fdp->fd_rdir; |
133 ndp->ni_topdir = fdp->fd_jdir; |
|
133 134 dp = fdp->fd_cdir; 135 VREF(dp); 136 for (;;) { 137 /* 138 * Check if root directory should replace current directory. 139 * Done at start of translation and after symbolic link. 140 */ --- 241 unchanged lines hidden (view full) --- 382 * Handle "..": two special cases. 383 * 1. If at root directory (e.g. after chroot) 384 * or at absolute root directory 385 * then ignore it so can't get out. 386 * 2. If this vnode is the root of a mounted 387 * filesystem, then replace it with the 388 * vnode which was mounted on so we take the 389 * .. in the other file system. | 134 135 dp = fdp->fd_cdir; 136 VREF(dp); 137 for (;;) { 138 /* 139 * Check if root directory should replace current directory. 140 * Done at start of translation and after symbolic link. 141 */ --- 241 unchanged lines hidden (view full) --- 383 * Handle "..": two special cases. 384 * 1. If at root directory (e.g. after chroot) 385 * or at absolute root directory 386 * then ignore it so can't get out. 387 * 2. If this vnode is the root of a mounted 388 * filesystem, then replace it with the 389 * vnode which was mounted on so we take the 390 * .. in the other file system. |
391 * 3. If the vnode is the top directory of 392 * the jail or chroot, don't let them out. |
|
390 */ 391 if (cnp->cn_flags & ISDOTDOT) { 392 for (;;) { | 393 */ 394 if (cnp->cn_flags & ISDOTDOT) { 395 for (;;) { |
393 if (dp == ndp->ni_rootdir || dp == rootvnode) { | 396 if (dp == ndp->ni_rootdir || 397 dp == ndp->ni_topdir || 398 dp == rootvnode) { |
394 ndp->ni_dvp = dp; 395 ndp->ni_vp = dp; 396 VREF(dp); 397 goto nextname; 398 } 399 if ((dp->v_flag & VROOT) == 0 || 400 (cnp->cn_flags & NOCROSSMOUNT)) 401 break; --- 305 unchanged lines hidden --- | 399 ndp->ni_dvp = dp; 400 ndp->ni_vp = dp; 401 VREF(dp); 402 goto nextname; 403 } 404 if ((dp->v_flag & VROOT) == 0 || 405 (cnp->cn_flags & NOCROSSMOUNT)) 406 break; --- 305 unchanged lines hidden --- |