Deleted Added
sdiff udiff text old ( 231238 ) new ( 232242 )
full compact
1/*-
2 * Copyright (c) 2011 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 232242 2012-02-27 22:37:35Z jamie $");
29
30#include <sys/types.h>
31#include <sys/event.h>
32#include <sys/mount.h>
33#include <sys/stat.h>
34#include <sys/sysctl.h>
35#include <sys/user.h>
36#include <sys/wait.h>

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

412 argv[3] = argv[0];
413 }
414 *(const char **)&argv[0] = _PATH_MOUNT;
415 }
416 *(const char **)&argv[1] = "-t";
417 break;
418
419 case IP_MOUNT_DEVFS:
420 argv = alloca(7 * sizeof(char *));
421 path = string_param(j->intparams[KP_PATH]);
422 if (path == NULL) {
423 jail_warnx(j, "mount.devfs: no path");
424 return -1;
425 }
426 devpath = alloca(strlen(path) + 5);
427 sprintf(devpath, "%s/dev", path);
428 if (check_path(j, "mount.devfs", devpath, 0,
429 down ? "devfs" : NULL) < 0)
430 return -1;
431 if (down) {
432 *(const char **)&argv[0] = "/sbin/umount";
433 argv[1] = devpath;
434 argv[2] = NULL;
435 } else {
436 *(const char **)&argv[0] = _PATH_MOUNT;
437 *(const char **)&argv[1] = "-t";
438 *(const char **)&argv[2] = "devfs";
439 ruleset = string_param(j->intparams[KP_DEVFS_RULESET]);
440 if (!ruleset)
441 ruleset = "4"; /* devfsrules_jail */
442 argv[3] = alloca(11 + strlen(ruleset));
443 sprintf(argv[3], "-oruleset=%s", ruleset);
444 *(const char **)&argv[4] = ".";
445 argv[5] = devpath;
446 argv[6] = NULL;
447 }
448 break;
449
450 case IP_COMMAND:
451 if (j->name != NULL)
452 goto default_command;
453 argc = 0;
454 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)

--- 403 unchanged lines hidden ---