command.c (216367) | command.c (223188) |
---|---|
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> | 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 216367 2010-12-10 23:57:55Z jamie $"); | 28__FBSDID("$FreeBSD: projects/jailconf/usr.sbin/jail/command.c 223188 2011-06-17 16:06:13Z 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> --- 69 unchanged lines hidden (view full) --- 106 /* FALLTHROUGH */ 107 case IP_STOP_TIMEOUT: 108 j->comstring = COMSTRING_DUMMY; 109 break; 110 default: 111 if (j->intparams[comparam] == NULL) 112 return 0; 113 j->comstring = | 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> --- 69 unchanged lines hidden (view full) --- 106 /* FALLTHROUGH */ 107 case IP_STOP_TIMEOUT: 108 j->comstring = COMSTRING_DUMMY; 109 break; 110 default: 111 if (j->intparams[comparam] == NULL) 112 return 0; 113 j->comstring = |
114 STAILQ_FIRST(&j->intparams[comparam]->val); | 114 TAILQ_FIRST(&j->intparams[comparam]->val); |
115 } 116 j->comparam = comparam; 117 } else 118 comparam = j->comparam; 119 next_comstring: 120 comstring = j->comstring; 121 if (comstring == NULL) 122 return 0; 123 if (paralimit == 0) { 124 requeue(j, &runnable); 125 return 1; 126 } 127 j->comstring = | 115 } 116 j->comparam = comparam; 117 } else 118 comparam = j->comparam; 119 next_comstring: 120 comstring = j->comstring; 121 if (comstring == NULL) 122 return 0; 123 if (paralimit == 0) { 124 requeue(j, &runnable); 125 return 1; 126 } 127 j->comstring = |
128 comstring == COMSTRING_DUMMY ? NULL : STAILQ_NEXT(comstring, tq); | 128 comstring == COMSTRING_DUMMY ? NULL : TAILQ_NEXT(comstring, tq); |
129 if (comstring != COMSTRING_DUMMY && comstring->len == 0) 130 goto next_comstring; 131 /* 132 * Collect exec arguments. Internal commands for network and 133 * mounting build their own argument lists. 134 */ 135 bg = j->flags & JF_FAILED; 136 down = j->flags & (JF_STOP | JF_FAILED); --- 152 unchanged lines hidden (view full) --- 289 } 290 j->flags |= JF_MOUNTED; 291 break; 292 293 case IP_COMMAND: 294 if (j->name != NULL) 295 goto default_command; 296 argc = 0; | 129 if (comstring != COMSTRING_DUMMY && comstring->len == 0) 130 goto next_comstring; 131 /* 132 * Collect exec arguments. Internal commands for network and 133 * mounting build their own argument lists. 134 */ 135 bg = j->flags & JF_FAILED; 136 down = j->flags & (JF_STOP | JF_FAILED); --- 152 unchanged lines hidden (view full) --- 289 } 290 j->flags |= JF_MOUNTED; 291 break; 292 293 case IP_COMMAND: 294 if (j->name != NULL) 295 goto default_command; 296 argc = 0; |
297 STAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq) | 297 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq) |
298 argc++; 299 argv = alloca((argc + 1) * sizeof(char *)); 300 argc = 0; | 298 argc++; 299 argv = alloca((argc + 1) * sizeof(char *)); 300 argc = 0; |
301 STAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq) | 301 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq) |
302 argv[argc++] = s->s; 303 argv[argc] = NULL; 304 j->comstring = NULL; 305 break; 306 307 default: 308 default_command: 309 if ((cs = strpbrk(comstring->s, "!\"$&'()*;<>?[\\]`{|}~")) && --- 493 unchanged lines hidden --- | 302 argv[argc++] = s->s; 303 argv[argc] = NULL; 304 j->comstring = NULL; 305 break; 306 307 default: 308 default_command: 309 if ((cs = strpbrk(comstring->s, "!\"$&'()*;<>?[\\]`{|}~")) && --- 493 unchanged lines hidden --- |