diff --git a/0.72_My_PuTTY/ldiscucs.c b/0.72_My_PuTTY/ldiscucs.c deleted file mode 100644 index d7a0e26..0000000 --- a/0.72_My_PuTTY/ldiscucs.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ldisc.c: PuTTY line discipline. Sits between the input coming - * from keypresses in the window, and the output channel leading to - * the back end. Implements echo and/or local line editing, - * depending on what's currently configured. - */ - -#include -#include - -#include "putty.h" -#include "terminal.h" -#include "ldisc.h" - -void lpage_send(Ldisc *ldisc, - int codepage, const char *buf, int len, bool interactive) -{ - wchar_t *widebuffer = 0; - int widesize = 0; - int wclen; - - if (codepage < 0) { - ldisc_send(ldisc, buf, len, interactive); - return; - } - - widesize = len * 2; - widebuffer = snewn(widesize, wchar_t); - - wclen = mb_to_wc(codepage, 0, buf, len, widebuffer, widesize); - luni_send(ldisc, widebuffer, wclen, interactive); - - sfree(widebuffer); -} - -void luni_send(Ldisc *ldisc, const wchar_t *widebuf, int len, bool interactive) -{ - int ratio = (in_utf(ldisc->term))?3:1; - char *linebuffer; - int linesize; - int i; - char *p; - - linesize = len * ratio * 2; - linebuffer = snewn(linesize, char); - - if (in_utf(ldisc->term)) { - /* UTF is a simple algorithm */ - for (p = linebuffer, i = 0; i < len; i++) { - unsigned long ch = widebuf[i]; - - if (IS_SURROGATE(ch)) { -#ifdef PLATFORM_IS_UTF16 - if (i+1 < len) { - unsigned long ch2 = widebuf[i+1]; - if (IS_SURROGATE_PAIR(ch, ch2)) { - ch = FROM_SURROGATES(ch, ch2); - i++; - } - } else -#endif - { - /* Unrecognised UTF-16 sequence */ - ch = '.'; - } - } - - p += encode_utf8(p, ch); - } - } else { - int rv; - rv = wc_to_mb(ldisc->term->ucsdata->line_codepage, 0, widebuf, len, - linebuffer, linesize, NULL, ldisc->term->ucsdata); - if (rv >= 0) - p = linebuffer + rv; - else - p = linebuffer; - } - if (p > linebuffer) - ldisc_send(ldisc, linebuffer, p - linebuffer, interactive); - - sfree(linebuffer); -} diff --git a/0.72_My_PuTTY/ssh1connection.c b/0.72_My_PuTTY/ssh1connection.c index 34e12f9..4ae877f 100644 --- a/0.72_My_PuTTY/ssh1connection.c +++ b/0.72_My_PuTTY/ssh1connection.c @@ -395,11 +395,13 @@ static void ssh1_connection_process_queue(PacketProtocolLayer *ppl) s->antispoof_prompt->to_server = true; s->antispoof_prompt->from_server = false; s->antispoof_prompt->name = dupstr("Authentication successful"); +#ifndef PERSOPORT add_prompt( s->antispoof_prompt, dupstr("Access granted. Press Return to begin session. "), false); s->antispoof_ret = seat_get_userpass_input( s->ppl.seat, s->antispoof_prompt, NULL); +#endif while (1) { while (s->antispoof_ret < 0 && bufchain_size(s->ppl.user_input) > 0) diff --git a/0.72_My_PuTTY/ssh2connection.c b/0.72_My_PuTTY/ssh2connection.c index 4e1da5c..6175e05 100644 --- a/0.72_My_PuTTY/ssh2connection.c +++ b/0.72_My_PuTTY/ssh2connection.c @@ -987,11 +987,13 @@ static void ssh2_connection_process_queue(PacketProtocolLayer *ppl) s->antispoof_prompt->to_server = true; s->antispoof_prompt->from_server = false; s->antispoof_prompt->name = dupstr("Authentication successful"); +#ifndef PERSOPORT add_prompt( s->antispoof_prompt, dupstr("Access granted. Press Return to begin session. "), false); s->antispoof_ret = seat_get_userpass_input( s->ppl.seat, s->antispoof_prompt, NULL); +#endif while (1) { while (s->antispoof_ret < 0 && bufchain_size(s->ppl.user_input) > 0) diff --git a/0.72_My_PuTTY/ssh2userauth.c b/0.72_My_PuTTY/ssh2userauth.c index 83123dd..7c7f916 100644 --- a/0.72_My_PuTTY/ssh2userauth.c +++ b/0.72_My_PuTTY/ssh2userauth.c @@ -22,6 +22,7 @@ #include "kitty.h" void SetSSHConnected( int flag ); char bufpass[1024]=""; +extern int is_backend_connected ; #endif struct ssh2_userauth_state { @@ -246,6 +247,10 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) container_of(ppl, struct ssh2_userauth_state, ppl); PktIn *pktin; +#ifdef RECONNECTPORT +is_backend_connected = 1 ; +#endif + ssh2_userauth_filter_queue(s); /* no matter why we were called */ crBegin(s->crState); @@ -448,7 +453,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) s->username = s->locally_allocated_username = dupstr(s->cur_prompt->prompts[0]->result); #ifdef PERSOPORT - SetUsernameInConfig( s->username ) ; + SetUsernameInConfig( (char*)s->username ) ; #endif free_prompts(s->cur_prompt); } else { @@ -881,7 +886,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) s->publickey_comment), false); #ifdef PERSOPORT - SetSSHConnected(1); + //SetSSHConnected(1); if( strlen(ManagePassPhrase(NULL))>0 ) { char *p = ManagePassPhrase(NULL) ; bufchain bc; @@ -1255,11 +1260,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) pq_push_front(s->ppl.in_pq, pktin); s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET; s->kbd_inter_refused = true; /* don't try it again */ -#ifdef PERSOPORT - if( !IsPasswordInConf() ) continue ; -#else continue; -#endif } s->ki_printed_header = false; @@ -1372,34 +1373,38 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) * user's response(s). */ #ifdef PERSOPORT - SetSSHConnected(1); - if( IsPasswordInConf() ) { - GetPasswordInConfig(bufpass) ; - while( (bufpass[strlen(bufpass)-1]=='n')&&(bufpass[strlen(bufpass)-2]=='\\') ) { - bufpass[strlen(bufpass)-2]='\0'; - bufpass[strlen(bufpass)-1]='\0'; - } - bufchain bc; - bufchain_init(&bc); - bufchain_add(&bc, bufpass, strlen(bufpass)); - s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, &bc ); - SetPasswordInConfig(""); - CleanPassword(bufpass); - { // Log de l'envoi du password - char *userlog = dupprintf("\nSend automatic password (Using keyboard-interactive authentication)" ); - logevent(NULL,userlog); - - if (flags & FLAG_INTERACTIVE && - (flags & FLAG_VERBOSE)) { - ppl_printf("%s\r\n",userlog); + if( IsPasswordInConf() ) { + GetPasswordInConfig(bufpass) ; + while( ((bufpass[strlen(bufpass)-1]=='n')&&(bufpass[strlen(bufpass)-2]=='\\')) || ((bufpass[strlen(bufpass)-1]=='r')&&(bufpass[strlen(bufpass)-2]=='\\')) ) { + bufpass[strlen(bufpass)-2]='\0'; + bufpass[strlen(bufpass)-1]='\0'; } + bufchain bc; + bufchain_init(&bc); + bufchain_add(&bc, bufpass, strlen(bufpass)); + bufchain_add(&bc,"\n",1); + s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, &bc ) ; - sfree(userlog); - } + SetPasswordInConfig(""); + CleanPassword(bufpass); + { // Log de l'envoi du password + char *userlog = dupprintf("Send automatic password (Using keyboard-interactive authentication)" ); + ppl_logevent(userlog); // Affichage dans l'event log + // Affichage à l'écran + if (flags & FLAG_INTERACTIVE && + (flags & FLAG_VERBOSE)) { + ppl_printf("%s\r\n",userlog); + } + + sfree(userlog); + } } else #endif s->userpass_ret = seat_get_userpass_input( s->ppl.seat, s->cur_prompt, NULL); +#ifdef PERSOPORT + if( !IsPasswordInConf() ) +#endif while (1) { while (s->userpass_ret < 0 && bufchain_size(s->ppl.user_input) > 0) @@ -1434,10 +1439,12 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_uint32(s->pktout, s->num_prompts); for (uint32_t i = 0; i < s->num_prompts; i++) { #ifdef PERSOPORT - if(!GetUserPassSSHNoSave()) - if(s!=NULL) - if(s->cur_prompt->prompts!=NULL) - if(s->cur_prompt->prompts[i]->result!=NULL) SetPasswordInConfig( s->cur_prompt->prompts[i]->result ) ; + ppl_logevent("Sent password"); + if(!GetUserPassSSHNoSave()) { + if(s!=NULL) + if(s->cur_prompt->prompts!=NULL) + if(s->cur_prompt->prompts[i]->result!=NULL) { SetPasswordInConfig( s->cur_prompt->prompts[i]->result ) ; } + } #endif put_stringz(s->pktout, s->cur_prompt->prompts[i]->result); @@ -1546,24 +1553,25 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) put_stringz(s->pktout, "password"); put_bool(s->pktout, false); #ifdef PERSOPORT - if( IsPasswordInConf() ) { - GetPasswordInConfig(bufpass); - while( ((bufpass[strlen(bufpass)-1]=='n')&&(bufpass[strlen(bufpass)-2]=='\\')) || ((bufpass[strlen(bufpass)-1]=='r')&&(bufpass[strlen(bufpass)-2]=='\\')) ) { - bufpass[strlen(bufpass)-2]='\0'; - bufpass[strlen(bufpass)-1]='\0'; - } - put_stringz(s->pktout, bufpass); - SetPasswordInConfig(""); - - { // Log de l'envoi du password - char *userlog = dupprintf("Send automatic password" ); - logevent(NULL,userlog); - if (flags & FLAG_INTERACTIVE && - (flags & FLAG_VERBOSE)) { - ppl_printf("\r\n%s\r\n",userlog); + if( IsPasswordInConf() ) { + GetPasswordInConfig(bufpass); + while( ((bufpass[strlen(bufpass)-1]=='n')&&(bufpass[strlen(bufpass)-2]=='\\')) || ((bufpass[strlen(bufpass)-1]=='r')&&(bufpass[strlen(bufpass)-2]=='\\')) ) { + bufpass[strlen(bufpass)-2]='\0'; + bufpass[strlen(bufpass)-1]='\0'; + } + put_stringz(s->pktout, bufpass); + SetPasswordInConfig(""); + CleanPassword(bufpass); + { // Log de l'envoi du password + char *userlog = dupprintf("Send automatic password" ); + ppl_logevent(userlog); // Affichage dans l'event log + // Affichage à l'écran + if (flags & FLAG_INTERACTIVE && + (flags & FLAG_VERBOSE)) { + ppl_printf("\r\n%s\r\n",userlog); + } + sfree(userlog); } - sfree(userlog); - } } else { put_stringz(s->pktout, s->password); } @@ -1588,7 +1596,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl) } else if( s != NULL ) { if( s->password != NULL ) { SetPasswordInConfig( s->password ) ; - } + } } } #endif diff --git a/0.72_My_PuTTY/windows/version_minor.txt b/0.72_My_PuTTY/windows/version_minor.txt index d00491f..0cfbf08 100644 --- a/0.72_My_PuTTY/windows/version_minor.txt +++ b/0.72_My_PuTTY/windows/version_minor.txt @@ -1 +1 @@ -1 +2 diff --git a/kitty.c b/kitty.c index 56a9506..68c2e9c 100644 --- a/kitty.c +++ b/kitty.c @@ -4957,6 +4957,28 @@ void SetShrinkBitmapEnable(int) ; void LoadParameters( void ) { char buffer[4096] ; +#ifdef ADBPORT + if( ReadParameter( INIT_SECTION, "adb", buffer ) ) { + if( !stricmp( buffer, "YES" ) ) SetADBFlag( 1 ) ; + if( !stricmp( buffer, "NO" ) ) SetADBFlag( 0 ) ; + } +#endif + if( ReadParameter( INIT_SECTION, "antiidle", buffer ) ) { buffer[127]='\0'; strcpy( AntiIdleStr, buffer ) ; } + if( ReadParameter( INIT_SECTION, "antiidledelay", buffer ) ) + { AntiIdleCountMax = (int)floor(atoi(buffer)/10.0) ; if( AntiIdleCountMax<=0 ) AntiIdleCountMax =1 ; } + if( ReadParameter( INIT_SECTION, "autostoresshkey", buffer ) ) { if( !stricmp( buffer, "YES" ) ) SetAutoStoreSSHKeyFlag( 1 ) ; } +#if (defined IMAGEPORT) && (!defined FDJ) + if( ReadParameter( INIT_SECTION, "backgroundimage", buffer ) ) { + if( !stricmp( buffer, "NO" ) ) BackgroundImageFlag = 0 ; + //if( !stricmp( buffer, "YES" ) ) BackgroundImageFlag = 1 ; // Broken en 0.71 ==> on desactive + } +#endif + if( ReadParameter( INIT_SECTION, "bcdelay", buffer ) ) { between_char_delay = atoi( buffer ) ; } + + + + + if( ReadParameter( INIT_SECTION, "configdir", buffer ) ) { if( strlen( buffer ) > 0 ) { if( existdirectory(buffer) ) SetConfigDirectory( buffer ) ; } } @@ -4968,14 +4990,6 @@ void LoadParameters( void ) { autocommand_delay = (int)(1000*atof( buffer )) ; if(autocommand_delay<5) autocommand_delay = 5 ; } -#if (defined IMAGEPORT) && (!defined FDJ) - if( ReadParameter( INIT_SECTION, "backgroundimage", buffer ) ) { - if( !stricmp( buffer, "NO" ) ) BackgroundImageFlag = 0 ; - //if( !stricmp( buffer, "YES" ) ) BackgroundImageFlag = 1 ; // Broken en 0.71 ==> on desactive - } -#endif - if( ReadParameter( INIT_SECTION, "autostoresshkey", buffer ) ) { if( !stricmp( buffer, "YES" ) ) SetAutoStoreSSHKeyFlag( 1 ) ; } - if( ReadParameter( INIT_SECTION, "bcdelay", buffer ) ) { between_char_delay = atoi( buffer ) ; } if( ReadParameter( INIT_SECTION, "browsedirectory", buffer ) ) { if( !stricmp( buffer, "NO" ) ) { DirectoryBrowseFlag = 0 ; } else if( (!stricmp( buffer, "YES" )) && (IniFileFlag==SAVEMODE_DIR) ) DirectoryBrowseFlag = 1 ; @@ -5019,9 +5033,6 @@ void LoadParameters( void ) { strcpy( KittySavFile, buffer) ; } } - if( ReadParameter( INIT_SECTION, "antiidle", buffer ) ) { buffer[127]='\0'; strcpy( AntiIdleStr, buffer ) ; } - if( ReadParameter( INIT_SECTION, "antiidledelay", buffer ) ) - { AntiIdleCountMax = (int)floor(atoi(buffer)/10.0) ; if( AntiIdleCountMax<=0 ) AntiIdleCountMax =1 ; } if( ReadParameter( INIT_SECTION, "shortcuts", buffer ) ) { if( !stricmp( buffer, "NO" ) ) ShortcutsFlag = 0 ; if( !stricmp( buffer, "YES" ) ) ShortcutsFlag = 1 ; @@ -5120,12 +5131,6 @@ void LoadParameters( void ) { if( !stricmp( buffer, "NO" ) ) cygterm_set_flag( 0 ) ; } #endif -#ifdef ADBPORT - if( ReadParameter( INIT_SECTION, "adb", buffer ) ) { - if( !stricmp( buffer, "YES" ) ) SetADBFlag( 1 ) ; - if( !stricmp( buffer, "NO" ) ) SetADBFlag( 0 ) ; - } -#endif #ifdef ZMODEMPORT if( ReadParameter( INIT_SECTION, "zmodem", buffer ) ) { if( !stricmp( buffer, "NO" ) ) ZModemFlag = 0 ; diff --git a/kitty_ssh.c b/kitty_ssh.c index 4c5b8ba..3085d80 100644 --- a/kitty_ssh.c +++ b/kitty_ssh.c @@ -36,11 +36,11 @@ int knock( char *hostname, unsigned short port, unsigned short proto) { addr.sin_port = htons(port); if( proto == PROTO_UDP) { - vprint("Hitting udp %s:%u\n", inet_ntoa(addr.sin_addr), port); + vprint("Hitting udp %s:%u\n\n", inet_ntoa(addr.sin_addr), port); connect(sd, (struct sockaddr*)&addr, sizeof(struct sockaddr)); send(sd, NULL, 0, 0); } else { - vprint("Hitting tcp %s:%u\n", inet_ntoa(addr.sin_addr), port); + vprint("Hitting tcp %s:%u\n\n", inet_ntoa(addr.sin_addr), port); connect(sd, (struct sockaddr*)&addr, sizeof(struct sockaddr)); }