mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Switch CONF_remote_cmd to being STR_AMBI.
The immediate usefulness of this is in pterm.exe: when the user uses -e to specify a command to run in the pterm, we retrieve the command in Unicode, store it in CONF_remote_cmd as UTF-8, and then in conpty.c we can extract it in the same form and convert it back to Unicode to pass losslessly to CreateProcessW. So now non-ACP Unicode works in that part of the pterm command line.
This commit is contained in:
@ -182,7 +182,9 @@ static void mainchan_open_confirmation(Channel *chan)
|
||||
if (mc->n_req_env)
|
||||
ppl_logevent("Sent %d environment variables", mc->n_req_env);
|
||||
|
||||
cmd = conf_get_str(mc->conf, CONF_remote_cmd);
|
||||
/* Ignore encoding of CONF_remote_cmd so as not to disturb
|
||||
* legacy handling of non-UTF-8 commands */
|
||||
cmd = conf_get_str_ambi(mc->conf, CONF_remote_cmd, NULL);
|
||||
if (conf_get_bool(mc->conf, CONF_ssh_subsys)) {
|
||||
retry_cmd_now = !sshfwd_start_subsystem(mc->sc, true, cmd);
|
||||
} else if (*cmd) {
|
||||
@ -205,7 +207,9 @@ static void mainchan_open_confirmation(Channel *chan)
|
||||
|
||||
static void mainchan_try_fallback_command(mainchan *mc)
|
||||
{
|
||||
const char *cmd = conf_get_str(mc->conf, CONF_remote_cmd2);
|
||||
/* Ignore encoding of CONF_remote_cmd2 so as not to disturb legacy
|
||||
* handling of non-UTF-8 commands */
|
||||
const char *cmd = conf_get_str_ambi(mc->conf, CONF_remote_cmd2, NULL);
|
||||
if (conf_get_bool(mc->conf, CONF_ssh_subsys2)) {
|
||||
sshfwd_start_subsystem(mc->sc, true, cmd);
|
||||
} else {
|
||||
@ -288,7 +292,7 @@ static void mainchan_request_response(Channel *chan, bool success)
|
||||
if (success) {
|
||||
ppl_logevent("Started a shell/command");
|
||||
mainchan_ready(mc);
|
||||
} else if (*conf_get_str(mc->conf, CONF_remote_cmd2)) {
|
||||
} else if (*conf_get_str_ambi(mc->conf, CONF_remote_cmd2, NULL)) {
|
||||
ppl_logevent("Primary command failed; attempting fallback");
|
||||
mainchan_try_fallback_command(mc);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user