From 2d1b66aa3fd00e4ea70e1d1d786c7e62f9dd5822 Mon Sep 17 00:00:00 2001 From: cyd01 Date: Tue, 5 Jan 2021 19:40:17 +0100 Subject: [PATCH] Tagging the 0.74.4.2 release of the KiTTY project. --- 0.74_My_PuTTY/config.c | 54 +++++++++- 0.74_My_PuTTY/putty.h | 1 + 0.74_My_PuTTY/settings.c | 2 + 0.74_My_PuTTY/ssh2userauth.c | 1 + 0.74_My_PuTTY/version.h | 2 +- 0.74_My_PuTTY/windows/MAKEFILE.MINGW | 4 +- 0.74_My_PuTTY/windows/version.rc2 | 2 +- 0.74_My_PuTTY/windows/version_minor.txt | 2 +- 0.74_My_PuTTY/windows/win_res.rc2 | 2 +- 0.74_My_PuTTY/windows/windlg.c | 2 +- 0.74_My_PuTTY/windows/window.c | 7 ++ 0.74_My_PuTTY/windows/winplink.c | 5 + 0.74_My_PuTTY/windows/winstore.c | 4 + blocnote/notepad.a | Bin 32498 -> 32498 bytes blocnote/notepad.rc | 2 +- docs/version.txt | 2 +- kitty.c | 25 ++++- kitty.h | 4 + kitty_ini.txt | 3 + kitty_launcher.c | 2 +- kitty_proxy.c | 128 +++++++++++------------- kitty_proxy.h | 9 +- kitty_savedump.c | 4 +- kitty_settings.c | 2 + kitty_store.c | 22 ++++ kitty_store.h | 2 + 26 files changed, 204 insertions(+), 89 deletions(-) diff --git a/0.74_My_PuTTY/config.c b/0.74_My_PuTTY/config.c index d8b6a79..ac3c1bf 100644 --- a/0.74_My_PuTTY/config.c +++ b/0.74_My_PuTTY/config.c @@ -10,9 +10,7 @@ #include "dialog.h" #include "storage.h" -#ifdef MOD_PROXY -#include "kitty_proxy.h" -#endif + #ifdef MOD_RUTTY #include "script.h" #endif /* rutty */ @@ -27,6 +25,47 @@ int GetReadOnlyFlag(void) ; #ifdef MOD_ZMODEM #define ATOFFSET(data, offset) ( (void *) ( (char *)(data) + (offset) ) ) #endif +#ifdef MOD_PROXY +#include "kitty_proxy.h" +void proxy_selection_handler(union control *ctrl, dlgparam *dlg, void *data, int event) { + int i, j; + Conf *conf = (Conf *)data; + if (event == EVENT_REFRESH) { + /* Fetching this once at the start of the function ensures we + * remember what the right value is supposed to be when + * operations below cause reentrant calls to this function. */ + char * oldproxy = conf_get_str(conf, CONF_proxyselection); + + dlg_update_start(ctrl, dlg); + dlg_listbox_clear(ctrl, dlg); + for (i = 0; i < lenof(proxies); i++) { + if( proxies[i].name==NULL ) break ; + dlg_listbox_addwithid(ctrl, dlg, proxies[i].name, proxies[i].val); + } + for (i = j = 0; i < lenof(proxies); i++) { + if( proxies[i].name==NULL ) break ; + if ( !strcmp(oldproxy,proxies[i].name) ) { + dlg_listbox_select(ctrl, dlg, i); + break; + } + j++; + } + if (i == lenof(proxies)) { /* an unsupported setting was chosen */ + dlg_listbox_select(ctrl, dlg, 0); + oldproxy = NULL; + } + dlg_update_done(ctrl, dlg); + if( oldproxy!=NULL ) conf_set_str(conf, CONF_proxyselection, oldproxy); /* restore */ + } else if (event == EVENT_SELCHANGE) { + int i = dlg_listbox_index(ctrl, dlg); + if (i < 0) + i = 0; + else + i = dlg_listbox_getid(ctrl, dlg, i); + conf_set_str(conf, CONF_proxyselection, proxies[i].name); + } +} +#endif #define PRINTER_DISABLED_STRING "None (printing disabled)" @@ -3434,7 +3473,7 @@ if( !GetPuttyFlag() ) { } - if (!midsession) { + if (!midsession /*||midsession*/ ) { /* * The Connection/Proxy panel. */ @@ -4019,6 +4058,13 @@ if( !GetPuttyFlag() ) { "IPv6", '6', I(ADDRTYPE_IPV6), NULL); #endif + +#ifdef MOD_PERSO + ctrl_checkbox(s, "Print Dynamic ports in window title",NO_SHORTCUT, + HELPCTX(no_help), + conf_checkbox_handler, + I(CONF_ssh_tunnel_print_in_title)); +#endif ctrl_tabdelay(s, pfd->addbutton); ctrl_columns(s, 1, 100); diff --git a/0.74_My_PuTTY/putty.h b/0.74_My_PuTTY/putty.h index b436c92..8ab1948 100644 --- a/0.74_My_PuTTY/putty.h +++ b/0.74_My_PuTTY/putty.h @@ -1572,6 +1572,7 @@ NORETURN void cleanup_exit(int); X(INT, NONE, scp_auto_pwd) \ X(BOOL, NONE, no_focus_rep) /* totally disable mouse reporting */ \ X(INT, NONE, scrolllines) /* Options for Scroll Lines per Wheel */ \ + X(BOOL, NONE, ssh_tunnel_print_in_title) /* print dynamic port number in window title */ \ /* #endif */ \ /* #ifdef MOD_PROXY */ \ X(STR, NONE, proxyselection) /* Options for proxy selection */ \ diff --git a/0.74_My_PuTTY/settings.c b/0.74_My_PuTTY/settings.c index f924277..eb31159 100644 --- a/0.74_My_PuTTY/settings.c +++ b/0.74_My_PuTTY/settings.c @@ -931,6 +931,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf) write_setting_i(sesskey, "SCPAutoPwd", conf_get_int(conf, CONF_scp_auto_pwd)); write_setting_b(sesskey, "NoFocusReporting", conf_get_bool(conf, CONF_no_focus_rep)); write_setting_i(sesskey, "LinesAtAScroll", conf_get_int(conf, CONF_scrolllines)); + write_setting_b(sesskey, "SSHTunnelInTitle", conf_get_bool(conf, CONF_ssh_tunnel_print_in_title)); #endif #ifdef MOD_PORTKNOCKING write_setting_s(sesskey, "PortKnocking", conf_get_str(conf, CONF_portknockingoptions) ); @@ -1601,6 +1602,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf) gppi(sesskey, "SCPAutoPwd", 0, conf, CONF_scp_auto_pwd); gppb(sesskey, "NoFocusReporting", true, conf, CONF_no_focus_rep); gppi(sesskey, "LinesAtAScroll", -1, conf, CONF_scrolllines); + gppb(sesskey, "SSHTunnelInTitle", false, conf, CONF_ssh_tunnel_print_in_title); #endif #ifdef MOD_PORTKNOCKING gpps(sesskey, "PortKnocking", "", conf, CONF_portknockingoptions ); diff --git a/0.74_My_PuTTY/ssh2userauth.c b/0.74_My_PuTTY/ssh2userauth.c index a4464b6..08fce8b 100644 --- a/0.74_My_PuTTY/ssh2userauth.c +++ b/0.74_My_PuTTY/ssh2userauth.c @@ -26,6 +26,7 @@ typedef struct agent_key { #ifdef MOD_PERSO #include "kitty.h" void SetSSHConnected( int flag ); +void debug_logevent( const char *fmt, ... ) ; size_t iso8859_1_to_utf8(char *content, size_t max_size) ; // Latin-1 = iso8859-1 size_t utf8_to_iso8859_15(char *const output, const char *const input, const size_t length) ; // Latin-9 = iso8859-15 char bufpass[1024]=""; diff --git a/0.74_My_PuTTY/version.h b/0.74_My_PuTTY/version.h index 4f4d63b..9ef54fd 100644 --- a/0.74_My_PuTTY/version.h +++ b/0.74_My_PuTTY/version.h @@ -1,5 +1,5 @@ #define RELEASE 0.74 #define TEXTVER "Release 0.74" #define SSHVER "-Release-0.74" -#define BINARY_VERSION 0,74,4,1 +#define BINARY_VERSION 0,74,4,2 #define SOURCE_COMMIT "unavailable" diff --git a/0.74_My_PuTTY/windows/MAKEFILE.MINGW b/0.74_My_PuTTY/windows/MAKEFILE.MINGW index 35434bb..703cf81 100644 --- a/0.74_My_PuTTY/windows/MAKEFILE.MINGW +++ b/0.74_My_PuTTY/windows/MAKEFILE.MINGW @@ -241,7 +241,7 @@ plink.exe: agentf.o aqsync.o \ winnpc.o winnps.o winpgntc.o winplink.o winproxy.o \ winsecur.o winser.o winshare.o winstore.o wintime.o winucs.o \ winx11.o x11fwd.o \ - adb.o kitty_registry.o kitty_commun.o kitty_ssh.o kitty_store.o kitty_tools.o + adb.o kitty_registry.o kitty_commun.o kitty_proxy.o kitty_ssh.o kitty_store.o kitty_tools.o $(CC) $(LDFLAGS) -o $@ -Wl,-Map,plink.map agentf.o aqsync.o \ be_all_s_plink.o \ be_misc.o callback.o cmdline.o conf.o cproxy.o \ @@ -265,7 +265,7 @@ plink.exe: agentf.o aqsync.o \ winmiscs.o winnet.o winnohlp.o winnoise.o winnojmp.o \ winnpc.o winnps.o winpgntc.o winplink.o winproxy.o \ winsecur.o winser.o winshare.o winstore.o wintime.o winucs.o \ - adb.o kitty_registry.o kitty_commun.o kitty_ssh.o kitty_store.o kitty_tools.o \ + adb.o kitty_registry.o kitty_commun.o kitty_proxy.o kitty_ssh.o kitty_store.o kitty_tools.o \ ../../base64/base64.a ../../bcrypt/bcrypt.a ../../mini/mini.a \ winx11.o x11fwd.o -ladvapi32 -lcomdlg32 -lgdi32 -limm32 \ -lole32 -lshell32 -luser32 \ diff --git a/0.74_My_PuTTY/windows/version.rc2 b/0.74_My_PuTTY/windows/version.rc2 index c1cf79d..a5316c5 100644 --- a/0.74_My_PuTTY/windows/version.rc2 +++ b/0.74_My_PuTTY/windows/version.rc2 @@ -63,7 +63,7 @@ BEGIN VALUE "FileVersion", TEXTVER #endif #if (defined MOD_PERSO) && (!defined FLJ) - VALUE "ProductVersion", TEXTVER " - Additional features on KiTTY That's all folks! by 9bis.com, 2005-2020" + VALUE "ProductVersion", TEXTVER " - Additional features on KiTTY That's all folks! by 9bis.com, 2005-2021" #else VALUE "ProductVersion", TEXTVER #endif diff --git a/0.74_My_PuTTY/windows/version_minor.txt b/0.74_My_PuTTY/windows/version_minor.txt index d00491f..0cfbf08 100644 --- a/0.74_My_PuTTY/windows/version_minor.txt +++ b/0.74_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -1 +2 diff --git a/0.74_My_PuTTY/windows/win_res.rc2 b/0.74_My_PuTTY/windows/win_res.rc2 index 3055bca..e427397 100644 --- a/0.74_My_PuTTY/windows/win_res.rc2 +++ b/0.74_My_PuTTY/windows/win_res.rc2 @@ -217,7 +217,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_MAINICON_0,IDC_STATIC,7,7,30,20 LTEXT "",IDA_VERSION,45,7,198,8 - LTEXT "Copyright \251 2005-2020",IDC_STATIC,45,19,78,8 + LTEXT "Copyright \251 2005-2021",IDC_STATIC,45,19,78,8 LTEXT "9bis software - https://www.9bis.net/kitty", IDC_WEBPAGE,45,31,145,8 LTEXT "Contact:",IDC_STATIC,45,43,46,8 diff --git a/0.74_My_PuTTY/windows/windlg.c b/0.74_My_PuTTY/windows/windlg.c index 4e1bf16..22dfd5d 100644 --- a/0.74_My_PuTTY/windows/windlg.c +++ b/0.74_My_PuTTY/windows/windlg.c @@ -241,7 +241,7 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg, #if (defined MOD_PERSO) && (!defined FLJ) //static const char MESSAGE[] = ""; -static const char MESSAGE[] = " KiTTY software is developed by Cyd for 9bis.com, copyright \251 2005-2020, thanks to Leo for bcrypt and mini libraries, thanks to all contributors " ; +static const char MESSAGE[] = " KiTTY software is developed by Cyd for 9bis.com, copyright \251 2005-2021, thanks to Leo for bcrypt and mini libraries, thanks to all contributors " ; static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) diff --git a/0.74_My_PuTTY/windows/window.c b/0.74_My_PuTTY/windows/window.c index 52d3fa6..ceff610 100644 --- a/0.74_My_PuTTY/windows/window.c +++ b/0.74_My_PuTTY/windows/window.c @@ -7514,6 +7514,7 @@ static void wintw_set_title(TermWin *tw, const char *title_in) { } if( GetProtectFlag() ) if( strstr(buffer, " (PROTECTED)")==NULL ) { strcat( buffer, " (PROTECTED)" ) ; } if( conf_get_bool(conf, CONF_alwaysontop) ) if( strstr(buffer, " (ONTOP)")==NULL ) { strcat( buffer, " (ONTOP)" ) ; } + if( conf_get_bool(conf, CONF_ssh_tunnel_print_in_title) ) if( strstr(buffer, " (SOCKS: ")==NULL ) { make_title( fmt, " (SOCKS: %s)", "%%d") ; strcat( buffer, fmt ) ; } set_title_internal( tw, buffer ) ; free(title); free(buffer); @@ -8148,6 +8149,9 @@ static void process_clipdata(HGLOBAL clipdata, bool unicode) clipboard_contents = snewn(clipboard_length + 1, wchar_t); memcpy(clipboard_contents, p, clipboard_length * sizeof(wchar_t)); clipboard_contents[clipboard_length] = L'\0'; +#ifdef MOD_PERSO + if( (GetPasteSize()==0) || (clipboard_length<=GetPasteSize()) || MessageBox(NULL,"Clipboard content is very large.\nAre you sure ?","Confirmation",MB_YESNO|MB_ICONWARNING)==IDYES ) +#endif term_do_paste(term, clipboard_contents, clipboard_length); } } else { @@ -8161,6 +8165,9 @@ static void process_clipdata(HGLOBAL clipdata, bool unicode) clipboard_contents, i); clipboard_length = i - 1; clipboard_contents[clipboard_length] = L'\0'; +#ifdef MOD_PERSO + if( (GetPasteSize()==0) || (clipboard_length<=GetPasteSize()) || MessageBox(NULL,"Clipboard content is very large.\nAre you sure ?","Confirmation",MB_YESNO|MB_ICONWARNING)==IDYES ) +#endif term_do_paste(term, clipboard_contents, clipboard_length); } } diff --git a/0.74_My_PuTTY/windows/winplink.c b/0.74_My_PuTTY/windows/winplink.c index 6985869..2f4efb7 100644 --- a/0.74_My_PuTTY/windows/winplink.c +++ b/0.74_My_PuTTY/windows/winplink.c @@ -551,6 +551,11 @@ int main(int argc, char **argv) else return 1; } +#ifdef MOD_PROXY +if( GetProxySelectionFlag() ) { + LoadProxyInfo( conf, conf_get_str(conf,CONF_proxyselection) ) ; +} +#endif #ifdef MOD_PORTKNOCKING ManagePortKnocking(conf_get_str(conf,CONF_host),conf_get_str(conf,CONF_portknockingoptions)); #endif diff --git a/0.74_My_PuTTY/windows/winstore.c b/0.74_My_PuTTY/windows/winstore.c index 04b2e47..9a6755f 100644 --- a/0.74_My_PuTTY/windows/winstore.c +++ b/0.74_My_PuTTY/windows/winstore.c @@ -398,6 +398,10 @@ void del_settings(const char *sessionname) char *p, *p2; if( GetReadOnlyFlag() ) return ; if( (strstr( sessionname, " [" )==sessionname)&&(sessionname[strlen(sessionname)-1]==']') ) { + if( !strcmp(sessionname," [..]") ) { + MessageBox(NULL,"It is not allowed to delete .. directory","Error",MB_OK|MB_ICONERROR) ; + return ; + } // La session a purger est un folder p = snewn(3 * strlen(sessionname) + 1, char); strcpy( p, sessionname+2 ) ; diff --git a/blocnote/notepad.a b/blocnote/notepad.a index 440f2a8840ba75df7689069ee0c8cb2904798228..cb0480e544aabd19728cdc98ad2d40c1232c7579 100644 GIT binary patch delta 46 zcmezLm+{kI#tCvPmZoNg80 ) SetPasteSize( atoi(buffer) ) ; } if( ReadParameter( INIT_SECTION, "PSCPPath", buffer ) ) { if( existfile( buffer ) ) { if( PSCPPath!=NULL) { free(PSCPPath) ; PSCPPath = NULL ; } diff --git a/kitty.h b/kitty.h index 8bb2b71..b4e74a6 100644 --- a/kitty.h +++ b/kitty.h @@ -136,6 +136,10 @@ extern char * ScriptCommand ; extern char * PasteCommand ; int GetPasteCommandFlag(void) ; +// paste size limit (number of characters). Above the limit a confirmation is requested. (0 means unlimited) +int GetPasteSize(void) ; +void SetPasteSize( const int size ) ; + // Flag de gestion de la fonction hyperlink extern int HyperlinkFlag ; int GetHyperlinkFlag(void) ; diff --git a/kitty_ini.txt b/kitty_ini.txt index b6f3ca0..5b720ae 100644 --- a/kitty_ini.txt +++ b/kitty_ini.txt @@ -137,6 +137,9 @@ mouseshortcuts=yes ; paste: enable/disable one line at a time feature in paste action (useful on slow servers only) paste=no +; pastesize: paste size limit (number of characters). Above the limit a confirmation is requested. (0 means unlimited) +;pastesize=0 + ; PlinkPath: the full path to the plink.exe (or klink.exe) binary ;PlinkPath= diff --git a/kitty_launcher.c b/kitty_launcher.c index fa9cbb9..4c03280 100644 --- a/kitty_launcher.c +++ b/kitty_launcher.c @@ -578,7 +578,7 @@ LRESULT CALLBACK Launcher_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lP case WM_COMMAND: {//Commandes du menu switch( LOWORD(wParam) ) { case IDM_ABOUT: - MessageBox(hwnd," TTY Launcher\nSession launcher for TTY terminal emulator\n(c), 2009-2020","About", MB_OK ) ; + MessageBox(hwnd," TTY Launcher\nSession launcher for TTY terminal emulator\n(c), 2009-2021","About", MB_OK ) ; break ; case IDM_QUIT: ResShell = Shell_NotifyIcon(NIM_DELETE, &TrayIcone) ; diff --git a/kitty_proxy.c b/kitty_proxy.c index 84e1ccb..74c1aa8 100644 --- a/kitty_proxy.c +++ b/kitty_proxy.c @@ -3,6 +3,7 @@ #include "kitty_tools.h" #include "kitty_registry.h" #include "kitty_proxy.h" +#include "kitty_store.h" #include "dialog.h" #include "storage.h" #include @@ -17,51 +18,8 @@ void SetProxySelectionFlag( const int flag ) { ProxySelectionFlag = flag ; } void debug_logevent( const char *fmt, ... ) ; -#define MAX_PROXY 100 -struct Proxies { - char *name; - int val; - } proxies[MAX_PROXY] ; +struct Proxies proxies[MAX_PROXY] ; -void proxy_selection_handler(union control *ctrl, dlgparam *dlg, void *data, int event) { - int i, j; - Conf *conf = (Conf *)data; - if (event == EVENT_REFRESH) { - /* Fetching this once at the start of the function ensures we - * remember what the right value is supposed to be when - * operations below cause reentrant calls to this function. */ - char * oldproxy = conf_get_str(conf, CONF_proxyselection); - - dlg_update_start(ctrl, dlg); - dlg_listbox_clear(ctrl, dlg); - for (i = 0; i < lenof(proxies); i++) { - if( proxies[i].name==NULL ) break ; - dlg_listbox_addwithid(ctrl, dlg, proxies[i].name, proxies[i].val); - } - for (i = j = 0; i < lenof(proxies); i++) { - if( proxies[i].name==NULL ) break ; - if ( !strcmp(oldproxy,proxies[i].name) ) { - dlg_listbox_select(ctrl, dlg, i); - break; - } - j++; - } - if (i == lenof(proxies)) { /* an unsupported setting was chosen */ - dlg_listbox_select(ctrl, dlg, 0); - oldproxy = NULL; - } - dlg_update_done(ctrl, dlg); - if( oldproxy!=NULL ) conf_set_str(conf, CONF_proxyselection, oldproxy); /* restore */ - } else if (event == EVENT_SELCHANGE) { - int i = dlg_listbox_index(ctrl, dlg); - if (i < 0) - i = 0; - else - i = dlg_listbox_getid(ctrl, dlg, i); - conf_set_str(conf, CONF_proxyselection, proxies[i].name); - } -} - void InitProxyList(void) { HKEY hKey ; int i,j; @@ -129,10 +87,16 @@ int LoadProxyInfo( Conf * conf, const char * name ) { debug_logevent( "Load proxy \"%s\" definition", name ) ; if( (IniFileFlag == SAVEMODE_REG)||(IniFileFlag == SAVEMODE_FILE) ) { HKEY hKey ; - sprintf( buffer, "%s\\Proxies\\%s", PUTTY_REG_POS, name ) ; + sprintf( buffer, "%s\\Proxies\\", PUTTY_REG_POS ) ; + char *b = (char*)malloc(4*strlen(name)+1); + mungestr(name,b); + strcat(buffer,b); + free(b); if( RegOpenKeyEx( HKEY_CURRENT_USER, buffer, 0, KEY_READ, &hKey) != ERROR_SUCCESS ) return 0; char lpData[4096] ; - if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyExcludeList", lpData ) ) { conf_set_str( conf, CONF_proxy_exclude_list, lpData ) ; } + if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyExcludeList", lpData ) ) { + conf_set_str( conf, CONF_proxy_exclude_list, lpData ) ; + } if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyDNS", lpData ) ) { int i=atoi(lpData); conf_set_int(conf, CONF_proxy_dns, (i+1)%3); @@ -142,30 +106,15 @@ int LoadProxyInfo( Conf * conf, const char * name ) { } else { conf_set_bool( conf, CONF_even_proxy_localhost, true ) ; } } - if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyMethod", lpData ) ) { - conf_set_int(conf, CONF_proxy_type, atoi(lpData) ) ; - if (conf_get_int(conf, CONF_proxy_type) == -1) { - if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyType", lpData ) ) { - int i = atoi(lpData) ; - if (i == 0) - conf_set_int(conf, CONF_proxy_type, PROXY_NONE); - else if (i == 1) - conf_set_int(conf, CONF_proxy_type, PROXY_HTTP); - else if (i == 3) - conf_set_int(conf, CONF_proxy_type, PROXY_TELNET); - else if (i == 4) - conf_set_int(conf, CONF_proxy_type, PROXY_CMD); - else { - if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxySOCKSVersion", lpData ) ) { - i = atoi(lpData); - if (i == 5) - conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS5); - else - conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS4); - } else { conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS5); } - } - } else { conf_set_int(conf, CONF_proxy_type, PROXY_NONE); } - } + if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyMethod", lpData ) ) { + int i = atoi(lpData) ; + if (i == 0) conf_set_int(conf, CONF_proxy_type, PROXY_NONE); + else if (i == 1) conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS4) ; + else if (i == 2) conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS5) ; + else if (i == 3) conf_set_int(conf, CONF_proxy_type, PROXY_HTTP) ; + else if (i == 4) conf_set_int(conf, CONF_proxy_type, PROXY_TELNET) ; + else if (i == 5) conf_set_int(conf, CONF_proxy_type, PROXY_CMD) ; + else conf_set_int(conf, CONF_proxy_type, PROXY_NONE) ; } if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyHost", lpData ) ) { conf_set_str( conf, CONF_proxy_host, lpData ) ; } if( GetValueData(HKEY_CURRENT_USER, buffer, "ProxyPort", lpData ) ) { conf_set_int( conf, CONF_proxy_port, atoi(lpData) ) ; } @@ -180,7 +129,44 @@ int LoadProxyInfo( Conf * conf, const char * name ) { mungestr( name, filename ) ; sprintf( fullpath, "%s\\Proxies\\%s", ConfigDirectory, filename ) ; if( existfile(fullpath) ) { - + FILE *fp; + if( (fp=fopen(fullpath,"r")) != NULL ) { + char buf2[MAX_VALUE_NAME]=""; + while( fgets(buffer,MAX_VALUE_NAME,fp)!=NULL ) { + if( ReadPortableValue(buffer, "ProxyExcludeList", buf2, MAX_VALUE_NAME) ) { + conf_set_str( conf, CONF_proxy_exclude_list, buf2 ) ; + } else if( ReadPortableValue(buffer, "ProxyDNS", buf2, MAX_VALUE_NAME) ) { + int i=atoi(buf2); + conf_set_int(conf, CONF_proxy_dns, (i+1)%3); + } else if( ReadPortableValue(buffer, "ProxyLocalhost", buf2, MAX_VALUE_NAME) ) { + if( atoi(buf2) == 0 ) { conf_set_bool( conf, CONF_even_proxy_localhost, false ) ; + } else { conf_set_bool( conf, CONF_even_proxy_localhost, true ) ; + } + } else if( ReadPortableValue(buffer, "ProxyMethod", buf2, MAX_VALUE_NAME) ) { + int i = atoi(buf2) ; + if (i == 0) conf_set_int(conf, CONF_proxy_type, PROXY_NONE); + else if (i == 1) conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS4) ; + else if (i == 2) conf_set_int(conf, CONF_proxy_type, PROXY_SOCKS5) ; + else if (i == 3) conf_set_int(conf, CONF_proxy_type, PROXY_HTTP) ; + else if (i == 4) conf_set_int(conf, CONF_proxy_type, PROXY_TELNET) ; + else if (i == 5) conf_set_int(conf, CONF_proxy_type, PROXY_CMD) ; + else conf_set_int(conf, CONF_proxy_type, PROXY_NONE) ; + } else if( ReadPortableValue(buffer, "ProxyHost", buf2, MAX_VALUE_NAME) ) { + conf_set_str( conf, CONF_proxy_host, buf2 ) ; + } else if( ReadPortableValue(buffer, "ProxyPort", buf2, MAX_VALUE_NAME) ) { + conf_set_int( conf, CONF_proxy_port, atoi(buf2) ) ; + } else if( ReadPortableValue(buffer, "ProxyUsername", buf2, MAX_VALUE_NAME) ) { + conf_set_str( conf, CONF_proxy_username, buf2 ) ; + } else if( ReadPortableValue(buffer, "ProxyPassword", buf2, MAX_VALUE_NAME) ) { + conf_set_str( conf, CONF_proxy_password, buf2 ) ; + } else if( ReadPortableValue(buffer, "ProxyTelnetCommand", buf2, MAX_VALUE_NAME) ) { + conf_set_str( conf, CONF_proxy_telnet_command, buf2 ) ; + } else if( ReadPortableValue(buffer, "ProxyLogToTerm", buf2, MAX_VALUE_NAME) ) { + conf_set_int( conf, CONF_proxy_log_to_term, atoi(buf2) ) ; + } + } + fclose(fp); + } } free( filename ) ; } diff --git a/kitty_proxy.h b/kitty_proxy.h index 8097cdc..f67c360 100644 --- a/kitty_proxy.h +++ b/kitty_proxy.h @@ -1,9 +1,16 @@ #ifndef KITTY_PROXY #define KITTY_PROXY + +#define MAX_PROXY 100 +struct Proxies { + char *name; + int val; +}; +extern struct Proxies proxies[MAX_PROXY] ; + int GetProxySelectionFlag() ; void SetProxySelectionFlag( const int flag ) ; int LoadProxyInfo( Conf * conf, const char * name ) ; -void proxy_selection_handler(union control *ctrl, dlgparam *dlg, void *data, int event) ; void InitProxyList(void) ; int LoadProxyInfo( Conf * conf, const char * name ) ; #endif diff --git a/kitty_savedump.c b/kitty_savedump.c index 6290e1b..f1edfbe 100644 --- a/kitty_savedump.c +++ b/kitty_savedump.c @@ -586,6 +586,7 @@ void SaveDumpConfig( FILE *fp, Conf * conf ) { fprintf( fp, "scp_auto_pwd=%d\n", conf_get_int(conf, CONF_scp_auto_pwd)); fprintf( fp, "no_focus_rep=%d\n", conf_get_bool(conf,CONF_no_focus_rep) ) ; fprintf( fp, "scrolllines=%d\n", conf_get_int(conf,CONF_scrolllines) ) ; + fprintf( fp, "ssh_tunnel_print_in_title=%d\n", conf_get_bool(conf,CONF_ssh_tunnel_print_in_title) ) ; #endif #ifdef MOD_PRINTCLIP fprintf( fp, "printclip=%d\n", conf_get_int(conf,CONF_printclip) ) ; @@ -677,7 +678,8 @@ void SaveDumpConfig( FILE *fp, Conf * conf ) { if( AutoCommand!= NULL ) fprintf( fp, "AutoCommand=%s\n", AutoCommand ) ; if( ScriptCommand!= NULL ) fprintf( fp, "ScriptCommand=%s\n", ScriptCommand ) ; if( PasteCommand!= NULL ) fprintf( fp, "PasteCommand=%s\n", PasteCommand ) ; - fprintf( fp, "PasteCommandFlag=%d\n", PasteCommandFlag ); + fprintf( fp, "PasteCommandFlag=%d\n", PasteCommandFlag ) ; + fprintf( fp, "PasteSize=%d\n", GetPasteSize() ) ; if( ScriptFileContent!= NULL ) { char * pst = ScriptFileContent ; fprintf( fp, "ScriptFileContent=" ) ; diff --git a/kitty_settings.c b/kitty_settings.c index aaefbdd..d07f99e 100644 --- a/kitty_settings.c +++ b/kitty_settings.c @@ -434,6 +434,7 @@ void save_open_settings_forced(char *filename, Conf *conf) { write_setting_i_forced(sesskey, "SCPAutoPwd", conf_get_int(conf, CONF_scp_auto_pwd)); write_setting_b_forced(sesskey, "NoFocusReporting", conf_get_bool(conf, CONF_no_focus_rep)); write_setting_i_forced(sesskey, "LinesAtAScroll", conf_get_int(conf, CONF_scrolllines)); + write_setting_b_forced(sesskey, "SSHTunnelInTitle", conf_get_bool(conf, CONF_ssh_tunnel_print_in_title)); #endif #ifdef MOD_PORTKNOCKING write_setting_s_forced(sesskey, "PortKnocking", conf_get_str(conf, CONF_portknockingoptions) ); @@ -1069,6 +1070,7 @@ void load_open_settings_forced(char *filename, Conf *conf) { gppi_forced(sesskey, "SCPAutoPwd", 0, conf, CONF_scp_auto_pwd); gppb_forced(sesskey, "NoFocusReporting", true, conf, CONF_no_focus_rep); gppi_forced(sesskey, "LinesAtAScroll", 5, conf, CONF_scrolllines); + gppb_forced(sesskey, "SSHTunnelInTitle", false, conf, CONF_ssh_tunnel_print_in_title); #endif #ifdef MOD_PORTKNOCKING gpps_forced(sesskey, "PortKnocking", "", conf, CONF_portknockingoptions ); diff --git a/kitty_store.c b/kitty_store.c index db2b206..36a1759 100644 --- a/kitty_store.c +++ b/kitty_store.c @@ -726,3 +726,25 @@ void SettingTest( void ) { } */ + +bool ReadPortableValue(const char *buffer, const char * name, char * value, const int maxlen) { + bool test = false ; + if( (buffer==NULL) || (name==NULL) ) { return false ; } + if( (strlen(buffer)==0) || (strlen(name)==0) ) { return false ; } + if( maxlen<=0 ) { return false ; } + char *b = (char*)malloc(strlen(name)+2), *pst ; + sprintf(b,"%s\\",name) ; + if( strstr(buffer,b)==buffer ) { + pst = (char*)buffer + strlen(b) ; + test = true ; + value[0]='\0'; + if( strlen(pst)>1 ) + if( (strlen(pst)<=maxlen) && (pst[strlen(pst)-2]=='\\') ) { + memcpy( value, pst, strlen(pst)-2 ) ; + value[strlen(pst)-2] = '\0' ; + } + unmungestr( value, value, MAX_VALUE_NAME ) ; + } + free(b) ; + return test ; +} diff --git a/kitty_store.h b/kitty_store.h index b9a7854..833991c 100644 --- a/kitty_store.h +++ b/kitty_store.h @@ -67,3 +67,5 @@ int loadPath() ; char * GetSessPath( void ) ; bool SessPathIsInitial( void ) ; bool IsThereDefaultSessionFile( void ) ; + +bool ReadPortableValue(const char *buffer, const char * name, char * value, const int maxlen) ;