Overview
| Artifact ID: | f566e674a003fe3ee9d4d0918853b46e51006251 |
|---|---|
| Ticket: | 488530ffffffffffffffffffffffffffffffffff
setuid Tcl scripts don't work on Solaris |
| User & Date: | kennykb on 2001-12-03 19:35:41 |
Changes
- assignee changed to: "msofer"
- cmimetype changed to: "text/plain"
- comment changed to:
On Solaris, create a script, "foo.tcl", that looks like the following: #!/bin/sh #\ exec tclsh8.3 "$0" ${1+"$@"} puts "----------------------------------------------------------------------" puts "----------------------------------------------------------------------" puts "----------------------------------------------------------------------" puts "----------------------------------------------------------------------" puts "----------------------------------------------------------------------" Now change its permissions to 2755 (rwsr-xr-x). Attempt to execute ./foo.tcl from the command line. An error results: invalid command name "---------------------------------------------------------------------"" while executing "---------------------------------------------------------------------"" (file "/dev/fd/3" line 1) What's happening here is that Solaris, for security reasons, doesn't pass the name of the script file into the shell. Instead, it opens the script file, leaves it open, and launches the shell with argv[0] equal to /dev/fd/N, where N is the number of the script file's filedescriptor. When this file is opened, the kernel simply dup's the filedescriptor. The file is not rewound. The result is that the Tcl_EvalFileEx that's been called from Tcl_Main starts reading the file in the middle. One obvious potential fix is to have Tcl_EvalFileEx seek the file to the beginning before reading it. The only problem I can see with this is if someone's [source]ing a device file and depending on its being left in place. I think I'd be prepared to break this behavior in order to make setuid scripts work. - foundin changed to: "obsolete: 8.3.4"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "kennykb"
- subsystem changed to: "45. Parsing and Eval"
- title changed to: "setuid Tcl scripts don't work on Solaris"
- type changed to: "Bug"