1/*- 2 * Copyright (c) 2010 James Gritton 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/command.c 214783 2010-11-04 17:01:21Z jamie $"); |
29 30#include <sys/types.h> 31#include <sys/event.h> 32#include <sys/stat.h> 33#include <sys/sysctl.h> 34#include <sys/user.h> 35#include <sys/wait.h> 36 --- 147 unchanged lines hidden (view full) --- 184 *(const char **)&argv[0] = _PATH_IFCONFIG; 185 argv[1] = comstring->s; 186 *(const char **)&argv[2] = down ? "-vnet" : "vnet"; 187 jidstr = string_param(j->intparams[KP_JID]); 188 *(const char **)&argv[3] = 189 jidstr ? jidstr : string_param(j->intparams[KP_NAME]); 190 argv[4] = NULL; 191 j->flags |= JF_IFUP; |
192 } else if (comparam == IP_MOUNT || comparam == IP__MOUNT_FROM_FSTAB) { |
193 argv = alloca(8 * sizeof(char *)); 194 comcs = alloca(comstring->len + 1); 195 strcpy(comcs, comstring->s); 196 argc = 0; 197 for (cs = strtok(comcs, " \t\f\v\r\n"); cs && argc < 4; 198 cs = strtok(NULL, " \t\f\v\r\n")) 199 argv[argc++] = cs; 200 if (argc < 3) { |
201 jail_warnx(j, "%s: %s: missing information", 202 j->intparams[comparam]->name, comstring->s); |
203 failed(j); 204 return -1; 205 } 206 if (down) { 207 argv[4] = NULL; 208 argv[3] = argv[1]; 209 *(const char **)&argv[0] = "/sbin/umount"; 210 } else { --- 7 unchanged lines hidden (view full) --- 218 argv[5] = NULL; 219 argv[4] = argv[1]; 220 argv[3] = argv[0]; 221 } 222 *(const char **)&argv[0] = _PATH_MOUNT; 223 } 224 *(const char **)&argv[1] = "-t"; 225 j->flags |= JF_MOUNTED; |
226 } else if (comparam == IP_MOUNT_DEVFS) { 227 path = string_param(j->intparams[KP_PATH]); 228 if (path == NULL) { 229 jail_warnx(j, "mount.devfs: no path"); 230 failed(j); 231 return -1; 232 } 233 if (down) { --- 435 unchanged lines hidden --- |