Tagging the 0.73.0.2 release of the kitty project.
This commit is contained in:
@@ -1 +0,0 @@
|
||||
"0.72.0"
|
||||
@@ -1 +0,0 @@
|
||||
6
|
||||
@@ -27,7 +27,7 @@ const struct BackendVtable *const backends[] = {
|
||||
&telnet_backend,
|
||||
&rlogin_backend,
|
||||
&raw_backend,
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
&adb_backend,
|
||||
#endif
|
||||
NULL
|
||||
@@ -14,7 +14,7 @@
|
||||
* have tiny little source modules containing nothing but
|
||||
* declarations of appname, for as long as I can...
|
||||
*/
|
||||
#if (defined PERSOPORT) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
char *appname = "KiTTY";
|
||||
#else
|
||||
const char *const appname = "PuTTY";
|
||||
@@ -32,10 +32,10 @@ const struct BackendVtable *const backends[] = {
|
||||
&rlogin_backend,
|
||||
&raw_backend,
|
||||
&serial_backend,
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
&cygterm_backend,
|
||||
#endif
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
&adb_backend,
|
||||
#endif
|
||||
NULL
|
||||
@@ -14,11 +14,11 @@ const struct BackendVtable *const backends[] = {
|
||||
&telnet_backend,
|
||||
&rlogin_backend,
|
||||
&raw_backend,
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
&adb_backend,
|
||||
#endif
|
||||
&serial_backend,
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
&cygterm_backend,
|
||||
#endif
|
||||
NULL
|
||||
@@ -14,10 +14,10 @@ const struct BackendVtable *const backends[] = {
|
||||
&telnet_backend,
|
||||
&rlogin_backend,
|
||||
&raw_backend,
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
&adb_backend,
|
||||
#endif
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
&cygterm_backend,
|
||||
#endif
|
||||
NULL
|
||||
@@ -28,13 +28,13 @@
|
||||
* executed immediately.)
|
||||
*/
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
#include "kitty_crypt.h"
|
||||
int decode64(char *buffer) ;
|
||||
void SetAutoStoreSSHKey( void ) ;
|
||||
void load_open_settings_forced(char *filename, Conf *conf) ;
|
||||
#endif
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
int GetADBFlag(void) ;
|
||||
#endif
|
||||
|
||||
@@ -168,7 +168,7 @@ static bool cmdline_check_unavailable(int flag, const char *p)
|
||||
static bool seen_hostname_argument = false;
|
||||
static bool seen_port_argument = false;
|
||||
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
void cygterm_set_flag( int flag ) ;
|
||||
bool get_got_host(void){ return seen_hostname_argument ; }
|
||||
void set_got_host(bool val ){ seen_hostname_argument = val ; }
|
||||
@@ -259,7 +259,7 @@ int cmdline_process_param(const char *p, char *value,
|
||||
} else {
|
||||
conf_set_int(conf, CONF_port, -1);
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
} else if (!strncmp(p, "ssh:", 4)) {
|
||||
char *pst = (char*)malloc(strlen(p)+1) ; strcpy(pst,p);
|
||||
char *q = (char*)pst ;
|
||||
@@ -518,7 +518,7 @@ int cmdline_process_param(const char *p, char *value,
|
||||
default_protocol = PROT_RAW;
|
||||
conf_set_int(conf, CONF_protocol, default_protocol);
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if (!strcmp(p, "-kload")) {
|
||||
RETURN(2);
|
||||
/* This parameter must be processed immediately rather than being
|
||||
@@ -533,7 +533,7 @@ int cmdline_process_param(const char *p, char *value,
|
||||
SetAutoStoreSSHKey();
|
||||
}
|
||||
#endif
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
if (!strcmp(p, "-cygterm")) {
|
||||
RETURN(1);
|
||||
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
|
||||
@@ -544,7 +544,7 @@ int cmdline_process_param(const char *p, char *value,
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
if (!strcmp(p, "-adb") && GetADBFlag()) {
|
||||
RETURN(1);
|
||||
UNAVAILABLE_IN(TOOLTYPE_FILETRANSFER | TOOLTYPE_NONNETWORK);
|
||||
@@ -266,7 +266,7 @@ bool conf_get_bool(Conf *conf, int primary)
|
||||
{
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( valuetypes[primary] == TYPE_INT ) {
|
||||
int i = conf_get_int( conf, primary ) ;
|
||||
if( i==0 ) { return false ; }
|
||||
@@ -285,7 +285,7 @@ int conf_get_int(Conf *conf, int primary)
|
||||
{
|
||||
struct key key;
|
||||
struct conf_entry *entry;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( valuetypes[primary] == TYPE_BOOL ) {
|
||||
return (conf_get_bool( conf, primary ) ? 1 : 0) ;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ FontSpec *conf_get_fontspec(Conf *conf, int primary)
|
||||
void conf_set_bool(Conf *conf, int primary, bool value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( valuetypes[primary] == TYPE_INT ) {
|
||||
conf_set_int( conf, primary, (value?1:0) );
|
||||
return ;
|
||||
@@ -432,7 +432,7 @@ void conf_set_bool(Conf *conf, int primary, bool value)
|
||||
void conf_set_int(Conf *conf, int primary, int value)
|
||||
{
|
||||
struct conf_entry *entry = snew(struct conf_entry);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( valuetypes[primary] == TYPE_BOOL ) {
|
||||
conf_set_bool( conf, primary, (value==0?false:true) );
|
||||
return ;
|
||||
@@ -10,20 +10,20 @@
|
||||
#include "dialog.h"
|
||||
#include "storage.h"
|
||||
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
#include "script.h"
|
||||
#endif /* rutty */
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
int cygterm_get_flag( void ) ;
|
||||
#endif
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
#include "kitty.h"
|
||||
union control * ctrlHostnameEdit = NULL ;
|
||||
void MASKPASS( char * password ) ;
|
||||
int stricmp(const char *s1, const char *s2) ;
|
||||
int GetReadOnlyFlag(void) ;
|
||||
#endif
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
#define ATOFFSET(data, offset) ( (void *) ( (char *)(data) + (offset) ) )
|
||||
#endif
|
||||
|
||||
@@ -185,7 +185,7 @@ void conf_filesel_handler(union control *ctrl, dlgparam *dlg,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
void ReadAutoCommandFromFile( const char * filename ) ;
|
||||
void ReadInitScript( const char * filename ) ;
|
||||
int existfile( const char * filename );
|
||||
@@ -239,7 +239,7 @@ static void config_host_handler(union control *ctrl, dlgparam *dlg,
|
||||
void *data, int event)
|
||||
{
|
||||
Conf *conf = (Conf *)data;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ctrlHostnameEdit = ctrl ;
|
||||
#endif
|
||||
|
||||
@@ -256,12 +256,12 @@ static void config_host_handler(union control *ctrl, dlgparam *dlg,
|
||||
*/
|
||||
dlg_label_change(ctrl, dlg, "Serial line");
|
||||
dlg_editbox_set(ctrl, dlg, conf_get_str(conf, CONF_serline));
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
} else if( cygterm_get_flag() && (conf_get_int(conf, CONF_protocol) == PROT_CYGTERM) ) {
|
||||
dlg_label_change(ctrl, dlg, "Command (use - for login shell, ? for exe)");
|
||||
dlg_editbox_set(ctrl, dlg, conf_get_str(conf, CONF_cygcmd) );
|
||||
#endif
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
} else if (conf_get_int(conf, CONF_protocol) == PROT_ADB) {
|
||||
char *saved_host = conf_get_str(conf, CONF_host);
|
||||
dlg_label_change(ctrl, dlg, "-a: any, -d: usb, -e: emulator, or :serial");
|
||||
@@ -277,7 +277,7 @@ static void config_host_handler(union control *ctrl, dlgparam *dlg,
|
||||
char *s = dlg_editbox_get(ctrl, dlg);
|
||||
if (conf_get_int(conf, CONF_protocol) == PROT_SERIAL)
|
||||
conf_set_str(conf, CONF_serline, s);
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
else if( cygterm_get_flag() && (conf_get_int(conf, CONF_protocol) == PROT_CYGTERM) ) {
|
||||
char *s = dlg_editbox_get(ctrl, dlg);
|
||||
conf_set_str(conf, CONF_cygcmd, s);
|
||||
@@ -308,7 +308,7 @@ static void config_port_handler(union control *ctrl, dlgparam *dlg,
|
||||
*/
|
||||
dlg_label_change(ctrl, dlg, "Speed");
|
||||
sprintf(buf, "%d", conf_get_int(conf, CONF_serspeed));
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
} else if( cygterm_get_flag() && (conf_get_int(conf, CONF_protocol) == PROT_CYGTERM) ) {
|
||||
dlg_label_change(ctrl, dlg, "Port (ignored)");
|
||||
strcpy(buf, "-");
|
||||
@@ -329,7 +329,7 @@ static void config_port_handler(union control *ctrl, dlgparam *dlg,
|
||||
|
||||
if (conf_get_int(conf, CONF_protocol) == PROT_SERIAL)
|
||||
conf_set_int(conf, CONF_serspeed, i);
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
else if( cygterm_get_flag() && (conf_get_int(conf, CONF_protocol) == PROT_CYGTERM) ) ;
|
||||
#endif
|
||||
else
|
||||
@@ -637,7 +637,7 @@ static void printerbox_handler(union control *ctrl, dlgparam *dlg,
|
||||
if (ctrl->editbox.has_list) {
|
||||
dlg_listbox_clear(ctrl, dlg);
|
||||
dlg_listbox_add(ctrl, dlg, PRINTER_DISABLED_STRING);
|
||||
#ifdef PRINTCLIPPORT
|
||||
#ifdef MOD_PRINTCLIP
|
||||
dlg_listbox_add(ctrl, dlg, PRINT_TO_CLIPBOARD_STRING);
|
||||
#endif
|
||||
pe = printer_start_enum(&nprinters);
|
||||
@@ -645,7 +645,7 @@ static void printerbox_handler(union control *ctrl, dlgparam *dlg,
|
||||
dlg_listbox_add(ctrl, dlg, printer_get_name(pe, i));
|
||||
printer_finish_enum(pe);
|
||||
}
|
||||
#ifdef PRINTCLIPPORT
|
||||
#ifdef MOD_PRINTCLIP
|
||||
printer = conf_get_str(conf, CONF_printer);
|
||||
if ( printer )
|
||||
dlg_editbox_set(ctrl, dlg, conf_get_str(conf,CONF_printer) ) ;
|
||||
@@ -663,7 +663,7 @@ static void printerbox_handler(union control *ctrl, dlgparam *dlg,
|
||||
#endif
|
||||
} else if (event == EVENT_VALCHANGE) {
|
||||
char *printer = dlg_editbox_get(ctrl, dlg);
|
||||
#ifdef PRINTCLIPPORT
|
||||
#ifdef MOD_PRINTCLIP
|
||||
if (!strcmp(printer, PRINTER_DISABLED_STRING)) {
|
||||
//printer[0] = '\0';
|
||||
conf_set_int(conf,CONF_printclip,0);
|
||||
@@ -739,7 +739,7 @@ static void sshbug_handler(union control *ctrl, dlgparam *dlg,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
#include "kitty.h"
|
||||
int dlg_listbox_get(union control *ctrl, void *dlg, int index, char * pstr, int maxcount) ;
|
||||
int dlg_listbox_gettext(union control *ctrl, void *dlg, int index, char * pstr, int maxcount) ;
|
||||
@@ -833,9 +833,9 @@ static void folder_handler(union control *ctrl, dlgparam *dlg,
|
||||
#endif
|
||||
|
||||
struct sessionsaver_data {
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
union control *editbox, *listbox, *clearbutton, *loadbutton, *savebutton, *delbutton, *createbutton, *delfolderbutton, *arrangebutton
|
||||
#if (defined PERSOPORT) && (!defined FDJ) && (defined STARTBUTTON)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ) && (defined MOD_STARTBUTTON)
|
||||
, *startbutton
|
||||
#endif
|
||||
;
|
||||
@@ -867,7 +867,7 @@ static bool load_selected_session(
|
||||
dlgparam *dlg, Conf *conf, bool *maybe_launch)
|
||||
{
|
||||
int i = dlg_listbox_index(ssd->listbox, dlg);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
{
|
||||
char sessionname[1024] ;
|
||||
int j;
|
||||
@@ -899,7 +899,7 @@ static bool load_selected_session(
|
||||
}
|
||||
isdef = !strcmp(ssd->sesslist.sessions[i], "Default Settings");
|
||||
load_settings(ssd->sesslist.sessions[i], conf);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( (get_param("INIFILE")==SAVEMODE_DIR) && GetDirectoryBrowseFlag() ) {
|
||||
conf_set_str(conf,CONF_folder,CurrentFolder) ;
|
||||
} else {
|
||||
@@ -922,7 +922,7 @@ static bool load_selected_session(
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
int filter_sessionname( const char * pattern, const char * sessionname, const char * folder, const char * savedsession ) {
|
||||
char buffer[4092] ;
|
||||
int lenpattern = strlen(pattern) ;
|
||||
@@ -978,7 +978,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
|
||||
if (event == EVENT_REFRESH) {
|
||||
if (ctrl == ssd->editbox) {
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ctrlSessionEdit = ctrl ;
|
||||
#endif
|
||||
dlg_editbox_set(ctrl, dlg, ssd->savedsession);
|
||||
@@ -986,7 +986,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
int i;
|
||||
dlg_update_start(ctrl, dlg);
|
||||
dlg_listbox_clear(ctrl, dlg);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( ssd->savedsession!=NULL ) strcpy( ssd->savedsession, dlg_editbox_get( ssd->editbox, dlg ) ) ; // ajout 0.63 pour que le filtre fonctionne
|
||||
|
||||
ctrlSessionList = ctrl ;
|
||||
@@ -1049,7 +1049,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
if (ctrl == ssd->editbox) {
|
||||
sfree(ssd->savedsession);
|
||||
ssd->savedsession = dlg_editbox_get(ctrl, dlg);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
sessionsaver_handler( ctrlSessionList, dlg, data, EVENT_REFRESH ) ;
|
||||
#endif
|
||||
top = ssd->sesslist.nsessions;
|
||||
@@ -1080,7 +1080,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
* double-click on the list box _and_ that session
|
||||
* contains a hostname.
|
||||
*/
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if (load_selected_session(ssd, dlg, conf, &mbl) &&
|
||||
(mbl && ctrl == ssd->listbox && conf_launchable(conf))) {
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
@@ -1119,7 +1119,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
ssd->sesslist.sessions[i]);
|
||||
}
|
||||
{
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
conf_set_str( conf, CONF_folder, CurrentFolder ) ;
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
@@ -1148,13 +1148,13 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
get_sesslist(&ssd->sesslist, true);
|
||||
dlg_refresh(ssd->editbox, dlg);
|
||||
dlg_refresh(ssd->listbox, dlg);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
RepliqueToPuTTY( PUTTY_REG_POS ) ;
|
||||
#endif
|
||||
} else if (!ssd->midsession &&
|
||||
ssd->delbutton && ctrl == ssd->delbutton) {
|
||||
int i = dlg_listbox_index(ssd->listbox, dlg);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
{ // Pour recuperer le bon index de la session a supprimer quand il y le filtre des sessions
|
||||
char sessionname[1024] ;
|
||||
int j;
|
||||
@@ -1172,7 +1172,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
get_sesslist(&ssd->sesslist, true);
|
||||
dlg_refresh(ssd->listbox, dlg);
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ssd->savedsession[0]='\0' ;
|
||||
dlg_refresh(ssd->editbox, dlg) ;
|
||||
sessionsaver_handler( ctrlSessionList, dlg, data, EVENT_REFRESH ) ;
|
||||
@@ -1183,7 +1183,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
dlg_end(dlg, 1);
|
||||
return;
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
strcpy( buffer, conf_get_str( conf, CONF_password) ) ;
|
||||
@@ -1230,8 +1230,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
} else if (ctrl == ssd->cancelbutton) {
|
||||
dlg_end(dlg, 0);
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#if (defined PERSOPORT) && (!defined FDJ) && (defined STARTBUTTON)
|
||||
#ifdef MOD_PERSO
|
||||
#if (defined MOD_PERSO) && (!defined FDJ) && (defined MOD_STARTBUTTON)
|
||||
else if (ctrl == ssd->startbutton) {
|
||||
if( conf_launchable(conf) ) {
|
||||
RunConfig(conf) ;
|
||||
@@ -1371,7 +1371,7 @@ static void charclass_handler(union control *ctrl, dlgparam *dlg,
|
||||
}
|
||||
|
||||
struct colour_data {
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
union control *listbox, *redit, *gedit, *bedit, *button,
|
||||
*bold_checkbox, *underline_checkbox, *selected_checkbox;
|
||||
#else
|
||||
@@ -1380,7 +1380,7 @@ struct colour_data {
|
||||
};
|
||||
|
||||
static const char *const colours[] = {
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
"Default Foreground", "Default Bold Foreground",
|
||||
"Default Underlined Foreground",
|
||||
"Default Background", "Default Bold Background",
|
||||
@@ -1410,7 +1410,7 @@ static const char *const colours[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
void dlg_control_enable(union control *ctrl, void *dlg, int enable);
|
||||
static const int itemcolour[] = {
|
||||
0, 1, 2, 0, 1, 2, 0, 0, 3, 3, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
|
||||
@@ -1473,7 +1473,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||
bool update = false, clear = false;
|
||||
int r, g, b;
|
||||
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
if (ctrl == cd->bold_checkbox) {
|
||||
conf_set_int(conf,CONF_bold_colour,1);
|
||||
dlg_control_enable(cd->bold_checkbox, dlg,0);
|
||||
@@ -1515,7 +1515,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||
dlg_update_start(ctrl, dlg);
|
||||
dlg_listbox_clear(ctrl, dlg);
|
||||
for (i = 0; i < lenof(colours); i++)
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
/* This allows us to hide list items we don't need to
|
||||
* see: if bold-as-colour (or underline) turned off, we just hide those bold
|
||||
* choices to decrease user confusion. And, of course, it looks
|
||||
@@ -1554,7 +1554,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||
clear = true;
|
||||
} else {
|
||||
clear = false;
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
/* I know this looks a bit weird, but I just had no
|
||||
* other choice. Other way it would break existing code and
|
||||
* worse yet, existing saved session structure.
|
||||
@@ -1585,7 +1585,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||
|
||||
i = dlg_listbox_index(cd->listbox, dlg);
|
||||
if (i >= 0) {
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
i = idxcolour[conf_get_int(conf,CONF_bold_colour)][conf_get_int(conf,CONF_under_colour)][conf_get_int(conf,CONF_sel_colour)][i];
|
||||
|
||||
#endif
|
||||
@@ -1609,7 +1609,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||
* EVENT_CALLBACK when it's finished and allow us to
|
||||
* pick up the results.
|
||||
*/
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
i = idxcolour[conf_get_int(conf,CONF_bold_colour)][conf_get_int(conf,CONF_under_colour)][conf_get_int(conf,CONF_sel_colour)][i];
|
||||
#endif
|
||||
dlg_coloursel_start(ctrl, dlg,
|
||||
@@ -1625,7 +1625,7 @@ static void colour_handler(union control *ctrl, dlgparam *dlg,
|
||||
* return nonzero on success, or zero if the colour
|
||||
* selector did nothing (user hit Cancel, for example).
|
||||
*/
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
i = idxcolour[conf_get_int(conf,CONF_bold_colour)][conf_get_int(conf,CONF_under_colour)][conf_get_int(conf,CONF_sel_colour)][i];
|
||||
#endif
|
||||
if (dlg_coloursel_results(ctrl, dlg, &r, &g, &b)) {
|
||||
@@ -2176,11 +2176,11 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
HELPCTX(no_help),
|
||||
sessionsaver_handler, P(ssd));
|
||||
ssd->okbutton->button.isdefault = true;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( GetConfigBoxHeight() > 7 ) ssd->okbutton->generic.column = 0 ; else
|
||||
#endif
|
||||
ssd->okbutton->generic.column = 3;
|
||||
#if (defined PERSOPORT) && (!defined FDJ) && (defined STARTBUTTON)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ) && (defined MOD_STARTBUTTON)
|
||||
if( (!midsession)&&(!GetPuttyFlag()) ) {
|
||||
ssd->startbutton = ctrl_pushbutton(s, "Start", NO_SHORTCUT, HELPCTX(no_help), sessionsaver_handler, P(ssd));
|
||||
if( GetConfigBoxHeight() > 7 ) ssd->startbutton->generic.column = 0 ; else ssd->startbutton->generic.column = 3;
|
||||
@@ -2189,7 +2189,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ssd->cancelbutton = ctrl_pushbutton(s, "Cancel", 'c', HELPCTX(no_help),
|
||||
sessionsaver_handler, P(ssd));
|
||||
ssd->cancelbutton->button.iscancel = true;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( GetConfigBoxHeight() > 7 ) ssd->cancelbutton->generic.column = 0 ; else
|
||||
#endif
|
||||
ssd->cancelbutton->generic.column = 4;
|
||||
@@ -2229,12 +2229,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
"Raw", 'w', I(PROT_RAW),
|
||||
"Telnet", 't', I(PROT_TELNET),
|
||||
"Rlogin", 'i', I(PROT_RLOGIN),
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
"ADB", 'b', I(PROT_ADB),
|
||||
#endif
|
||||
NULL);
|
||||
} else {
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
if( GetADBFlag() )
|
||||
ctrl_radiobuttons(s, "Connection type:", NO_SHORTCUT, 4,
|
||||
HELPCTX(session_hostname),
|
||||
@@ -2266,7 +2266,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
"Load, save or delete a stored session");
|
||||
ctrl_columns(s, 2, 75, 25);
|
||||
get_sesslist(&ssd->sesslist, true);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ssd->editbox = ctrl_editbox(s, "Saved Sessions/New Folder", 'e', 100,
|
||||
HELPCTX(session_saved),
|
||||
sessionsaver_handler, P(ssd), P(NULL));
|
||||
@@ -2294,12 +2294,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
HELPCTX(session_saved),
|
||||
sessionsaver_handler, P(ssd));
|
||||
ssd->listbox->generic.column = 0;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ssd->listbox->listbox.height = GetConfigBoxHeight() ;
|
||||
#else
|
||||
ssd->listbox->listbox.height = 7;
|
||||
#endif
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
if( cygterm_get_flag() ) ssd->listbox->listbox.height-- ;
|
||||
#endif
|
||||
if (!midsession) {
|
||||
@@ -2315,7 +2315,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ssd->loadbutton = NULL;
|
||||
}
|
||||
/* "Save" button is permitted mid-session. */
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetReadOnlyFlag() ) {
|
||||
if( get_param("INIFILE") == 1 )
|
||||
ssd->savebutton = ctrl_pushbutton(s, "Save (f)", 'v', HELPCTX(session_saved), sessionsaver_handler, P(ssd));
|
||||
@@ -2439,7 +2439,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ctrl_text(s, "(Log file name can contain &Y, &M, &D for date,"
|
||||
" &T for time, &H for host name, and &P for port number)",
|
||||
HELPCTX(logging_filename));
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ctrl_editbox(s, "Log rotation delay (sec)", NO_SHORTCUT, 50,
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler, I(CONF_logtimerotation), I(-1) ) ;
|
||||
@@ -2473,7 +2473,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
}
|
||||
|
||||
/* rutty: Session/Scripting panel */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
if( !GetPuttyFlag() && (GetRuttyFlag()>0) ) {
|
||||
ctrl_settitle(b, "Session/Scripting", "Scripting (RuTTY patch)");
|
||||
s = ctrl_getset(b, "Session/Scripting", "Start", NULL);
|
||||
@@ -2584,7 +2584,12 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
conf_radiobutton_bool_handler,
|
||||
I(CONF_bksp_is_delete),
|
||||
"Control-H", I(0), "Control-? (127)", I(1), NULL);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ctrl_radiobuttons(s, "The Enter key", 'y', 2,
|
||||
HELPCTX(no_help),
|
||||
conf_radiobutton_handler,
|
||||
I(CONF_enter_sends_crlf),
|
||||
"CR", I(0), "CR LF", I(1), NULL);
|
||||
ctrl_radiobuttons(s, "The Home and End keys", 'e', 3,
|
||||
HELPCTX(keyboard_homeend),
|
||||
conf_radiobutton_handler,
|
||||
@@ -2605,7 +2610,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
I(CONF_funky_type),
|
||||
"ESC[n~", I(0), "Linux", I(1), "Xterm R6", I(2),
|
||||
"VT400", I(3), "VT100+", I(4), "SCO", I(5),
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
// "AT&T 513", I(6),
|
||||
// "Sun Xterm", I(8),
|
||||
#endif
|
||||
@@ -2638,7 +2643,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
"Make default system alert sound", I(BELL_DEFAULT),
|
||||
"Visual bell (flash window)", I(BELL_VISUAL), NULL);
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ctrl_checkbox(s, "Put window on foreground on bell", NO_SHORTCUT,
|
||||
HELPCTX(no_help),
|
||||
conf_checkbox_handler, I(CONF_foreground_on_bell) ) ;
|
||||
@@ -2791,7 +2796,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
conf_editbox_handler,
|
||||
I(CONF_window_border), I(-1));
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetPuttyFlag() ) {
|
||||
/*
|
||||
* Brad's The Window/Position & Icon panel.
|
||||
@@ -2824,7 +2829,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
|
||||
}
|
||||
#endif
|
||||
#if (defined IMAGEPORT) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
if( !GetPuttyFlag() && GetBackgroundImageFlag() ) {
|
||||
/*
|
||||
* The Window/Background panel.
|
||||
@@ -2848,7 +2853,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
|
||||
s = ctrl_getset(b, "Window/Back.&Image", "bg_wp_img_settings",
|
||||
"Desktop and image settings");
|
||||
ctrl_editbox(s, "Opacity:", NO_SHORTCUT, 20,
|
||||
ctrl_editbox(s, "Opacity: (negative with Image for gradient)", NO_SHORTCUT, 20,
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler,
|
||||
I(CONF_bg_opacity), I(-1) ) ;
|
||||
@@ -2859,7 +2864,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
|
||||
s = ctrl_getset(b, "Window/Back.&Image", "bg_img_settings",
|
||||
"Image settings");
|
||||
ctrl_filesel(s, "Image file:", NO_SHORTCUT,
|
||||
ctrl_filesel(s, "Image file: (or #RRGGBB for gradient)", NO_SHORTCUT,
|
||||
FILTER_IMAGE_FILES, FALSE, "Select background image file",
|
||||
HELPCTX(no_help),
|
||||
conf_filesel_handler, I(CONF_bg_image_filename) );
|
||||
@@ -2893,7 +2898,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
static char transTitle[256]="Window/Transparency" ;
|
||||
if( !GetPuttyFlag() ) {
|
||||
if( GetTransparencyFlag() ) ctrl_settitle(b, transTitle, "Options controlling transparency");
|
||||
@@ -2924,7 +2929,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
ctrl_editbox(s, "Window title:", 't', 100,
|
||||
HELPCTX(appearance_title),
|
||||
conf_editbox_handler, I(CONF_wintitle), I(1));
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetPuttyFlag() ) {
|
||||
ctrl_text(s, " %%f: folder name", HELPCTX(appearance_title));
|
||||
ctrl_text(s, " %%h: hostname", HELPCTX(appearance_title));
|
||||
@@ -2944,7 +2949,7 @@ if( !GetPuttyFlag() ) {
|
||||
ctrl_checkbox(s, "Warn before closing window", 'w',
|
||||
HELPCTX(behaviour_closewarn),
|
||||
conf_checkbox_handler, I(CONF_warn_on_close));
|
||||
#ifdef DISABLEALTGRPORT
|
||||
#ifdef MOD_DISABLEALTGR
|
||||
if( !GetPuttyFlag() ) {
|
||||
ctrl_checkbox(s, "Disable AltGr menu", NO_SHORTCUT,
|
||||
HELPCTX(no_help),
|
||||
@@ -2986,12 +2991,6 @@ if( !GetPuttyFlag() ) {
|
||||
HELPCTX(translation_utf8linedraw),
|
||||
conf_checkbox_handler, I(CONF_utf8linedraw));
|
||||
|
||||
#ifdef ACSPORT
|
||||
ctrl_checkbox(s, "Allow ACS line drawing in UTF", NO_SHORTCUT,
|
||||
HELPCTX(no_help),
|
||||
conf_checkbox_handler, I(CONF_acs_in_utf));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The Window/Selection panel.
|
||||
*/
|
||||
@@ -3088,7 +3087,7 @@ if( !GetPuttyFlag() ) {
|
||||
"Both", I(3),
|
||||
NULL);
|
||||
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
cd = (struct colour_data *) ctrl_alloc(b, sizeof(struct colour_data));
|
||||
memset(cd , 0, sizeof(*cd ));
|
||||
cd->bold_checkbox =
|
||||
@@ -3110,7 +3109,7 @@ if( !GetPuttyFlag() ) {
|
||||
HELPCTX(colours_config));
|
||||
ctrl_columns(s, 2, 67, 33);
|
||||
cd = (struct colour_data *)ctrl_alloc(b, sizeof(struct colour_data));
|
||||
#ifndef TUTTYPORT
|
||||
#ifndef MOD_TUTTY
|
||||
cd = (struct colour_data *)ctrl_alloc(b, sizeof(struct colour_data));
|
||||
#endif
|
||||
cd->listbox = ctrl_listbox(s, "Select a colour to adjust:", 'u',
|
||||
@@ -3147,7 +3146,7 @@ if( !GetPuttyFlag() ) {
|
||||
HELPCTX(connection_keepalive),
|
||||
conf_editbox_handler, I(CONF_ping_interval),
|
||||
I(-1));
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
ctrl_editbox(s, "Anti-idle string", NO_SHORTCUT, 50,
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler, I(CONF_antiidle), I(1) ) ;
|
||||
@@ -3177,7 +3176,7 @@ if( !GetPuttyFlag() ) {
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
#ifdef RECONNECTPORT
|
||||
#ifdef MOD_RECONNECT
|
||||
if( !GetPuttyFlag() && GetAutoreconnectFlag() ) {
|
||||
s = ctrl_getset(b, "Connection", "reconnect", "Reconnect options");
|
||||
ctrl_checkbox(s, "Attempt to reconnect on system wakeup", NO_SHORTCUT, HELPCTX(no_help), conf_checkbox_handler, I(CONF_wakeup_reconnect)) ;
|
||||
@@ -3195,7 +3194,7 @@ if( !GetPuttyFlag() ) {
|
||||
HELPCTX(connection_loghost),
|
||||
conf_editbox_handler, I(CONF_loghost), I(1));
|
||||
}
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
// port knocking panel
|
||||
if( !GetPuttyFlag() ) {
|
||||
// ctrl_settitle(b, "Connection/Port knocking", "Options controlling port knocking") ;
|
||||
@@ -3241,9 +3240,9 @@ if( !GetPuttyFlag() ) {
|
||||
sfree(userlabel);
|
||||
}
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetPuttyFlag() ) {
|
||||
#ifndef NO_PASSWORD
|
||||
#ifndef MOD_NOPASSWORD
|
||||
c = ctrl_editbox(s, "Auto-login password", NO_SHORTCUT, 50,
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler, I(CONF_password), I(1) ) ;
|
||||
@@ -3452,7 +3451,7 @@ if( !GetPuttyFlag() ) {
|
||||
"exist without looking strange.", HELPCTX(no_help));
|
||||
}
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if (!midsession) {
|
||||
s = ctrl_getset(b, "Connection/SSH", "pscp", "PSCP integration") ;
|
||||
ctrl_checkbox(s, "Send file in current directory", NO_SHORTCUT,
|
||||
@@ -3855,7 +3854,7 @@ if( !GetPuttyFlag() ) {
|
||||
pfd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
|
||||
HELPCTX(ssh_tunnels_portfwd),
|
||||
portfwd_handler, P(pfd));
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
pfd->listbox->listbox.height = 12 ;
|
||||
#else
|
||||
pfd->listbox->listbox.height = 3;
|
||||
@@ -3956,7 +3955,7 @@ if( !GetPuttyFlag() ) {
|
||||
sshbug_handler, I(CONF_sshbug_rsa1));
|
||||
}
|
||||
}
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
// z-modem panel
|
||||
if( (!GetPuttyFlag())&&GetZModemFlag() ) {
|
||||
ctrl_settitle(b, "Connection/ZModem",
|
||||
@@ -4001,7 +4000,7 @@ if( !GetPuttyFlag() ) {
|
||||
/**/
|
||||
}
|
||||
#endif
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetPuttyFlag() ) {
|
||||
ctrl_settitle(b, "Comment", "Options comments");
|
||||
s = ctrl_getset(b, "Comment", "freecomment",
|
||||
@@ -4018,7 +4017,7 @@ if( !GetPuttyFlag() ) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
/*
|
||||
* The standard directory-selector handler expects the main `context'
|
||||
* field to contain the `offsetof' a Filename field in the
|
||||
@@ -461,7 +461,7 @@ void ctrl_free(union control *ctrl)
|
||||
case CTRL_FILESELECT:
|
||||
sfree(ctrl->fileselect.title);
|
||||
break;
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
case CTRL_DIRECTORYSELECT:
|
||||
sfree(ctrl->fileselect.title);
|
||||
break;
|
||||
@@ -470,7 +470,7 @@ void ctrl_free(union control *ctrl)
|
||||
sfree(ctrl);
|
||||
}
|
||||
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
union control *ctrl_directorysel(struct controlset *s,char *label,char shortcut,
|
||||
char *title,
|
||||
intorptr helpctx, handler_fn handler,
|
||||
@@ -29,7 +29,7 @@ enum {
|
||||
CTRL_COLUMNS, /* divide window into columns */
|
||||
CTRL_FILESELECT, /* label plus filename selector */
|
||||
CTRL_FONTSELECT, /* label plus font selector */
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
CTRL_DIRECTORYSELECT, /* label plus directory selector */
|
||||
#endif
|
||||
CTRL_TABDELAY /* see `tabdelay' below */
|
||||
@@ -407,7 +407,7 @@ union control {
|
||||
STANDARD_PREFIX;
|
||||
char shortcut;
|
||||
} fontselect;
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
struct {
|
||||
STANDARD_PREFIX;
|
||||
char shortcut;
|
||||
@@ -545,7 +545,7 @@ union control *ctrl_checkbox(struct controlset *, const char *label,
|
||||
char shortcut, intorptr helpctx,
|
||||
handler_fn handler, intorptr context);
|
||||
union control *ctrl_tabdelay(struct controlset *, union control *);
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
union control *ctrl_directorysel(struct controlset *,char *label,char shortcut,
|
||||
char *title,
|
||||
intorptr helpctx,
|
||||
@@ -585,7 +585,7 @@ void dlg_filesel_set(union control *ctrl, dlgparam *dp, Filename *fn);
|
||||
Filename *dlg_filesel_get(union control *ctrl, dlgparam *dp);
|
||||
void dlg_fontsel_set(union control *ctrl, dlgparam *dp, FontSpec *fn);
|
||||
FontSpec *dlg_fontsel_get(union control *ctrl, dlgparam *dp);
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
void dlg_directorysel_set(union control *ctrl, void *dlg, Filename fn);
|
||||
void dlg_directorysel_get(union control *ctrl, void *dlg, Filename *fn);
|
||||
#endif
|
||||
@@ -677,7 +677,7 @@ int ctrl_path_elements(const char *path);
|
||||
* or INT_MAX if the paths are identical. */
|
||||
int ctrl_path_compare(const char *p1, const char *p2);
|
||||
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
/*
|
||||
* The standard directory-selector handler expects the main `context'
|
||||
* field to contain the `offsetof' a Filename field in the
|
||||
@@ -50,7 +50,6 @@ static const SocketVtable ErrorSocket_sockvt = {
|
||||
NULL /* write */,
|
||||
NULL /* write_oob */,
|
||||
NULL /* write_eof */,
|
||||
NULL /* flush */,
|
||||
NULL /* set_frozen */,
|
||||
sk_error_socket_error,
|
||||
sk_error_peer_info,
|
||||
@@ -21,7 +21,7 @@
|
||||
(backend_ldisc_option_state(ldisc->backend, LD_EDIT))))
|
||||
|
||||
/* rutty: special entry point for local data (in windows.c) */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
int GetPuttyFlag(void) ;
|
||||
int GetRuttyFlag(void) ;
|
||||
|
||||
@@ -141,7 +141,7 @@ void ldisc_free(Ldisc *ldisc)
|
||||
}
|
||||
|
||||
/* rutty: */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
#include "script.h"
|
||||
extern ScriptData scriptdata; /* in window.c */
|
||||
#endif /* rutty */
|
||||
@@ -160,7 +160,7 @@ void ldisc_send(Ldisc *ldisc, const void *vbuf, int len, bool interactive)
|
||||
assert(len);
|
||||
|
||||
/* rutty: */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
if( !GetPuttyFlag() && (GetRuttyFlag()>0) ) { script_local(&scriptdata, buf,len); }
|
||||
#endif /* rutty */
|
||||
|
||||
@@ -25,7 +25,7 @@ struct LogContext {
|
||||
static Filename *xlatlognam(Filename *s, char *hostname, int port,
|
||||
struct tm *tm);
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
int GetPuttyFlag(void) ;
|
||||
int mkdir(const char *path, int mode);
|
||||
int insert( char * ch, const char * c, const int ipos ) ;
|
||||
@@ -156,7 +156,7 @@ static void logwrite(LogContext *ctx, ptrlen data)
|
||||
* to one of L_OPENING, L_OPEN or L_ERROR. Hence we process all of
|
||||
* those three _after_ processing L_CLOSED.
|
||||
*/
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !LogMode ) return ;
|
||||
if( timestamp_newfile ) {
|
||||
if (ctx->state == L_OPEN) { logfclose(ctx);}
|
||||
@@ -171,7 +171,7 @@ static void logwrite(LogContext *ctx, ptrlen data)
|
||||
bufchain_add(&ctx->queue, data.ptr, data.len);
|
||||
} else if (ctx->state == L_OPEN) {
|
||||
assert(ctx->lgfp);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetPuttyFlag() ) {
|
||||
if( timestamp_newline ) { log_writetimestamp( ctx ) ; timestamp_newline = 0 ; }
|
||||
char * c = (char*)(data.ptr+data.len-1) ;
|
||||
@@ -303,7 +303,7 @@ void logfopen(LogContext *ctx)
|
||||
xlatlognam(conf_get_filename(ctx->conf, CONF_logfilename),
|
||||
conf_get_str(ctx->conf, CONF_host),
|
||||
conf_get_int(ctx->conf, CONF_port), &tm);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
test_dir( ctx->currlogfilename ) ;
|
||||
#endif
|
||||
|
||||
@@ -585,7 +585,7 @@ void log_reconfig(LogContext *ctx, Conf *conf)
|
||||
static Filename *xlatlognam(Filename *src, char *hostname, int port,
|
||||
struct tm *tm)
|
||||
{
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
char buf[100], *bufp;
|
||||
#else
|
||||
char buf[32], *bufp;
|
||||
@@ -619,7 +619,7 @@ static Filename *xlatlognam(Filename *src, char *hostname, int port,
|
||||
case 't':
|
||||
size = strftime(buf, sizeof(buf), "%H%M%S", tm);
|
||||
break;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
case 'h':
|
||||
strcpy(buf,hostname) ;
|
||||
int i ; while( (i=poss(":",buf))>0 ) { buf[i-1]='-' ; } // Pour gerer IPv6
|
||||
@@ -105,7 +105,7 @@ bool conf_launchable(Conf *conf)
|
||||
{
|
||||
if (conf_get_int(conf, CONF_protocol) == PROT_SERIAL)
|
||||
return conf_get_str(conf, CONF_serline)[0] != 0;
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
else if (conf_get_int(conf, CONF_protocol) == PROT_CYGTERM)
|
||||
return conf_get_str(conf, CONF_cygcmd)[0] != 0;
|
||||
#endif
|
||||
@@ -117,7 +117,7 @@ char const *conf_dest(Conf *conf)
|
||||
{
|
||||
if (conf_get_int(conf, CONF_protocol) == PROT_SERIAL)
|
||||
return conf_get_str(conf, CONF_serline);
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
else if (conf_get_int(conf, CONF_protocol) == PROT_CYGTERM)
|
||||
return conf_get_str(conf, CONF_cygcmd) ;
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,403 +1,403 @@
|
||||
#ifndef PUTTY_MPINT_H
|
||||
#define PUTTY_MPINT_H
|
||||
|
||||
/*
|
||||
* PuTTY's multiprecision integer library.
|
||||
*
|
||||
* This library is written with the aim of avoiding leaking the input
|
||||
* numbers via timing and cache side channels. This means avoiding
|
||||
* making any control flow change, or deciding the address of any
|
||||
* memory access, based on the value of potentially secret input data.
|
||||
*
|
||||
* But in a library that has to handle numbers of arbitrary size, you
|
||||
* can't avoid your control flow depending on the _size_ of the input!
|
||||
* So the rule is that an mp_int has a nominal size that need not be
|
||||
* its mathematical size: i.e. if you call (say) mp_from_bytes_be to
|
||||
* turn an array of 256 bytes into an integer, and all but the last of
|
||||
* those bytes is zero, then you get an mp_int which has space for 256
|
||||
* bytes of data but just happens to store the value 1. So the
|
||||
* _nominal_ sizes of input data - e.g. the size in bits of some
|
||||
* public-key modulus - are not considered secret, and control flow is
|
||||
* allowed to do what it likes based on those sizes. But the same
|
||||
* function, called with the same _nominally sized_ arguments
|
||||
* containing different values, should run in the same length of time.
|
||||
*
|
||||
* When a function returns an 'mp_int *', it is newly allocated to an
|
||||
* appropriate nominal size (which, again, depends only on the nominal
|
||||
* sizes of the inputs). Other functions have 'into' in their name,
|
||||
* and they instead overwrite the contents of an existing mp_int.
|
||||
*
|
||||
* Functions in this API which return values that are logically
|
||||
* boolean return them as 'unsigned' rather than the C99 bool type.
|
||||
* That's because C99 bool does an implicit test for non-zero-ness
|
||||
* when converting any other integer type to it, which compilers might
|
||||
* well implement using data-dependent control flow.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create and destroy mp_ints. A newly created one is initialised to
|
||||
* zero. mp_clear also resets an existing number to zero.
|
||||
*/
|
||||
mp_int *mp_new(size_t maxbits);
|
||||
void mp_free(mp_int *);
|
||||
void mp_clear(mp_int *x);
|
||||
|
||||
/*
|
||||
* Create mp_ints from various sources: little- and big-endian binary
|
||||
* data, an ordinary C unsigned integer type, a decimal or hex string
|
||||
* (given either as a ptrlen or a C NUL-terminated string), and
|
||||
* another mp_int.
|
||||
*
|
||||
* The decimal and hex conversion functions have running time
|
||||
* dependent on the length of the input data, of course.
|
||||
*/
|
||||
mp_int *mp_from_bytes_le(ptrlen bytes);
|
||||
mp_int *mp_from_bytes_be(ptrlen bytes);
|
||||
mp_int *mp_from_integer(uintmax_t n);
|
||||
mp_int *mp_from_decimal_pl(ptrlen decimal);
|
||||
mp_int *mp_from_decimal(const char *decimal);
|
||||
mp_int *mp_from_hex_pl(ptrlen hex);
|
||||
mp_int *mp_from_hex(const char *hex);
|
||||
mp_int *mp_copy(mp_int *x);
|
||||
|
||||
/*
|
||||
* A macro for declaring large fixed numbers in source code (such as
|
||||
* elliptic curve parameters, or standard Diffie-Hellman moduli). The
|
||||
* idea is that you just write something like
|
||||
*
|
||||
* mp_int *value = MP_LITERAL(0x19284376283754638745693467245);
|
||||
*
|
||||
* and it newly allocates you an mp_int containing that number.
|
||||
*
|
||||
* Internally, the macro argument is stringified and passed to
|
||||
* mp_from_hex. That's not as fast as it could be if I had instead set
|
||||
* up some kind of mp_from_array_of_uint64_t() function, but I think
|
||||
* this system is valuable for the fact that the literal integers
|
||||
* appear in a very natural syntax that can be pasted directly out
|
||||
* into, say, Python if you want to cross-check a calculation.
|
||||
*/
|
||||
static inline mp_int *mp__from_string_literal(const char *lit)
|
||||
{
|
||||
/* Don't call this directly; it's not equipped to deal with
|
||||
* hostile data. Use only via the MP_LITERAL macro. */
|
||||
if (lit[0] && (lit[1] == 'x' || lit[1] == 'X'))
|
||||
return mp_from_hex(lit+2);
|
||||
else
|
||||
return mp_from_decimal(lit);
|
||||
}
|
||||
#define MP_LITERAL(number) mp__from_string_literal(#number)
|
||||
|
||||
/*
|
||||
* Create an mp_int with the value 2^power.
|
||||
*/
|
||||
mp_int *mp_power_2(size_t power);
|
||||
|
||||
/*
|
||||
* Retrieve the value of a particular bit or byte of an mp_int. The
|
||||
* byte / bit index is not considered to be secret data. Out-of-range
|
||||
* byte/bit indices are handled cleanly and return zero.
|
||||
*/
|
||||
uint8_t mp_get_byte(mp_int *x, size_t byte);
|
||||
unsigned mp_get_bit(mp_int *x, size_t bit);
|
||||
|
||||
/*
|
||||
* Retrieve the value of an mp_int as a uintmax_t, assuming it's small
|
||||
* enough to fit.
|
||||
*/
|
||||
uintmax_t mp_get_integer(mp_int *x);
|
||||
|
||||
/*
|
||||
* Set an mp_int bit. Again, the bit index is not considered secret.
|
||||
* Do not pass an out-of-range index, on pain of assertion failure.
|
||||
*/
|
||||
void mp_set_bit(mp_int *x, size_t bit, unsigned val);
|
||||
|
||||
/*
|
||||
* Return the nominal size of an mp_int, in terms of the maximum
|
||||
* number of bytes or bits that can fit in it.
|
||||
*/
|
||||
size_t mp_max_bytes(mp_int *x);
|
||||
size_t mp_max_bits(mp_int *x);
|
||||
|
||||
/*
|
||||
* Return the _mathematical_ bit count of an mp_int (not its nominal
|
||||
* size), i.e. a value n such that 2^{n-1} <= x < 2^n.
|
||||
*
|
||||
* This function is supposed to run in constant time for a given
|
||||
* nominal input size. Of course it's likely that clients of this
|
||||
* function will promptly need to use the result as the limit of some
|
||||
* loop (e.g. marshalling an mp_int into an SSH packet, which doesn't
|
||||
* permit extra prefix zero bytes). But that's up to the caller to
|
||||
* decide the safety of.
|
||||
*/
|
||||
size_t mp_get_nbits(mp_int *x);
|
||||
|
||||
/*
|
||||
* Return the value of an mp_int as a decimal or hex string. The
|
||||
* result is dynamically allocated, and the caller is responsible for
|
||||
* freeing it.
|
||||
*
|
||||
* These functions should run in constant time for a given nominal
|
||||
* input size, even though the exact number of digits returned is
|
||||
* variable. They always allocate enough space for the largest output
|
||||
* that might be needed, but they don't always fill it.
|
||||
*/
|
||||
char *mp_get_decimal(mp_int *x);
|
||||
char *mp_get_hex(mp_int *x);
|
||||
char *mp_get_hex_uppercase(mp_int *x);
|
||||
|
||||
/*
|
||||
* Compare two mp_ints, or compare one mp_int against a C integer. The
|
||||
* 'eq' functions return 1 if the two inputs are equal, or 0
|
||||
* otherwise; the 'hs' functions return 1 if the first input is >= the
|
||||
* second, and 0 otherwise.
|
||||
*/
|
||||
unsigned mp_cmp_hs(mp_int *a, mp_int *b);
|
||||
unsigned mp_cmp_eq(mp_int *a, mp_int *b);
|
||||
unsigned mp_hs_integer(mp_int *x, uintmax_t n);
|
||||
unsigned mp_eq_integer(mp_int *x, uintmax_t n);
|
||||
|
||||
/*
|
||||
* Take the minimum or maximum of two mp_ints, without using a
|
||||
* conditional branch.
|
||||
*/
|
||||
void mp_min_into(mp_int *r, mp_int *x, mp_int *y);
|
||||
void mp_max_into(mp_int *r, mp_int *x, mp_int *y);
|
||||
mp_int *mp_min(mp_int *x, mp_int *y);
|
||||
mp_int *mp_max(mp_int *x, mp_int *y);
|
||||
|
||||
/*
|
||||
* Diagnostic function. Writes out x in hex to the supplied stdio
|
||||
* stream, preceded by the string 'prefix' and followed by 'suffix'.
|
||||
*
|
||||
* This is useful to put temporarily into code, but it's also
|
||||
* potentially useful to call from a debugger.
|
||||
*/
|
||||
void mp_dump(FILE *fp, const char *prefix, mp_int *x, const char *suffix);
|
||||
|
||||
/*
|
||||
* Overwrite one mp_int with another.
|
||||
*/
|
||||
void mp_copy_into(mp_int *dest, mp_int *src);
|
||||
|
||||
/*
|
||||
* Conditional selection. Overwrites dest with either src0 or src1,
|
||||
* according to the value of 'choose_src1'. choose_src1 should be 0 or
|
||||
* 1; if it's 1, then dest is set to src1, otherwise src0.
|
||||
*
|
||||
* The value of choose_src1 is considered to be secret data, so
|
||||
* control flow and memory access should not depend on it.
|
||||
*/
|
||||
void mp_select_into(mp_int *dest, mp_int *src0, mp_int *src1,
|
||||
unsigned choose_src1);
|
||||
|
||||
/*
|
||||
* Addition, subtraction and multiplication, either targeting an
|
||||
* existing mp_int or making a new one large enough to hold whatever
|
||||
* the output might be..
|
||||
*/
|
||||
void mp_add_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_sub_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_mul_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
mp_int *mp_add(mp_int *x, mp_int *y);
|
||||
mp_int *mp_sub(mp_int *x, mp_int *y);
|
||||
mp_int *mp_mul(mp_int *x, mp_int *y);
|
||||
|
||||
/*
|
||||
* Bitwise operations.
|
||||
*/
|
||||
void mp_and_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_or_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_xor_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_bic_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
|
||||
/*
|
||||
* Addition, subtraction and multiplication with one argument small
|
||||
* enough to fit in a C integer. For mp_mul_integer_into, it has to be
|
||||
* even smaller than that.
|
||||
*/
|
||||
void mp_add_integer_into(mp_int *r, mp_int *a, uintmax_t n);
|
||||
void mp_sub_integer_into(mp_int *r, mp_int *a, uintmax_t n);
|
||||
void mp_mul_integer_into(mp_int *r, mp_int *a, uint16_t n);
|
||||
|
||||
/*
|
||||
* Conditional addition/subtraction. If yes == 1, sets r to a+b or a-b
|
||||
* (respectively). If yes == 0, sets r to just a. 'yes' is considered
|
||||
* secret data.
|
||||
*/
|
||||
void mp_cond_add_into(mp_int *r, mp_int *a, mp_int *b, unsigned yes);
|
||||
void mp_cond_sub_into(mp_int *r, mp_int *a, mp_int *b, unsigned yes);
|
||||
|
||||
/*
|
||||
* Swap x0 and x1 if swap == 1, and not if swap == 0. 'swap' is
|
||||
* considered secret.
|
||||
*/
|
||||
void mp_cond_swap(mp_int *x0, mp_int *x1, unsigned swap);
|
||||
|
||||
/*
|
||||
* Set x to 0 if clear == 1, and otherwise leave it unchanged. 'clear'
|
||||
* is considered secret.
|
||||
*/
|
||||
void mp_cond_clear(mp_int *x, unsigned clear);
|
||||
|
||||
/*
|
||||
* Division. mp_divmod_into divides n by d, and writes the quotient
|
||||
* into q and the remainder into r. You can pass either of q and r as
|
||||
* NULL if you don't need one of the outputs.
|
||||
*
|
||||
* mp_div and mp_mod are wrappers that return one or other of those
|
||||
* outputs as a freshly allocated mp_int of the appropriate size.
|
||||
*
|
||||
* Division by zero gives no error, and returns a quotient of 0 and a
|
||||
* remainder of n (so as to still satisfy the division identity that
|
||||
* n=qd+r).
|
||||
*/
|
||||
void mp_divmod_into(mp_int *n, mp_int *d, mp_int *q, mp_int *r);
|
||||
mp_int *mp_div(mp_int *n, mp_int *d);
|
||||
mp_int *mp_mod(mp_int *x, mp_int *modulus);
|
||||
|
||||
/*
|
||||
* Trivially easy special case of mp_mod: reduce a number mod a power
|
||||
* of two.
|
||||
*/
|
||||
void mp_reduce_mod_2to(mp_int *x, size_t p);
|
||||
|
||||
/*
|
||||
* Modular inverses. mp_invert computes the inverse of x mod modulus
|
||||
* (and will expect the two to be coprime). mp_invert_mod_2to computes
|
||||
* the inverse of x mod 2^p, and is a great deal faster.
|
||||
*/
|
||||
mp_int *mp_invert_mod_2to(mp_int *x, size_t p);
|
||||
mp_int *mp_invert(mp_int *x, mp_int *modulus);
|
||||
|
||||
/*
|
||||
* System for taking square roots modulo an odd prime.
|
||||
*
|
||||
* In order to do this efficiently, you need to provide an extra piece
|
||||
* of information at setup time, namely a number which is not
|
||||
* congruent mod p to any square. Given p and that non-square, you can
|
||||
* use modsqrt_new to make a context containing all the necessary
|
||||
* equipment for actually calculating the square roots, and then you
|
||||
* can call mp_modsqrt as many times as you like on that context
|
||||
* before freeing it.
|
||||
*
|
||||
* The output parameter '*success' will be filled in with 1 if the
|
||||
* operation was successful, or 0 if the input number doesn't have a
|
||||
* square root mod p at all. In the latter case, the returned mp_int
|
||||
* will be nonsense and you shouldn't depend on it.
|
||||
*
|
||||
* ==== WARNING ====
|
||||
*
|
||||
* This function DOES NOT TREAT THE PRIME MODULUS AS SECRET DATA! It
|
||||
* will protect the number you're taking the square root _of_, but not
|
||||
* the number you're taking the root of it _mod_.
|
||||
*
|
||||
* (This is because the algorithm requires a number of loop iterations
|
||||
* equal to the number of factors of 2 in p-1. And the expected use of
|
||||
* this function is for elliptic-curve point decompression, in which
|
||||
* the modulus is always a well-known one written down in standards
|
||||
* documents.)
|
||||
*/
|
||||
typedef struct ModsqrtContext ModsqrtContext;
|
||||
ModsqrtContext *modsqrt_new(mp_int *p, mp_int *any_nonsquare_mod_p);
|
||||
void modsqrt_free(ModsqrtContext *);
|
||||
mp_int *mp_modsqrt(ModsqrtContext *sc, mp_int *x, unsigned *success);
|
||||
|
||||
/*
|
||||
* Functions for Montgomery multiplication, a fast technique for doing
|
||||
* a long series of modular multiplications all with the same modulus
|
||||
* (which has to be odd).
|
||||
*
|
||||
* You start by calling monty_new to set up a context structure
|
||||
* containing all the precomputed bits and pieces needed by the
|
||||
* algorithm. Then, any numbers you want to work with must first be
|
||||
* transformed into the internal Montgomery representation using
|
||||
* monty_import; having done that, you can use monty_mul and monty_pow
|
||||
* to operate on them efficiently; and finally, monty_export will
|
||||
* convert numbers back out of Montgomery representation to give their
|
||||
* ordinary values.
|
||||
*
|
||||
* Addition and subtraction are not optimised by the Montgomery trick,
|
||||
* but monty_add and monty_sub are provided anyway for convenience.
|
||||
*
|
||||
* There are also monty_invert and monty_modsqrt, which are analogues
|
||||
* of mp_invert and mp_modsqrt which take their inputs in Montgomery
|
||||
* representation. For mp_modsqrt, the prime modulus of the
|
||||
* ModsqrtContext must be the same as the modulus of the MontyContext.
|
||||
*
|
||||
* The query functions monty_modulus and monty_identity return numbers
|
||||
* stored inside the MontyContext, without copying them. The returned
|
||||
* pointers are still owned by the MontyContext, so don't free them!
|
||||
*/
|
||||
MontyContext *monty_new(mp_int *modulus);
|
||||
void monty_free(MontyContext *mc);
|
||||
mp_int *monty_modulus(MontyContext *mc); /* doesn't transfer ownership */
|
||||
mp_int *monty_identity(MontyContext *mc); /* doesn't transfer ownership */
|
||||
void monty_import_into(MontyContext *mc, mp_int *r, mp_int *x);
|
||||
mp_int *monty_import(MontyContext *mc, mp_int *x);
|
||||
void monty_export_into(MontyContext *mc, mp_int *r, mp_int *x);
|
||||
mp_int *monty_export(MontyContext *mc, mp_int *x);
|
||||
void monty_mul_into(MontyContext *, mp_int *r, mp_int *, mp_int *);
|
||||
mp_int *monty_add(MontyContext *, mp_int *, mp_int *);
|
||||
mp_int *monty_sub(MontyContext *, mp_int *, mp_int *);
|
||||
mp_int *monty_mul(MontyContext *, mp_int *, mp_int *);
|
||||
mp_int *monty_pow(MontyContext *, mp_int *base, mp_int *exponent);
|
||||
mp_int *monty_invert(MontyContext *, mp_int *);
|
||||
mp_int *monty_modsqrt(ModsqrtContext *sc, mp_int *mx, unsigned *success);
|
||||
|
||||
/*
|
||||
* Modular arithmetic functions which don't use an explicit
|
||||
* MontyContext. mp_modpow will use one internally (on the assumption
|
||||
* that the exponent is likely to be large enough to make it
|
||||
* worthwhile); the other three will just do ordinary non-Montgomery-
|
||||
* optimised modular reduction. Use mp_modmul if you only have one
|
||||
* product to compute; if you have a lot, consider using a
|
||||
* MontyContext in the client code.
|
||||
*/
|
||||
mp_int *mp_modpow(mp_int *base, mp_int *exponent, mp_int *modulus);
|
||||
mp_int *mp_modmul(mp_int *x, mp_int *y, mp_int *modulus);
|
||||
mp_int *mp_modadd(mp_int *x, mp_int *y, mp_int *modulus);
|
||||
mp_int *mp_modsub(mp_int *x, mp_int *y, mp_int *modulus);
|
||||
|
||||
/*
|
||||
* Shift an mp_int right by a given number of bits. The shift count is
|
||||
* considered to be secret data, and as a result, the algorithm takes
|
||||
* O(n log n) time instead of the obvious O(n).
|
||||
*/
|
||||
mp_int *mp_rshift_safe(mp_int *x, size_t shift);
|
||||
|
||||
/*
|
||||
* Shift an mp_int left or right by a fixed number of bits. The shift
|
||||
* count is NOT considered to be secret data! Use this if you're
|
||||
* always dividing by 2, for example, but don't use it to shift by a
|
||||
* variable amount derived from another secret number.
|
||||
*
|
||||
* The upside is that these functions run in sensible linear time.
|
||||
*/
|
||||
void mp_lshift_fixed_into(mp_int *r, mp_int *a, size_t shift);
|
||||
void mp_rshift_fixed_into(mp_int *r, mp_int *x, size_t shift);
|
||||
mp_int *mp_rshift_fixed(mp_int *x, size_t shift);
|
||||
|
||||
/*
|
||||
* Generate a random mp_int.
|
||||
*
|
||||
* The _function_ definitions here will expect to be given a gen_data
|
||||
* function that provides random data. Normally you'd use this using
|
||||
* random_read() from random.c, and the macro wrappers automate that.
|
||||
*
|
||||
* (This is a bit of a dodge to avoid mpint.c having a link-time
|
||||
* dependency on random.c, so that programs can link against one but
|
||||
* not the other: if a client of this header uses one of these macros
|
||||
* then _they_ have link-time dependencies on both modules.)
|
||||
*
|
||||
* mp_random_bits[_fn] returns an integer 0 <= n < 2^bits.
|
||||
* mp_random_in_range[_fn](lo,hi) returns an integer lo <= n < hi.
|
||||
*/
|
||||
typedef void (*random_read_fn_t)(void *, size_t);
|
||||
mp_int *mp_random_bits_fn(size_t bits, random_read_fn_t randfn);
|
||||
mp_int *mp_random_in_range_fn(
|
||||
mp_int *lo_inclusive, mp_int *hi_exclusive, random_read_fn_t randfn);
|
||||
#define mp_random_bits(bits) mp_random_bits_fn(bits, random_read)
|
||||
#define mp_random_in_range(lo, hi) mp_random_in_range_fn(lo, hi, random_read)
|
||||
|
||||
#endif /* PUTTY_MPINT_H */
|
||||
#ifndef PUTTY_MPINT_H
|
||||
#define PUTTY_MPINT_H
|
||||
|
||||
/*
|
||||
* PuTTY's multiprecision integer library.
|
||||
*
|
||||
* This library is written with the aim of avoiding leaking the input
|
||||
* numbers via timing and cache side channels. This means avoiding
|
||||
* making any control flow change, or deciding the address of any
|
||||
* memory access, based on the value of potentially secret input data.
|
||||
*
|
||||
* But in a library that has to handle numbers of arbitrary size, you
|
||||
* can't avoid your control flow depending on the _size_ of the input!
|
||||
* So the rule is that an mp_int has a nominal size that need not be
|
||||
* its mathematical size: i.e. if you call (say) mp_from_bytes_be to
|
||||
* turn an array of 256 bytes into an integer, and all but the last of
|
||||
* those bytes is zero, then you get an mp_int which has space for 256
|
||||
* bytes of data but just happens to store the value 1. So the
|
||||
* _nominal_ sizes of input data - e.g. the size in bits of some
|
||||
* public-key modulus - are not considered secret, and control flow is
|
||||
* allowed to do what it likes based on those sizes. But the same
|
||||
* function, called with the same _nominally sized_ arguments
|
||||
* containing different values, should run in the same length of time.
|
||||
*
|
||||
* When a function returns an 'mp_int *', it is newly allocated to an
|
||||
* appropriate nominal size (which, again, depends only on the nominal
|
||||
* sizes of the inputs). Other functions have 'into' in their name,
|
||||
* and they instead overwrite the contents of an existing mp_int.
|
||||
*
|
||||
* Functions in this API which return values that are logically
|
||||
* boolean return them as 'unsigned' rather than the C99 bool type.
|
||||
* That's because C99 bool does an implicit test for non-zero-ness
|
||||
* when converting any other integer type to it, which compilers might
|
||||
* well implement using data-dependent control flow.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Create and destroy mp_ints. A newly created one is initialised to
|
||||
* zero. mp_clear also resets an existing number to zero.
|
||||
*/
|
||||
mp_int *mp_new(size_t maxbits);
|
||||
void mp_free(mp_int *);
|
||||
void mp_clear(mp_int *x);
|
||||
|
||||
/*
|
||||
* Create mp_ints from various sources: little- and big-endian binary
|
||||
* data, an ordinary C unsigned integer type, a decimal or hex string
|
||||
* (given either as a ptrlen or a C NUL-terminated string), and
|
||||
* another mp_int.
|
||||
*
|
||||
* The decimal and hex conversion functions have running time
|
||||
* dependent on the length of the input data, of course.
|
||||
*/
|
||||
mp_int *mp_from_bytes_le(ptrlen bytes);
|
||||
mp_int *mp_from_bytes_be(ptrlen bytes);
|
||||
mp_int *mp_from_integer(uintmax_t n);
|
||||
mp_int *mp_from_decimal_pl(ptrlen decimal);
|
||||
mp_int *mp_from_decimal(const char *decimal);
|
||||
mp_int *mp_from_hex_pl(ptrlen hex);
|
||||
mp_int *mp_from_hex(const char *hex);
|
||||
mp_int *mp_copy(mp_int *x);
|
||||
|
||||
/*
|
||||
* A macro for declaring large fixed numbers in source code (such as
|
||||
* elliptic curve parameters, or standard Diffie-Hellman moduli). The
|
||||
* idea is that you just write something like
|
||||
*
|
||||
* mp_int *value = MP_LITERAL(0x19284376283754638745693467245);
|
||||
*
|
||||
* and it newly allocates you an mp_int containing that number.
|
||||
*
|
||||
* Internally, the macro argument is stringified and passed to
|
||||
* mp_from_hex. That's not as fast as it could be if I had instead set
|
||||
* up some kind of mp_from_array_of_uint64_t() function, but I think
|
||||
* this system is valuable for the fact that the literal integers
|
||||
* appear in a very natural syntax that can be pasted directly out
|
||||
* into, say, Python if you want to cross-check a calculation.
|
||||
*/
|
||||
static inline mp_int *mp__from_string_literal(const char *lit)
|
||||
{
|
||||
/* Don't call this directly; it's not equipped to deal with
|
||||
* hostile data. Use only via the MP_LITERAL macro. */
|
||||
if (lit[0] && (lit[1] == 'x' || lit[1] == 'X'))
|
||||
return mp_from_hex(lit+2);
|
||||
else
|
||||
return mp_from_decimal(lit);
|
||||
}
|
||||
#define MP_LITERAL(number) mp__from_string_literal(#number)
|
||||
|
||||
/*
|
||||
* Create an mp_int with the value 2^power.
|
||||
*/
|
||||
mp_int *mp_power_2(size_t power);
|
||||
|
||||
/*
|
||||
* Retrieve the value of a particular bit or byte of an mp_int. The
|
||||
* byte / bit index is not considered to be secret data. Out-of-range
|
||||
* byte/bit indices are handled cleanly and return zero.
|
||||
*/
|
||||
uint8_t mp_get_byte(mp_int *x, size_t byte);
|
||||
unsigned mp_get_bit(mp_int *x, size_t bit);
|
||||
|
||||
/*
|
||||
* Retrieve the value of an mp_int as a uintmax_t, assuming it's small
|
||||
* enough to fit.
|
||||
*/
|
||||
uintmax_t mp_get_integer(mp_int *x);
|
||||
|
||||
/*
|
||||
* Set an mp_int bit. Again, the bit index is not considered secret.
|
||||
* Do not pass an out-of-range index, on pain of assertion failure.
|
||||
*/
|
||||
void mp_set_bit(mp_int *x, size_t bit, unsigned val);
|
||||
|
||||
/*
|
||||
* Return the nominal size of an mp_int, in terms of the maximum
|
||||
* number of bytes or bits that can fit in it.
|
||||
*/
|
||||
size_t mp_max_bytes(mp_int *x);
|
||||
size_t mp_max_bits(mp_int *x);
|
||||
|
||||
/*
|
||||
* Return the _mathematical_ bit count of an mp_int (not its nominal
|
||||
* size), i.e. a value n such that 2^{n-1} <= x < 2^n.
|
||||
*
|
||||
* This function is supposed to run in constant time for a given
|
||||
* nominal input size. Of course it's likely that clients of this
|
||||
* function will promptly need to use the result as the limit of some
|
||||
* loop (e.g. marshalling an mp_int into an SSH packet, which doesn't
|
||||
* permit extra prefix zero bytes). But that's up to the caller to
|
||||
* decide the safety of.
|
||||
*/
|
||||
size_t mp_get_nbits(mp_int *x);
|
||||
|
||||
/*
|
||||
* Return the value of an mp_int as a decimal or hex string. The
|
||||
* result is dynamically allocated, and the caller is responsible for
|
||||
* freeing it.
|
||||
*
|
||||
* These functions should run in constant time for a given nominal
|
||||
* input size, even though the exact number of digits returned is
|
||||
* variable. They always allocate enough space for the largest output
|
||||
* that might be needed, but they don't always fill it.
|
||||
*/
|
||||
char *mp_get_decimal(mp_int *x);
|
||||
char *mp_get_hex(mp_int *x);
|
||||
char *mp_get_hex_uppercase(mp_int *x);
|
||||
|
||||
/*
|
||||
* Compare two mp_ints, or compare one mp_int against a C integer. The
|
||||
* 'eq' functions return 1 if the two inputs are equal, or 0
|
||||
* otherwise; the 'hs' functions return 1 if the first input is >= the
|
||||
* second, and 0 otherwise.
|
||||
*/
|
||||
unsigned mp_cmp_hs(mp_int *a, mp_int *b);
|
||||
unsigned mp_cmp_eq(mp_int *a, mp_int *b);
|
||||
unsigned mp_hs_integer(mp_int *x, uintmax_t n);
|
||||
unsigned mp_eq_integer(mp_int *x, uintmax_t n);
|
||||
|
||||
/*
|
||||
* Take the minimum or maximum of two mp_ints, without using a
|
||||
* conditional branch.
|
||||
*/
|
||||
void mp_min_into(mp_int *r, mp_int *x, mp_int *y);
|
||||
void mp_max_into(mp_int *r, mp_int *x, mp_int *y);
|
||||
mp_int *mp_min(mp_int *x, mp_int *y);
|
||||
mp_int *mp_max(mp_int *x, mp_int *y);
|
||||
|
||||
/*
|
||||
* Diagnostic function. Writes out x in hex to the supplied stdio
|
||||
* stream, preceded by the string 'prefix' and followed by 'suffix'.
|
||||
*
|
||||
* This is useful to put temporarily into code, but it's also
|
||||
* potentially useful to call from a debugger.
|
||||
*/
|
||||
void mp_dump(FILE *fp, const char *prefix, mp_int *x, const char *suffix);
|
||||
|
||||
/*
|
||||
* Overwrite one mp_int with another.
|
||||
*/
|
||||
void mp_copy_into(mp_int *dest, mp_int *src);
|
||||
|
||||
/*
|
||||
* Conditional selection. Overwrites dest with either src0 or src1,
|
||||
* according to the value of 'choose_src1'. choose_src1 should be 0 or
|
||||
* 1; if it's 1, then dest is set to src1, otherwise src0.
|
||||
*
|
||||
* The value of choose_src1 is considered to be secret data, so
|
||||
* control flow and memory access should not depend on it.
|
||||
*/
|
||||
void mp_select_into(mp_int *dest, mp_int *src0, mp_int *src1,
|
||||
unsigned choose_src1);
|
||||
|
||||
/*
|
||||
* Addition, subtraction and multiplication, either targeting an
|
||||
* existing mp_int or making a new one large enough to hold whatever
|
||||
* the output might be..
|
||||
*/
|
||||
void mp_add_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_sub_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_mul_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
mp_int *mp_add(mp_int *x, mp_int *y);
|
||||
mp_int *mp_sub(mp_int *x, mp_int *y);
|
||||
mp_int *mp_mul(mp_int *x, mp_int *y);
|
||||
|
||||
/*
|
||||
* Bitwise operations.
|
||||
*/
|
||||
void mp_and_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_or_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_xor_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
void mp_bic_into(mp_int *r, mp_int *a, mp_int *b);
|
||||
|
||||
/*
|
||||
* Addition, subtraction and multiplication with one argument small
|
||||
* enough to fit in a C integer. For mp_mul_integer_into, it has to be
|
||||
* even smaller than that.
|
||||
*/
|
||||
void mp_add_integer_into(mp_int *r, mp_int *a, uintmax_t n);
|
||||
void mp_sub_integer_into(mp_int *r, mp_int *a, uintmax_t n);
|
||||
void mp_mul_integer_into(mp_int *r, mp_int *a, uint16_t n);
|
||||
|
||||
/*
|
||||
* Conditional addition/subtraction. If yes == 1, sets r to a+b or a-b
|
||||
* (respectively). If yes == 0, sets r to just a. 'yes' is considered
|
||||
* secret data.
|
||||
*/
|
||||
void mp_cond_add_into(mp_int *r, mp_int *a, mp_int *b, unsigned yes);
|
||||
void mp_cond_sub_into(mp_int *r, mp_int *a, mp_int *b, unsigned yes);
|
||||
|
||||
/*
|
||||
* Swap x0 and x1 if swap == 1, and not if swap == 0. 'swap' is
|
||||
* considered secret.
|
||||
*/
|
||||
void mp_cond_swap(mp_int *x0, mp_int *x1, unsigned swap);
|
||||
|
||||
/*
|
||||
* Set x to 0 if clear == 1, and otherwise leave it unchanged. 'clear'
|
||||
* is considered secret.
|
||||
*/
|
||||
void mp_cond_clear(mp_int *x, unsigned clear);
|
||||
|
||||
/*
|
||||
* Division. mp_divmod_into divides n by d, and writes the quotient
|
||||
* into q and the remainder into r. You can pass either of q and r as
|
||||
* NULL if you don't need one of the outputs.
|
||||
*
|
||||
* mp_div and mp_mod are wrappers that return one or other of those
|
||||
* outputs as a freshly allocated mp_int of the appropriate size.
|
||||
*
|
||||
* Division by zero gives no error, and returns a quotient of 0 and a
|
||||
* remainder of n (so as to still satisfy the division identity that
|
||||
* n=qd+r).
|
||||
*/
|
||||
void mp_divmod_into(mp_int *n, mp_int *d, mp_int *q, mp_int *r);
|
||||
mp_int *mp_div(mp_int *n, mp_int *d);
|
||||
mp_int *mp_mod(mp_int *x, mp_int *modulus);
|
||||
|
||||
/*
|
||||
* Trivially easy special case of mp_mod: reduce a number mod a power
|
||||
* of two.
|
||||
*/
|
||||
void mp_reduce_mod_2to(mp_int *x, size_t p);
|
||||
|
||||
/*
|
||||
* Modular inverses. mp_invert computes the inverse of x mod modulus
|
||||
* (and will expect the two to be coprime). mp_invert_mod_2to computes
|
||||
* the inverse of x mod 2^p, and is a great deal faster.
|
||||
*/
|
||||
mp_int *mp_invert_mod_2to(mp_int *x, size_t p);
|
||||
mp_int *mp_invert(mp_int *x, mp_int *modulus);
|
||||
|
||||
/*
|
||||
* System for taking square roots modulo an odd prime.
|
||||
*
|
||||
* In order to do this efficiently, you need to provide an extra piece
|
||||
* of information at setup time, namely a number which is not
|
||||
* congruent mod p to any square. Given p and that non-square, you can
|
||||
* use modsqrt_new to make a context containing all the necessary
|
||||
* equipment for actually calculating the square roots, and then you
|
||||
* can call mp_modsqrt as many times as you like on that context
|
||||
* before freeing it.
|
||||
*
|
||||
* The output parameter '*success' will be filled in with 1 if the
|
||||
* operation was successful, or 0 if the input number doesn't have a
|
||||
* square root mod p at all. In the latter case, the returned mp_int
|
||||
* will be nonsense and you shouldn't depend on it.
|
||||
*
|
||||
* ==== WARNING ====
|
||||
*
|
||||
* This function DOES NOT TREAT THE PRIME MODULUS AS SECRET DATA! It
|
||||
* will protect the number you're taking the square root _of_, but not
|
||||
* the number you're taking the root of it _mod_.
|
||||
*
|
||||
* (This is because the algorithm requires a number of loop iterations
|
||||
* equal to the number of factors of 2 in p-1. And the expected use of
|
||||
* this function is for elliptic-curve point decompression, in which
|
||||
* the modulus is always a well-known one written down in standards
|
||||
* documents.)
|
||||
*/
|
||||
typedef struct ModsqrtContext ModsqrtContext;
|
||||
ModsqrtContext *modsqrt_new(mp_int *p, mp_int *any_nonsquare_mod_p);
|
||||
void modsqrt_free(ModsqrtContext *);
|
||||
mp_int *mp_modsqrt(ModsqrtContext *sc, mp_int *x, unsigned *success);
|
||||
|
||||
/*
|
||||
* Functions for Montgomery multiplication, a fast technique for doing
|
||||
* a long series of modular multiplications all with the same modulus
|
||||
* (which has to be odd).
|
||||
*
|
||||
* You start by calling monty_new to set up a context structure
|
||||
* containing all the precomputed bits and pieces needed by the
|
||||
* algorithm. Then, any numbers you want to work with must first be
|
||||
* transformed into the internal Montgomery representation using
|
||||
* monty_import; having done that, you can use monty_mul and monty_pow
|
||||
* to operate on them efficiently; and finally, monty_export will
|
||||
* convert numbers back out of Montgomery representation to give their
|
||||
* ordinary values.
|
||||
*
|
||||
* Addition and subtraction are not optimised by the Montgomery trick,
|
||||
* but monty_add and monty_sub are provided anyway for convenience.
|
||||
*
|
||||
* There are also monty_invert and monty_modsqrt, which are analogues
|
||||
* of mp_invert and mp_modsqrt which take their inputs in Montgomery
|
||||
* representation. For mp_modsqrt, the prime modulus of the
|
||||
* ModsqrtContext must be the same as the modulus of the MontyContext.
|
||||
*
|
||||
* The query functions monty_modulus and monty_identity return numbers
|
||||
* stored inside the MontyContext, without copying them. The returned
|
||||
* pointers are still owned by the MontyContext, so don't free them!
|
||||
*/
|
||||
MontyContext *monty_new(mp_int *modulus);
|
||||
void monty_free(MontyContext *mc);
|
||||
mp_int *monty_modulus(MontyContext *mc); /* doesn't transfer ownership */
|
||||
mp_int *monty_identity(MontyContext *mc); /* doesn't transfer ownership */
|
||||
void monty_import_into(MontyContext *mc, mp_int *r, mp_int *x);
|
||||
mp_int *monty_import(MontyContext *mc, mp_int *x);
|
||||
void monty_export_into(MontyContext *mc, mp_int *r, mp_int *x);
|
||||
mp_int *monty_export(MontyContext *mc, mp_int *x);
|
||||
void monty_mul_into(MontyContext *, mp_int *r, mp_int *, mp_int *);
|
||||
mp_int *monty_add(MontyContext *, mp_int *, mp_int *);
|
||||
mp_int *monty_sub(MontyContext *, mp_int *, mp_int *);
|
||||
mp_int *monty_mul(MontyContext *, mp_int *, mp_int *);
|
||||
mp_int *monty_pow(MontyContext *, mp_int *base, mp_int *exponent);
|
||||
mp_int *monty_invert(MontyContext *, mp_int *);
|
||||
mp_int *monty_modsqrt(ModsqrtContext *sc, mp_int *mx, unsigned *success);
|
||||
|
||||
/*
|
||||
* Modular arithmetic functions which don't use an explicit
|
||||
* MontyContext. mp_modpow will use one internally (on the assumption
|
||||
* that the exponent is likely to be large enough to make it
|
||||
* worthwhile); the other three will just do ordinary non-Montgomery-
|
||||
* optimised modular reduction. Use mp_modmul if you only have one
|
||||
* product to compute; if you have a lot, consider using a
|
||||
* MontyContext in the client code.
|
||||
*/
|
||||
mp_int *mp_modpow(mp_int *base, mp_int *exponent, mp_int *modulus);
|
||||
mp_int *mp_modmul(mp_int *x, mp_int *y, mp_int *modulus);
|
||||
mp_int *mp_modadd(mp_int *x, mp_int *y, mp_int *modulus);
|
||||
mp_int *mp_modsub(mp_int *x, mp_int *y, mp_int *modulus);
|
||||
|
||||
/*
|
||||
* Shift an mp_int right by a given number of bits. The shift count is
|
||||
* considered to be secret data, and as a result, the algorithm takes
|
||||
* O(n log n) time instead of the obvious O(n).
|
||||
*/
|
||||
mp_int *mp_rshift_safe(mp_int *x, size_t shift);
|
||||
|
||||
/*
|
||||
* Shift an mp_int left or right by a fixed number of bits. The shift
|
||||
* count is NOT considered to be secret data! Use this if you're
|
||||
* always dividing by 2, for example, but don't use it to shift by a
|
||||
* variable amount derived from another secret number.
|
||||
*
|
||||
* The upside is that these functions run in sensible linear time.
|
||||
*/
|
||||
void mp_lshift_fixed_into(mp_int *r, mp_int *a, size_t shift);
|
||||
void mp_rshift_fixed_into(mp_int *r, mp_int *x, size_t shift);
|
||||
mp_int *mp_rshift_fixed(mp_int *x, size_t shift);
|
||||
|
||||
/*
|
||||
* Generate a random mp_int.
|
||||
*
|
||||
* The _function_ definitions here will expect to be given a gen_data
|
||||
* function that provides random data. Normally you'd use this using
|
||||
* random_read() from random.c, and the macro wrappers automate that.
|
||||
*
|
||||
* (This is a bit of a dodge to avoid mpint.c having a link-time
|
||||
* dependency on random.c, so that programs can link against one but
|
||||
* not the other: if a client of this header uses one of these macros
|
||||
* then _they_ have link-time dependencies on both modules.)
|
||||
*
|
||||
* mp_random_bits[_fn] returns an integer 0 <= n < 2^bits.
|
||||
* mp_random_in_range[_fn](lo,hi) returns an integer lo <= n < hi.
|
||||
*/
|
||||
typedef void (*random_read_fn_t)(void *, size_t);
|
||||
mp_int *mp_random_bits_fn(size_t bits, random_read_fn_t randfn);
|
||||
mp_int *mp_random_in_range_fn(
|
||||
mp_int *lo_inclusive, mp_int *hi_exclusive, random_read_fn_t randfn);
|
||||
#define mp_random_bits(bits) mp_random_bits_fn(bits, random_read)
|
||||
#define mp_random_in_range(lo, hi) mp_random_in_range_fn(lo, hi, random_read)
|
||||
|
||||
#endif /* PUTTY_MPINT_H */
|
||||
@@ -31,7 +31,6 @@ struct SocketVtable {
|
||||
size_t (*write) (Socket *s, const void *data, size_t len);
|
||||
size_t (*write_oob) (Socket *s, const void *data, size_t len);
|
||||
void (*write_eof) (Socket *s);
|
||||
void (*flush) (Socket *s);
|
||||
void (*set_frozen) (Socket *s, bool is_frozen);
|
||||
/* ignored by tcp, but vital for ssl */
|
||||
const char *(*socket_error) (Socket *s);
|
||||
@@ -108,8 +107,6 @@ Socket *new_listener(const char *srcaddr, int port, Plug *plug,
|
||||
SockAddr *name_lookup(const char *host, int port, char **canonicalname,
|
||||
Conf *conf, int addressfamily, LogContext *logctx,
|
||||
const char *lookup_reason_for_logging);
|
||||
bool proxy_for_destination (SockAddr *addr, const char *hostname, int port,
|
||||
Conf *conf);
|
||||
|
||||
/* platform-dependent callback from new_connection() */
|
||||
/* (same caveat about addr as new_connection()) */
|
||||
@@ -148,7 +145,7 @@ Socket *sk_new(SockAddr *addr, int port, bool privport, bool oobinline,
|
||||
Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug,
|
||||
bool local_host_only, int address_family);
|
||||
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
int sk_getport(Socket *s);
|
||||
#endif
|
||||
|
||||
@@ -162,8 +159,6 @@ static inline size_t sk_write_oob(Socket *s, const void *data, size_t len)
|
||||
{ return s->vt->write_oob(s, data, len); }
|
||||
static inline void sk_write_eof(Socket *s)
|
||||
{ s->vt->write_eof(s); }
|
||||
static inline void sk_flush(Socket *s)
|
||||
{ s->vt->flush(s); }
|
||||
|
||||
static inline void plug_log(
|
||||
Plug *p, int type, SockAddr *addr, int port, const char *msg, int code)
|
||||
@@ -22,7 +22,7 @@
|
||||
* won't generate true random numbers. So we must scream, panic,
|
||||
* and exit immediately if that should happen.
|
||||
*/
|
||||
#ifndef INTEGRATED_AGENT
|
||||
#ifndef MOD_INTEGRATED_AGENT
|
||||
int random_byte(void)
|
||||
{
|
||||
modalfatalbox("Internal error: attempt to use random numbers in Pageant");
|
||||
@@ -124,7 +124,7 @@ void pageant_make_keylist1(BinarySink *bs)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
int GetScrumbleKeyFlag(void) ;
|
||||
static int * tab_int = NULL ;
|
||||
void scrumble_int(void) {
|
||||
@@ -310,7 +310,7 @@ void pageant_handle_msg(BinarySink *bs,
|
||||
unsigned response_type;
|
||||
unsigned char response_md5[16];
|
||||
int i;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
char *fingerprint;
|
||||
#endif
|
||||
|
||||
@@ -347,7 +347,7 @@ void pageant_handle_msg(BinarySink *bs,
|
||||
pageant_failure_msg(bs, "key not found", logctx, logfn);
|
||||
goto challenge1_cleanup;
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
fingerprint = rsa_ssh1_fingerprint(key);
|
||||
if (! confirm_key_usage(fingerprint, key->comment)) {
|
||||
goto challenge1_cleanup;
|
||||
@@ -386,7 +386,7 @@ void pageant_handle_msg(BinarySink *bs,
|
||||
ptrlen keyblob, sigdata;
|
||||
strbuf *signature;
|
||||
uint32_t flags, supported_flags;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
char* confirm_fingerprint;
|
||||
#endif
|
||||
|
||||
@@ -424,7 +424,7 @@ void pageant_handle_msg(BinarySink *bs,
|
||||
pageant_failure_msg(bs, "key not found", logctx, logfn);
|
||||
return;
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
confirm_fingerprint = ssh2_fingerprint_blob(keyblob);
|
||||
if (! confirm_key_usage( confirm_fingerprint , key->comment)) {
|
||||
sfree(confirm_fingerprint);
|
||||
@@ -760,7 +760,7 @@ RSAKey *pageant_nth_ssh1_key(int i)
|
||||
|
||||
ssh2_userkey *pageant_nth_ssh2_key(int i)
|
||||
{
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
return index234(ssh2keys, get_scrumble_int(i));
|
||||
#else
|
||||
return index234(ssh2keys, i);
|
||||
@@ -1166,7 +1166,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
|
||||
* length, so add a placeholder here to fill in
|
||||
* afterwards */
|
||||
put_uint32(blob, 0);
|
||||
#ifdef WINCRYPTPORT
|
||||
#ifdef MOD_WINCRYPT
|
||||
#ifdef USE_CAPI
|
||||
if(0 == strncmp("cert://", filename->path, 7)) {
|
||||
ssh2_userkey_loadpub(filename, NULL, BinarySink_UPCAST(blob),
|
||||
@@ -1186,7 +1186,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
|
||||
strbuf_free(blob);
|
||||
return PAGEANT_ACTION_FAILURE;
|
||||
}
|
||||
#ifdef WINCRYPTPORT
|
||||
#ifdef MOD_WINCRYPT
|
||||
#ifdef USE_CAPI
|
||||
}
|
||||
#endif /* USE_CAPI */
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
NOTIFYICONDATA trayIcone ;
|
||||
int GetAskConfirmationFlag(void) ;
|
||||
int GetShowBalloonOnKeyUsage( void ) ;
|
||||
@@ -57,11 +57,6 @@ void proxy_activate (ProxySocket *p)
|
||||
if (output_after < output_before)
|
||||
plug_sent(p->plug, output_after);
|
||||
|
||||
/* if we were asked to flush the output during
|
||||
* the proxy negotiation process, do so now.
|
||||
*/
|
||||
if (p->pending_flush) sk_flush(p->sub_socket);
|
||||
|
||||
/* if we have a pending EOF to send, send it */
|
||||
if (p->pending_eof) sk_write_eof(p->sub_socket);
|
||||
|
||||
@@ -128,17 +123,6 @@ static void sk_proxy_write_eof (Socket *s)
|
||||
sk_write_eof(ps->sub_socket);
|
||||
}
|
||||
|
||||
static void sk_proxy_flush (Socket *s)
|
||||
{
|
||||
ProxySocket *ps = container_of(s, ProxySocket, sock);
|
||||
|
||||
if (ps->state != PROXY_STATE_ACTIVE) {
|
||||
ps->pending_flush = true;
|
||||
return;
|
||||
}
|
||||
sk_flush(ps->sub_socket);
|
||||
}
|
||||
|
||||
static void sk_proxy_set_frozen (Socket *s, bool is_frozen)
|
||||
{
|
||||
ProxySocket *ps = container_of(s, ProxySocket, sock);
|
||||
@@ -258,7 +242,7 @@ static int plug_proxy_accepting(Plug *p,
|
||||
* This function can accept a NULL pointer as `addr', in which case
|
||||
* it will only check the host name.
|
||||
*/
|
||||
bool proxy_for_destination (SockAddr *addr, const char *hostname,
|
||||
static bool proxy_for_destination(SockAddr *addr, const char *hostname,
|
||||
int port, Conf *conf)
|
||||
{
|
||||
int s = 0, e = 0;
|
||||
@@ -393,7 +377,6 @@ static const struct SocketVtable ProxySocket_sockvt = {
|
||||
sk_proxy_write,
|
||||
sk_proxy_write_oob,
|
||||
sk_proxy_write_eof,
|
||||
sk_proxy_flush,
|
||||
sk_proxy_set_frozen,
|
||||
sk_proxy_socket_error,
|
||||
NULL, /* peer_info */
|
||||
@@ -437,7 +420,6 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
|
||||
ret->remote_port = port;
|
||||
|
||||
ret->error = NULL;
|
||||
ret->pending_flush = false;
|
||||
ret->pending_eof = false;
|
||||
ret->freeze = false;
|
||||
|
||||
@@ -25,7 +25,6 @@ struct ProxySocket {
|
||||
|
||||
bufchain pending_output_data;
|
||||
bufchain pending_oob_output_data;
|
||||
bool pending_flush;
|
||||
bufchain pending_input_data;
|
||||
bool pending_eof;
|
||||
|
||||
@@ -50,14 +50,14 @@ static void source(const char *src);
|
||||
static void rsource(const char *src);
|
||||
static void sink(const char *targ, const char *src);
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
void SetAutoStoreSSHKey( void ) ;
|
||||
#if (defined PERSOPORT) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
char *appname = "PSCP";
|
||||
#else
|
||||
const char *const appname = "PSCP";
|
||||
#endif
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
int ManagePortKnocking( char* host, char *portstr ) ;
|
||||
#endif
|
||||
#endif
|
||||
@@ -137,14 +137,10 @@ static void tell_user(FILE *stream, const char *fmt, ...)
|
||||
sfree(str2);
|
||||
}
|
||||
|
||||
/*
|
||||
* In pscp, all agent requests should be synchronous, so this is a
|
||||
* never-called stub.
|
||||
*/
|
||||
void agent_schedule_callback(void (*callback)(void *, void *, int),
|
||||
void *callback_ctx, void *data, int len)
|
||||
{
|
||||
assert(!"We shouldn't be here");
|
||||
unreachable("all PSCP agent requests should be synchronous");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -468,7 +464,7 @@ static void do_cmd(char *host, char *user, char *cmd)
|
||||
|
||||
platform_psftp_pre_conn_setup();
|
||||
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
ManagePortKnocking(conf_get_str(conf,CONF_host),conf_get_str(conf,CONF_portknockingoptions));
|
||||
#endif
|
||||
|
||||
@@ -2212,7 +2208,7 @@ static void usage(void)
|
||||
printf(" -sshlog file\n");
|
||||
printf(" -sshrawlog file\n");
|
||||
printf(" log protocol details to a file\n");
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
printf(" -auto-store-sshkey\n");
|
||||
printf(" store automatically the servers ssh keys\n");
|
||||
#endif
|
||||
@@ -2311,7 +2307,7 @@ int psftp_main(int argc, char *argv[])
|
||||
sanitise_stderr = true;
|
||||
} else if (strcmp(argv[i], "-no-sanitise-stderr") == 0) {
|
||||
sanitise_stderr = false;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
} else if( (strcmp(argv[i], "-auto_store_sshkey")==0) || (strcmp(argv[i], "-auto-store-sshkey") == 0) ) {
|
||||
SetAutoStoreSSHKey();
|
||||
#endif
|
||||
@@ -15,14 +15,14 @@
|
||||
#include "ssh.h"
|
||||
#include "sftp.h"
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
void SetAutoStoreSSHKey( void ) ;
|
||||
#if (defined PERSOPORT) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
char *appname = "PSFTP";
|
||||
#else
|
||||
const char *const appname = "PSFTP";
|
||||
#endif
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
int ManagePortKnocking( char* host, char *portstr ) ;
|
||||
#endif
|
||||
#endif
|
||||
@@ -2437,14 +2437,10 @@ static bool verbose = false;
|
||||
|
||||
void ldisc_echoedit_update(Ldisc *ldisc) { }
|
||||
|
||||
/*
|
||||
* In psftp, all agent requests should be synchronous, so this is a
|
||||
* never-called stub.
|
||||
*/
|
||||
void agent_schedule_callback(void (*callback)(void *, void *, int),
|
||||
void *callback_ctx, void *data, int len)
|
||||
{
|
||||
assert(!"We shouldn't be here");
|
||||
unreachable("all PSFTP agent requests should be synchronous");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2548,7 +2544,7 @@ static void usage(void)
|
||||
printf(" -sshlog file\n");
|
||||
printf(" -sshrawlog file\n");
|
||||
printf(" log protocol details to a file\n");
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
printf(" -auto-store-sshkey\n");
|
||||
printf(" store automatically the servers ssh keys\n");
|
||||
#endif
|
||||
@@ -2868,7 +2864,7 @@ int psftp_main(int argc, char *argv[])
|
||||
if (!userhost && conf_get_str(conf, CONF_host)[0] != '\0') {
|
||||
userhost = dupstr(conf_get_str(conf, CONF_host));
|
||||
}
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
ManagePortKnocking(conf_get_str(conf,CONF_host),conf_get_str(conf,CONF_portknockingoptions));
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
#define MAX_TICK_MINS (INT_MAX / (60 * TICKSPERSEC))
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
#define ATTR_ITALIC 0x1000000U
|
||||
#include <stdint.h>
|
||||
void debug_log( const char *fmt, ...) ;
|
||||
@@ -41,10 +41,10 @@ int switch_private_key_flag( void ) ;
|
||||
BOOL WINAPI SetDefaultDllDirectories( DWORD DirectoryFlags ) ;
|
||||
BOOL WINAPI CryptProtectMemory( LPVOID pData, DWORD cbData, DWORD dwFlags );
|
||||
#endif
|
||||
#ifdef PRINTCLIPPORT
|
||||
#ifdef MOD_PRINTCLIP
|
||||
#define PRINT_TO_CLIPBOARD_STRING "Windows clipboard"
|
||||
#endif
|
||||
#ifdef HYPERLINKPORT
|
||||
#ifdef MOD_HYPERLINK
|
||||
/*
|
||||
* HACK: PuttyTray / Nutty
|
||||
* Hyperlink stuff: define
|
||||
@@ -151,7 +151,7 @@ enum {
|
||||
#define ATTR_FGSHIFT 0
|
||||
#define ATTR_BGSHIFT 9
|
||||
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
#define ATTR_SELECTED 0x02000000U
|
||||
#endif
|
||||
|
||||
@@ -412,10 +412,10 @@ enum {
|
||||
enum {
|
||||
/* Protocol back ends. (CONF_protocol) */
|
||||
PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH,
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
PROT_CYGTERM,
|
||||
#endif
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
PROT_ADB,
|
||||
#endif
|
||||
/* PROT_SERIAL is supported on a subset of platforms, but it doesn't
|
||||
@@ -446,7 +446,7 @@ enum {
|
||||
FUNKY_VT400,
|
||||
FUNKY_VT100P,
|
||||
FUNKY_SCO
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
,
|
||||
FUNKY_ATT513,
|
||||
FUNKY_ATT4410,
|
||||
@@ -621,7 +621,7 @@ extern const int be_default_protocol;
|
||||
* Name of this particular application, for use in the config box
|
||||
* and other pieces of text.
|
||||
*/
|
||||
#if (defined PERSOPORT) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
extern char *appname;
|
||||
#else
|
||||
extern const char *const appname;
|
||||
@@ -1373,7 +1373,8 @@ NORETURN void cleanup_exit(int);
|
||||
X(INT, NONE, serflow) /* SER_FLOW_NONE, SER_FLOW_XONXOFF, ... */ \
|
||||
/* Keyboard options */ \
|
||||
X(BOOL, NONE, bksp_is_delete) \
|
||||
/* #ifdef PERSOPORT */ \
|
||||
/* #ifdef MOD_PERSO */ \
|
||||
X(INT, NONE, enter_sends_crlf) \
|
||||
X(INT, NONE, rxvt_homeend) \
|
||||
/* #else */ \
|
||||
/* X(BOOL, NONE, rxvt_homeend) */\
|
||||
@@ -1537,7 +1538,7 @@ NORETURN void cleanup_exit(int);
|
||||
X(INT, NONE, shadowboldoffset) /* in pixels */ \
|
||||
X(BOOL, NONE, crhaslf) \
|
||||
X(STR, NONE, winclass) \
|
||||
/* #ifdef PERSOPORT */ \
|
||||
/* #ifdef MOD_PERSO */ \
|
||||
X(INT, NONE, bcdelay) \
|
||||
X(INT, NONE, initdelay) \
|
||||
X(INT, NONE, transparencynumber) \
|
||||
@@ -1567,14 +1568,11 @@ NORETURN void cleanup_exit(int);
|
||||
X(STR, NONE, comment) \
|
||||
X(INT, NONE, scp_auto_pwd) \
|
||||
/* #endif */ \
|
||||
/* #ifdef ACSPORT */ \
|
||||
X(BOOL, NONE, acs_in_utf) \
|
||||
/* #endif */ \
|
||||
/* #ifdef PRINTCLIPPORT */ \
|
||||
/* #ifdef MOD_PRINTCLIP */ \
|
||||
X(INT, NONE, printclip) \
|
||||
/* #endif */ \
|
||||
/* rutty: scripting options */ \
|
||||
/* #ifdef RUTTYPORT*/ \
|
||||
/* #ifdef MOD_RUTTY*/ \
|
||||
X(FILENAME, NONE, script_filename) \
|
||||
X(INT, NONE, script_mode) \
|
||||
X(INT, NONE, script_line_delay) \
|
||||
@@ -1588,14 +1586,14 @@ NORETURN void cleanup_exit(int);
|
||||
X(STR, NONE, script_waitfor) \
|
||||
X(STR, NONE, script_halton) \
|
||||
/* #endif */ \
|
||||
/* #ifdef CYGTERMPORT */ \
|
||||
/* #ifdef MOD_CYGTERM */ \
|
||||
/* Cygterm options */ \
|
||||
X(INT, NONE, cygautopath) \
|
||||
X(INT, NONE, cygterm64) \
|
||||
X(STR, NONE, cygcmd) \
|
||||
X(INT, NONE, alt_metabit) /* set meta instead of escape */ \
|
||||
/* #endif */ \
|
||||
/* #if (defined IMAGEPORT) && (!defined FDJ) */\
|
||||
/* #if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ) */\
|
||||
X(INT, NONE, bg_opacity) \
|
||||
X(INT, NONE, bg_slideshow) \
|
||||
X(INT, NONE, bg_type) /* 0=solid 1=wallpaper 2=bitmap */ \
|
||||
@@ -1605,11 +1603,11 @@ NORETURN void cleanup_exit(int);
|
||||
X(INT, NONE, bg_image_abs_y) \
|
||||
X(INT, NONE, bg_image_abs_fixed) /* 0=fixed to desktop, 1=fixed to term wnd */ \
|
||||
/* #endif */ \
|
||||
/* #ifdef RECONNECTPORT */ \
|
||||
/* #ifdef MOD_RECONNECT */ \
|
||||
X(INT, NONE, wakeup_reconnect) \
|
||||
X(INT, NONE, failure_reconnect) \
|
||||
/* #endif */ \
|
||||
/* #ifdef HYPERLINKPORT */ \
|
||||
/* #ifdef MOD_HYPERLINK */ \
|
||||
/* \
|
||||
* HACK: PuttyTray / Nutty \
|
||||
* Hyperlink stuff: Underline settings \
|
||||
@@ -1621,7 +1619,7 @@ NORETURN void cleanup_exit(int);
|
||||
X(FILENAME, NONE, url_browser) \
|
||||
X(STR, NONE, url_regex) \
|
||||
/* #endif */ \
|
||||
/* #ifdef TUTTYPORT */ \
|
||||
/* #ifdef MOD_TUTTY */ \
|
||||
X(INT, NONE, window_closable) \
|
||||
X(INT, NONE, window_minimizable) \
|
||||
X(INT, NONE, window_maximizable) \
|
||||
@@ -1631,7 +1629,7 @@ NORETURN void cleanup_exit(int);
|
||||
X(INT, NONE, under_colour) \
|
||||
X(INT, NONE, sel_colour) \
|
||||
/* #endif */ \
|
||||
/* #ifdef ZMODEMPORT */ \
|
||||
/* #ifdef MOD_ZMODEM */ \
|
||||
/* Z modem options */ \
|
||||
X(FILENAME, NONE, rzcommand) \
|
||||
X(STR, NONE, rzoptions) \
|
||||
@@ -1639,11 +1637,11 @@ NORETURN void cleanup_exit(int);
|
||||
X(STR, NONE, szoptions) \
|
||||
X(STR, NONE, zdownloaddir) \
|
||||
/* #endif */ \
|
||||
/* #ifdef PORTKNOCKINGPORT */ \
|
||||
/* #ifdef MOD_PORTKNOCKING */ \
|
||||
/* port knocking options */ \
|
||||
X(STR, NONE, portknockingoptions) \
|
||||
/* #endif */ \
|
||||
/* #ifdef DISABLEALTGRPORT */ \
|
||||
/* #ifdef MOD_DISABLEALTGR */ \
|
||||
/* Disable AltGr button */ \
|
||||
X(INT, NONE, disablealtgr) \
|
||||
/* #endif */ \
|
||||
@@ -1654,7 +1652,7 @@ NORETURN void cleanup_exit(int);
|
||||
enum config_primary_key { CONFIG_OPTIONS(CONF_ENUM_DEF) N_CONFIG_OPTIONS };
|
||||
#undef CONF_ENUM_DEF
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
#define NCFGCOLOURS 34
|
||||
#else
|
||||
#define NCFGCOLOURS 22 /* number of colours in CONF_colours above */
|
||||
@@ -1816,7 +1814,7 @@ typedef enum SmallKeypadKey {
|
||||
SKK_HOME, SKK_END, SKK_INSERT, SKK_DELETE, SKK_PGUP, SKK_PGDN,
|
||||
} SmallKeypadKey;
|
||||
|
||||
#ifdef KEYMAPPINGPORT
|
||||
#ifdef MOD_KEYMAPPING
|
||||
int format_arrow_key(char *buf, Terminal *term, int xkey, int modifier, bool alt);
|
||||
#else
|
||||
int format_arrow_key(char *buf, Terminal *term, int xkey, bool ctrl);
|
||||
@@ -1927,7 +1925,7 @@ extern const struct BackendVtable loop_backend;
|
||||
|
||||
extern const struct BackendVtable raw_backend;
|
||||
|
||||
#ifdef ADBPORT
|
||||
#ifdef MOD_ADB
|
||||
/*
|
||||
* Exports from adb.c.
|
||||
*/
|
||||
@@ -1935,7 +1933,7 @@ extern const struct BackendVtable raw_backend;
|
||||
//extern Backend adb_backend;
|
||||
extern const struct BackendVtable adb_backend ;
|
||||
#endif
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
/*
|
||||
* Exports from cygterm.c.
|
||||
*/
|
||||
@@ -13,14 +13,14 @@
|
||||
#endif
|
||||
|
||||
/* rutty: */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
#include "script.h"
|
||||
#endif /* rutty */
|
||||
#ifdef HYPERLINKPORT
|
||||
#ifdef MOD_HYPERLINK
|
||||
#include "urlhack.h"
|
||||
#endif
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
extern char PassKey[1024] ;
|
||||
extern int cryptstring( char * st, const char * key ) ;
|
||||
extern int decryptstring( char * st, const char * key ) ;
|
||||
@@ -639,7 +639,8 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_b(sesskey, "RFCEnviron", conf_get_bool(conf, CONF_rfc_environ));
|
||||
write_setting_b(sesskey, "PassiveTelnet", conf_get_bool(conf, CONF_passive_telnet));
|
||||
write_setting_b(sesskey, "BackspaceIsDelete", conf_get_bool(conf, CONF_bksp_is_delete));
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
write_setting_i(sesskey, "EnterSendsCrLf", conf_get_int(conf, CONF_enter_sends_crlf));
|
||||
write_setting_i(sesskey, "RXVTHomeEnd", conf_get_int(conf, CONF_rxvt_homeend));
|
||||
#else
|
||||
write_setting_b(sesskey, "RXVTHomeEnd", conf_get_bool(conf, CONF_rxvt_homeend));
|
||||
@@ -715,7 +716,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_b(sesskey, "TrueColour", conf_get_bool(conf, CONF_true_colour));
|
||||
write_setting_i(sesskey, "BoldAsColour", conf_get_int(conf, CONF_bold_style)-1);
|
||||
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
write_setting_i(sesskey, "WindowClosable", conf_get_int(conf, CONF_window_closable) );
|
||||
write_setting_i(sesskey, "WindowMinimizable", conf_get_int(conf, CONF_window_minimizable) );
|
||||
write_setting_i(sesskey, "WindowMaximizable", conf_get_int(conf, CONF_window_maximizable) );
|
||||
@@ -816,7 +817,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_b(sesskey, "ConnectionSharingDownstream", conf_get_bool(conf, CONF_ssh_connection_sharing_downstream));
|
||||
wmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys, false);
|
||||
/* rutty: */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
write_setting_filename(sesskey, "ScriptFileName", conf_get_filename(conf, CONF_script_filename));
|
||||
write_setting_i(sesskey, "ScriptMode", (conf_get_int(conf, CONF_script_mode)!=SCRIPT_PLAY)?SCRIPT_STOP:conf_get_int(conf, CONF_script_mode)); /* dont save with record on */
|
||||
write_setting_i(sesskey, "ScriptLineDelay", conf_get_int(conf, CONF_script_line_delay));
|
||||
@@ -830,11 +831,11 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_s(sesskey, "ScriptWait", conf_get_str(conf, CONF_script_waitfor));
|
||||
write_setting_s(sesskey, "ScriptHalt", conf_get_str(conf, CONF_script_halton));
|
||||
#endif /* rutty */
|
||||
#ifdef RECONNECTPORT
|
||||
#ifdef MOD_RECONNECT
|
||||
write_setting_i(sesskey, "WakeupReconnect", conf_get_int(conf,CONF_wakeup_reconnect) );
|
||||
write_setting_i(sesskey, "FailureReconnect", conf_get_int(conf,CONF_failure_reconnect) );
|
||||
#endif
|
||||
#if (defined IMAGEPORT) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
if( GetBackgroundImageFlag() ) {
|
||||
write_setting_i(sesskey, "BgOpacity", conf_get_int(conf, CONF_bg_opacity) );
|
||||
write_setting_i(sesskey, "BgSlideshow", conf_get_int(conf, CONF_bg_slideshow) );
|
||||
@@ -846,7 +847,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_i(sesskey, "BgImagePlacement", conf_get_int(conf, CONF_bg_image_abs_fixed) );
|
||||
}
|
||||
#endif
|
||||
#ifdef HYPERLINKPORT
|
||||
#ifdef MOD_HYPERLINK
|
||||
/*
|
||||
* HACK: PuttyTray / Nutty
|
||||
* Hyperlink stuff: Save hyperlink settings
|
||||
@@ -856,7 +857,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_i(sesskey, "HyperlinkBrowserUseDefault", conf_get_int(conf, CONF_url_defbrowser));
|
||||
write_setting_filename(sesskey, "HyperlinkBrowser", conf_get_filename(conf, CONF_url_browser));
|
||||
write_setting_i(sesskey, "HyperlinkRegularExpressionUseDefault", conf_get_int(conf, CONF_url_defregex));
|
||||
#ifndef NO_HYPERLINK
|
||||
#ifndef MOD_NOHYPERLINK
|
||||
if( !strcmp(conf_get_str(conf, CONF_url_regex),"@°@°@NO REGEX--") )
|
||||
write_setting_s(sesskey, "HyperlinkRegularExpression", urlhack_default_regex ) ;
|
||||
else
|
||||
@@ -865,21 +866,21 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_s(sesskey, "HyperlinkRegularExpression", conf_get_str(conf, CONF_url_regex));
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
//if (do_host)
|
||||
write_setting_i(sesskey, "CygtermAltMetabit", conf_get_int(conf, CONF_alt_metabit));
|
||||
write_setting_i(sesskey, "CygtermAutoPath", conf_get_int(conf, CONF_cygautopath) );
|
||||
write_setting_i(sesskey, "Cygterm64", conf_get_int(conf, CONF_cygterm64));
|
||||
write_setting_s(sesskey, "CygtermCommand", conf_get_str(conf, CONF_cygcmd) );
|
||||
#endif
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
write_setting_filename(sesskey, "rzCommand", conf_get_filename(conf, CONF_rzcommand) );
|
||||
write_setting_s(sesskey, "rzOptions", conf_get_str(conf, CONF_rzoptions) );
|
||||
write_setting_filename(sesskey, "szCommand", conf_get_filename(conf, CONF_szcommand) );
|
||||
write_setting_s(sesskey, "szOptions", conf_get_str(conf, CONF_szoptions) );
|
||||
write_setting_s(sesskey, "zDownloadDir", conf_get_str(conf, CONF_zdownloaddir) );
|
||||
#endif
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( conf_get_int(conf, CONF_transparencynumber)<-1 ) conf_set_int(conf, CONF_transparencynumber,-1) ;
|
||||
if( conf_get_int(conf, CONF_transparencynumber)>255 ) conf_set_int(conf, CONF_transparencynumber,255) ;
|
||||
write_setting_i(sesskey, "TransparencyValue", conf_get_int(conf, CONF_transparencynumber) ) ;
|
||||
@@ -913,7 +914,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
strcpy( PassKey, "" ) ;
|
||||
}
|
||||
char pst[4096] ;
|
||||
#ifndef NO_PASSWORD
|
||||
#ifndef MOD_NOPASSWORD
|
||||
strcpy( pst, conf_get_str(conf, CONF_password ) );
|
||||
MASKPASS(pst);
|
||||
cryptstring( pst, PassKey ) ;
|
||||
@@ -924,13 +925,10 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_s(sesskey, "Comment", conf_get_str(conf, CONF_comment) );
|
||||
write_setting_i(sesskey, "SCPAutoPwd", conf_get_int(conf, CONF_scp_auto_pwd));
|
||||
#endif
|
||||
#ifdef ACSPORT
|
||||
write_setting_b(sesskey, "ACSinUTF", conf_get_bool(conf, CONF_acs_in_utf));
|
||||
#endif
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
write_setting_s(sesskey, "PortKnocking", conf_get_str(conf, CONF_portknockingoptions) );
|
||||
#endif
|
||||
#ifdef DISABLEALTGRPORT
|
||||
#ifdef MOD_DISABLEALTGR
|
||||
write_setting_i(sesskey, "DisableAltGr", conf_get_int(conf, CONF_disablealtgr));
|
||||
#endif
|
||||
}
|
||||
@@ -941,7 +939,7 @@ bool load_settings(const char *section, Conf *conf)
|
||||
sesskey = open_settings_r(section);
|
||||
bool exists = (sesskey != NULL);
|
||||
load_open_settings(sesskey, conf);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
if( section != NULL ) conf_set_str( conf, CONF_sessionname, section ) ;
|
||||
else conf_set_str( conf, CONF_sessionname, "" ) ;
|
||||
#endif
|
||||
@@ -955,7 +953,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
{
|
||||
int i;
|
||||
char *prot;
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
/*
|
||||
* HACK: PuTTY-url
|
||||
* Set font quality to cleartype on Windows Vista and above
|
||||
@@ -1188,7 +1186,8 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppb(sesskey, "RFCEnviron", false, conf, CONF_rfc_environ);
|
||||
gppb(sesskey, "PassiveTelnet", false, conf, CONF_passive_telnet);
|
||||
gppb(sesskey, "BackspaceIsDelete", true, conf, CONF_bksp_is_delete);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
gppi(sesskey, "EnterSendsCrLf", 0, conf, CONF_enter_sends_crlf);
|
||||
gppi(sesskey, "RXVTHomeEnd", 0, conf, CONF_rxvt_homeend);
|
||||
#else
|
||||
gppb(sesskey, "RXVTHomeEnd", false, conf, CONF_rxvt_homeend);
|
||||
@@ -1230,7 +1229,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppb(sesskey, "TelnetRet", true, conf, CONF_telnet_newline);
|
||||
gppi(sesskey, "LocalEcho", AUTO, conf, CONF_localecho);
|
||||
gppi(sesskey, "LocalEdit", AUTO, conf, CONF_localedit);
|
||||
#if (defined PERSOPORT) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
gpps(sesskey, "Answerback", "KiTTY", conf, CONF_answerback);
|
||||
#else
|
||||
gpps(sesskey, "Answerback", "PuTTY", conf, CONF_answerback);
|
||||
@@ -1269,7 +1268,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
/ 1000
|
||||
#endif
|
||||
);
|
||||
#ifdef HYPERLINKPORT
|
||||
#ifdef MOD_HYPERLINK
|
||||
gppi(sesskey, "ScrollbackLines", 10000, conf, CONF_savelines);
|
||||
#else
|
||||
gppi(sesskey, "ScrollbackLines", 2000, conf, CONF_savelines);
|
||||
@@ -1285,7 +1284,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppi(sesskey, "TermWidth", 80, conf, CONF_width);
|
||||
gppi(sesskey, "TermHeight", 24, conf, CONF_height);
|
||||
gppfont(sesskey, "Font", conf, CONF_font);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
/*
|
||||
* HACK: PuTTY-url
|
||||
* Set font quality to cleartype on Windows Vista and higher
|
||||
@@ -1306,7 +1305,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppb(sesskey, "TrueColour", true, conf, CONF_true_colour);
|
||||
i = gppi_raw(sesskey, "BoldAsColour", 1); conf_set_int(conf, CONF_bold_style, i+1);
|
||||
|
||||
#ifdef TUTTYPORT
|
||||
#ifdef MOD_TUTTY
|
||||
gppi(sesskey, "WindowClosable", 1, conf, CONF_window_closable);
|
||||
gppi(sesskey, "WindowMinimizable", 1, conf, CONF_window_minimizable);
|
||||
gppi(sesskey, "WindowMaximizable", 1, conf, CONF_window_maximizable);
|
||||
@@ -1395,7 +1394,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppb(sesskey, "CJKAmbigWide", false, conf, CONF_cjk_ambig_wide);
|
||||
gppb(sesskey, "UTF8Override", true, conf, CONF_utf8_override);
|
||||
gpps(sesskey, "Printer", "", conf, CONF_printer);
|
||||
#ifdef PRINTCLIPPORT
|
||||
#ifdef MOD_PRINTCLIP
|
||||
if( !strcmp( conf_get_str(conf,CONF_printer),PRINT_TO_CLIPBOARD_STRING) ) { conf_set_int(conf,CONF_printclip,1) ; }
|
||||
else { conf_set_int(conf,CONF_printclip,0) ; }
|
||||
#endif
|
||||
@@ -1462,7 +1461,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
conf, CONF_ssh_connection_sharing_downstream);
|
||||
gppmap(sesskey, "SSHManualHostKeys", conf, CONF_ssh_manual_hostkeys);
|
||||
/* rutty: */
|
||||
#ifdef RUTTYPORT
|
||||
#ifdef MOD_RUTTY
|
||||
gppfile(sesskey, "ScriptFileName", conf, CONF_script_filename);
|
||||
gppi(sesskey, "ScriptMode", 0, conf, CONF_script_mode);
|
||||
gppi(sesskey, "ScriptLineDelay", 0, conf, CONF_script_line_delay);
|
||||
@@ -1476,11 +1475,11 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gpps(sesskey, "ScriptWait", "", conf, CONF_script_waitfor);
|
||||
gpps(sesskey, "ScriptHalt", "", conf, CONF_script_halton);
|
||||
#endif /* rutty */
|
||||
#ifdef RECONNECTPORT
|
||||
#ifdef MOD_RECONNECT
|
||||
gppi(sesskey, "WakeupReconnect", 0, conf, CONF_wakeup_reconnect );
|
||||
gppi(sesskey, "FailureReconnect", 0, conf, CONF_failure_reconnect );
|
||||
#endif
|
||||
#if (defined IMAGEPORT) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
gppi(sesskey, "BgOpacity", 50, conf, CONF_bg_opacity );
|
||||
gppi(sesskey, "BgSlideshow", 0, conf, CONF_bg_slideshow );
|
||||
gppi(sesskey, "BgType", 0, conf, CONF_bg_type );
|
||||
@@ -1490,7 +1489,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppi(sesskey, "BgImageAbsoluteY", 0, conf, CONF_bg_image_abs_y );
|
||||
gppi(sesskey, "BgImagePlacement", 0, conf, CONF_bg_image_abs_fixed );
|
||||
#endif
|
||||
#ifdef HYPERLINKPORT
|
||||
#ifdef MOD_HYPERLINK
|
||||
/*
|
||||
* HACK: PuttyTray / Nutty
|
||||
* Hyperlink stuff: Load hyperlink settings
|
||||
@@ -1501,24 +1500,24 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppfile(sesskey, "HyperlinkBrowser", conf, CONF_url_browser);
|
||||
gppi(sesskey, "HyperlinkRegularExpressionUseDefault", 1, conf, CONF_url_defregex);
|
||||
|
||||
#ifndef NO_HYPERLINK
|
||||
#ifndef MOD_NOHYPERLINK
|
||||
gpps(sesskey, "HyperlinkRegularExpression", urlhack_default_regex, conf, CONF_url_regex);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CYGTERMPORT
|
||||
#ifdef MOD_CYGTERM
|
||||
gppi(sesskey, "CygtermAltMetabit", 0, conf, CONF_alt_metabit);
|
||||
gppi(sesskey, "CygtermAutoPath", 1, conf, CONF_cygautopath );
|
||||
gppi(sesskey, "Cygterm64", 0, conf, CONF_cygterm64);
|
||||
gpps(sesskey, "CygtermCommand", "", conf, CONF_cygcmd );
|
||||
#endif
|
||||
#ifdef ZMODEMPORT
|
||||
#ifdef MOD_ZMODEM
|
||||
gppfile(sesskey, "rzCommand", conf, CONF_rzcommand );
|
||||
gpps(sesskey, "rzOptions", "-e -v", conf, CONF_rzoptions );
|
||||
gppfile(sesskey, "szCommand", conf, CONF_szcommand );
|
||||
gpps(sesskey, "szOptions", "-e -v", conf, CONF_szoptions );
|
||||
gpps(sesskey, "zDownloadDir", "C:\\", conf, CONF_zdownloaddir );
|
||||
#endif
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
gppi(sesskey, "TransparencyValue", 0, conf, CONF_transparencynumber ) ;
|
||||
if( conf_get_int( conf, CONF_transparencynumber) < -1 ) conf_set_int( conf,CONF_transparencynumber,-1) ;
|
||||
if( conf_get_int( conf, CONF_transparencynumber) > 255 ) conf_set_int( conf,CONF_transparencynumber,255) ;
|
||||
@@ -1546,7 +1545,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppi(sesskey, "WindowState", 0, conf, CONF_windowstate );
|
||||
gppb(sesskey, "SaveWindowPos", false, conf, CONF_save_windowpos ); /* BKG */
|
||||
gppb(sesskey, "ForegroundOnBell", false, conf, CONF_foreground_on_bell );
|
||||
#ifndef NO_PASSWORD
|
||||
#ifndef MOD_NOPASSWORD
|
||||
if( strlen(conf_get_str(conf, CONF_host))>0 ) {
|
||||
if( (strlen(conf_get_str(conf, CONF_host))+strlen(conf_get_str(conf, CONF_termtype))) < 1000 ) {
|
||||
sprintf( PassKey, "%s%sKiTTY", conf_get_str(conf, CONF_host), conf_get_str(conf, CONF_termtype) ) ;
|
||||
@@ -1589,13 +1588,10 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gpps(sesskey, "Comment", "", conf, CONF_comment );
|
||||
gppi(sesskey, "SCPAutoPwd", 0, conf, CONF_scp_auto_pwd);
|
||||
#endif
|
||||
#ifdef ACSPORT
|
||||
gppb(sesskey, "ACSinUTF", false, conf, CONF_acs_in_utf);
|
||||
#endif
|
||||
#ifdef PORTKNOCKINGPORT
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
gpps(sesskey, "PortKnocking", "", conf, CONF_portknockingoptions );
|
||||
#endif
|
||||
#ifdef DISABLEALTGRPORT
|
||||
#ifdef MOD_DISABLEALTGR
|
||||
gppi(sesskey, "DisableAltGr", 0, conf, CONF_disablealtgr);
|
||||
#endif
|
||||
}
|
||||
@@ -1678,7 +1674,7 @@ void get_sesslist(struct sesslist *list, bool allocate)
|
||||
list->sessions = NULL;
|
||||
}
|
||||
}
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
/* Fonction de creation d'une session */
|
||||
void create_settings( const char * name ) {
|
||||
Conf *cfg = conf_new() ;
|
||||
@@ -887,6 +887,9 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle,
|
||||
ssh->ic_out_raw.fn = ssh_bpp_output_raw_data_callback;
|
||||
ssh->ic_out_raw.ctx = ssh;
|
||||
|
||||
ssh->term_width = conf_get_int(ssh->conf, CONF_width);
|
||||
ssh->term_height = conf_get_int(ssh->conf, CONF_height);
|
||||
|
||||
ssh->backend.vt = &ssh_backend;
|
||||
*backend_handle = &ssh->backend;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
void SetUsernameInConfig( char * username ) ;
|
||||
char * ManagePassPhrase( const char * st ) ;
|
||||
void SetPasswordInConfig( const char * password ) ;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -417,7 +417,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
|
||||
return;
|
||||
}
|
||||
s->username = dupstr(s->cur_prompt->prompts[0]->result);
|
||||
#ifdef PERSOPORT
|
||||
#ifdef MOD_PERSO
|
||||
SetUsernameInConfig( s->username ) ;
|
||||
#endif
|
||||
free_prompts(s->cur_prompt);
|
||||
@@ -461,7 +461,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
|
||||
if (!s->privatekey_available)
|
||||
ppl_logevent("Key file contains public key only");
|
||||
s->privatekey_encrypted = rsa_ssh1_encrypted(s->keyfile, NULL);
|
||||
#ifdef WINCRYPTPORT
|
||||
#ifdef MOD_WINCRYPT
|
||||
#ifdef USE_CAPI
|
||||
if(s->publickey_comment && 0 == strncmp("cert://", s->publickey_comment, 7)) {
|
||||
sfree(s->keyfile->path);
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user