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

Send login info in a single conn_send() call

Should "fix" the timing difference in login info between modes.
This removes a 10ms SLEEP() between the different pieces of data,
and would likely have resolved ticket 185 if it wasn't already
closed.
parent 03c892d0
No related branches found
No related tags found
No related merge requests found
Pipeline #8091 passed
...@@ -3992,34 +3992,40 @@ do_paste(void) ...@@ -3992,34 +3992,40 @@ do_paste(void)
void void
send_login(struct bbslist *bbs) { send_login(struct bbslist *bbs) {
const size_t userlen = strlen(bbs->user);
const size_t passlen = strlen(bbs->password);
const size_t syspasslen = strlen(bbs->syspass);
const size_t derbufsz = userlen + passlen + syspasslen + 3 + 1;
size_t derbufpos = 0;
char *derbuf = malloc(derbufsz);
if ((bbs->conn_type != CONN_TYPE_RLOGIN) if ((bbs->conn_type != CONN_TYPE_RLOGIN)
&& (bbs->conn_type != CONN_TYPE_RLOGIN_REVERSED) && (bbs->conn_type != CONN_TYPE_RLOGIN_REVERSED)
&& (bbs->conn_type != CONN_TYPE_SSH)) { && (bbs->conn_type != CONN_TYPE_SSH)) {
if (bbs->conn_type != CONN_TYPE_SSHNA) { if (bbs->conn_type != CONN_TYPE_SSHNA) {
if (bbs->user[0]) { if (bbs->user[0]) {
conn_send(bbs->user, strlen(bbs->user), 0); memcpy(&derbuf[derbufpos], bbs->user, userlen);
conn_send( derbufpos += userlen;
cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r", derbuf[derbufpos++] = '\r';
1, derbuf[derbufpos] = 0;
0);
SLEEP(10);
} }
} }
if (bbs->password[0]) { if (bbs->password[0]) {
conn_send(bbs->password, strlen(bbs->password), 0); memcpy(&derbuf[derbufpos], bbs->password, passlen);
conn_send( derbufpos += passlen;
cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r", derbuf[derbufpos++] = '\r';
1, derbuf[derbufpos] = 0;
0);
SLEEP(10);
} }
} }
if (bbs->syspass[0]) { if (bbs->syspass[0]) {
conn_send(bbs->syspass, strlen(bbs->syspass), 0); memcpy(&derbuf[derbufpos], bbs->syspass, syspasslen);
conn_send(cterm->emulation == CTERM_EMULATION_ATASCII ? "\x9b" : "\r", derbufpos += syspasslen;
1, derbuf[derbufpos++] = '\r';
0); derbuf[derbufpos] = 0;
} }
if (derbufpos)
conn_send(derbuf, derbufpos, 0);
free(derbuf);
} }
static void static void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment