Blame SOURCES/0001-patch-8.1.0881-can-execute-shell-commands-in-rvim-th.patch

a64932
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
a64932
index 8256152..8320039 100644
a64932
--- a/runtime/doc/starting.txt
a64932
+++ b/runtime/doc/starting.txt
a64932
@@ -247,12 +247,18 @@ a slash.  Thus "-R" means recovery and "-/R" readonly.
a64932
 		changes and writing.
a64932
 		{not in Vi}
a64932
 
a64932
-						*-Z* *restricted-mode* *E145*
a64932
+					*-Z* *restricted-mode* *E145* *E981*
a64932
 -Z		Restricted mode.  All commands that make use of an external
a64932
 		shell are disabled.  This includes suspending with CTRL-Z,
a64932
-		":sh", filtering, the system() function, backtick expansion,
a64932
-		delete(), rename(), mkdir(), writefile(), libcall(),
a64932
-		job_start(), etc.
a64932
+		":sh", filtering, the system() function, backtick expansion
a64932
+		and libcall().
a64932
+		Also disallowed are delete(), rename(), mkdir(), job_start(),
a64932
+		etc.
a64932
+		Interfaces, such as Python, Ruby and Lua, are also disabled,
a64932
+		since they could be used to execute shell commands.  Perl uses
a64932
+		the Safe module.
a64932
+		Note that the user may still find a loophole to execute a
a64932
+		shell command, it has only been made difficult.
a64932
 		{not in Vi}
a64932
 
a64932
 							*-g*
a64932
diff --git a/src/evalfunc.c b/src/evalfunc.c
a64932
index dd4462d..3cc305a 100644
a64932
--- a/src/evalfunc.c
a64932
+++ b/src/evalfunc.c
a64932
@@ -6446,7 +6446,7 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv)
a64932
 #endif
a64932
 
a64932
     rettv->vval.v_number = FALSE;
a64932
-    if (check_restricted() || check_secure())
a64932
+    if (check_secure())
a64932
 	return;
a64932
 #ifdef FEAT_CMDHIST
a64932
     str = get_tv_string_chk(&argvars[0]);	/* NULL on type error */
a64932
@@ -7456,6 +7456,9 @@ f_luaeval(typval_T *argvars, typval_T *rettv)
a64932
     char_u	*str;
a64932
     char_u	buf[NUMBUFLEN];
a64932
 
a64932
+    if (check_restricted() || check_secure())
a64932
+	return;
a64932
+
a64932
     str = get_tv_string_buf(&argvars[0], buf);
a64932
     do_luaeval(str, argvars + 1, rettv);
a64932
 }
a64932
@@ -8188,6 +8191,8 @@ f_mzeval(typval_T *argvars, typval_T *rettv)
a64932
     char_u	*str;
a64932
     char_u	buf[NUMBUFLEN];
a64932
 
a64932
+    if (check_restricted() || check_secure())
a64932
+	return;
a64932
     str = get_tv_string_buf(&argvars[0], buf);
a64932
     do_mzeval(str, rettv);
a64932
 }
a64932
@@ -8398,6 +8403,9 @@ f_py3eval(typval_T *argvars, typval_T *rettv)
a64932
     char_u	*str;
a64932
     char_u	buf[NUMBUFLEN];
a64932
 
a64932
+    if (check_restricted() || check_secure())
a64932
+	return;
a64932
+
a64932
     if (p_pyx == 0)
a64932
 	p_pyx = 3;
a64932
 
a64932
@@ -8416,6 +8424,9 @@ f_pyeval(typval_T *argvars, typval_T *rettv)
a64932
     char_u	*str;
a64932
     char_u	buf[NUMBUFLEN];
a64932
 
a64932
+    if (check_restricted() || check_secure())
a64932
+	return;
a64932
+
a64932
     if (p_pyx == 0)
a64932
 	p_pyx = 2;
a64932
 
a64932
@@ -8431,6 +8442,9 @@ f_pyeval(typval_T *argvars, typval_T *rettv)
a64932
     static void
a64932
 f_pyxeval(typval_T *argvars, typval_T *rettv)
a64932
 {
a64932
+    if (check_restricted() || check_secure())
a64932
+	return;
a64932
+
a64932
 # if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3)
a64932
     init_pyxversion();
a64932
     if (p_pyx == 2)
a64932
@@ -10272,7 +10286,7 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED)
a64932
     typval_T	*varp;
a64932
     char_u	nbuf[NUMBUFLEN];
a64932
 
a64932
-    if (check_restricted() || check_secure())
a64932
+    if (check_secure())
a64932
 	return;
a64932
     (void)get_tv_number(&argvars[0]);	    /* issue errmsg if type error */
a64932
     varname = get_tv_string_chk(&argvars[1]);
a64932
@@ -10792,7 +10806,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv)
a64932
 
