wok-current view tpp/stuff/optional-x.patch @ rev 18235

Up: tazinst(63): fix "/dev/sdb or /dev/sdb or ... /dev/sdb" bug
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Jul 24 14:46:51 2015 +0300 (2015-07-24)
parents
children
line source
1 Description: Don't execute commands with --exec by default
2 Author: Axel Beckert <abe@debian.org>
3 Debian-Bug: 706644
5 Index: tpp/tpp.rb
6 ===================================================================
7 --- tpp.orig/tpp.rb 2013-06-12 22:13:55.000000000 +0200
8 +++ tpp/tpp.rb 2013-06-12 22:15:08.000000000 +0200
9 @@ -725,9 +725,13 @@
10 end
12 def do_exec(cmdline)
13 - rc = Kernel.system(cmdline)
14 - if not rc then
15 - # @todo: add error message
16 + if $execok then
17 + rc = Kernel.system(cmdline)
18 + if not rc then
19 + # @todo: add error message
20 + end
21 + else
22 + @screen.addstr("--exec disabled by default for security reasons. Use option -x to enable it.")
23 end
24 end
26 @@ -1683,6 +1687,7 @@
27 $stderr.puts "\t -t <type>\tset filetype <type> as output format"
28 $stderr.puts "\t -o <file>\twrite output to file <file>"
29 $stderr.puts "\t -s <seconds>\twait <seconds> seconds between slides (with -t autoplay)"
30 + $stderr.puts "\t -x\t\tallow parsing of --exec in input files"
31 $stderr.puts "\t --version\tprint the version"
32 $stderr.puts "\t --help\t\tprint this help"
33 $stderr.puts "\n\t currently available types: ncurses (default), autoplay, latex, txt"
34 @@ -1699,6 +1704,7 @@
35 output = nil
36 type = "ncurses"
37 time = 1
38 +$execok = nil
40 skip_next = false
42 @@ -1720,6 +1726,8 @@
43 elsif ARGV[i] == "-s" then
44 time = ARGV[i+1].to_i
45 skip_next = true
46 + elsif ARGV[i] == "-x" then
47 + $execok = 1
48 elsif input == nil then
49 input = ARGV[i]
50 end