mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
9fcbb86f71
This centralises the messages for weak crypto algorithms (general, and host keys in particular, the latter including a list of all the other available host key types) into ssh/common.c, in much the same way as we previously did for ordinary host key warnings. The reason is the same too: I'm about to want to vary the text in one of those dialog boxes, so it's convenient to start by putting it somewhere that I can modify just once.
79 lines
1.8 KiB
C
79 lines
1.8 KiB
C
/*
|
|
* Common pieces between the platform console frontend modules.
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
#include <stdarg.h>
|
|
|
|
#include "putty.h"
|
|
#include "misc.h"
|
|
#include "console.h"
|
|
|
|
const char console_abandoned_msg[] = "Connection abandoned.\n";
|
|
|
|
const SeatDialogPromptDescriptions *console_prompt_descriptions(Seat *seat)
|
|
{
|
|
static const SeatDialogPromptDescriptions descs = {
|
|
.hk_accept_action = "enter \"y\"",
|
|
.hk_connect_once_action = "enter \"n\"",
|
|
.hk_cancel_action = "press Return",
|
|
.hk_cancel_action_Participle = "Pressing Return",
|
|
.weak_accept_action = "enter \"y\"",
|
|
.weak_cancel_action = "enter \"n\"",
|
|
};
|
|
return &descs;
|
|
}
|
|
|
|
bool console_batch_mode = false;
|
|
|
|
/*
|
|
* Error message and/or fatal exit functions, all based on
|
|
* console_print_error_msg which the platform front end provides.
|
|
*/
|
|
void console_print_error_msg_fmt_v(
|
|
const char *prefix, const char *fmt, va_list ap)
|
|
{
|
|
char *msg = dupvprintf(fmt, ap);
|
|
console_print_error_msg(prefix, msg);
|
|
sfree(msg);
|
|
}
|
|
|
|
void console_print_error_msg_fmt(const char *prefix, const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
console_print_error_msg_fmt_v(prefix, fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
void modalfatalbox(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
console_print_error_msg_fmt_v("FATAL ERROR", fmt, ap);
|
|
va_end(ap);
|
|
cleanup_exit(1);
|
|
}
|
|
|
|
void nonfatal(const char *fmt, ...)
|
|
{
|
|
va_list ap;
|
|
va_start(ap, fmt);
|
|
console_print_error_msg_fmt_v("ERROR", fmt, ap);
|
|
va_end(ap);
|
|
}
|
|
|
|
void console_connection_fatal(Seat *seat, const char *msg)
|
|
{
|
|
console_print_error_msg("FATAL ERROR", msg);
|
|
cleanup_exit(1);
|
|
}
|
|
|
|
/*
|
|
* Console front ends redo their select() or equivalent every time, so
|
|
* they don't need separate timer handling.
|
|
*/
|
|
void timer_change_notify(unsigned long next)
|
|
{
|
|
}
|