Last active
January 8, 2021 21:05
-
-
Save terinjokes/c8f6ba26431bdfc70f7c04e4b3739b39 to your computer and use it in GitHub Desktop.
OpenSSH 8.4p1 OverrideTerm option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/mux.c b/mux.c | |
index 376f0d71..a240664d 100644 | |
--- a/mux.c | |
+++ b/mux.c | |
@@ -1922,7 +1922,9 @@ mux_client_request_session(int fd) | |
close(devnull); | |
} | |
- if ((term = getenv("TERM")) == NULL) | |
+ term = options.override_term ? options.override_term : getenv("TERM"); | |
+ | |
+ if (term == NULL) | |
term = ""; | |
echar = 0xffffffff; | |
if (options.escape_char != SSH_ESCAPECHAR_NONE) | |
diff --git a/readconf.c b/readconf.c | |
index 554efd7c..5f575c6f 100644 | |
--- a/readconf.c | |
+++ b/readconf.c | |
@@ -172,7 +172,7 @@ typedef enum { | |
oStreamLocalBindMask, oStreamLocalBindUnlink, oRevokedHostKeys, | |
oFingerprintHash, oUpdateHostkeys, oHostbasedKeyTypes, | |
oPubkeyAcceptedKeyTypes, oCASignatureAlgorithms, oProxyJump, | |
- oSecurityKeyProvider, | |
+ oSecurityKeyProvider, oOverrideTerm, | |
oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported | |
} OpCodes; | |
@@ -310,6 +310,7 @@ static struct { | |
{ "ignoreunknown", oIgnoreUnknown }, | |
{ "proxyjump", oProxyJump }, | |
{ "securitykeyprovider", oSecurityKeyProvider }, | |
+ { "overrideterm", oOverrideTerm }, | |
{ NULL, oBadOption } | |
}; | |
@@ -1853,6 +1854,16 @@ parse_keytypes: | |
*charptr = xstrdup(arg); | |
break; | |
+ case oOverrideTerm: | |
+ if (s == NULL) { | |
+ error("%.200s line %d: Missing argument.", | |
+ filename, linenum); | |
+ return -1; | |
+ } | |
+ len = strspn(s, WHITESPACE "="); | |
+ options->override_term = xstrdup(s + len); | |
+ return 0; | |
+ | |
case oDeprecated: | |
debug("%s line %d: Deprecated option \"%s\"", | |
filename, linenum, keyword); | |
@@ -2062,6 +2073,7 @@ initialize_options(Options * options) | |
options->update_hostkeys = -1; | |
options->hostbased_key_types = NULL; | |
options->pubkey_key_types = NULL; | |
+ options->override_term = NULL; | |
} | |
/* | |
diff --git a/readconf.h b/readconf.h | |
index d6a15550..2c9167dc 100644 | |
--- a/readconf.h | |
+++ b/readconf.h | |
@@ -168,6 +168,8 @@ typedef struct { | |
int jump_port; | |
char *jump_extra; | |
+ char *override_term; | |
+ | |
char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ | |
} Options; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment