Here's how to stop shell escapes from vi
Martin Weitzel
martin at mwtech.UUCP
Wed Sep 26 04:49:03 AEST 1990
In article <1038:Sep2414:36:0390 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>In article <1990Sep24.040745.10454 at chinet.chi.il.us> les at chinet.chi.il.us (Leslie Mikesell) writes:
>> In article <27387:Sep2320:07:3890 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>> > [ trash the colon with pty -0 tr \: \? | pty vi ]
[...]
>> Umm... Well, there's 'Q' to go to ex mode and stay there while you
>> type sh,
> [ blah blah blah ]
>
>Read my lips: ``The only thing that you can't completely control from
>within vi is the mapping of the colon---and my solution handles that.''
>You can map Q. You can map @. You can even map !---I didn't realize this
>at first. You can map every single f-ing character the user can type.
>Except the colon.
Dan, calm down. I confess that after your first posting I had not
understood your proposual to map all "dangerous" command from *within*
vi and that mapping Q, @, and ! to <esc> so could effectively disable
these commands. But playing a little with vi, to confirm if it could
work, revealed other interesting things.
If you have two minutes time, please try the following: 2000i-<esc>
This should construct a line of 2000 characters, which is above the
limits at least my vi (386/ix Rel 2.0.2) can handle. Then insert
another character into this line ... and whoops, vi throws you into
ex-mode.
Nice feature - who would ever have thought? Possibly some user which
you carefully tried to keep away from ex-prompts knows this little
"feature" (who said it is a bug?).
Vi wasn't designed for what you have in mind. It MUST be fixed in the
vi-sources, if it should work reliable! I would never trust in any
other solution.
--
Martin Weitzel, email: martin at mwtech.UUCP, voice: 49-(0)6151-6 56 83
More information about the Comp.unix.sysv386
mailing list