Changeset 98156
- Timestamp:
- Sep 26, 2012, 4:16:41 PM (12 years ago)
- Location:
- trunk/base
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/configure
r97235 r98156 711 711 SVN 712 712 SED 713 SANDBOX_EXEC 713 714 RSYNC 714 715 RMDIR … … 5545 5546 5546 5547 5548 # Extract the first word of "sandbox-exec", so it can be a program name with args. 5549 set dummy sandbox-exec; ac_word=$2 5550 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 5551 $as_echo_n "checking for $ac_word... " >&6; } 5552 if ${ac_cv_path_SANDBOX_EXEC+:} false; then : 5553 $as_echo_n "(cached) " >&6 5554 else 5555 case $SANDBOX_EXEC in 5556 [\\/]* | ?:[\\/]*) 5557 ac_cv_path_SANDBOX_EXEC="$SANDBOX_EXEC" # Let the user override the test with a path. 5558 ;; 5559 *) 5560 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 5561 for as_dir in /usr/bin 5562 do 5563 IFS=$as_save_IFS 5564 test -z "$as_dir" && as_dir=. 5565 for ac_exec_ext in '' $ac_executable_extensions; do 5566 if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 5567 ac_cv_path_SANDBOX_EXEC="$as_dir/$ac_word$ac_exec_ext" 5568 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 5569 break 2 5570 fi 5571 done 5572 done 5573 IFS=$as_save_IFS 5574 5575 ;; 5576 esac 5577 fi 5578 SANDBOX_EXEC=$ac_cv_path_SANDBOX_EXEC 5579 if test -n "$SANDBOX_EXEC"; then 5580 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SANDBOX_EXEC" >&5 5581 $as_echo "$SANDBOX_EXEC" >&6; } 5582 else 5583 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 5584 $as_echo "no" >&6; } 5585 fi 5586 5587 5547 5588 # Extract the first word of "sed", so it can be a program name with args. 5548 5589 set dummy sed; ac_word=$2 -
trunk/base/configure.ac
r93255 r98156 134 134 AC_PATH_PROG(RMDIR, [rmdir], []) 135 135 AC_PATH_PROG(RSYNC, [rsync], []) 136 AC_PATH_PROG(SANDBOX_EXEC, [sandbox-exec], [], [/usr/bin]) 136 137 AC_PATH_PROG(SED, [sed]) 137 138 AC_PATH_PROG(SVN, [svn], []) -
trunk/base/src/pextlib1.0/system.c
r91557 r98156 78 78 }; 79 79 80 static int check_sandboxing(Tcl_Interp *interp, char **sandbox_exec_path, char **profilestr) 81 { 82 Tcl_Obj *tcl_result; 83 int supported; 84 int len; 85 86 tcl_result = Tcl_GetVar2Ex(interp, "portsandbox_supported", NULL, TCL_GLOBAL_ONLY); 87 if (!tcl_result || Tcl_GetBooleanFromObj(interp, tcl_result, &supported) != TCL_OK || !supported) { 88 return 0; 89 } 90 91 tcl_result = Tcl_GetVar2Ex(interp, "portutil::autoconf::sandbox_exec_path", NULL, TCL_GLOBAL_ONLY); 92 if (!tcl_result || !(*sandbox_exec_path = Tcl_GetString(tcl_result))) { 93 return 0; 94 } 95 96 tcl_result = Tcl_GetVar2Ex(interp, "portsandbox_profile", NULL, TCL_GLOBAL_ONLY); 97 if (!tcl_result || !(*profilestr = Tcl_GetStringFromObj(tcl_result, &len)) 98 || len == 0) { 99 return 0; 100 } 101 102 return 1; 103 } 104 80 105 /* usage: system ?-notty? ?-nice value? ?-W path? command */ 81 106 int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) … … 84 109 struct linebuf circbuf[CBUFSIZ]; 85 110 size_t linelen; 86 char *args[ 4];111 char *args[7]; 87 112 char *cmdstring; 113 int sandbox = 0; 114 char *sandbox_exec_path; 115 char *profilestr; 88 116 FILE *pdes; 89 117 int fdset[2], nullfd; … … 129 157 } 130 158 159 #if 0 160 /* check if and how we should use sandbox-exec */ 161 sandbox = check_sandboxing(interp, &sandbox_exec_path, &profilestr); 162 #endif 163 131 164 /* 132 165 * Fork a child to run the command, in a popen() like fashion - … … 179 212 180 213 /* XXX ugly string constants */ 181 args[0] = "sh"; 182 args[1] = "-c"; 183 args[2] = cmdstring; 184 args[3] = NULL; 185 execve("/bin/sh", args, environ); 214 if (sandbox) { 215 args[0] = "sandbox-exec"; 216 args[1] = "-p"; 217 args[2] = profilestr; 218 args[3] = "sh"; 219 args[4] = "-c"; 220 args[5] = cmdstring; 221 args[6] = NULL; 222 execve(sandbox_exec_path, args, environ); 223 } else { 224 args[0] = "sh"; 225 args[1] = "-c"; 226 args[2] = cmdstring; 227 args[3] = NULL; 228 execve("/bin/sh", args, environ); 229 } 186 230 _exit(1); 187 231 break; -
trunk/base/src/port1.0/Makefile
r93261 r98156 7 7 portdeactivate.tcl portsubmit.tcl port_autoconf.tcl portstartupitem.tcl \ 8 8 porttrace.tcl portlivecheck.tcl portdistcheck.tcl portmirror.tcl \ 9 portload.tcl portunload.tcl portdistfiles.tcl fetch_common.tcl 9 portload.tcl portunload.tcl portdistfiles.tcl fetch_common.tcl \ 10 portsandbox.tcl 10 11 11 12 include ../../Mk/macports.subdir.mk -
trunk/base/src/port1.0/port.tcl
r79593 r98156 59 59 60 60 package require portdistfiles 1.0 61 package require portsandbox 1.0 -
trunk/base/src/port1.0/port_autoconf.tcl.in
r88721 r98156 66 66 variable xcodebuild_path "@XCODEBUILD@" 67 67 variable xcrun_path "@XCRUN@" 68 variable sandbox_exec_path "@SANDBOX_EXEC@" 68 69 variable sed_command "@SED@" 69 70 variable sed_ext_flag "@SED_EXT@"
Note: See TracChangeset
for help on using the changeset viewer.