Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Sep 2009 11:09:35 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 168397 for review
Message-ID:  <200909101109.n8AB9Zrx019915@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=168397

Change 168397 by zec@zec_nxlab on 2009/09/10 11:08:39

	When expading '@' to jail names in symlinks, substitute '.'
	with '/' in case of hierarchichal jails / vimages.
	
	This change is unlikely to ever get commited to svn.

Affected files ...

.. //depot/projects/vimage/src/sys/kern/vfs_lookup.c#30 edit

Differences ...

==== //depot/projects/vimage/src/sys/kern/vfs_lookup.c#30 (text+ko) ====

@@ -349,12 +349,24 @@
 			break;
 		}
 #ifdef IMUNES_SYMLINK_HACK
+		/*
+		 * If the symbolic link includes a special character '@',
+		 * and V_morphing_symlinks is set, substitute the first
+		 * occurence of '@' with full path to jail / vimage name.
+		 * If the full path includes subhierarchies, s/./\// when
+		 * expanding '@' to jail / vimage name.
+		 *
+		 * XXX revisit buffer length checking.
+		 */
 		CURVNET_SET(TD_TO_VNET(curthread));
 		if (V_morphing_symlinks) {
 			char *sp = strchr(cp, '@');
-			int vnamelen = strlen(td->td_ucred->cr_prison->pr_name);
 
 			if (sp) {
+				char *vname = td->td_ucred->cr_prison->pr_name;
+				int vnamelen = strlen(vname);
+				int i;
+
 				if (vnamelen >= auio.uio_resid) {
 					if (ndp->ni_pathlen > 1)
 						uma_zfree(namei_zone, cp);
@@ -367,6 +379,9 @@
 				bcopy(td->td_ucred->cr_prison->pr_name,
 				    sp, vnamelen);
 				linklen += (vnamelen - 1);
+				for (i = 0; i < vnamelen; i++)
+					if (sp[i] == '.')
+						sp[i] = '/';
 			}
 		}
 		CURVNET_RESTORE();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909101109.n8AB9Zrx019915>