a64932
     rettv->vval.v_number = 0;
a64932
 
a64932
-    if (check_restricted() || check_secure())
a64932
+    if (check_secure())
a64932
 	return;
a64932
 
a64932
     tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL));
a64932
@@ -13674,7 +13688,7 @@ f_writefile(typval_T *argvars, typval_T *rettv)
a64932
     list_T	*list;
a64932
 
a64932
     rettv->vval.v_number = -1;
a64932
-    if (check_restricted() || check_secure())
a64932
+    if (check_secure())
a64932
 	return;
a64932
 
a64932
     if (argvars[0].v_type != VAR_LIST)
a64932
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
a64932
index 111fe01..1827fec 100644
a64932
--- a/src/ex_cmds.c
a64932
+++ b/src/ex_cmds.c
a64932
@@ -4693,7 +4693,7 @@ check_restricted(void)
a64932
 {
a64932
     if (restricted)
a64932
     {
a64932
-	EMSG(_("E145: Shell commands not allowed in rvim"));
a64932
+	EMSG(_("E145: Shell commands and some functionality not allowed in rvim"));
a64932
 	return TRUE;
a64932
     }
a64932
     return FALSE;
a64932
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
a64932
index 48b0253..82d6e29 100644
a64932
--- a/src/ex_cmds.h
a64932
+++ b/src/ex_cmds.h
a64932
@@ -56,6 +56,7 @@
a64932
 				 * curbuf_lock is set */
a64932
 #define MODIFY       0x200000L	/* forbidden in non-'modifiable' buffer */
a64932
 #define EXFLAGS      0x400000L	/* allow flags after count in argument */
a64932
+#define RESTRICT     0x800000L	/* forbidden in restricted mode */
a64932
 #define FILES	(XFILE | EXTRA)	/* multiple extra files allowed */
a64932
 #define WORD1	(EXTRA | NOSPC)	/* one extra word allowed */
a64932
 #define FILE1	(FILES | NOSPC)	/* 1 file allowed, defaults to current file */
a64932
@@ -860,13 +861,13 @@ EX(CMD_lunmap,		"lunmap",	ex_unmap,
a64932
 			EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_lua,		"lua",		ex_lua,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_luado,		"luado",	ex_luado,
a64932
-			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_luafile,		"luafile",	ex_luafile,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_lvimgrep,	"lvimgrep",	ex_vimgrep,
a64932
 			RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE,
a64932
@@ -929,10 +930,10 @@ EX(CMD_mode,		"mode",		ex_mode,
a64932
 			WORD1|TRLBAR|CMDWIN,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_mzscheme,	"mzscheme",	ex_mzscheme,
a64932
-			RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK,
a64932
+			RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_mzfile,		"mzfile",	ex_mzfile,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_next,		"next",		ex_next,
a64932
 			RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
a64932
@@ -1115,37 +1116,37 @@ EX(CMD_pwd,		"pwd",		ex_pwd,
a64932
 			TRLBAR|CMDWIN,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_python,		"python",	ex_python,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_pydo,		"pydo",		ex_pydo,
a64932
-			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_pyfile,		"pyfile",	ex_pyfile,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_py3,		"py3",		ex_py3,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_py3do,		"py3do",	ex_py3do,
a64932
-			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_python3,		"python3",	ex_py3,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_py3file,		"py3file",	ex_py3file,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_pyx,		"pyx",		ex_pyx,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_pyxdo,		"pyxdo",	ex_pyxdo,
a64932
-			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_pythonx,		"pythonx",	ex_pyx,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_pyxfile,		"pyxfile",	ex_pyxfile,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_quit,		"quit",		ex_quit,
a64932
 			BANG|RANGE|COUNT|NOTADR|TRLBAR|CMDWIN,
a64932
@@ -1199,13 +1200,13 @@ EX(CMD_runtime,		"runtime",	ex_runtime,
a64932
 			BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_ruby,		"ruby",		ex_ruby,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_rubydo,		"rubydo",	ex_rubydo,
a64932
-			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_rubyfile,	"rubyfile",	ex_rubyfile,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_rundo,		"rundo",	ex_rundo,
a64932
 			NEEDARG|FILE1,
a64932
@@ -1472,13 +1473,13 @@ EX(CMD_tabs,		"tabs",		ex_tabs,
a64932
 			TRLBAR|CMDWIN,
a64932
 			ADDR_TABS),
a64932
 EX(CMD_tcl,		"tcl",		ex_tcl,
a64932
-			RANGE|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_tcldo,		"tcldo",	ex_tcldo,
a64932
-			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN,
a64932
+			RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_tclfile,		"tclfile",	ex_tclfile,
a64932
-			RANGE|FILE1|NEEDARG|CMDWIN,
a64932
+			RANGE|FILE1|NEEDARG|CMDWIN|RESTRICT,
a64932
 			ADDR_LINES),
a64932
 EX(CMD_tearoff,		"tearoff",	ex_tearoff,
a64932
 			NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN,
a64932
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
a64932
index ef86fc8..aaf2f9d 100644
a64932
--- a/src/ex_docmd.c
a64932
+++ b/src/ex_docmd.c
a64932
@@ -2372,11 +2372,16 @@ do_one_cmd(
a64932
 #ifdef HAVE_SANDBOX
a64932
 	if (sandbox != 0 && !(ea.argt & SBOXOK))
a64932
 	{
a64932
-	    /* Command not allowed in sandbox. */
a64932
+	    // Command not allowed in sandbox.
a64932
 	    errormsg = (char_u *)_(e_sandbox);
a64932
 	    goto doend;
a64932
 	}
a64932
 #endif
a64932
+	if (restricted != 0 && (ea.argt & RESTRICT))
a64932
+	{
a64932
+	    errormsg = (char_u *)_("E981: Command not allowed in rvim");
a64932
+	    goto doend;
a64932
+	}
a64932
 	if (!curbuf->b_p_ma && (ea.argt & MODIFY))
a64932
 	{
a64932
 	    /* Command not allowed in non-'modifiable' buffer */
a64932
diff --git a/src/if_perl.xs b/src/if_perl.xs
a64932
index 7b45033..fc8d613 100644
a64932
--- a/src/if_perl.xs
a64932
+++ b/src/if_perl.xs
a64932
@@ -930,6 +930,7 @@ VIM_init(void)
a64932
 #ifdef DYNAMIC_PERL
a64932
 static char *e_noperl = N_("Sorry, this command is disabled: the Perl library could not be loaded.");
a64932
 #endif
a64932
+static char *e_perlsandbox = N_("E299: Perl evaluation forbidden in sandbox without the Safe module");
a64932
 
a64932
 /*
a64932
  * ":perl"
a64932
@@ -978,13 +979,12 @@ ex_perl(exarg_T *eap)
a64932
 	vim_free(script);
a64932
     }
a64932
 
a64932
-#ifdef HAVE_SANDBOX
a64932
-    if (sandbox)
a64932
+    if (sandbox || secure)
a64932
     {
a64932
 	safe = perl_get_sv("VIM::safe", FALSE);
a64932
 # ifndef MAKE_TEST  /* avoid a warning for unreachable code */
a64932
 	if (safe == NULL || !SvTRUE(safe))
a64932
-	    EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module"));
a64932
+	    EMSG(_(e_perlsandbox));
a64932
 	else
a64932
 # endif
a64932
 	{
a64932
@@ -996,7 +996,6 @@ ex_perl(exarg_T *eap)
a64932
 	}
a64932
     }
a64932
     else
a64932
-#endif
a64932
 	perl_eval_sv(sv, G_DISCARD | G_NOARGS);
a64932
 
a64932
     SvREFCNT_dec(sv);
a64932
@@ -1259,13 +1258,12 @@ do_perleval(char_u *str, typval_T *rettv)
a64932
 	ENTER;
a64932
 	SAVETMPS;
a64932
 
a64932
-#ifdef HAVE_SANDBOX
a64932
-	if (sandbox)
a64932
+	if (sandbox || secure)
a64932
 	{
a64932
 	    safe = get_sv("VIM::safe", FALSE);
a64932
 # ifndef MAKE_TEST  /* avoid a warning for unreachable code */
a64932
 	    if (safe == NULL || !SvTRUE(safe))
a64932
-		EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module"));
a64932
+		EMSG(_(e_perlsandbox));
a64932
 	    else
a64932
 # endif
a64932
 	    {
a64932
@@ -1281,7 +1279,6 @@ do_perleval(char_u *str, typval_T *rettv)
a64932
 	    }
a64932
 	}
a64932
 	else
a64932
-#endif /* HAVE_SANDBOX */
a64932
 	    sv = eval_pv((char *)str, 0);
a64932
 
a64932
 	if (sv) {
a64932
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
a64932
index e36089a..5f1c38c 100644
a64932
--- a/src/testdir/Make_all.mak
a64932
+++ b/src/testdir/Make_all.mak
a64932
@@ -156,6 +156,7 @@ NEW_TESTS = test_arabic.res \
a64932
 	    test_quotestar.res \
a64932
 	    test_regex_char_classes.res \
a64932
 	    test_registers.res \
a64932
+	    test_restricted.res \
a64932
 	    test_retab.res \
a64932
 	    test_ruby.res \
a64932
 	    test_scrollbind.res \
a64932
diff --git a/src/testdir/test_restricted.vim b/src/testdir/test_restricted.vim
a64932
new file mode 100644
a64932
index 0000000..9dd937c
a64932
--- /dev/null
a64932
+++ b/src/testdir/test_restricted.vim
a64932
@@ -0,0 +1,107 @@
a64932
+" Test for "rvim" or "vim -Z"
a64932
+
a64932
+source shared.vim
a64932
+
a64932
+func Test_restricted()
a64932
+  let cmd = GetVimCommand('Xrestricted')
a64932
+  if cmd == ''
a64932
+    return
a64932
+  endif
a64932
+
a64932
+  call writefile([
a64932
+	\ "silent !ls",
a64932
+	\ "call writefile([v:errmsg], 'Xrestrout')",
a64932
+	\ "qa!",
a64932
+	\ ], 'Xrestricted')
a64932
+  call system(cmd . ' -Z')
a64932
+  call assert_match('E145:', join(readfile('Xrestrout')))
a64932
+
a64932
+  call delete('Xrestricted')
a64932
+  call delete('Xrestrout')
a64932
+endfunc
a64932
+
a64932
+func Run_restricted_test(ex_cmd, error)
a64932
+  let cmd = GetVimCommand('Xrestricted')
a64932
+  if cmd == ''
a64932
+    return
a64932
+  endif
a64932
+
a64932
+  call writefile([
a64932
+	\ a:ex_cmd,
a64932
+	\ "call writefile([v:errmsg], 'Xrestrout')",
a64932
+	\ "qa!",
a64932
+	\ ], 'Xrestricted')
a64932
+  call system(cmd . ' -Z')
a64932
+  call assert_match(a:error, join(readfile('Xrestrout')))
a64932
+
a64932
+  call delete('Xrestricted')
a64932
+  call delete('Xrestrout')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_lua()
a64932
+  if !has('lua')
a64932
+    throw 'Skipped: Lua is not supported'
a64932
+  endif
a64932
+  call Run_restricted_test('lua print("Hello, Vim!")', 'E981:')
a64932
+  call Run_restricted_test('luado return "hello"', 'E981:')
a64932
+  call Run_restricted_test('luafile somefile', 'E981:')
a64932
+  call Run_restricted_test('call luaeval("expression")', 'E145:')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_mzscheme()
a64932
+  if !has('mzscheme')
a64932
+    throw 'Skipped: MzScheme is not supported'
a64932
+  endif
a64932
+  call Run_restricted_test('mzscheme statement', 'E981:')
a64932
+  call Run_restricted_test('mzfile somefile', 'E981:')
a64932
+  call Run_restricted_test('call mzeval("expression")', 'E145:')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_perl()
a64932
+  if !has('perl')
a64932
+    throw 'Skipped: Perl is not supported'
a64932
+  endif
a64932
+  " TODO: how to make Safe mode fail?
a64932
+  " call Run_restricted_test('perl system("ls")', 'E981:')
a64932
+  " call Run_restricted_test('perldo system("hello")', 'E981:')
a64932
+  " call Run_restricted_test('perlfile somefile', 'E981:')
a64932
+  " call Run_restricted_test('call perleval("system(\"ls\")")', 'E145:')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_python()
a64932
+  if !has('python')
a64932
+    throw 'Skipped: Python is not supported'
a64932
+  endif
a64932
+  call Run_restricted_test('python print "hello"', 'E981:')
a64932
+  call Run_restricted_test('pydo return "hello"', 'E981:')
a64932
+  call Run_restricted_test('pyfile somefile', 'E981:')
a64932
+  call Run_restricted_test('call pyeval("expression")', 'E145:')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_python3()
a64932
+  if !has('python3')
a64932
+    throw 'Skipped: Python3 is not supported'
a64932
+  endif
a64932
+  call Run_restricted_test('py3 print "hello"', 'E981:')
a64932
+  call Run_restricted_test('py3do return "hello"', 'E981:')
a64932
+  call Run_restricted_test('py3file somefile', 'E981:')
a64932
+  call Run_restricted_test('call py3eval("expression")', 'E145:')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_ruby()
a64932
+  if !has('ruby')
a64932
+    throw 'Skipped: Ruby is not supported'
a64932
+  endif
a64932
+  call Run_restricted_test('ruby print "Hello"', 'E981:')
a64932
+  call Run_restricted_test('rubydo print "Hello"', 'E981:')
a64932
+  call Run_restricted_test('rubyfile somefile', 'E981:')
a64932
+endfunc
a64932
+
a64932
+func Test_restricted_tcl()
a64932
+  if !has('tcl')
a64932
+    throw 'Skipped: Tcl is not supported'
a64932
+  endif
a64932
+  call Run_restricted_test('tcl puts "Hello"', 'E981:')
a64932
+  call Run_restricted_test('tcldo puts "Hello"', 'E981:')
a64932
+  call Run_restricted_test('tclfile somefile', 'E981:')
a64932
+endfunc