mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-26 01:32:25 +00:00
028714d02a
I'd forgotten that the text-only branch of seat_antispoof_msg() constructs a string from its input in the expectation that it's a one-line message. So it was a mistake to put a \n at the start of the string in interactor_announce() to get a blank line first. Now interactor_announce() makes an extra call to seat_antispoof_msg to show its blank line, and seat_antispoof_msg itself handles the blank-line case specially.
29 lines
911 B
C
29 lines
911 B
C
#include "putty.h"
|
|
#include "misc.h"
|
|
|
|
void seat_antispoof_msg(InteractionReadySeat iseat, const char *msg)
|
|
{
|
|
strbuf *sb = strbuf_new();
|
|
seat_set_trust_status(iseat.seat, true);
|
|
if (seat_can_set_trust_status(iseat.seat)) {
|
|
/*
|
|
* If the seat can directly indicate that this message is
|
|
* generated by the client, then we can just use the message
|
|
* unmodified as an unspoofable header.
|
|
*/
|
|
put_datapl(sb, ptrlen_from_asciz(msg));
|
|
} else if (*msg) {
|
|
/*
|
|
* Otherwise, add enough padding around it that the server
|
|
* wouldn't be able to mimic it within our line-length
|
|
* constraint.
|
|
*/
|
|
strbuf_catf(sb, "-- %s ", msg);
|
|
while (sb->len < 78)
|
|
put_byte(sb, '-');
|
|
}
|
|
put_datapl(sb, PTRLEN_LITERAL("\r\n"));
|
|
seat_banner_pl(iseat, ptrlen_from_strbuf(sb));
|
|
strbuf_free(sb);
|
|
}
|