diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-14 16:25:50 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2007-11-14 16:25:50 -0800 |
commit | 18d767fb17ec197d3ed24ec27a5364ee84b612ca (patch) | |
tree | 73f664a55c8a42afd3b72bb33ff5b389ad63905f /bashline.c | |
parent | bff0c156047ae6ca0bb9a5e04587ebe1d1ef5249 (diff) | |
download | vyatta-bash-18d767fb17ec197d3ed24ec27a5364ee84b612ca.tar.gz vyatta-bash-18d767fb17ec197d3ed24ec27a5364ee84b612ca.zip |
* add restricted modes ("output" and "full").
* support "root-level" programmable completion in restricted modes.
Diffstat (limited to 'bashline.c')
-rw-r--r-- | bashline.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1067,7 +1067,8 @@ attempt_shell_completion (text, start, end) #if defined (PROGRAMMABLE_COMPLETION) /* Attempt programmable completion. */ - if (!matches && in_command_position == 0 && prog_completion_enabled && + if (!matches && prog_completion_enabled && + (in_vyatta_restricted_mode(OUTPUT) || in_command_position == 0) && (progcomp_size () > 0) && current_prompt_string == ps1_prompt) { int s, e, foundcs; @@ -1081,7 +1082,9 @@ attempt_shell_completion (text, start, end) s = find_cmd_start (start); e = find_cmd_end (end); n = find_cmd_name (s); - if (e > s && assignment (n, 0) == 0) + if ((e > s || (in_vyatta_restricted_mode(OUTPUT) && + strcmp(n, text) == 0)) && + assignment (n, 0) == 0) prog_complete_matches = programmable_completions (n, text, s, e, &foundcs); else foundcs = 0; @@ -1126,6 +1129,11 @@ bash_default_completion (text, start, end, qc, in_command_position) matches = (char **)NULL; + if (in_vyatta_restricted_mode(OUTPUT)) { + rl_ignore_some_completions_function = bash_ignore_everything; + return matches; + } + /* New posix-style command substitution or variable name? */ if (!matches && *text == '$') { |