Deleted Added
full compact
command.c (276277) command.c (278484)
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>
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: stable/10/usr.sbin/jail/command.c 276277 2014-12-27 02:17:35Z jamie $");
28__FBSDID("$FreeBSD: stable/10/usr.sbin/jail/command.c 278484 2015-02-10 01:05:51Z 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>

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

107 if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))
108 continue;
109 j->comstring = &dummystring;
110 break;
111 case IP_MOUNT_FDESCFS:
112 if (!bool_param(j->intparams[IP_MOUNT_FDESCFS]))
113 continue;
114 j->comstring = &dummystring;
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>

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

107 if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))
108 continue;
109 j->comstring = &dummystring;
110 break;
111 case IP_MOUNT_FDESCFS:
112 if (!bool_param(j->intparams[IP_MOUNT_FDESCFS]))
113 continue;
114 j->comstring = &dummystring;
115 break;
116 case IP_MOUNT_PROCFS:
117 if (!bool_param(j->intparams[IP_MOUNT_PROCFS]))
118 continue;
119 j->comstring = &dummystring;
120 break;
115 case IP__OP:
116 case IP_STOP_TIMEOUT:
117 j->comstring = &dummystring;
118 break;
119 default:
120 if (j->intparams[comparam] == NULL)
121 continue;
122 j->comstring = create_failed || (stopping &&

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

524 *(const char **)&argv[1] = "-t";
525 *(const char **)&argv[2] = "fdescfs";
526 *(const char **)&argv[3] = ".";
527 argv[4] = devpath;
528 argv[5] = NULL;
529 }
530 break;
531
121 case IP__OP:
122 case IP_STOP_TIMEOUT:
123 j->comstring = &dummystring;
124 break;
125 default:
126 if (j->intparams[comparam] == NULL)
127 continue;
128 j->comstring = create_failed || (stopping &&

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

530 *(const char **)&argv[1] = "-t";
531 *(const char **)&argv[2] = "fdescfs";
532 *(const char **)&argv[3] = ".";
533 argv[4] = devpath;
534 argv[5] = NULL;
535 }
536 break;
537
538 case IP_MOUNT_PROCFS:
539 argv = alloca(7 * sizeof(char *));
540 path = string_param(j->intparams[KP_PATH]);
541 if (path == NULL) {
542 jail_warnx(j, "mount.procfs: no path");
543 return -1;
544 }
545 devpath = alloca(strlen(path) + 6);
546 sprintf(devpath, "%s/proc", path);
547 if (check_path(j, "mount.procfs", devpath, 0,
548 down ? "procfs" : NULL) < 0)
549 return -1;
550 if (down) {
551 *(const char **)&argv[0] = "/sbin/umount";
552 argv[1] = devpath;
553 argv[2] = NULL;
554 } else {
555 *(const char **)&argv[0] = _PATH_MOUNT;
556 *(const char **)&argv[1] = "-t";
557 *(const char **)&argv[2] = "procfs";
558 *(const char **)&argv[3] = ".";
559 argv[4] = devpath;
560 argv[5] = NULL;
561 }
562 break;
563
532 case IP_COMMAND:
533 if (j->name != NULL)
534 goto default_command;
535 argc = 0;
536 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
537 argc++;
538 argv = alloca((argc + 1) * sizeof(char *));
539 argc = 0;

--- 409 unchanged lines hidden ---
564 case IP_COMMAND:
565 if (j->name != NULL)
566 goto default_command;
567 argc = 0;
568 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
569 argc++;
570 argv = alloca((argc + 1) * sizeof(char *));
571 argc = 0;

--- 409 unchanged lines hidden ---