Skip to content
Snippets Groups Projects
Commit 51713c8e authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add new "Binmode Broken" option for telnet.

In this mode, SyncTERM won't will/do TELNET_BINARY_TX at the start
of a connection, leaving the mode up to the remote system. The main
purpose for this option is to work around a bug in older Synchronet
releases where early CTRL-C checking wouldn't work in binary mode.

Implements feature request 91.
parent 4aca7119
No related branches found
No related tags found
No related merge requests found
......@@ -544,6 +544,11 @@ System Password::
An additional password that can be sent after the
first kbd:[Alt+L] using successive kbd:[Alt+L]s.
Binmode Broken::
Telnet binary mode is broken on the remote system, do not enable it when
connecting. This option is to work around a bug in CTRL-C checking in
older Synchronet versions.
Screen Mode::
Selects the format of the window when connected.
A mode specifies the number of columns, the number of rows,
......
......@@ -820,6 +820,7 @@ read_item(str_list_t listfile, struct bbslist *entry, char *bbsname, int id, int
if (entry->stop_bits < 1 || entry->stop_bits > 2)
entry->stop_bits = 1;
entry->parity = iniGetEnum(section, NULL, "Parity", parity_enum, SYNCTERM_PARITY_NONE);
entry->telnet_no_binary = iniGetBool(section, NULL, "TelnetBrokenTextmode", false);
/* Log Stuff */
iniGetSString(section, NULL, "LogFile", "", entry->logfile, sizeof(entry->logfile));
......@@ -1160,6 +1161,7 @@ enum {
BBSLIST_FIELD_STOP_BITS,
BBSLIST_FIELD_DATA_BITS,
BBSLIST_FIELD_PARITY,
BBSLIST_FIELD_TELNET_NO_BINARY,
};
void
......@@ -1248,6 +1250,10 @@ build_edit_list(struct bbslist *item, char opt[][69], int *optmap, char **opts,
optmap[i] = BBSLIST_FIELD_SFTP_PUBLIC_KEY;
sprintf(opt[i++], "SFTP Public Key %s", item->sftp_public_key ? "Yes" : "No");
}
if (item->conn_type == CONN_TYPE_TELNET || item->conn_type == CONN_TYPE_TELNETS) {
optmap[i] = BBSLIST_FIELD_TELNET_NO_BINARY;
sprintf(opt[i++], "Binmode Broken %s", item->telnet_no_binary ? "Yes" : "No");
}
optmap[i] = BBSLIST_FIELD_SCREEN_MODE;
sprintf(opt[i++], "Screen Mode %s", screen_modes[item->screen_mode]);
optmap[i] = BBSLIST_FIELD_FONT;
......@@ -1383,6 +1389,11 @@ build_edit_help(struct bbslist *item, int isdefault, char *helpbuf, size_t hbsz)
" Open an SFTP channel and transfer the public key to\n"
" .ssh/authorized_keys\n\n", hbsz - hblen);
}
if (item->conn_type == CONN_TYPE_TELNET || item->conn_type == CONN_TYPE_TELNETS) {
hblen += strlcat(helpbuf + hblen, "~ Binmode Broken ~\n"
" Telnet binary mode is broken on the remote system, do not\n"
" enable it when connecting\n\n", hbsz - hblen);
}
hblen += strlcat(helpbuf + hblen, "~ Screen Mode ~\n"
" Display mode to use\n\n", hbsz - hblen);
hblen += strlcat(helpbuf + hblen, "~ Font ~\n"
......@@ -1945,6 +1956,12 @@ edit_list(struct bbslist **list, struct bbslist *item, char *listpath, int isdef
changed = 1;
iniSetBool(&inifile, itemname, "SFTPPublicKey", item->sftp_public_key, &ini_style);
break;
case BBSLIST_FIELD_TELNET_NO_BINARY:
item->telnet_no_binary = !item->telnet_no_binary;
changed = 1;
iniSetBool(&inifile, itemname, "TelnetBrokenTextmode", item->telnet_no_binary, &ini_style);
break;
}
if (uifc.changes)
changed = 1;
......@@ -2003,6 +2020,7 @@ add_bbs(char *listpath, struct bbslist *bbs, bool new_entry)
iniSetString(&inifile, bbs->name, "Comment", bbs->comment, &ini_style);
iniSetBool(&inifile, bbs->name, "ForceLCF", bbs->force_lcf, &ini_style);
iniSetBool(&inifile, bbs->name, "YellowIsYellow", bbs->yellow_is_yellow, &ini_style);
iniSetBool(&inifile, bbs->name, "TelnetBrokenTextmode", bbs->telnet_no_binary, &ini_style);
if (bbs->has_fingerprint) {
char fp[41];
fp[0] = 0;
......
......@@ -152,6 +152,7 @@ struct bbslist {
bool has_fingerprint;
uint8_t ssh_fingerprint[20];
bool sftp_public_key;
bool telnet_no_binary;
// No way to get a uint8_t from an ini file.
short unsigned int stop_bits;
short unsigned int data_bits;
......
......@@ -154,9 +154,11 @@ telnet_connect(struct bbslist *bbs)
// Suppress Go Aheads (both directions)
request_telnet_opt(TELNET_WILL, TELNET_SUP_GA);
request_telnet_opt(TELNET_DO, TELNET_SUP_GA);
// Enable binary mode (both directions)
request_telnet_opt(TELNET_WILL, TELNET_BINARY_TX);
request_telnet_opt(TELNET_DO, TELNET_BINARY_TX);
if (!bbs->telnet_no_binary) {
// Enable binary mode (both directions)
request_telnet_opt(TELNET_WILL, TELNET_BINARY_TX);
request_telnet_opt(TELNET_DO, TELNET_BINARY_TX);
}
// Request that the server echos
request_telnet_opt(TELNET_DO, TELNET_ECHO);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment