Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c3398cbb7 | ||
|
|
2d0a377626 | ||
|
|
232c3b29fd | ||
|
|
3bab5a6151 | ||
|
|
9bb4b61196 | ||
|
|
80597e340d | ||
|
|
c558736424 | ||
|
|
7f7fac22e9 | ||
|
|
8124638aba | ||
|
|
63053a885f | ||
|
|
464c88d396 | ||
|
|
6af39c95c2 | ||
|
|
ebb5e2f164 | ||
|
|
c4b6dabb28 | ||
|
|
e85550c70e | ||
|
|
9d80c6b171 | ||
|
|
9a8af62267 | ||
|
|
45c65bbdb0 | ||
|
|
12d8132e56 | ||
|
|
b76939b3d0 | ||
|
|
659bc96519 | ||
|
|
cb833b241a | ||
|
|
042b9f5cef | ||
|
|
1d13ae9175 | ||
|
|
2e87a6dc2b | ||
|
|
057faa84f9 | ||
|
|
8612fa5ef2 | ||
|
|
0ae14d0859 | ||
|
|
977da5f49c | ||
|
|
cc43da0078 | ||
|
|
7400667711 | ||
|
|
b9f427b176 | ||
|
|
f1377e7040 | ||
|
|
62c2de1dd2 | ||
|
|
5180166b5d | ||
|
|
e45c98b427 | ||
|
|
dea7220469 | ||
|
|
49d45ac099 |
@@ -1,2 +1,2 @@
|
||||
github: [ cyd01 ]
|
||||
custom: [ "https://www.paypal.com/donate/?token=oyJhWJ4Z0AW-wJxIBGIfxC2LyYmnbSPU2Vax9EJdVAtaEYvh8VXsSyCOHCVCO8Y9uH_I4G&country.x=GB&locale.x=GB", "http://kitty.9bis.com" ]
|
||||
custom: [ "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=65VYL8F5AD57G&source=url", "https://www.9bis.com/kitty/" ]
|
||||
|
||||
@@ -3,17 +3,17 @@ name: C/C++ CI
|
||||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/heads
|
||||
branches:
|
||||
- master # Push events on master branch
|
||||
- feat-*
|
||||
- fix-*
|
||||
- bugfix*
|
||||
# branches:
|
||||
# - master # Push events on master branch
|
||||
# - feat-*
|
||||
# - fix-*
|
||||
# - bugfix*
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- v*
|
||||
|
||||
env:
|
||||
VERSION: 0.73
|
||||
VERSION: 0.74
|
||||
|
||||
jobs:
|
||||
# Build for Win 32bits
|
||||
@@ -32,15 +32,14 @@ jobs:
|
||||
mkdir ../builds
|
||||
docker run --rm -i -v $(pwd)/../builds:/builds -v $(pwd):/sources cyd01/cross-gcc "cd ${VERSION}_My_PuTTY/windows ; make -f MAKEFILE.MINGW cross ; cd /builds ; ls -l"
|
||||
mv -f $(pwd)/../builds ./
|
||||
cd builds ; zip kitty.zip *.exe
|
||||
|
||||
# Upload runner package tar.gz/zip as artifact
|
||||
- name: Publish Artifact
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: kitty.zip
|
||||
path: builds/kitty.zip
|
||||
name: kitty
|
||||
path: builds/
|
||||
|
||||
# Build for Win 64bits
|
||||
build64:
|
||||
@@ -57,12 +56,11 @@ jobs:
|
||||
mkdir ../builds
|
||||
docker run --rm -i -v $(pwd)/../builds:/builds -v $(pwd):/sources cyd01/cross-gcc "cd ${VERSION}_My_PuTTY/windows ; make -f MAKEFILE.MINGW cross64 ; cd /builds ; ls -l"
|
||||
mv -f $(pwd)/../builds ./
|
||||
cd builds ; zip kitty.zip *.exe
|
||||
|
||||
# Upload runner package tar.gz/zip as artifact
|
||||
- name: Publish Artifact
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: kitty64.zip
|
||||
path: builds/kitty.zip
|
||||
name: kitty64
|
||||
path: builds/
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* have tiny little source modules containing nothing but
|
||||
* declarations of appname, for as long as I can...
|
||||
*/
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
char *appname = "KiTTY";
|
||||
#else
|
||||
const char *const appname = "PuTTY";
|
||||
|
||||
@@ -30,9 +30,93 @@
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
#include "kitty_crypt.h"
|
||||
#include "kitty.h"
|
||||
int decode64(char *buffer) ;
|
||||
void SetAutoStoreSSHKey( void ) ;
|
||||
void load_open_settings_forced(char *filename, Conf *conf) ;
|
||||
void SetPasswordInConfig( const char * password ) ;
|
||||
int GetCryptSaltFlag() ;
|
||||
extern char CurrentFolder[1024] ;
|
||||
// Manage connect string as: user:pass@@@hostname:port/cmd
|
||||
void ManageConnectString( Conf *cf, char * hostname ) {
|
||||
int i, j ;
|
||||
char *p, *us, *pw, *hn, *po, *cm ;
|
||||
us = (char*)malloc(strlen(hostname)+1); strcpy(us,"");
|
||||
pw = (char*)malloc(strlen(hostname)+1); strcpy(pw,"");
|
||||
hn = (char*)malloc(strlen(hostname)+1); strcpy(hn,hostname);
|
||||
po = (char*)malloc(strlen(hostname)+1); strcpy(po,"");
|
||||
cm = (char*)malloc(strlen(hostname)+1); strcpy(cm,"");
|
||||
for( i=0 ; i<strlen(hostname) ; i++ ) {
|
||||
if( hostname[i]=='@' ) {
|
||||
if( hostname[i+1]=='@' ) {
|
||||
i++ ;
|
||||
} else {
|
||||
strcpy( us, hostname ) ;
|
||||
us[i] = '\0' ;
|
||||
j = 0 ;
|
||||
do { i++; hn[j]=hostname[i]; j++; } while( hostname[i]!='\0' ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( hn[0]=='[' ) { // IPv6
|
||||
char *q ;
|
||||
if( (q = strstr( hn, "]" )) != NULL ) {
|
||||
q++ ;
|
||||
if( (p = strstr( q, "/" )) != NULL ) {
|
||||
strcpy( cm, p+1 ) ;
|
||||
p[0] = '\0' ;
|
||||
}
|
||||
if( (p = strstr( q, ":" )) != NULL ) {
|
||||
strcpy( po, p+1 ) ;
|
||||
p[0] = '\0' ;
|
||||
}
|
||||
q[0] = '\0' ;
|
||||
}
|
||||
} else { // IPv4
|
||||
if( (p = strstr( hn, "/" )) != NULL ) {
|
||||
strcpy( cm, p+1 ) ;
|
||||
p[0] = '\0' ;
|
||||
}
|
||||
if( (p = strstr( hn, ":" )) != NULL ) {
|
||||
strcpy( po, p+1 ) ;
|
||||
p[0] = '\0' ;
|
||||
}
|
||||
|
||||
}
|
||||
if( strlen(us)>0 ) {
|
||||
if( (p = strstr( us, ":" )) != NULL ) {
|
||||
strcpy( pw, p+1 ) ;
|
||||
p[0] = '\0' ;
|
||||
while( (p = strstr( pw, "@@" )) != NULL ) { // Manage @ in password ( @ => double @@)
|
||||
do { p[0] = p[1] ; p++ ; } while( p[0] != '\0' ) ;
|
||||
}
|
||||
}
|
||||
if( strlen(pw)>0 ) {
|
||||
SetPasswordInConfig( pw ) ;
|
||||
}
|
||||
sprintf( hostname, "%s@%s", us, hn ) ;
|
||||
} else {
|
||||
strcpy( hostname, hn ) ;
|
||||
}
|
||||
if( strlen(po)>0 ) {
|
||||
conf_set_int( cf, CONF_port, atoi(po) ) ;
|
||||
}
|
||||
if( strlen(cm)>0 ) {
|
||||
if( cm[0] == '#' ) {
|
||||
decryptstring( GetCryptSaltFlag(), (char*)cm+1, MASTER_PASSWORD ) ;
|
||||
conf_set_str( conf, CONF_autocommand, cm+1 ) ;
|
||||
} else {
|
||||
char *s = (char*)malloc( strlen(cm)+1 ) ;
|
||||
strcpy( s, cm ) ;
|
||||
int i = decode64(s) ;
|
||||
s[i] = '\0' ;
|
||||
conf_set_str( conf,CONF_autocommand,s ) ;
|
||||
free(s) ;
|
||||
}
|
||||
}
|
||||
free(cm);free(po);free(hn);free(pw);free(us);
|
||||
}
|
||||
#endif
|
||||
#ifdef MOD_ADB
|
||||
int GetADBFlag(void) ;
|
||||
@@ -172,7 +256,6 @@ int cmdline_process_param(const char *p, char *value,
|
||||
int need_save, Conf *conf)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (p[0] != '-') {
|
||||
if (need_save < 0)
|
||||
return 0;
|
||||
@@ -207,6 +290,7 @@ int cmdline_process_param(const char *p, char *value,
|
||||
* the default session and never be able to do anything
|
||||
* else).
|
||||
*/
|
||||
|
||||
if (!strncmp(p, "telnet:", 7)) {
|
||||
/*
|
||||
* If the argument starts with "telnet:", set the
|
||||
@@ -254,59 +338,26 @@ int cmdline_process_param(const char *p, char *value,
|
||||
conf_set_int(conf, CONF_port, -1);
|
||||
}
|
||||
#ifdef MOD_PERSO
|
||||
} else if (!strncmp(p, "ssh:", 4)) {
|
||||
} else if (!strncmp(p, "ssh:", 4)) {
|
||||
char *pst = (char*)malloc(strlen(p)+1) ; strcpy(pst,p);
|
||||
char *q = (char*)pst ;
|
||||
/*
|
||||
* If the hostname starts with "ssh:",
|
||||
* set the protocol to SSH and process
|
||||
* the string as a SSH URL
|
||||
*/
|
||||
char c;
|
||||
q += 4;
|
||||
if (q[0] == '/' && q[1] == '/')
|
||||
q += 2;
|
||||
conf_set_int( conf, CONF_protocol, PROT_SSH);
|
||||
pst = q;
|
||||
while (*pst && *pst != ':' && *pst != '/')
|
||||
pst++;
|
||||
c = *pst;
|
||||
/*
|
||||
* If the hostname starts with "ssh:",
|
||||
* set the protocol to SSH and process
|
||||
* the string as a SSH URL
|
||||
*/
|
||||
q += 4;
|
||||
if (q[0] == '/' && q[1] == '/')
|
||||
q += 2;
|
||||
//while (*q && *q != ':' && *q != '/') q++ ;
|
||||
conf_set_int( conf, CONF_protocol, PROT_SSH);
|
||||
conf_set_int( conf, CONF_port, 22);
|
||||
ManageConnectString( conf, q ) ;
|
||||
|
||||
if (*pst) *pst++ = '\0';
|
||||
|
||||
if (c == ':')
|
||||
conf_set_int( conf,CONF_port,atoi(pst));
|
||||
else if( (c == '/')&&(strlen(pst)>0) ) {
|
||||
conf_set_int( conf,CONF_port,22);
|
||||
char * buf;
|
||||
buf=(char*)malloc(strlen(pst)+10);
|
||||
strcpy(buf,pst);
|
||||
if( pst[0]=='#' ) {
|
||||
decryptstring( (char*)pst+1, MASTER_PASSWORD ) ;
|
||||
conf_set_str( conf,CONF_autocommand, pst+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *s = (char*)malloc( strlen(pst)+1 ) ;
|
||||
strcpy( s, pst ) ;
|
||||
int i = decode64(s) ;
|
||||
s[i]='\0';
|
||||
conf_set_str(conf,CONF_autocommand,s);
|
||||
free(s);
|
||||
}
|
||||
free(buf);
|
||||
}
|
||||
else
|
||||
conf_set_int( conf,CONF_port,22) ;
|
||||
char * buf;
|
||||
buf=(char*)malloc( strlen(q)+10 );
|
||||
strncpy(buf,q,strlen(q)+1);
|
||||
buf[strlen(q)+1] = '\0' ;
|
||||
conf_set_str( conf, CONF_host, buf);
|
||||
free(buf);
|
||||
seen_hostname_argument = true ;
|
||||
conf_set_str( conf, CONF_host, q ) ;
|
||||
seen_hostname_argument = true ;
|
||||
free(pst);
|
||||
} else if (!strncmp(p, "putty:", 4)) {
|
||||
} else if (!strncmp(p, "putty:", 4)) {
|
||||
char * q = (char*)p ;
|
||||
int ret = 0;
|
||||
q += 6;
|
||||
@@ -392,6 +443,10 @@ int cmdline_process_param(const char *p, char *value,
|
||||
hostname[len-1] == '\t'))
|
||||
hostname[--len] = '\0';
|
||||
seen_hostname_argument = true;
|
||||
#ifdef MOD_PERSO
|
||||
// Manage connect string user:pass@hostname
|
||||
ManageConnectString( conf, hostname ) ;
|
||||
#endif
|
||||
conf_set_str(conf, CONF_host, hostname);
|
||||
|
||||
if ((cmdline_tooltype & TOOLTYPE_HOST_ARG_CAN_BE_SESSION) &&
|
||||
@@ -470,9 +525,36 @@ int cmdline_process_param(const char *p, char *value,
|
||||
RETURN(2);
|
||||
/* This parameter must be processed immediately rather than being
|
||||
* saved. */
|
||||
#if MOD_PERSO
|
||||
if( IniFileFlag == SAVEMODE_REG ) {
|
||||
do_defaults(value, conf);
|
||||
loaded_session = true;
|
||||
cmdline_session_name = dupstr(value) ;
|
||||
} else {
|
||||
char *pst = strstr( value, "/" ) ;
|
||||
if( pst==NULL ) {
|
||||
do_defaults(value, conf);
|
||||
loaded_session = true;
|
||||
cmdline_session_name = dupstr(value) ;
|
||||
} else {
|
||||
char *name = (char*)malloc( strlen(value)+1 ) ;
|
||||
strcpy(name,value) ;
|
||||
pst = strstr( name, "/" ) ;
|
||||
cmdline_session_name = dupstr(pst+1) ;
|
||||
pst[0]='\0';
|
||||
conf_set_str(conf,CONF_folder,name) ;
|
||||
SetSessPath( name ) ;
|
||||
strcpy( CurrentFolder, name ) ;
|
||||
do_defaults(pst+1, conf);
|
||||
loaded_session = true;
|
||||
free(value) ;
|
||||
}
|
||||
}
|
||||
#else
|
||||
do_defaults(value, conf);
|
||||
loaded_session = true;
|
||||
cmdline_session_name = dupstr(value);
|
||||
#endif
|
||||
return 2;
|
||||
}
|
||||
if (!strcmp(p, "-ssh")) {
|
||||
@@ -522,6 +604,10 @@ int cmdline_process_param(const char *p, char *value,
|
||||
cmdline_session_name = dupstr(value);
|
||||
return 2;
|
||||
}
|
||||
if (!strcmp(p, "-knock")) {
|
||||
RETURN(2);
|
||||
conf_set_str( conf, CONF_portknockingoptions, value ) ;
|
||||
}
|
||||
if ( !strcmp(p, "-auto_store_sshkey") || !strcmp(p, "-auto-store-sshkey") ) {
|
||||
RETURN(1);
|
||||
SetAutoStoreSSHKey();
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
#endif /* rutty */
|
||||
#ifdef MOD_PERSO
|
||||
#include "kitty.h"
|
||||
#include "kitty_store.h"
|
||||
union control * ctrlHostnameEdit = NULL ;
|
||||
void MASKPASS( char * password ) ;
|
||||
void MASKPASS( const int mode, char * password ) ;
|
||||
int stricmp(const char *s1, const char *s2) ;
|
||||
int GetReadOnlyFlag(void) ;
|
||||
#endif
|
||||
@@ -722,7 +723,7 @@ static void sshbug_handler(union control *ctrl, dlgparam *dlg,
|
||||
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) ;
|
||||
|
||||
int StringList_Add( char **list, char *str ) ;
|
||||
int StringList_Add( char **list, const char *str ) ;
|
||||
int StringList_Exist( const char **list, const char * name ) ;
|
||||
void StringList_Del( char **list, const char * name ) ;
|
||||
void StringList_Up( char **list, const char * name ) ;
|
||||
@@ -738,7 +739,9 @@ int RunSession( HWND hwnd, const char * folder_in, char * session_in ) ;
|
||||
|
||||
extern char ** FolderList ;
|
||||
|
||||
static char CurrentFolder[1024]="Default" ;
|
||||
static char * selectedsession = NULL ;
|
||||
|
||||
extern char CurrentFolder[1024] ;
|
||||
union control * ctrlSessionList = NULL ;
|
||||
union control * ctrlSessionEdit = NULL ;
|
||||
union control * ctrlFolderList = NULL ;
|
||||
@@ -813,7 +816,7 @@ static void folder_handler(union control *ctrl, dlgparam *dlg,
|
||||
struct sessionsaver_data {
|
||||
#ifdef MOD_PERSO
|
||||
union control *editbox, *listbox, *clearbutton, *loadbutton, *savebutton, *delbutton, *createbutton, *delfolderbutton, *arrangebutton
|
||||
#if (defined MOD_PERSO) && (!defined FDJ) && (defined MOD_STARTBUTTON)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ) && (defined MOD_STARTBUTTON)
|
||||
, *startbutton
|
||||
#endif
|
||||
;
|
||||
@@ -850,6 +853,11 @@ static bool load_selected_session(
|
||||
char sessionname[1024] ;
|
||||
int j;
|
||||
dlg_listbox_gettext(ctrlSessionList, dlg, i, sessionname, 1024 ) ;
|
||||
|
||||
if( selectedsession!=NULL ) { free(selectedsession); }
|
||||
selectedsession = (char*)malloc(strlen(sessionname)+1);
|
||||
strcpy(selectedsession,sessionname);
|
||||
|
||||
for( j=0; j<ssd->sesslist.nsessions; j++ ) {
|
||||
if( !strcmp( ssd->sesslist.sessions[j], sessionname ) ) i = j ;
|
||||
}
|
||||
@@ -1011,11 +1019,16 @@ void filter_session_portable(union control *ctrl, dlgparam *dlg, const int nb, c
|
||||
// Adding Default Settings Session only on Main folder
|
||||
for( i=0 ; i<nb ; i++ ) if( tabb[i] ) {
|
||||
if( strstr(sessionslist[i],"Default Settings")==sessionslist[i] ) {
|
||||
if( !strcmp(CurrentFolder,"Default") ) sessionlist_add(s,sessionslist[i],&j,true) ;
|
||||
if( !strcmp(CurrentFolder,"Default") && SessPathIsInitial() ) sessionlist_add(s,sessionslist[i],&j,true) ;
|
||||
tabb[i] = false ;
|
||||
}
|
||||
}
|
||||
|
||||
// Removing session that starts with __
|
||||
for( i=0 ; i<nb ; i++ ) if( tabb[i] ) {
|
||||
if( (sessionslist[i][0]=='_')&&(sessionslist[i][1]=='_') ) { }
|
||||
}
|
||||
|
||||
// Adding other session depending on the filter
|
||||
for( i=0 ; i<nb ; i++ ) if( tabb[i] ) {
|
||||
if( !GetSessionFilterFlag() ) { // On filter disable
|
||||
@@ -1026,7 +1039,12 @@ void filter_session_portable(union control *ctrl, dlgparam *dlg, const int nb, c
|
||||
tabb[i] = false ;
|
||||
}
|
||||
|
||||
for( i=0 ; i<nb ; i++ ) { if( s[i] != NULL ) { dlg_listbox_add(ctrl, dlg, s[i]) ; } }
|
||||
for( i=0 ; i<nb ; i++ ) {
|
||||
if( s[i] != NULL ) {
|
||||
dlg_listbox_add(ctrl, dlg, s[i]) ;
|
||||
if( !strcmp(s[i],selectedsession) ) { dlg_listbox_select(ctrl, dlg, i); }
|
||||
}
|
||||
}
|
||||
// cleaning
|
||||
for( i=0 ; i<nb ; i++ ) { if( s[i] != NULL ) { free(s[i]) ; } }
|
||||
free(tabb);
|
||||
@@ -1045,6 +1063,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
if (ctrl == ssd->editbox) {
|
||||
#ifdef MOD_PERSO
|
||||
ctrlSessionEdit = ctrl ;
|
||||
if( selectedsession==NULL ) { selectedsession=(char*)malloc(1);strcpy(selectedsession,""); }
|
||||
#endif
|
||||
dlg_editbox_set(ctrl, dlg, ssd->savedsession);
|
||||
} else if (ctrl == ssd->listbox) {
|
||||
@@ -1052,16 +1071,15 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
dlg_update_start(ctrl, dlg);
|
||||
dlg_listbox_clear(ctrl, dlg);
|
||||
#ifdef MOD_PERSO
|
||||
if( ssd->savedsession!=NULL ) strcpy( ssd->savedsession, dlg_editbox_get( ssd->editbox, dlg ) ) ; // ajout 0.63 pour que le filtre fonctionne
|
||||
|
||||
if( ssd->savedsession!=NULL ) strcpy( ssd->savedsession, dlg_editbox_get( ssd->editbox, dlg ) ) ;
|
||||
ctrlSessionList = ctrl ;
|
||||
//if(get_param("INIFILE")==SAVEMODE_DIR) CleanFolderName( CurrentFolder ) ;
|
||||
|
||||
int j;
|
||||
if( get_param("INIFILE")==SAVEMODE_DIR ) {
|
||||
filter_session_portable(ctrl, dlg, ssd->sesslist.nsessions,ssd->sesslist.sessions, ssd->savedsession, CurrentFolder ) ;
|
||||
}
|
||||
else
|
||||
for (i = 0; i < ssd->sesslist.nsessions; i++) {
|
||||
for (i = 0, j=0; i < ssd->sesslist.nsessions; i++) {
|
||||
char folder[1024] ;
|
||||
strcpy( folder, "" ) ;
|
||||
if( (get_param("INIFILE")==SAVEMODE_REG) || ((get_param("INIFILE")==SAVEMODE_DIR) && !GetDirectoryBrowseFlag()) ) { // Registry mode
|
||||
@@ -1069,8 +1087,8 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
}
|
||||
if( GetPuttyFlag() ) { // In PuTTY mode => all sessions
|
||||
dlg_listbox_add(ctrl, dlg, ssd->sesslist.sessions[i]);
|
||||
}
|
||||
|
||||
}
|
||||
else if( (ssd->sesslist.sessions[i][0]=='_') && (ssd->sesslist.sessions[i][1]=='_') ) { } // Do nothing if session name starts with __
|
||||
else if( !GetSessionFilterFlag() ) // In registry mode without filter => all sessions
|
||||
dlg_listbox_add(ctrl, dlg, ssd->sesslist.sessions[i]);
|
||||
else { // In registry mode with filter
|
||||
@@ -1083,18 +1101,23 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
|| ( filter_sessionname( "comment:", ssd->sesslist.sessions[i], folder, ssd->savedsession ) )
|
||||
|| ( filter_sessionname( "title:", ssd->sesslist.sessions[i], folder, ssd->savedsession ) )
|
||||
|| ( filter_sessionname( "class:", ssd->sesslist.sessions[i], folder, ssd->savedsession ) )
|
||||
//|| (stristr(host,ssd->savedsession)!=NULL) /* Filtre sur le nom du host */
|
||||
|| (stristr(ssd->sesslist.sessions[i],ssd->savedsession)!=NULL) )
|
||||
|| ( stristr(ssd->sesslist.sessions[i],ssd->savedsession)!=NULL) ) {
|
||||
dlg_listbox_add(ctrl, dlg, ssd->sesslist.sessions[i]) ;
|
||||
if( !strcmp(ssd->sesslist.sessions[i],selectedsession) ) { dlg_listbox_select(ctrl, dlg, j); }
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
dlg_update_done(ctrl, dlg);
|
||||
//if( get_param("INIFILE")!=SAVEMODE_DIR ) { dlg_listbox_select(ctrl,dlg,0) ; }
|
||||
#else
|
||||
for (i = 0; i < ssd->sesslist.nsessions; i++)
|
||||
dlg_listbox_add(ctrl, dlg, ssd->sesslist.sessions[i]);
|
||||
#endif
|
||||
dlg_update_done(ctrl, dlg);
|
||||
#endif
|
||||
|
||||
}
|
||||
} else if (event == EVENT_VALCHANGE) {
|
||||
int top, bottom, halfway, i;
|
||||
@@ -1133,27 +1156,26 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
* contains a hostname.
|
||||
*/
|
||||
#ifdef MOD_PERSO
|
||||
if (load_selected_session(ssd, dlg, conf, &mbl) &&
|
||||
(mbl && ctrl == ssd->listbox && conf_launchable(conf))) {
|
||||
if (load_selected_session(ssd, dlg, conf, &mbl) &&
|
||||
(mbl && ctrl == ssd->listbox && conf_launchable(conf))) {
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
strcpy( buffer, conf_get_str( conf, CONF_password) ) ;
|
||||
MASKPASS( buffer ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), buffer ) ;
|
||||
conf_set_str( conf, CONF_password, buffer ) ;
|
||||
memset( buffer, 0, strlen(buffer) ) ;
|
||||
}
|
||||
}
|
||||
if( GetDblClickFlag()==1 ) {
|
||||
sessionsaver_handler( ssd->startbutton, dlg, data, EVENT_ACTION ) ;
|
||||
sessionsaver_handler( ssd->clearbutton, dlg, data, EVENT_ACTION ) ;
|
||||
sessionsaver_handler( ctrlSessionList, dlg, data, EVENT_REFRESH ) ;
|
||||
}
|
||||
else
|
||||
dlg_end(dlg, 1); /* it's all over, and succeeded */
|
||||
}
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
sessionsaver_handler( ssd->startbutton, dlg, data, EVENT_ACTION ) ;
|
||||
sessionsaver_handler( ssd->clearbutton, dlg, data, EVENT_ACTION ) ;
|
||||
sessionsaver_handler( ctrlSessionList, dlg, data, EVENT_REFRESH ) ;
|
||||
} else
|
||||
dlg_end(dlg, 1); /* it's all over, and succeeded */
|
||||
}
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
strcpy( buffer, conf_get_str( conf, CONF_password) ) ;
|
||||
MASKPASS( buffer ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), buffer ) ;
|
||||
conf_set_str( conf, CONF_password, buffer ) ;
|
||||
memset( buffer, 0, strlen(buffer) ) ;
|
||||
}
|
||||
@@ -1182,7 +1204,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
strcpy( buffer, conf_get_str( conf, CONF_password) ) ;
|
||||
MASKPASS( buffer ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), buffer ) ;
|
||||
conf_set_str( conf, CONF_password, buffer ) ;
|
||||
memset( buffer, 0, strlen(buffer) ) ;
|
||||
}
|
||||
@@ -1194,7 +1216,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
strcpy( buffer, conf_get_str( conf, CONF_password) ) ;
|
||||
MASKPASS( buffer ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), buffer ) ;
|
||||
conf_set_str( conf, CONF_password, buffer ) ;
|
||||
memset( buffer, 0, strlen(buffer) ) ;
|
||||
}
|
||||
@@ -1256,7 +1278,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
if( conf_get_int(conf, CONF_protocol) != PROT_SERIAL ) {
|
||||
char buffer[1024] ;
|
||||
strcpy( buffer, conf_get_str( conf, CONF_password) ) ;
|
||||
MASKPASS( buffer ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), buffer ) ;
|
||||
conf_set_str( conf, CONF_password, buffer ) ;
|
||||
memset( buffer, 0, strlen(buffer) ) ;
|
||||
}
|
||||
@@ -1300,7 +1322,7 @@ static void sessionsaver_handler(union control *ctrl, dlgparam *dlg,
|
||||
dlg_end(dlg, 0);
|
||||
}
|
||||
#ifdef MOD_PERSO
|
||||
#if (defined MOD_PERSO) && (!defined FDJ) && (defined MOD_STARTBUTTON)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ) && (defined MOD_STARTBUTTON)
|
||||
else if (ctrl == ssd->startbutton) {
|
||||
char sessionname[1024];
|
||||
if( conf_launchable(conf) ) {
|
||||
@@ -2259,7 +2281,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
if( GetConfigBoxHeight() > 7 ) ssd->okbutton->generic.column = 0 ; else
|
||||
#endif
|
||||
ssd->okbutton->generic.column = 3;
|
||||
#if (defined MOD_PERSO) && (!defined FDJ) && (defined MOD_STARTBUTTON)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ) && (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;
|
||||
@@ -2349,6 +2371,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ssd->editbox = ctrl_editbox(s, "Saved Sessions/New Folder", 'e', 100,
|
||||
HELPCTX(session_saved),
|
||||
sessionsaver_handler, P(ssd), P(NULL));
|
||||
|
||||
ssd->editbox->generic.column = 0;
|
||||
if( !midsession && ( (get_param("INIFILE")!=2)||(!GetDirectoryBrowseFlag()) ) ) {
|
||||
ssd->clearbutton = ctrl_pushbutton(s, "Clear", NO_SHORTCUT,
|
||||
@@ -2375,6 +2398,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ssd->listbox->generic.column = 0;
|
||||
#ifdef MOD_PERSO
|
||||
ssd->listbox->listbox.height = GetConfigBoxHeight() ;
|
||||
ssd->listbox->listbox.hscroll = true ; /* Does nothing */
|
||||
#else
|
||||
ssd->listbox->listbox.height = 7;
|
||||
#endif
|
||||
@@ -2450,7 +2474,7 @@ void setup_config_box(struct controlbox *b, bool midsession,
|
||||
ctrl_droplist(s, "Folder", NO_SHORTCUT, 80,
|
||||
HELPCTX(no_help),
|
||||
folder_handler, I(CONF_folder)) ;
|
||||
}
|
||||
}
|
||||
#else
|
||||
ssd->savebutton = ctrl_pushbutton(s, "Save", 'v',
|
||||
HELPCTX(session_saved),
|
||||
@@ -2920,7 +2944,7 @@ s = ctrl_getset(b, "Terminal/Bell", "overload",
|
||||
|
||||
}
|
||||
#endif
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( !GetPuttyFlag() && GetBackgroundImageFlag() ) {
|
||||
/*
|
||||
* The Window/Background panel.
|
||||
@@ -3028,7 +3052,8 @@ if( !GetPuttyFlag() ) {
|
||||
ctrl_text(s, " %%P: protocol name", HELPCTX(appearance_title));
|
||||
ctrl_text(s, " %%s: session name", HELPCTX(appearance_title));
|
||||
ctrl_text(s, " %%u: username", HELPCTX(appearance_title));
|
||||
ctrl_text(s, " %%w: forwarded ports list", HELPCTX(appearance_title));
|
||||
ctrl_text(s, " %%l: forwarded local ports list", HELPCTX(appearance_title));
|
||||
ctrl_text(s, " %%d: forwarded dynamic ports list", HELPCTX(appearance_title));
|
||||
}
|
||||
#endif
|
||||
ctrl_checkbox(s, "Separate window and icon titles", 'i',
|
||||
@@ -3337,7 +3362,8 @@ if( !GetPuttyFlag() ) {
|
||||
c = ctrl_editbox(s, "Auto-login password", NO_SHORTCUT, 50,
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler, I(CONF_password), I(1) ) ;
|
||||
c->editbox.password = 1;
|
||||
//if( !debug_flag )
|
||||
c->editbox.password = 1;
|
||||
#endif
|
||||
ctrlAutoCommandContentEdit = ctrl_editbox(s, "Command", NO_SHORTCUT, 74,
|
||||
HELPCTX(no_help),
|
||||
@@ -4046,7 +4072,7 @@ if( !GetPuttyFlag() ) {
|
||||
"PSCP and WinSCP integration");
|
||||
|
||||
s = ctrl_getset(b, "Connection/SSH/PSCP and WinSCP", "winSCPproto", "General protocol setting") ;
|
||||
ctrl_radiobuttons(s, "Prefered protocol:", NO_SHORTCUT, 7,
|
||||
ctrl_radiobuttons(s, "Prefered protocol:", NO_SHORTCUT, 4,
|
||||
HELPCTX(no_help),
|
||||
conf_radiobutton_handler,
|
||||
I(CONF_winscpprot),
|
||||
@@ -4086,6 +4112,10 @@ if( !GetPuttyFlag() ) {
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler, I(CONF_winscprawsettings),
|
||||
I(1));
|
||||
ctrl_editbox(s, "Shell (scp mode only)", NO_SHORTCUT, 100,
|
||||
HELPCTX(no_help),
|
||||
conf_editbox_handler, I(CONF_pscpshell),
|
||||
I(1));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -352,7 +352,6 @@ union control *ctrl_listbox(struct controlset *s, const char *label,
|
||||
c->listbox.percentwidth = 100;
|
||||
c->listbox.ncols = 0;
|
||||
c->listbox.percentages = NULL;
|
||||
c->listbox.hscroll = true;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@@ -786,6 +786,45 @@ void portfwdmgr_free(PortFwdManager *mgr)
|
||||
sfree(mgr);
|
||||
}
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
// Manage sftpconnect that ends with :* (create a local forward port dynamically)
|
||||
void AddDynamicSFTPConnect( Conf *conf ) {
|
||||
char * p = conf_get_str( conf, CONF_sftpconnect ) ;
|
||||
if( p[0]==':' ) {
|
||||
if( (conf_get_str( conf, CONF_username )!=NULL) && (strlen(conf_get_str( conf, CONF_username ))>0) ) {
|
||||
char *b ;
|
||||
b = (char*) malloc( strlen(conf_get_str( conf, CONF_username )) + 20 ) ;
|
||||
sprintf( b, "%s@localhost%s", conf_get_str( conf, CONF_username ),p ) ;
|
||||
conf_set_str( conf, CONF_sftpconnect, b ) ;
|
||||
p = conf_get_str( conf, CONF_sftpconnect ) ;
|
||||
free(b);
|
||||
} else if( strstr(conf_get_str( conf, CONF_host ),"@")!=NULL ) {
|
||||
char *b ;
|
||||
b = (char*) malloc( strlen(conf_get_str( conf, CONF_host )) + 20 ) ;
|
||||
strcpy(b,conf_get_str( conf, CONF_host ));
|
||||
strstr(b,"@")[0]='\0';
|
||||
strcat(b,"@localhost");
|
||||
strcat(b,p);
|
||||
conf_set_str( conf, CONF_sftpconnect, b ) ;
|
||||
p = conf_get_str( conf, CONF_sftpconnect ) ;
|
||||
free(b) ;
|
||||
}
|
||||
}
|
||||
if( (p[strlen(p)-1]=='*') && (p[strlen(p)-2]==':') ) {
|
||||
char key[10], val[20] ;
|
||||
p[strlen(p)-2]='\0' ;
|
||||
int rnd = (rand() % (65000 - 60000)) + 60000 ;
|
||||
sprintf(key,"L%d",rnd);
|
||||
sprintf(val,"localhost:%d",conf_get_int(conf, CONF_port));
|
||||
conf_set_str_str(conf, CONF_portfwd, key, val) ;
|
||||
char *b = (char*) malloc( strlen(p)+20 );
|
||||
sprintf(b,"%s:%d",p,rnd) ;
|
||||
conf_set_str( conf, CONF_sftpconnect, b ) ;
|
||||
free(b);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void portfwdmgr_config(PortFwdManager *mgr, Conf *conf)
|
||||
{
|
||||
PortFwdRecord *pfr;
|
||||
@@ -805,7 +844,6 @@ void portfwdmgr_config(PortFwdManager *mgr, Conf *conf)
|
||||
*/
|
||||
for (i = 0; (pfr = index234(mgr->forwardings, i)) != NULL; i++)
|
||||
pfr->status = DESTROY;
|
||||
|
||||
for (val = conf_get_str_strs(conf, CONF_portfwd, NULL, &key);
|
||||
val != NULL;
|
||||
val = conf_get_str_strs(conf, CONF_portfwd, key, &key)) {
|
||||
|
||||
@@ -52,7 +52,7 @@ static void sink(const char *targ, const char *src);
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
void SetAutoStoreSSHKey( void ) ;
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
char *appname = "PSCP";
|
||||
#else
|
||||
const char *const appname = "PSCP";
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
void SetAutoStoreSSHKey( void ) ;
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
char *appname = "PSFTP";
|
||||
#else
|
||||
const char *const appname = "PSFTP";
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define MAX_TICK_MINS (INT_MAX / (60 * TICKSPERSEC))
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
extern int debug_flag ;
|
||||
#define ATTR_ITALIC 0x1000000U
|
||||
#include <stdint.h>
|
||||
void debug_log( const char *fmt, ...) ;
|
||||
@@ -622,7 +623,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 MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
extern char *appname;
|
||||
#else
|
||||
extern const char *const appname;
|
||||
@@ -1547,6 +1548,7 @@ NORETURN void cleanup_exit(int);
|
||||
X(INT, NONE, winscpprot) \
|
||||
X(STR, NONE, sftpconnect) \
|
||||
X(STR, NONE, pscpoptions) \
|
||||
X(STR, NONE, pscpshell) \
|
||||
X(STR, NONE, pscpremotedir) \
|
||||
X(STR, NONE, winscpoptions) \
|
||||
X(STR, NONE, winscprawsettings) \
|
||||
@@ -1589,7 +1591,7 @@ NORETURN void cleanup_exit(int);
|
||||
X(STR, NONE, script_waitfor) \
|
||||
X(STR, NONE, script_halton) \
|
||||
/* #endif */ \
|
||||
/* #if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ) */\
|
||||
/* #if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ) */\
|
||||
X(INT, NONE, bg_opacity) \
|
||||
X(INT, NONE, bg_slideshow) \
|
||||
X(INT, NONE, bg_type) /* 0=solid 1=wallpaper 2=bitmap */ \
|
||||
|
||||
@@ -25,12 +25,13 @@
|
||||
#define SAVEMODE_DIR 2
|
||||
#endif
|
||||
extern char FileExtension[15] ;
|
||||
extern char PassKey[1024] ;
|
||||
extern int cryptstring( char * st, const char * key ) ;
|
||||
extern int decryptstring( char * st, const char * key ) ;
|
||||
int cryptpassword( int mode, char * password, const char * host, const char * termtype ) ;
|
||||
int decryptpassword( int mode, char * password, const char * host, const char * termtype ) ;
|
||||
int get_param( const char * val ) ;
|
||||
void MASKPASS( char * password ) ;
|
||||
void MASKPASS( const int mode, char * password ) ;
|
||||
int GetBackgroundImageFlag(void) ;
|
||||
int GetCryptSaltFlag() ;
|
||||
int DebugGetPassword( Conf *conf, const char *pwd ) ;
|
||||
#endif
|
||||
|
||||
/* The cipher order given here is the default order. */
|
||||
@@ -839,7 +840,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
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 MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
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) );
|
||||
@@ -890,6 +891,7 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_i(sesskey, "WinSCPProtocol", conf_get_int(conf, CONF_winscpprot) );
|
||||
write_setting_s(sesskey, "SFTPConnect", conf_get_str(conf, CONF_sftpconnect) );
|
||||
write_setting_s(sesskey, "PSCPOptions", conf_get_str(conf, CONF_pscpoptions) );
|
||||
write_setting_s(sesskey, "PSCPShell", conf_get_str(conf, CONF_pscpshell) );
|
||||
write_setting_s(sesskey, "PSCPRemoteDir", conf_get_str(conf, CONF_pscpremotedir) );
|
||||
write_setting_s(sesskey, "WinSCPOptions", conf_get_str(conf, CONF_winscpoptions) );
|
||||
write_setting_s(sesskey, "WinSCPRawSettings", conf_get_str(conf, CONF_winscprawsettings) );
|
||||
@@ -910,16 +912,11 @@ void save_open_settings(settings_w *sesskey, Conf *conf)
|
||||
write_setting_b(sesskey, "SaveWindowPos", conf_get_bool(conf, CONF_save_windowpos) ); /* BKG */
|
||||
write_setting_b(sesskey, "ForegroundOnBell", conf_get_bool(conf, CONF_foreground_on_bell) );
|
||||
|
||||
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) ) ;
|
||||
} else {
|
||||
strcpy( PassKey, "" ) ;
|
||||
}
|
||||
char pst[4096] ;
|
||||
#ifndef MOD_NOPASSWORD
|
||||
char pst[4096] ;
|
||||
strcpy( pst, conf_get_str(conf, CONF_password ) );
|
||||
MASKPASS(pst);
|
||||
cryptstring( pst, PassKey ) ;
|
||||
MASKPASS(GetCryptSaltFlag(), pst);
|
||||
cryptpassword( GetCryptSaltFlag(), pst, conf_get_str(conf, CONF_host), conf_get_str(conf, CONF_termtype) ) ;
|
||||
write_setting_s(sesskey, "Password", pst);
|
||||
memset(pst,0,strlen(pst));
|
||||
#endif
|
||||
@@ -950,20 +947,27 @@ bool load_settings(const char *section, Conf *conf)
|
||||
close_settings_r(sesskey);
|
||||
#ifdef MOD_PERSO
|
||||
if (exists && conf_launchable(conf)) {
|
||||
if( get_param("INIFILE") == SAVEMODE_DIR ) {
|
||||
char *name=NULL ;
|
||||
if( (section!=NULL) && (strlen(section)>0) && (strlen(conf_get_str( conf, CONF_folder))>0) ) {
|
||||
name=(char*)malloc( strlen(section)+strlen(conf_get_str( conf, CONF_folder))+2);
|
||||
sprintf(name,"%s/%s",conf_get_str( conf, CONF_folder),section);
|
||||
} else if( (section!=NULL) && (strlen(section)>0) ) {
|
||||
name=(char*)malloc( strlen(section)+1);
|
||||
sprintf(name,"%s",section);
|
||||
if( get_param("INIFILE") == SAVEMODE_DIR ) {
|
||||
char *name = NULL ;
|
||||
if( (section!=NULL) && (strlen(section)>0) && (strlen(conf_get_str( conf, CONF_folder))>0) ) {
|
||||
if( strcmp(conf_get_str( conf, CONF_folder), "Default" ) ) {
|
||||
name = (char*)malloc( strlen(section)+strlen(conf_get_str( conf, CONF_folder)) + 2 ) ;
|
||||
sprintf( name, "%s/%s", conf_get_str( conf, CONF_folder), section ) ;
|
||||
}
|
||||
} else if( (section!=NULL) && (strlen(section)>0) ) {
|
||||
name = (char*)malloc( strlen(section)+1 ) ;
|
||||
sprintf( name, "%s", section ) ;
|
||||
}
|
||||
if( name!=NULL ) {
|
||||
//add_session_to_jumplist(section) ;
|
||||
add_session_to_jumplist(name) ;
|
||||
free(name) ;
|
||||
} else {
|
||||
add_session_to_jumplist(section) ;
|
||||
}
|
||||
} else {
|
||||
add_session_to_jumplist(section);
|
||||
}
|
||||
add_session_to_jumplist(name);
|
||||
if( name!=NULL ) free(name);
|
||||
} else {
|
||||
add_session_to_jumplist(section);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (exists && conf_launchable(conf))
|
||||
@@ -1255,7 +1259,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 MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
gpps(sesskey, "Answerback", "KiTTY", conf, CONF_answerback);
|
||||
#else
|
||||
gpps(sesskey, "Answerback", "PuTTY", conf, CONF_answerback);
|
||||
@@ -1505,7 +1509,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppi(sesskey, "WakeupReconnect", 0, conf, CONF_wakeup_reconnect );
|
||||
gppi(sesskey, "FailureReconnect", 0, conf, CONF_failure_reconnect );
|
||||
#endif
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
gppi(sesskey, "BgOpacity", 50, conf, CONF_bg_opacity );
|
||||
gppi(sesskey, "BgSlideshow", 0, conf, CONF_bg_slideshow );
|
||||
gppi(sesskey, "BgType", 0, conf, CONF_bg_type );
|
||||
@@ -1550,6 +1554,7 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppi(sesskey, "WinSCPProtocol", 1, conf, CONF_winscpprot );
|
||||
gpps(sesskey, "SFTPConnect", "", conf, CONF_sftpconnect );
|
||||
gpps(sesskey, "PSCPOptions", "-r", conf, CONF_pscpoptions );
|
||||
gpps(sesskey, "PSCPShell", "", conf, CONF_pscpshell );
|
||||
gpps(sesskey, "PSCPRemoteDir", "", conf, CONF_pscpremotedir );
|
||||
gpps(sesskey, "WinSCPOptions", "", conf, CONF_winscpoptions );
|
||||
gpps(sesskey, "WinSCPRawSettings", "", conf, CONF_winscprawsettings );
|
||||
@@ -1571,38 +1576,14 @@ void load_open_settings(settings_r *sesskey, Conf *conf)
|
||||
gppb(sesskey, "SaveWindowPos", false, conf, CONF_save_windowpos ); /* BKG */
|
||||
gppb(sesskey, "ForegroundOnBell", false, conf, CONF_foreground_on_bell );
|
||||
#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) ) ;
|
||||
} else {
|
||||
strcpy( PassKey, "" ) ;
|
||||
}
|
||||
gpps(sesskey, "Password", "", conf, CONF_password );
|
||||
} else {
|
||||
if( strlen(conf_get_str(conf, CONF_termtype)) < 1000 ) {
|
||||
sprintf( PassKey, "%sKiTTY", conf_get_str(conf, CONF_termtype) ) ;
|
||||
} else {
|
||||
strcpy( PassKey, "" ) ;
|
||||
}
|
||||
gpps(sesskey, "Password", "", conf, CONF_password );
|
||||
}
|
||||
|
||||
gpps(sesskey, "Password", "", conf, CONF_password );
|
||||
if( strlen(conf_get_str(conf, CONF_password))>0 ) {
|
||||
char pst[4096] ;
|
||||
if( strlen(conf_get_str(conf, CONF_password))<=4095 ) { strcpy( pst, conf_get_str(conf, CONF_password) ) ; }
|
||||
else { memcpy( pst, conf_get_str( conf, CONF_password ), 4095 ) ; pst[4095]='\0'; }
|
||||
decryptstring( pst, PassKey ) ;
|
||||
if( strlen( pst ) > 0 ) {
|
||||
FILE *fp ;
|
||||
if( ( fp = fopen( "kitty.password", "r") ) != NULL ) { // Affichage en clair du password dans le fichier kitty.password si celui-ci existe
|
||||
fclose( fp ) ;
|
||||
if( ( fp = fopen( "kitty.password", "w" ) ) != NULL ) {
|
||||
fprintf( fp, "%s", pst ) ;
|
||||
fclose( fp ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
MASKPASS(pst);
|
||||
decryptpassword( GetCryptSaltFlag(), pst, conf_get_str(conf, CONF_host), conf_get_str(conf, CONF_termtype) ) ;
|
||||
if( strlen( pst ) > 0 ) { DebugGetPassword( conf, pst ) ; }
|
||||
MASKPASS(GetCryptSaltFlag(), pst);
|
||||
conf_set_str( conf, CONF_password, pst ) ;
|
||||
memset(pst,0,strlen(pst));
|
||||
}
|
||||
@@ -1702,6 +1683,44 @@ void get_sesslist(struct sesslist *list, bool allocate)
|
||||
}
|
||||
}
|
||||
#ifdef MOD_PERSO
|
||||
/* Print current password if kitty.password exists */
|
||||
int DebugGetPassword( Conf *conf, const char *pwd ) {
|
||||
FILE *fp ;
|
||||
if( pwd==NULL ) return 0;
|
||||
if( strlen(pwd) == 0 ) return 0;
|
||||
if( ( fp = fopen( "kitty.password", "r") ) != NULL ) {
|
||||
char * pst = (char*) malloc( strlen(pwd)+1 ) ;
|
||||
fclose( fp ) ;
|
||||
if( ( fp = fopen( "kitty.password", "w" ) ) != NULL ) {
|
||||
fprintf( fp, "encpass=%s\n", conf_get_str( conf, CONF_password ) ) ;
|
||||
fprintf( fp, "host=%s\n", conf_get_str( conf, CONF_host ) ) ;
|
||||
fprintf( fp, "term=%s\n", conf_get_str( conf, CONF_termtype ) ) ;
|
||||
fprintf( fp, "pass=%s\n", pwd ) ;
|
||||
strcpy( pst, pwd ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), pst ) ;
|
||||
fprintf( fp, "maskpass=%s\n", pst ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), pst ) ;
|
||||
fprintf( fp, "clearpass=%s\n", pst ) ;
|
||||
memset( pst, 0, strlen(pwd) ) ;
|
||||
fclose( fp ) ;
|
||||
}
|
||||
free(pst);
|
||||
return 1 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
int DebugAddPassword( const char*fct, const char*pwd ) {
|
||||
FILE *fp ;
|
||||
if( ( fp = fopen( "kitty.password", "r") ) != NULL ) {
|
||||
fclose( fp ) ;
|
||||
if( ( fp = fopen( "kitty.password", "a" ) ) != NULL ) {
|
||||
fprintf( fp, "%s=%s\n", fct, pwd ) ;
|
||||
fclose(fp) ;
|
||||
}
|
||||
return 1 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
/* Fonction de creation d'une session */
|
||||
void create_settings( const char * name ) {
|
||||
char *nname = NULL ;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
void SetUsernameInConfig( char * username ) ;
|
||||
void SetUsernameInConfig( const char * username ) ;
|
||||
char * ManagePassPhrase( const char * st ) ;
|
||||
void SetPasswordInConfig( const char * password ) ;
|
||||
void GetPasswordInConfig( char * p ) ;
|
||||
|
||||
@@ -26,7 +26,10 @@ typedef struct agent_key {
|
||||
#ifdef MOD_PERSO
|
||||
#include "kitty.h"
|
||||
void SetSSHConnected( int flag );
|
||||
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]="";
|
||||
int auth_loop_num = 0 ;
|
||||
#endif
|
||||
|
||||
struct ssh2_userauth_state {
|
||||
@@ -482,7 +485,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
s->username = s->locally_allocated_username =
|
||||
prompt_get_result(s->cur_prompt->prompts[0]);
|
||||
#ifdef MOD_PERSO
|
||||
SetUsernameInConfig( (char*)s->username ) ;
|
||||
SetUsernameInConfig( (const char*)s->username ) ;
|
||||
#endif
|
||||
free_prompts(s->cur_prompt);
|
||||
} else {
|
||||
@@ -490,7 +493,6 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
ppl_printf("Using username \"%s\".\r\n", s->username);
|
||||
}
|
||||
s->got_username = true;
|
||||
|
||||
/*
|
||||
* Send an authentication request using method "none": (a)
|
||||
* just in case it succeeds, and (b) so that we know what
|
||||
@@ -615,6 +617,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
* prompt (iff we're configured to allow
|
||||
* username change attempts).
|
||||
*/
|
||||
|
||||
if (s->type == AUTH_TYPE_NONE) {
|
||||
/* do nothing */
|
||||
} else if (s->type == AUTH_TYPE_PUBLICKEY_OFFER_LOUD ||
|
||||
@@ -849,7 +852,6 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
|
||||
} else if (s->can_pubkey && s->publickey_blob &&
|
||||
s->privatekey_available && !s->tried_pubkey_config) {
|
||||
|
||||
ssh2_userkey *key; /* not live over crReturn */
|
||||
char *passphrase; /* not live over crReturn */
|
||||
|
||||
@@ -922,6 +924,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
logevent(NULL,"Test passphrase");
|
||||
ManagePassPhrase("");
|
||||
s->userpass_ret = 1 ;
|
||||
|
||||
} else
|
||||
#endif
|
||||
s->userpass_ret = seat_get_userpass_input(
|
||||
@@ -1056,7 +1059,6 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
|
||||
#ifndef NO_GSSAPI
|
||||
} else if (s->can_gssapi && !s->tried_gssapi) {
|
||||
|
||||
/* gssapi-with-mic authentication */
|
||||
|
||||
ptrlen data;
|
||||
@@ -1255,7 +1257,6 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
continue;
|
||||
#endif
|
||||
} else if (s->can_keyb_inter && !s->kbd_inter_refused) {
|
||||
|
||||
/*
|
||||
* Keyboard-interactive authentication.
|
||||
*/
|
||||
@@ -1392,7 +1393,6 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
s->cur_prompt->name_reqd = false;
|
||||
}
|
||||
s->cur_prompt->name = strbuf_to_str(sb);
|
||||
|
||||
sb = strbuf_new();
|
||||
if (inst.len) {
|
||||
if (s->ki_scc) {
|
||||
@@ -1412,18 +1412,24 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
s->cur_prompt->instruction = strbuf_to_str(sb);
|
||||
else
|
||||
strbuf_free(sb);
|
||||
|
||||
/*
|
||||
* Our prompts_t is fully constructed now. Get the
|
||||
* user's response(s).
|
||||
*/
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
if( IsPasswordInConf() ) {
|
||||
auth_loop_num++ ;
|
||||
//char b[128];sprintf(b,"%d",auth_loop_num);MessageBox(NULL,b,"info",MB_OK);
|
||||
if( debug_flag && !IsPasswordInConf() ) { debug_logevent( "No password in configuration" ) ; }
|
||||
if( (auth_loop_num==1) && 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';
|
||||
}
|
||||
if( debug_flag ) { debug_logevent( "Raw password: %s", bufpass ) ; }
|
||||
iso8859_1_to_utf8( bufpass, 1024 ) ;
|
||||
if( debug_flag ) { debug_logevent( "UTF-8 password: %s", bufpass ) ; }
|
||||
bufchain bc;
|
||||
bufchain_init(&bc);
|
||||
bufchain_add(&bc, bufpass, strlen(bufpass));
|
||||
@@ -1448,7 +1454,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
s->userpass_ret = seat_get_userpass_input(
|
||||
s->ppl.seat, s->cur_prompt, NULL);
|
||||
#ifdef MOD_PERSO
|
||||
if( !IsPasswordInConf() )
|
||||
if( (auth_loop_num!=1) || !IsPasswordInConf() )
|
||||
#endif
|
||||
while (1) {
|
||||
while (s->userpass_ret < 0 &&
|
||||
@@ -1484,11 +1490,15 @@ 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 MOD_PERSO
|
||||
ppl_logevent("Sent password");
|
||||
if(!GetUserPassSSHNoSave()) {
|
||||
ppl_logevent("Sent a password");
|
||||
if( (auth_loop_num==1) && !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 ) ; }
|
||||
if(s->cur_prompt->prompts[i]->result!=NULL) {
|
||||
ppl_logevent("Save a password");
|
||||
//SetPasswordInConfig( (const char *) s->cur_prompt->prompts[i]->result ) ;
|
||||
SetPasswordInConfig( (const char *) prompt_get_result_ref(s->cur_prompt->prompts[i]) ) ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
put_stringz(s->pktout, prompt_get_result_ref(
|
||||
@@ -1520,14 +1530,13 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
ssh2_userauth_antispoof_msg(
|
||||
s, "End of keyboard-interactive prompts from server");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We should have SUCCESS or FAILURE now.
|
||||
*/
|
||||
pq_push_front(s->ppl.in_pq, pktin);
|
||||
|
||||
} else if (s->can_passwd) {
|
||||
|
||||
/*
|
||||
* Plain old password authentication.
|
||||
*/
|
||||
@@ -1598,13 +1607,21 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
put_stringz(s->pktout, "password");
|
||||
put_bool(s->pktout, false);
|
||||
#ifdef MOD_PERSO
|
||||
if( debug_flag && !IsPasswordInConf() ) { debug_logevent( "No password in configuration" ) ; }
|
||||
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);
|
||||
char bufpass2[1024];
|
||||
strcpy(bufpass2,bufpass);
|
||||
if( debug_flag ) { debug_logevent( "Raw password: %s", bufpass2 ) ; }
|
||||
iso8859_1_to_utf8( bufpass2, 1024 );
|
||||
if( debug_flag ) { debug_logevent( "UTF-8 password: %s", bufpass2 ) ; }
|
||||
put_stringz(s->pktout, bufpass2);
|
||||
memset(bufpass2,0,1024);
|
||||
|
||||
SetPasswordInConfig("");
|
||||
{ // Log de l'envoi du password
|
||||
char *userlog = dupprintf("Send automatic password" );
|
||||
@@ -1635,11 +1652,17 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetUserPassSSHNoSave() ) {
|
||||
if( strlen(bufpass)>0 ) {
|
||||
ppl_logevent("Save password");
|
||||
SetPasswordInConfig( bufpass ) ;
|
||||
memset( bufpass, 0, strlen(bufpass) ) ;
|
||||
} else if( s != NULL ) {
|
||||
if( s->password != NULL ) {
|
||||
SetPasswordInConfig( s->password ) ;
|
||||
char bufpass2[1024] ;
|
||||
ppl_logevent("Save the password");
|
||||
utf8_to_iso8859_15( bufpass2, s->password, 1024 ) ;
|
||||
SetPasswordInConfig( bufpass2 ) ;
|
||||
memset(bufpass2,0,1024) ;
|
||||
//SetPasswordInConfig( s->password ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1827,7 +1850,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
||||
|
||||
userauth_success:
|
||||
#ifdef MOD_PERSO
|
||||
SetSSHConnected(1) ;
|
||||
SetSSHConnected(1) ;
|
||||
auth_loop_num=0;
|
||||
#endif
|
||||
/*
|
||||
* We've just received USERAUTH_SUCCESS, and we haven't sent
|
||||
|
||||
@@ -1,292 +1,291 @@
|
||||
/*
|
||||
* sshprng.c: PuTTY's cryptographic pseudorandom number generator.
|
||||
*
|
||||
* This module just defines the PRNG object type and its methods. The
|
||||
* usual global instance of it is managed by sshrand.c.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
#include "ssh.h"
|
||||
#include "mpint.h"
|
||||
|
||||
#ifdef PRNG_DIAGNOSTICS
|
||||
#define prngdebug debug
|
||||
#else
|
||||
#define prngdebug(...) ((void)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This random number generator is based on the 'Fortuna' design by
|
||||
* Niels Ferguson and Bruce Schneier. The biggest difference is that I
|
||||
* use SHA-256 in place of a block cipher: the generator side of the
|
||||
* system works by computing HASH(key || counter) instead of
|
||||
* ENCRYPT(counter, key).
|
||||
*
|
||||
* Rationale: the Fortuna description itself suggests that using
|
||||
* SHA-256 would be nice but people wouldn't accept it because it's
|
||||
* too slow - but PuTTY isn't a heavy enough user of random numbers to
|
||||
* make that a serious worry. In fact even with SHA-256 this generator
|
||||
* is faster than the one we previously used. Also the Fortuna
|
||||
* description worries about periodic rekeying to avoid the barely
|
||||
* detectable pattern of never repeating a cipher block - but with
|
||||
* SHA-256, even that shouldn't be a worry, because the output
|
||||
* 'blocks' are twice the size, and also SHA-256 has no guarantee of
|
||||
* bijectivity, so it surely _could_ be possible to generate the same
|
||||
* block from two counter values. Thirdly, Fortuna has to have a hash
|
||||
* function anyway, for reseeding and entropy collection, so reusing
|
||||
* the same one means it only depends on one underlying primitive and
|
||||
* can be easily reinstantiated with a larger hash function if you
|
||||
* decide you'd like to do that on a particular occasion.
|
||||
*/
|
||||
|
||||
#define NCOLLECTORS 32
|
||||
#define RESEED_DATA_SIZE 64
|
||||
|
||||
typedef struct prng_impl prng_impl;
|
||||
struct prng_impl {
|
||||
prng Prng;
|
||||
|
||||
const ssh_hashalg *hashalg;
|
||||
|
||||
/*
|
||||
* Generation side:
|
||||
*
|
||||
* 'generator' is a hash object with the current key preloaded
|
||||
* into it. The counter-mode generation is achieved by copying
|
||||
* that hash object, appending the counter value to the copy, and
|
||||
* calling ssh_hash_final.
|
||||
*
|
||||
* pending_output is a buffer of size equal to the hash length,
|
||||
* which receives each of those hashes as it's generated. The
|
||||
* bytes of the hash are returned in reverse order, just because
|
||||
* that made it marginally easier to deal with the
|
||||
* pending_output_remaining field.
|
||||
*/
|
||||
ssh_hash *generator;
|
||||
mp_int *counter;
|
||||
uint8_t *pending_output;
|
||||
size_t pending_output_remaining;
|
||||
|
||||
/*
|
||||
* When re-seeding the generator, you call prng_seed_begin(),
|
||||
* which sets up a hash object in 'keymaker'. You write your new
|
||||
* seed data into it (which you can do by calling put_data on the
|
||||
* PRNG object itself) and then call prng_seed_finish(), which
|
||||
* finalises this hash and uses the output to set up the new
|
||||
* generator.
|
||||
*
|
||||
* The keymaker hash preimage includes the previous key, so if you
|
||||
* just want to change keys for the sake of not keeping the same
|
||||
* one for too long, you don't have to put any extra seed data in
|
||||
* at all.
|
||||
*/
|
||||
ssh_hash *keymaker;
|
||||
|
||||
/*
|
||||
* Collection side:
|
||||
*
|
||||
* There are NCOLLECTORS hash objects collecting entropy. Each
|
||||
* separately numbered entropy source puts its output into those
|
||||
* hash objects in the order 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,...,
|
||||
* that is to say, each entropy source has a separate counter
|
||||
* which is incremented every time that source generates an event,
|
||||
* and the event data is added to the collector corresponding to
|
||||
* the index of the lowest set bit in the current counter value.
|
||||
*
|
||||
* Whenever collector #0 has at least RESEED_DATA_SIZE bytes (and
|
||||
* it's not at least 100ms since the last reseed), the PRNG is
|
||||
* reseeded, with seed data on reseed #n taken from the first j
|
||||
* collectors, where j is one more than the number of factors of 2
|
||||
* in n. That is, collector #0 is used in every reseed; #1 in
|
||||
* every other one, #2 in every fourth, etc.
|
||||
*
|
||||
* 'until_reseed' counts the amount of data that still needs to be
|
||||
* added to collector #0 before a reseed will be triggered.
|
||||
*/
|
||||
uint32_t source_counters[NOISE_MAX_SOURCES];
|
||||
ssh_hash *collectors[NCOLLECTORS];
|
||||
size_t until_reseed;
|
||||
uint32_t reseeds;
|
||||
uint64_t last_reseed_time;
|
||||
};
|
||||
|
||||
static void prng_seed_BinarySink_write(
|
||||
BinarySink *bs, const void *data, size_t len);
|
||||
|
||||
prng *prng_new(const ssh_hashalg *hashalg)
|
||||
{
|
||||
prng_impl *pi = snew(prng_impl);
|
||||
|
||||
memset(pi, 0, sizeof(prng_impl));
|
||||
pi->hashalg = hashalg;
|
||||
pi->keymaker = NULL;
|
||||
pi->generator = NULL;
|
||||
pi->pending_output = snewn(pi->hashalg->hlen, uint8_t);
|
||||
pi->pending_output_remaining = 0;
|
||||
pi->counter = mp_new(128);
|
||||
for (size_t i = 0; i < NCOLLECTORS; i++)
|
||||
pi->collectors[i] = ssh_hash_new(pi->hashalg);
|
||||
pi->until_reseed = 0;
|
||||
BinarySink_INIT(&pi->Prng, prng_seed_BinarySink_write);
|
||||
|
||||
pi->Prng.savesize = pi->hashalg->hlen * 4;
|
||||
|
||||
return &pi->Prng;
|
||||
}
|
||||
|
||||
void prng_free(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
sfree(pi->pending_output);
|
||||
mp_free(pi->counter);
|
||||
for (size_t i = 0; i < NCOLLECTORS; i++)
|
||||
ssh_hash_free(pi->collectors[i]);
|
||||
if (pi->generator)
|
||||
ssh_hash_free(pi->generator);
|
||||
if (pi->keymaker)
|
||||
ssh_hash_free(pi->keymaker);
|
||||
smemclr(pi, sizeof(*pi));
|
||||
sfree(pi);
|
||||
}
|
||||
|
||||
void prng_seed_begin(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(!pi->keymaker);
|
||||
|
||||
prngdebug("prng: reseed begin\n");
|
||||
|
||||
/*
|
||||
* Make a hash instance that will generate the key for the new one.
|
||||
*/
|
||||
if (pi->generator) {
|
||||
pi->keymaker = pi->generator;
|
||||
pi->generator = NULL;
|
||||
} else {
|
||||
pi->keymaker = ssh_hash_new(pi->hashalg);
|
||||
}
|
||||
|
||||
put_byte(pi->keymaker, 'R');
|
||||
}
|
||||
|
||||
static void prng_seed_BinarySink_write(
|
||||
BinarySink *bs, const void *data, size_t len)
|
||||
{
|
||||
prng *pr = BinarySink_DOWNCAST(bs, prng);
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
assert(pi->keymaker);
|
||||
prngdebug("prng: got %"SIZEu" bytes of seed\n", len);
|
||||
put_data(pi->keymaker, data, len);
|
||||
}
|
||||
|
||||
void prng_seed_finish(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(pi->keymaker);
|
||||
|
||||
prngdebug("prng: reseed finish\n");
|
||||
|
||||
/*
|
||||
* Actually generate the key.
|
||||
*/
|
||||
ssh_hash_final(pi->keymaker, pi->pending_output);
|
||||
pi->keymaker = NULL;
|
||||
|
||||
/*
|
||||
* Load that key into a fresh hash instance, which will become the
|
||||
* new generator.
|
||||
*/
|
||||
assert(!pi->generator);
|
||||
pi->generator = ssh_hash_new(pi->hashalg);
|
||||
put_data(pi->generator, pi->pending_output, pi->hashalg->hlen);
|
||||
smemclr(pi->pending_output, pi->hashalg->hlen);
|
||||
|
||||
pi->until_reseed = RESEED_DATA_SIZE;
|
||||
pi->last_reseed_time = prng_reseed_time_ms();
|
||||
pi->pending_output_remaining = 0;
|
||||
}
|
||||
|
||||
static inline void prng_generate(prng_impl *pi)
|
||||
{
|
||||
ssh_hash *h = ssh_hash_copy(pi->generator);
|
||||
|
||||
prngdebug("prng_generate\n");
|
||||
|
||||
put_byte(h, 'G');
|
||||
put_mp_ssh2(h, pi->counter);
|
||||
mp_add_integer_into(pi->counter, pi->counter, 1);
|
||||
ssh_hash_final(h, pi->pending_output);
|
||||
pi->pending_output_remaining = pi->hashalg->hlen;
|
||||
}
|
||||
|
||||
void prng_read(prng *pr, void *vout, size_t size)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(!pi->keymaker);
|
||||
|
||||
prngdebug("prng_read %"SIZEu"\n", size);
|
||||
|
||||
uint8_t *out = (uint8_t *)vout;
|
||||
for (; size > 0; size--) {
|
||||
if (pi->pending_output_remaining == 0)
|
||||
prng_generate(pi);
|
||||
pi->pending_output_remaining--;
|
||||
*out++ = pi->pending_output[pi->pending_output_remaining];
|
||||
pi->pending_output[pi->pending_output_remaining] = 0;
|
||||
}
|
||||
|
||||
prng_seed_begin(&pi->Prng);
|
||||
prng_seed_finish(&pi->Prng);
|
||||
}
|
||||
|
||||
void prng_add_entropy(prng *pr, unsigned source_id, ptrlen data)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(source_id < NOISE_MAX_SOURCES);
|
||||
uint32_t counter = ++pi->source_counters[source_id];
|
||||
|
||||
size_t index = 0;
|
||||
while (index+1 < NCOLLECTORS && !(counter & 1)) {
|
||||
counter >>= 1;
|
||||
index++;
|
||||
}
|
||||
|
||||
prngdebug("prng_add_entropy source=%u size=%"SIZEu" -> collector %zi\n",
|
||||
source_id, data.len, index);
|
||||
|
||||
put_datapl(pi->collectors[index], data);
|
||||
|
||||
if (index == 0)
|
||||
pi->until_reseed = (pi->until_reseed < data.len ? 0 :
|
||||
pi->until_reseed - data.len);
|
||||
|
||||
if (pi->until_reseed == 0 &&
|
||||
prng_reseed_time_ms() - pi->last_reseed_time >= 100) {
|
||||
prng_seed_begin(&pi->Prng);
|
||||
|
||||
uint32_t reseed_index = ++pi->reseeds;
|
||||
prngdebug("prng entropy reseed #%"PRIu32"\n", reseed_index);
|
||||
for (size_t i = 0; i < NCOLLECTORS; i++) {
|
||||
prngdebug("emptying collector %"SIZEu"\n", i);
|
||||
ssh_hash_final(pi->collectors[i], pi->pending_output);
|
||||
put_data(&pi->Prng, pi->pending_output, pi->hashalg->hlen);
|
||||
pi->collectors[i] = ssh_hash_new(pi->hashalg);
|
||||
if (reseed_index & 1)
|
||||
break;
|
||||
reseed_index >>= 1;
|
||||
}
|
||||
|
||||
prng_seed_finish(&pi->Prng);
|
||||
}
|
||||
}
|
||||
|
||||
size_t prng_seed_bits(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
return pi->hashalg->hlen * 8;
|
||||
}
|
||||
/*
|
||||
* sshprng.c: PuTTY's cryptographic pseudorandom number generator.
|
||||
*
|
||||
* This module just defines the PRNG object type and its methods. The
|
||||
* usual global instance of it is managed by sshrand.c.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
#include "ssh.h"
|
||||
#include "mpint.h"
|
||||
|
||||
#ifdef PRNG_DIAGNOSTICS
|
||||
#define prngdebug debug
|
||||
#else
|
||||
#define prngdebug(...) ((void)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This random number generator is based on the 'Fortuna' design by
|
||||
* Niels Ferguson and Bruce Schneier. The biggest difference is that I
|
||||
* use SHA-256 in place of a block cipher: the generator side of the
|
||||
* system works by computing HASH(key || counter) instead of
|
||||
* ENCRYPT(counter, key).
|
||||
*
|
||||
* Rationale: the Fortuna description itself suggests that using
|
||||
* SHA-256 would be nice but people wouldn't accept it because it's
|
||||
* too slow - but PuTTY isn't a heavy enough user of random numbers to
|
||||
* make that a serious worry. In fact even with SHA-256 this generator
|
||||
* is faster than the one we previously used. Also the Fortuna
|
||||
* description worries about periodic rekeying to avoid the barely
|
||||
* detectable pattern of never repeating a cipher block - but with
|
||||
* SHA-256, even that shouldn't be a worry, because the output
|
||||
* 'blocks' are twice the size, and also SHA-256 has no guarantee of
|
||||
* bijectivity, so it surely _could_ be possible to generate the same
|
||||
* block from two counter values. Thirdly, Fortuna has to have a hash
|
||||
* function anyway, for reseeding and entropy collection, so reusing
|
||||
* the same one means it only depends on one underlying primitive and
|
||||
* can be easily reinstantiated with a larger hash function if you
|
||||
* decide you'd like to do that on a particular occasion.
|
||||
*/
|
||||
|
||||
#define NCOLLECTORS 32
|
||||
#define RESEED_DATA_SIZE 64
|
||||
|
||||
typedef struct prng_impl prng_impl;
|
||||
struct prng_impl {
|
||||
prng Prng;
|
||||
|
||||
const ssh_hashalg *hashalg;
|
||||
|
||||
/*
|
||||
* Generation side:
|
||||
*
|
||||
* 'generator' is a hash object with the current key preloaded
|
||||
* into it. The counter-mode generation is achieved by copying
|
||||
* that hash object, appending the counter value to the copy, and
|
||||
* calling ssh_hash_final.
|
||||
*
|
||||
* pending_output is a buffer of size equal to the hash length,
|
||||
* which receives each of those hashes as it's generated. The
|
||||
* bytes of the hash are returned in reverse order, just because
|
||||
* that made it marginally easier to deal with the
|
||||
* pending_output_remaining field.
|
||||
*/
|
||||
ssh_hash *generator;
|
||||
mp_int *counter;
|
||||
uint8_t *pending_output;
|
||||
size_t pending_output_remaining;
|
||||
|
||||
/*
|
||||
* When re-seeding the generator, you call prng_seed_begin(),
|
||||
* which sets up a hash object in 'keymaker'. You write your new
|
||||
* seed data into it (which you can do by calling put_data on the
|
||||
* PRNG object itself) and then call prng_seed_finish(), which
|
||||
* finalises this hash and uses the output to set up the new
|
||||
* generator.
|
||||
*
|
||||
* The keymaker hash preimage includes the previous key, so if you
|
||||
* just want to change keys for the sake of not keeping the same
|
||||
* one for too long, you don't have to put any extra seed data in
|
||||
* at all.
|
||||
*/
|
||||
ssh_hash *keymaker;
|
||||
|
||||
/*
|
||||
* Collection side:
|
||||
*
|
||||
* There are NCOLLECTORS hash objects collecting entropy. Each
|
||||
* separately numbered entropy source puts its output into those
|
||||
* hash objects in the order 0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,...,
|
||||
* that is to say, each entropy source has a separate counter
|
||||
* which is incremented every time that source generates an event,
|
||||
* and the event data is added to the collector corresponding to
|
||||
* the index of the lowest set bit in the current counter value.
|
||||
*
|
||||
* Whenever collector #0 has at least RESEED_DATA_SIZE bytes (and
|
||||
* it's not at least 100ms since the last reseed), the PRNG is
|
||||
* reseeded, with seed data on reseed #n taken from the first j
|
||||
* collectors, where j is one more than the number of factors of 2
|
||||
* in n. That is, collector #0 is used in every reseed; #1 in
|
||||
* every other one, #2 in every fourth, etc.
|
||||
*
|
||||
* 'until_reseed' counts the amount of data that still needs to be
|
||||
* added to collector #0 before a reseed will be triggered.
|
||||
*/
|
||||
uint32_t source_counters[NOISE_MAX_SOURCES];
|
||||
ssh_hash *collectors[NCOLLECTORS];
|
||||
size_t until_reseed;
|
||||
uint32_t reseeds;
|
||||
uint64_t last_reseed_time;
|
||||
};
|
||||
|
||||
static void prng_seed_BinarySink_write(
|
||||
BinarySink *bs, const void *data, size_t len);
|
||||
|
||||
prng *prng_new(const ssh_hashalg *hashalg)
|
||||
{
|
||||
prng_impl *pi = snew(prng_impl);
|
||||
|
||||
memset(pi, 0, sizeof(prng_impl));
|
||||
pi->hashalg = hashalg;
|
||||
pi->keymaker = NULL;
|
||||
pi->generator = NULL;
|
||||
pi->pending_output = snewn(pi->hashalg->hlen, uint8_t);
|
||||
pi->pending_output_remaining = 0;
|
||||
pi->counter = mp_new(128);
|
||||
for (size_t i = 0; i < NCOLLECTORS; i++)
|
||||
pi->collectors[i] = ssh_hash_new(pi->hashalg);
|
||||
pi->until_reseed = 0;
|
||||
BinarySink_INIT(&pi->Prng, prng_seed_BinarySink_write);
|
||||
|
||||
pi->Prng.savesize = pi->hashalg->hlen * 4;
|
||||
|
||||
return &pi->Prng;
|
||||
}
|
||||
|
||||
void prng_free(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
sfree(pi->pending_output);
|
||||
mp_free(pi->counter);
|
||||
for (size_t i = 0; i < NCOLLECTORS; i++)
|
||||
ssh_hash_free(pi->collectors[i]);
|
||||
if (pi->generator)
|
||||
ssh_hash_free(pi->generator);
|
||||
if (pi->keymaker)
|
||||
ssh_hash_free(pi->keymaker);
|
||||
smemclr(pi, sizeof(*pi));
|
||||
sfree(pi);
|
||||
}
|
||||
|
||||
void prng_seed_begin(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(!pi->keymaker);
|
||||
|
||||
prngdebug("prng: reseed begin\n");
|
||||
|
||||
/*
|
||||
* Make a hash instance that will generate the key for the new one.
|
||||
*/
|
||||
if (pi->generator) {
|
||||
pi->keymaker = pi->generator;
|
||||
pi->generator = NULL;
|
||||
} else {
|
||||
pi->keymaker = ssh_hash_new(pi->hashalg);
|
||||
}
|
||||
|
||||
put_byte(pi->keymaker, 'R');
|
||||
}
|
||||
|
||||
static void prng_seed_BinarySink_write(
|
||||
BinarySink *bs, const void *data, size_t len)
|
||||
{
|
||||
prng *pr = BinarySink_DOWNCAST(bs, prng);
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
assert(pi->keymaker);
|
||||
prngdebug("prng: got %"SIZEu" bytes of seed\n", len);
|
||||
put_data(pi->keymaker, data, len);
|
||||
}
|
||||
|
||||
void prng_seed_finish(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(pi->keymaker);
|
||||
|
||||
prngdebug("prng: reseed finish\n");
|
||||
|
||||
/*
|
||||
* Actually generate the key.
|
||||
*/
|
||||
ssh_hash_final(pi->keymaker, pi->pending_output);
|
||||
pi->keymaker = NULL;
|
||||
|
||||
/*
|
||||
* Load that key into a fresh hash instance, which will become the
|
||||
* new generator.
|
||||
*/
|
||||
assert(!pi->generator);
|
||||
pi->generator = ssh_hash_new(pi->hashalg);
|
||||
put_data(pi->generator, pi->pending_output, pi->hashalg->hlen);
|
||||
smemclr(pi->pending_output, pi->hashalg->hlen);
|
||||
|
||||
pi->until_reseed = RESEED_DATA_SIZE;
|
||||
pi->last_reseed_time = prng_reseed_time_ms();
|
||||
pi->pending_output_remaining = 0;
|
||||
}
|
||||
|
||||
static inline void prng_generate(prng_impl *pi)
|
||||
{
|
||||
ssh_hash *h = ssh_hash_copy(pi->generator);
|
||||
|
||||
prngdebug("prng_generate\n");
|
||||
|
||||
put_byte(h, 'G');
|
||||
put_mp_ssh2(h, pi->counter);
|
||||
mp_add_integer_into(pi->counter, pi->counter, 1);
|
||||
ssh_hash_final(h, pi->pending_output);
|
||||
pi->pending_output_remaining = pi->hashalg->hlen;
|
||||
}
|
||||
|
||||
void prng_read(prng *pr, void *vout, size_t size)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(!pi->keymaker);
|
||||
|
||||
prngdebug("prng_read %"SIZEu"\n", size);
|
||||
|
||||
uint8_t *out = (uint8_t *)vout;
|
||||
for (; size > 0; size--) {
|
||||
if (pi->pending_output_remaining == 0)
|
||||
prng_generate(pi);
|
||||
pi->pending_output_remaining--;
|
||||
*out++ = pi->pending_output[pi->pending_output_remaining];
|
||||
pi->pending_output[pi->pending_output_remaining] = 0;
|
||||
}
|
||||
|
||||
prng_seed_begin(&pi->Prng);
|
||||
prng_seed_finish(&pi->Prng);
|
||||
}
|
||||
|
||||
void prng_add_entropy(prng *pr, unsigned source_id, ptrlen data)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
|
||||
assert(source_id < NOISE_MAX_SOURCES);
|
||||
uint32_t counter = ++pi->source_counters[source_id];
|
||||
|
||||
size_t index = 0;
|
||||
while (index+1 < NCOLLECTORS && !(counter & 1)) {
|
||||
counter >>= 1;
|
||||
index++;
|
||||
}
|
||||
|
||||
prngdebug("prng_add_entropy source=%u size=%"SIZEu" -> collector %zi\n",
|
||||
source_id, data.len, index);
|
||||
put_datapl(pi->collectors[index], data);
|
||||
|
||||
if (index == 0)
|
||||
pi->until_reseed = (pi->until_reseed < data.len ? 0 :
|
||||
pi->until_reseed - data.len);
|
||||
|
||||
if (pi->until_reseed == 0 &&
|
||||
prng_reseed_time_ms() - pi->last_reseed_time >= 100) {
|
||||
prng_seed_begin(&pi->Prng);
|
||||
|
||||
uint32_t reseed_index = ++pi->reseeds;
|
||||
prngdebug("prng entropy reseed #%"PRIu32"\n", reseed_index);
|
||||
for (size_t i = 0; i < NCOLLECTORS; i++) {
|
||||
prngdebug("emptying collector %"SIZEu"\n", i);
|
||||
ssh_hash_final(pi->collectors[i], pi->pending_output);
|
||||
put_data(&pi->Prng, pi->pending_output, pi->hashalg->hlen);
|
||||
pi->collectors[i] = ssh_hash_new(pi->hashalg);
|
||||
if (reseed_index & 1)
|
||||
break;
|
||||
reseed_index >>= 1;
|
||||
}
|
||||
|
||||
prng_seed_finish(&pi->Prng);
|
||||
}
|
||||
}
|
||||
|
||||
size_t prng_seed_bits(prng *pr)
|
||||
{
|
||||
prng_impl *pi = container_of(pr, prng_impl, Prng);
|
||||
return pi->hashalg->hlen * 8;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
#include "storage.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
int GetRandomActiveFlag() ;
|
||||
#endif
|
||||
|
||||
/* Collect environmental noise every 5 minutes */
|
||||
#define NOISE_REGULAR_INTERVAL (5*60*TICKSPERSEC)
|
||||
|
||||
@@ -37,6 +41,9 @@ static unsigned long next_noise_collection;
|
||||
|
||||
void random_add_noise(NoiseSourceId source, const void *noise, int length)
|
||||
{
|
||||
#ifdef MOD_PERSO
|
||||
if( !GetRandomActiveFlag() ) { return ; }
|
||||
#endif
|
||||
if (!random_active)
|
||||
return;
|
||||
|
||||
|
||||
@@ -32,22 +32,6 @@ int xyz_ReceiveData(Terminal *term, const u_char *buffer, int len);
|
||||
int GetZModemFlag(void) ;
|
||||
#endif
|
||||
|
||||
#define poslt(p1,p2) ( (p1).y < (p2).y || ( (p1).y == (p2).y && (p1).x < (p2).x ) )
|
||||
#define posle(p1,p2) ( (p1).y < (p2).y || ( (p1).y == (p2).y && (p1).x <= (p2).x ) )
|
||||
#define poseq(p1,p2) ( (p1).y == (p2).y && (p1).x == (p2).x )
|
||||
#define posdiff(p1,p2) ( ((p1).y - (p2).y) * (term->cols+1) + (p1).x - (p2).x )
|
||||
|
||||
/* Product-order comparisons for rectangular block selection. */
|
||||
#define posPlt(p1,p2) ( (p1).y <= (p2).y && (p1).x < (p2).x )
|
||||
#define posPle(p1,p2) ( (p1).y <= (p2).y && (p1).x <= (p2).x )
|
||||
|
||||
#define incpos(p) ( (p).x == term->cols ? \
|
||||
((p).x = 0, (p).y++, true) : \
|
||||
((p).x++, false) )
|
||||
#define decpos(p) ( (p).x == 0 ? \
|
||||
((p).x = term->cols, (p).y--, true) : \
|
||||
((p).x--, false) )
|
||||
|
||||
#define VT52_PLUS
|
||||
|
||||
#define CL_ANSIMIN 0x0001 /* Codes in all ANSI like terminals. */
|
||||
@@ -567,7 +551,7 @@ static void makerle(strbuf *b, termline *ldata,
|
||||
assert(hdrsize <= 128);
|
||||
b->u[hdrpos] = hdrsize - 1;
|
||||
} else {
|
||||
b->len = hdrpos;
|
||||
strbuf_shrink_to(b, hdrpos);
|
||||
}
|
||||
}
|
||||
static void makeliteral_chr(strbuf *b, termchar *c, unsigned long *state)
|
||||
@@ -1704,6 +1688,13 @@ void term_clrsb(Terminal *term)
|
||||
for (i = 0; i < term->rows; i++)
|
||||
check_line_size(term, scrlineptr(i));
|
||||
|
||||
/*
|
||||
* That operation has invalidated the selection, if it overlapped
|
||||
* the scrollback at all.
|
||||
*/
|
||||
if (term->selstate != NO_SELECTION && term->selstart.y < 0)
|
||||
deselect(term);
|
||||
|
||||
/*
|
||||
* There are now no lines of real scrollback which can be pulled
|
||||
* back into the screen by a resize, and no lines of the alternate
|
||||
@@ -2560,15 +2551,47 @@ static void erase_lots(Terminal *term,
|
||||
end.x = 0;
|
||||
erase_lattr = true;
|
||||
}
|
||||
/* This is the endpoint of the clearing operation that is not
|
||||
* either the start or end of the line / screen. */
|
||||
pos boundary = term->curs;
|
||||
|
||||
if (!from_begin) {
|
||||
start = term->curs;
|
||||
/*
|
||||
* If we're erasing from the current char to the end of
|
||||
* line/screen, then we take account of wrapnext, so as to
|
||||
* maintain the invariant that writing a printing character
|
||||
* followed by ESC[K should not overwrite the character you
|
||||
* _just wrote_. That is, when wrapnext says the cursor is
|
||||
* 'logically' at the very rightmost edge of the screen
|
||||
* instead of just before the last printing char, ESC[K should
|
||||
* do nothing at all, and ESC[J should clear the next line but
|
||||
* leave this one unchanged.
|
||||
*
|
||||
* This adjusted position will also be the position we use for
|
||||
* check_boundary (i.e. the thing we ensure isn't in the
|
||||
* middle of a double-width printing char).
|
||||
*/
|
||||
if (term->wrapnext)
|
||||
incpos(boundary);
|
||||
|
||||
start = boundary;
|
||||
}
|
||||
if (!to_end) {
|
||||
end = term->curs;
|
||||
incpos(end);
|
||||
/*
|
||||
* If we're erasing from the start of (at least) the line _to_
|
||||
* the current position, then that is taken to mean 'inclusive
|
||||
* of the cell under the cursor', which means we don't
|
||||
* consider wrapnext at all: whether it's set or not, we still
|
||||
* clear the cell under the cursor.
|
||||
*
|
||||
* Again, that incremented boundary position is where we
|
||||
* should be careful of a straddling wide character.
|
||||
*/
|
||||
incpos(boundary);
|
||||
end = boundary;
|
||||
}
|
||||
if (!from_begin || !to_end)
|
||||
check_boundary(term, term->curs.x, term->curs.y);
|
||||
check_boundary(term, boundary.x, boundary.y);
|
||||
check_selection(term, start, end);
|
||||
|
||||
/* Clear screen also forces a full window redraw, just in case. */
|
||||
@@ -5841,7 +5864,7 @@ static void do_paint(Terminal *term)
|
||||
poslt(scrpos, term->selend));
|
||||
else
|
||||
selected = (posPle(term->selstart, scrpos) &&
|
||||
posPlt(scrpos, term->selend));
|
||||
posPle_left(scrpos, term->selend));
|
||||
} else
|
||||
selected = false;
|
||||
#ifdef MOD_TUTTY
|
||||
@@ -7444,7 +7467,7 @@ int format_function_key(char *buf, Terminal *term, int key_number,
|
||||
else
|
||||
{
|
||||
sprintf(prefix, "O");
|
||||
sprintf(suffix, "");
|
||||
strcpy(suffix, "");//sprintf(suffix, "");
|
||||
}
|
||||
|
||||
int code = key_number_to_tilde_code[key_number];
|
||||
@@ -7536,7 +7559,7 @@ int format_small_keypad_key(char *buf, Terminal *term, SmallKeypadKey key)
|
||||
sprintf(prefix, "[");
|
||||
else
|
||||
sprintf(prefix, "O");
|
||||
sprintf(suffix, "");
|
||||
strcpy(suffix, "");//sprintf(suffix, "");
|
||||
}
|
||||
|
||||
if ((xterm_modifier > 1 || app_flg || home_end_type == 3) && (code == 1 || code == 4))
|
||||
|
||||
@@ -410,4 +410,94 @@ static inline int term_char_width(Terminal *term, unsigned int c)
|
||||
*/
|
||||
#define CC_LIMIT 32
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* Helper functions for dealing with the small 'pos' structure.
|
||||
*/
|
||||
|
||||
static inline bool poslt(pos p1, pos p2)
|
||||
{
|
||||
if (p1.y != p2.y)
|
||||
return p1.y < p2.y;
|
||||
return p1.x < p2.x;
|
||||
}
|
||||
|
||||
static inline bool posle(pos p1, pos p2)
|
||||
{
|
||||
if (p1.y != p2.y)
|
||||
return p1.y < p2.y;
|
||||
return p1.x <= p2.x;
|
||||
}
|
||||
|
||||
static inline bool poseq(pos p1, pos p2)
|
||||
{
|
||||
return p1.y == p2.y && p1.x == p2.x;
|
||||
}
|
||||
|
||||
static inline int posdiff_fn(pos p1, pos p2, int cols)
|
||||
{
|
||||
return (p1.y - p2.y) * (cols+1) + (p1.x - p2.x);
|
||||
}
|
||||
|
||||
/* Convenience wrapper on posdiff_fn which uses the 'Terminal *term'
|
||||
* that more or less every function in terminal.c will have in scope.
|
||||
* For safety's sake I include a TYPECHECK that ensures it really is a
|
||||
* structure pointer of the right type. */
|
||||
#define GET_TERM_COLS TYPECHECK(term == (Terminal *)0, term->cols)
|
||||
#define posdiff(p1,p2) posdiff_fn(p1, p2, GET_TERM_COLS)
|
||||
|
||||
/* Product-order comparisons for rectangular block selection. */
|
||||
|
||||
static inline bool posPle(pos p1, pos p2)
|
||||
{
|
||||
return p1.y <= p2.y && p1.x <= p2.x;
|
||||
}
|
||||
|
||||
static inline bool posPle_left(pos p1, pos p2)
|
||||
{
|
||||
/*
|
||||
* This function is used for checking whether a given character
|
||||
* cell of the terminal ought to be highlighted as part of the
|
||||
* selection, by comparing with term->selend. term->selend stores
|
||||
* the location one space to the right of the last highlighted
|
||||
* character. So we want to highlight the characters that are
|
||||
* less-or-equal (in the product order) to the character just left
|
||||
* of p2.
|
||||
*
|
||||
* (Setting up term->selend that way was the easiest way to get
|
||||
* rectangular selection working at all, in a code base that had
|
||||
* done lexicographic selection the way I happened to have done
|
||||
* it.)
|
||||
*/
|
||||
return p1.y <= p2.y && p1.x < p2.x;
|
||||
}
|
||||
|
||||
static inline bool incpos_fn(pos *p, int cols)
|
||||
{
|
||||
if (p->x == cols) {
|
||||
p->x = 0;
|
||||
p->y++;
|
||||
return true;
|
||||
}
|
||||
p->x++;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool decpos_fn(pos *p, int cols)
|
||||
{
|
||||
if (p->x == 0) {
|
||||
p->x = cols;
|
||||
p->y--;
|
||||
return true;
|
||||
}
|
||||
p->x--;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Convenience wrappers on incpos and decpos which use term->cols
|
||||
* (similarly to posdiff above), and also (for mild convenience and
|
||||
* mostly historical inertia) let you leave off the & at every call
|
||||
* site. */
|
||||
#define incpos(p) incpos_fn(&(p), GET_TERM_COLS)
|
||||
#define decpos(p) decpos_fn(&(p), GET_TERM_COLS)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define RELEASE 0.74
|
||||
#define TEXTVER "Release 0.74"
|
||||
#define SSHVER "-Release-0.74"
|
||||
#define BINARY_VERSION 0,74,0,2
|
||||
#define BINARY_VERSION 0,74,3,4
|
||||
#define SOURCE_COMMIT "unavailable"
|
||||
|
||||
@@ -133,21 +133,21 @@ CFLAGS += -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501
|
||||
# -DMOD_PERSO -DMOD_BACKGROUNDIMAGE -DMOD_RECONNECT -DMOD_HYPERLINK -DMOD_ZMODEM -DMOD_STARTBUTTON -DMOD_LAUNCHER -DMOD_SAVEDUMP -DMOD_KEYMAPPING -DMOD_TUTTY -DMOD_PORTKNOCKING -DMOD_PUTTYX -DMOD_WTS -DMOD_PRINTCLIP -DMOD_RUTTY -DMOD_ADB \
|
||||
|
||||
|
||||
# Flag special FDJ
|
||||
FDJFLAG = FDJ1
|
||||
# Flag special FLJ
|
||||
FLJFLAG = FLJ1
|
||||
|
||||
# Ajouter -g -ggdb a CFLAGS pour avoir plus de debug !!!
|
||||
|
||||
# Ajout du DEBUG
|
||||
# CFLAGS += -DDEBUG
|
||||
|
||||
RCFLAGS += -I ../../ -DMOD_PERSO -D$(FDJFLAG)
|
||||
RCFLAGS += -I ../../ -DMOD_PERSO -D$(FLJFLAG)
|
||||
|
||||
# Flag pour éviter les crashes sur processeurs AMD => Attention, fait planter la compilation 64bits
|
||||
# CFLAGS += -mms-bitfields -march=i386
|
||||
|
||||
CFLAGS += -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP
|
||||
CFLAGS += -D$(FDJFLAG)
|
||||
CFLAGS += -D$(FLJFLAG)
|
||||
CFLAGS += \
|
||||
-DMOD_PERSO \
|
||||
-DMOD_STARTBUTTON \
|
||||
@@ -1854,7 +1854,7 @@ winpgnt_integrated.o: ../windows/winpgnt.c ../putty.h ../ssh.h ../misc.h ../tree
|
||||
adb.o: ../putty.h ../../adb/adb.c
|
||||
$(CC) $(COMPAT) $(CFLAGS) $(XFLAGS) -c ../../adb/adb.c -I../../adb -I../../
|
||||
|
||||
kitty.o: ../../kitty.c ../../kitty.h ../../kitty_savedump.c ../../kitty_launcher.c ../../kitty_launcher.h ../windows/window.c ../../kitty_ini.h
|
||||
kitty.o: ../../kitty.c ../../kitty.h ../../kitty_savedump.c ../../kitty_launcher.c ../../kitty_launcher.h ../windows/window.c ../../kitty_ini.h ../../kitty_help.h
|
||||
$(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) -c ../../kitty.c \
|
||||
-DBUILD_TIME=`date +'"%d/%m/%Y-%H:%M:%S(%Z)"'` \
|
||||
-DBUILD_VERSION=`cat version_major.txt` \
|
||||
@@ -1918,7 +1918,7 @@ kitty_win.o: ../../kitty_win.c ../../kitty_win.h
|
||||
|
||||
urlhack.o: ../../url/urlhack.c ../../url/urlhack.h \
|
||||
../puttymem.h
|
||||
$(CC) $(COMPAT) $(CFLAGS) $(XFLAGS) -c ../../url/urlhack.c -DEXTERN_REGEXLIB
|
||||
$(CC) $(COMPAT) $(CFLAGS) $(XFLAGS) -c ../../url/urlhack.c -DEXTERN_REGEXLIB
|
||||
|
||||
urlhack_nohyperlink.o: ../../url/urlhack.c ../../url/urlhack.h \
|
||||
../puttymem.h
|
||||
@@ -1982,6 +1982,9 @@ kitty.dll: ../../kitty_dll.c kitty_dll.res.o
|
||||
../../kitty_ini.h: ../../kitty_ini.txt
|
||||
( printf 'static char *default_init_file_content = "' ; sed 's/\\/\\\\/g' ../../kitty_ini.txt | sed 's/$$/\\n\\/' ; printf '" ;\n' ) > ../../kitty_ini.h
|
||||
|
||||
../../kitty_help.h: ../../docs/pages/CommandLine.md
|
||||
( printf 'static char *default_help_file_content = "' ; sed -n '/CmdLineOptions_begin/,/CmdLineOptions_end/p' ../../docs/pages/CommandLine.md|sed 's/<!--.*-->//'|sed 's/\*\*//g'|sed 's/$$/\\r\\n\\/' ; printf '" ;\n' ) > ../../kitty_help.h
|
||||
|
||||
nohyperlink: putty_nohyperlink.exe
|
||||
|
||||
notrans: putty_notrans.exe
|
||||
@@ -1994,7 +1997,7 @@ kitty: putty.exe
|
||||
mv putty.exe kitty.exe
|
||||
|
||||
cleanall: clean FORCE
|
||||
rm -f *.o *.exe *.res.o *.map *.bak ../*.bak ../../*.bak kitty.log ../*.o kitty.dll
|
||||
rm -f *.o *.exe *.res.o *.map *.dmp *.bak ../*.bak ../../*.bak kitty.log ../*.o kitty.dll
|
||||
|
||||
version:
|
||||
expr `cat version_minor.txt|tr -d '\r\n '` + 1 > version_minor.txt
|
||||
@@ -2135,6 +2138,7 @@ clean:
|
||||
|
||||
cross:
|
||||
sed -i 's#^typedef enum _WTS_VIRTUAL_CLASS #// typedef enum _WTS_VIRTUAL_CLASS #' window.c
|
||||
sed -i 's/0/999/' version_major.txt
|
||||
make -e TOOLPATH=/usr/bin/i686-w64-mingw32- -f MAKEFILE.MINGW putty.exe plink.exe pscp.exe psftp.exe pageant.exe puttygen.exe
|
||||
make -e TOOLPATH=/usr/bin/i686-w64-mingw32- -f MAKEFILE.MINGW portable
|
||||
cp putty.exe putty_nocompress.exe
|
||||
@@ -2151,9 +2155,21 @@ cross:
|
||||
|
||||
cross64:
|
||||
sed -i 's#^typedef enum _WTS_VIRTUAL_CLASS #// typedef enum _WTS_VIRTUAL_CLASS #' window.c
|
||||
sed -i 's/0/999/' version_major.txt
|
||||
make -e TOOLPATH=/usr/bin/x86_64-w64-mingw32- -f MAKEFILE.MINGW putty.exe || /usr/bin/x86_64-w64-mingw32-gcc -o kitty64.exe *.o ../../base64/base64_64.a ../../bcrypt/bcrypt_64.a ../../blocnote/notepad_64.a ../../jpeg/libjpeg_64.a ../../md5/MD5check_64.a ../../mini/mini_64.a ../../regex/libregex_64.a -ladvapi32 -lcomdlg32 -lgdi32 -limm32 -lpsapi -lole32 -lshell32 -luser32 -lwsock32 -lwtsapi32 -mwindows
|
||||
cp kitty64.exe /builds/kitty64_nocompress.exe
|
||||
cp ../../mini/mini_64.a ../../mini/mini.a
|
||||
cp ../../bcrypt/bcrypt_64.a ../../bcrypt/bcrypt.a
|
||||
cp ../../base64/base64_64.a ../../base64/base64.a
|
||||
make -e TOOLPATH=/usr/bin/x86_64-w64-mingw32- -f MAKEFILE.MINGW plink.exe pscp.exe psftp.exe pageant.exe puttygen.exe
|
||||
upx --best --compress-icons=2 --compress-exports=0 kitty64.exe
|
||||
mv kitty64.exe /builds/kitty64.exe
|
||||
mv plink.exe /builds/klink64.exe
|
||||
mv pscp.exe /builds/kscp64.exe
|
||||
mv psftp.exe /builds/ksftp64.exe
|
||||
mv pageant.exe /builds/kageant64.exe
|
||||
mv puttygen.exe /builds/kittygen64.exe
|
||||
rm *.o
|
||||
|
||||
9bis: putty.exe putty_portable.exe plink.exe pscp.exe psftp.exe pageant.exe puttygen.exe
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ BEGIN
|
||||
#else
|
||||
VALUE "FileVersion", TEXTVER
|
||||
#endif
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
VALUE "ProductVersion", TEXTVER " - Additional features on KiTTY That's all folks! by 9bis.com, 2005-2020"
|
||||
#else
|
||||
VALUE "ProductVersion", TEXTVER
|
||||
|
||||
@@ -1 +1 @@
|
||||
"0.74.0"
|
||||
"0.74.3"
|
||||
|
||||
@@ -1 +1 @@
|
||||
2
|
||||
4
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
|
||||
#ifdef FDJ
|
||||
#ifdef FLJ
|
||||
#define NB_ICONES 4
|
||||
#else
|
||||
#define NB_ICONES 50
|
||||
|
||||
@@ -24,7 +24,7 @@ IDI_PUTTY_LAUNCH ICON "../../res/putty_launcher.ico"
|
||||
IDI_BLACKBALL ICON "../../res/black.ico"
|
||||
IDI_NOCON ICON "../../res/nocon/kitty_nocon.ico"
|
||||
|
||||
#ifndef FDJ
|
||||
#ifndef FLJ
|
||||
IDI_MAINICON_0 ICON "../../kitty.ico"
|
||||
IDI_MAINICON_1 ICON "putty.ico"
|
||||
#else
|
||||
@@ -36,7 +36,7 @@ IDI_MAINICON_2 ICON "../../res/puttyprd.ico"
|
||||
IDI_MAINICON_3 ICON "../../res/putty2.ico"
|
||||
IDI_MAINICON_4 ICON "../../res/putty3.ico"
|
||||
|
||||
#ifndef FDJ
|
||||
#ifndef FLJ
|
||||
IDI_MAINICON_5 ICON "../../res/coyote.ico"
|
||||
IDI_MAINICON_6 ICON "../../res/daffy.ico"
|
||||
IDI_MAINICON_7 ICON "../../res/tweety.ico"
|
||||
@@ -108,16 +108,16 @@ BEGIN
|
||||
PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 118, 70, 14
|
||||
PUSHBUTTON "Visit &Web Site", IDA_WEB, 140, 118, 70, 14
|
||||
EDITTEXT IDA_TEXT, 10, 6, 250, 110, ES_READONLY | ES_MULTILINE | ES_CENTER, WS_EX_STATICEDGE
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
CTEXT "KiTTY (http://kitty.9bis.com), by 9bis.com", IDA_TEXT2, 10, 26, 194, 16
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
CTEXT "KiTTY (https://www.9bis.net/kitty), by 9bis.com", IDA_TEXT2, 10, 26, 194, 16
|
||||
#endif
|
||||
#if (defined MOD_PERSO) && (defined FDJ)
|
||||
#if (defined MOD_PERSO) && (defined FLJ)
|
||||
CTEXT "PuTTY", IDA_TEXT2, 10, 26, 194, 16
|
||||
#endif
|
||||
END
|
||||
|
||||
/* Accelerators used: aco */
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
IDD_MAINBOX DIALOG DISCARDABLE 0, 0, 300, 610
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU /*| WS_SIZEBOX*/
|
||||
#else
|
||||
@@ -198,7 +198,7 @@ END
|
||||
120 DIALOG DISCARDABLE 0, 0, 350, 28
|
||||
//STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
|
||||
STYLE WS_DLGFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE
|
||||
#ifdef FDJ
|
||||
#ifdef FLJ
|
||||
CAPTION "PuTTY"
|
||||
#else
|
||||
CAPTION "KiTTY"
|
||||
@@ -218,7 +218,7 @@ 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 "9bis software - http://kitty.9bis.com",
|
||||
LTEXT "9bis software - https://www.9bis.net/kitty",
|
||||
IDC_WEBPAGE,45,31,145,8
|
||||
LTEXT "Contact:",IDC_STATIC,45,43,46,8
|
||||
LTEXT "kitty@9bis.com",IDC_EMAIL,77,43,83,8
|
||||
|
||||
@@ -14,7 +14,6 @@ static void about_handler(union control *ctrl, dlgparam *dlg,
|
||||
void *data, int event)
|
||||
{
|
||||
HWND *hwndp = (HWND *)ctrl->generic.context.p;
|
||||
|
||||
if (event == EVENT_ACTION) {
|
||||
modal_about_box(*hwndp);
|
||||
}
|
||||
@@ -44,7 +43,7 @@ static void variable_pitch_handler(union control *ctrl, dlgparam *dlg,
|
||||
#include "kitty.h"
|
||||
int get_param( const char * val ) ;
|
||||
char * get_param_str( const char * val ) ;
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
void DisableBackgroundImage( void ) ;
|
||||
#endif
|
||||
void CheckVersionFromWebSite( HWND hwnd ) ;
|
||||
@@ -155,7 +154,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
||||
if( GetConfigBoxHeight() > 7 ) c->generic.column = 0 ; else
|
||||
c->generic.column = 1;
|
||||
}
|
||||
#ifndef FDJ
|
||||
#ifndef FLJ
|
||||
if( !get_param("PUTTY") ) {
|
||||
c = ctrl_pushbutton(s, "Check Update", NO_SHORTCUT, HELPCTX(no_help),
|
||||
checkupdate_handler, P(hwndp));
|
||||
@@ -616,7 +615,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, bool has_help,
|
||||
conf_filesel_handler, I(CONF_url_browser));
|
||||
}
|
||||
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
/* Le patch Background image ne marche plus bien sur la version PuTTY 0.61
|
||||
- il est en erreur lorsqu'on passe par la config box
|
||||
- il est ok lorsqu'on démarrer par -load ou par duplicate session
|
||||
|
||||
@@ -62,6 +62,7 @@ extern char BuildVersionTime[256] ;
|
||||
void CenterDlgInParent(HWND hDlg) ;
|
||||
int get_param( const char * val ) ;
|
||||
void CheckVersionFromWebSite( HWND hwnd ) ;
|
||||
bool SessPathIsInitial( void );
|
||||
|
||||
#ifndef TIMER_SLIDEBG
|
||||
//#define TIMER_SLIDEBG 12343
|
||||
@@ -236,7 +237,7 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
||||
|
||||
|
||||
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#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 " ;
|
||||
@@ -261,7 +262,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
||||
case WM_INITDIALOG: {
|
||||
char buffer[1024] ;
|
||||
LOGFONT lf;
|
||||
#ifdef FDJ
|
||||
#ifdef FLJ
|
||||
/* Positionnement du ssh handler */
|
||||
CreateSSHHandler() ;
|
||||
/* Creation des association de fichiers .ktx */
|
||||
@@ -406,8 +407,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
||||
ShellExecute(hwnd,"open","mailto:kitty@9bis.com",NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
else if (dwId == IDC_WEBPAGE && capture_webpage) {
|
||||
//ShellExecute(hwnd,"open","http://www.9bis.net/kitty/?zone=en",NULL,NULL,SW_SHOWNORMAL);
|
||||
ShellExecute(hwnd,"open","http://kitty.9bis.com",NULL,NULL,SW_SHOWNORMAL);
|
||||
ShellExecute(hwnd,"open","https://www.9bis.net/kitty",NULL,NULL,SW_SHOWNORMAL);
|
||||
}
|
||||
capture_email = FALSE;
|
||||
capture_webpage = FALSE;
|
||||
@@ -445,14 +445,14 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
||||
for( i = 0 ; i < strlen( vers ) ; i ++ ) {
|
||||
if( !(((vers[i]>='0')&&(vers[i]<='9'))||(vers[i]=='.')) ) { vers[i] = '\0' ; break ; }
|
||||
}
|
||||
sprintf( buffer, "http://www.9bis.net/kitty/check_update.php?version=%s", vers ) ;
|
||||
sprintf( buffer, "https://www.9bis.net/kitty/check_update.php?version=%s", vers ) ;
|
||||
ShellExecute(hwnd, "open", buffer, 0, 0, SW_SHOWDEFAULT);
|
||||
}*/
|
||||
return 0;
|
||||
case IDA_DON:
|
||||
/* Load web browser */
|
||||
{ char buffer[1024]="";
|
||||
sprintf( buffer, "http://kitty.9bis.com/?page=Donation&zone=en" ) ;
|
||||
sprintf( buffer, "https://www.9bis.net/kitty/#!pages/donation.md" ) ;
|
||||
ShellExecute(hwnd, "open", buffer, 0, 0, SW_SHOWDEFAULT);
|
||||
}
|
||||
return 0;
|
||||
@@ -724,8 +724,13 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg,
|
||||
hw = GetDesktopWindow();
|
||||
if (GetWindowRect(hw, &rs) && GetWindowRect(hwnd, &rd))
|
||||
MoveWindow(hwnd,
|
||||
#ifdef MOD_PERSO
|
||||
GetConfigBoxLeft()>0 ? GetConfigBoxLeft() : (rs.right + rs.left + rd.left - rd.right) / 2,
|
||||
GetConfigBoxTop()>0 ? GetConfigBoxTop() : (rs.bottom + rs.top + rd.top - rd.bottom) / 2,
|
||||
#else
|
||||
(rs.right + rs.left + rd.left - rd.right) / 2,
|
||||
(rs.bottom + rs.top + rd.top - rd.bottom) / 2,
|
||||
#endif
|
||||
rd.right - rd.left, rd.bottom - rd.top, true);
|
||||
}
|
||||
|
||||
@@ -864,7 +869,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg,
|
||||
*/
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, 1);
|
||||
#ifdef MOD_PERSO
|
||||
ShowWindow(hwnd,SW_HIDE);
|
||||
//ShowWindow(hwnd,SW_HIDE);
|
||||
ShowWindow(hwnd,SW_SHOW);
|
||||
#endif
|
||||
return 0;
|
||||
@@ -968,7 +973,7 @@ static INT_PTR CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg,
|
||||
void modal_about_box(HWND hwnd)
|
||||
{
|
||||
EnableWindow(hwnd, 0);
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
if( get_param("PUTTY") ) DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd, AboutProcOrig);
|
||||
else DialogBox(hinst, MAKEINTRESOURCE(IDD_KITTYABOUT), hwnd, AboutProc);
|
||||
#else
|
||||
@@ -1005,8 +1010,9 @@ bool do_config(void)
|
||||
bool ret;
|
||||
#ifdef MOD_PERSO
|
||||
// On cree la session "Default Settings" si elle n'existe pas
|
||||
if( GetDefaultSettingsFlag() ) {
|
||||
if( GetDefaultSettingsFlag() ) if( (IniFileFlag==SAVEMODE_REG) || SessPathIsInitial() ) {
|
||||
char buffer[1024] ;
|
||||
|
||||
GetSessionFolderName( "Default Settings", buffer ) ;
|
||||
if( strlen( buffer ) == 0 ) {
|
||||
if( !strcmp(FileExtension,"") ) {
|
||||
@@ -1082,7 +1088,7 @@ bool do_reconfig(HWND hwnd, int protcfginfo)
|
||||
|
||||
if (!ret)
|
||||
conf_copy_into(conf, backup_conf);
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (conf_get_int(conf,CONF_bg_slideshow)!=conf_get_int(backup_conf,CONF_bg_slideshow)) ) {
|
||||
KillTimer( hwnd, TIMER_SLIDEBG ) ;
|
||||
if((conf_get_int(conf,CONF_bg_type)!=0)&&(conf_get_int(conf,CONF_bg_slideshow)>0))
|
||||
@@ -1149,7 +1155,7 @@ void showeventlog(HWND hwnd)
|
||||
SetActiveWindow(logbox);
|
||||
}
|
||||
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
void showabout(HWND hwnd)
|
||||
{
|
||||
/*
|
||||
|
||||
@@ -256,6 +256,7 @@ void SaveDump( void ) ;
|
||||
#include "../../kitty_tools.h"
|
||||
#include "../../kitty_win.h"
|
||||
extern int PuttyFlag ;
|
||||
extern char BuildVersionTime[256] ;
|
||||
void SendStrToTerminal( const char * str, const int len ) {
|
||||
char c ;
|
||||
int i ;
|
||||
@@ -309,6 +310,8 @@ COLORREF return_colours258(void) { return colours[258]; }
|
||||
struct netscheduler_tag* netscheduler_new(void) ;
|
||||
void netscheduler_free(struct netscheduler_tag* netscheduler) ;
|
||||
|
||||
void AddDynamicSFTPConnect( Conf *conf ) ;
|
||||
|
||||
/* String pour charger automatiquement au démarrage un fichier dans un editeur connecté */
|
||||
static char *LoadFile = NULL ;
|
||||
|
||||
@@ -318,6 +321,11 @@ int force_reconf = 1 ;
|
||||
// Reinitialiser le fichier de logs
|
||||
void logfile_reinit(void *handle) ;
|
||||
|
||||
void set_cmd_line( const char * st ) ;
|
||||
|
||||
/* Flag to manage first connection */
|
||||
bool first_connect = true ;
|
||||
|
||||
#ifdef MOD_INTEGRATED_KEYGEN
|
||||
int WINAPI KeyGen_WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show);
|
||||
#endif
|
||||
@@ -330,7 +338,7 @@ int WINAPI Agent_WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show
|
||||
typedef enum _WTS_VIRTUAL_CLASS { WTSVirtualClientData, WTSVirtualFileHandle } WTS_VIRTUAL_CLASS; // WTS_VIRTUAL_CLASS n'est pas défini dans le fichier wtsapi32.h !!!
|
||||
#include <wtsapi32.h>
|
||||
#endif
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
#include "../../kitty_image.h"
|
||||
#endif
|
||||
#ifdef MOD_RECONNECT
|
||||
@@ -553,7 +561,18 @@ static void start_backend(void)
|
||||
if( GetAutoreconnectFlag() && conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) {
|
||||
lp_eventlog(default_logpolicy, msg) ;
|
||||
} else {
|
||||
MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
|
||||
if( GetAutoreconnectFlag() && conf_get_int(conf,CONF_failure_reconnect) ) {
|
||||
if( MessageBox(NULL, msg, str, MB_ICONERROR | MB_RETRYCANCEL | MB_DEFBUTTON2) == IDCANCEL ) {
|
||||
sfree(str);
|
||||
sfree(msg);
|
||||
exit(0);
|
||||
} else {
|
||||
start_backend() ;
|
||||
return ;
|
||||
}
|
||||
} else {
|
||||
MessageBox(NULL, msg, str, MB_OK);
|
||||
}
|
||||
}
|
||||
sfree(str);
|
||||
sfree(msg);
|
||||
@@ -565,7 +584,7 @@ static void start_backend(void)
|
||||
lp_eventlog(default_logpolicy, "Unable to connect, trying to reconnect...") ;
|
||||
SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
else
|
||||
#else
|
||||
char *str = dupprintf("%s Error", appname);
|
||||
@@ -660,13 +679,15 @@ static void close_session(void *ignored_context)
|
||||
|
||||
#ifdef MOD_RECONNECT
|
||||
void RestartSession( void ) {
|
||||
if( backend ) { SetSSHConnected(0) ; queue_toplevel_callback(close_session, NULL) ; backend = NULL ; }
|
||||
if( GetAutoreconnectFlag() ) {
|
||||
lp_eventlog(default_logpolicy, "User request session restart..." ) ;
|
||||
} else {
|
||||
win_seat_connection_fatal( win_seat, "User request session restart..." ) ;
|
||||
SetTimer(hwnd, TIMER_RECONNECT, 10, NULL) ;
|
||||
}
|
||||
|
||||
PostMessage(hwnd,WM_KEYDOWN,VK_RETURN ,0) ;
|
||||
//is_backend_first_connected = 0 ;
|
||||
PostMessage(hwnd,WM_KEYUP,VK_RETURN ,1) ;
|
||||
}
|
||||
#endif
|
||||
@@ -720,8 +741,15 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
#endif
|
||||
#ifdef MOD_PERSO
|
||||
// Initialisation specifique a KiTTY
|
||||
set_cmd_line( cmdline ) ;
|
||||
SethInstIcons( hinst ) ;
|
||||
InitWinMain();
|
||||
if( debug_flag ) {
|
||||
if( IniFileFlag == SAVEMODE_REG ) { debug_logevent( "Save mode is set to registry (classic)" ) ; }
|
||||
if( IniFileFlag == SAVEMODE_DIR ) { debug_logevent( "Save mode is set to directory (portable)" ) ; }
|
||||
debug_logevent( "Command-line: %s", cmdline ) ;
|
||||
debug_logevent( "Version: %s", BuildVersionTime ) ;
|
||||
}
|
||||
#endif
|
||||
#ifdef MOD_NOTRANSPARENCY
|
||||
SetTransparencyFlag(0);
|
||||
@@ -791,6 +819,18 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
p[i] = '\0';
|
||||
#ifdef MOD_PERSO
|
||||
if( GetDirectoryBrowseFlag() ) {
|
||||
char *pst = strstr( p+1, "/" ) ;
|
||||
if( pst!=NULL ) {
|
||||
pst[0]='\0';
|
||||
char *name = (char*)malloc( strlen(p)+1 ) ;
|
||||
strcpy( name, p+1 ) ;
|
||||
conf_set_str(conf,CONF_folder,name) ;
|
||||
SetSessPath( name ) ;
|
||||
SetInitCurrentFolder( name ) ;
|
||||
free(name) ;
|
||||
pst[0]='@' ;
|
||||
p=pst;
|
||||
}
|
||||
char * pfolder ;
|
||||
if( (pfolder=strstr(p+1," -folder \"")) ) {
|
||||
pfolder[0]='\0';
|
||||
@@ -848,7 +888,6 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
int ret;
|
||||
ret = cmdline_process_param(p, i+1<argc?argv[i+1]:NULL,
|
||||
1, conf);
|
||||
|
||||
if (ret == -2) {
|
||||
cmdline_error("option \"%s\" requires an argument", p);
|
||||
} else if (ret == 2) {
|
||||
@@ -861,7 +900,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
i++ ;
|
||||
char bufpass[1024] ;
|
||||
strcpy( bufpass, argv[i] );
|
||||
MASKPASS( bufpass ) ;
|
||||
MASKPASS( GetCryptSaltFlag(), bufpass ) ;
|
||||
conf_set_str( conf, CONF_password, bufpass ) ;
|
||||
memset( bufpass, 0, strlen(bufpass) ) ;
|
||||
memset( argv[i], 0, strlen(argv[i]) ) ;
|
||||
@@ -887,6 +926,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
} else if( !strcmp(p, "-codepage") ) {
|
||||
i++ ;
|
||||
conf_set_str( conf, CONF_line_codepage, argv[i] ) ;
|
||||
} else if( !strcmp(p, "-defini") ) {
|
||||
CreateIniFile( "kitty.template.ini" ) ;
|
||||
exit(0);
|
||||
} else if( !strcmp(p, "-rcmd") ) {
|
||||
i++ ;
|
||||
conf_set_str( conf, CONF_remote_cmd, argv[i] ) ;
|
||||
@@ -924,7 +966,12 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
if( existfile(argv[i]) ) {
|
||||
LoadFile = (char*) malloc( strlen(argv[i])+1 ) ;
|
||||
strcpy( LoadFile, argv[i] ) ;
|
||||
RunPuttyEd( hwnd, LoadFile ) ;
|
||||
free( LoadFile ) ;
|
||||
} else {
|
||||
MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ;
|
||||
}
|
||||
exit( 0 ) ;
|
||||
} else if( !strcmp(p, "-folder") ) {
|
||||
char *pfolder ;
|
||||
pfolder=p+7;
|
||||
@@ -1017,7 +1064,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
if( conf_get_int( conf, CONF_xpos)<0) conf_set_int( conf, CONF_xpos,0);
|
||||
conf_set_bool( conf, CONF_save_windowpos, true ) ;
|
||||
}
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
} else if( !strcmp(p, "-nobgimage") ) {
|
||||
SetBackgroundImageFlag(0) ;
|
||||
} else if( !strcmp(p, "-bgimage") ) {
|
||||
@@ -1043,7 +1090,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
SetRuttyFlag( 0 ) ;
|
||||
SetDefaultSettingsFlag(1);
|
||||
SetReadOnlyFlag(0);
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
SetBackgroundImageFlag(0) ;
|
||||
#endif
|
||||
#ifdef MOD_RECONNECT
|
||||
@@ -1064,18 +1111,24 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
CreateSSHHandler() ; return 0 ;
|
||||
} else if( !strcmp(p, "-fileassoc") ) {
|
||||
CreateFileAssoc() ; return 0 ;
|
||||
#ifndef FDJ
|
||||
} else if( !strcmp(p, "-key") ) {
|
||||
GenerePrivateKey( "private.key.ppk" ) ; return 0 ;
|
||||
#endif
|
||||
} else if( !strcmp(p, "-ed") ) {
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "%s|%s|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ;
|
||||
sprintf(buffer, "%s|%s|0|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ;
|
||||
return Notepad_WinMain(inst, prev, buffer, show) ;
|
||||
} else if( !strcmp(p, "-edb") ) {
|
||||
char buffer[1024];
|
||||
i++;
|
||||
sprintf(buffer, "%s|%s|%s", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ;
|
||||
if( existfile(argv[i]) ) {
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "%s|%s|%s|0", (char*)get_param_str("INI"), (char*)get_param_str("SAV"), argv[i] ) ;
|
||||
return Notepad_WinMain(inst, prev, buffer, show) ;
|
||||
} else {
|
||||
MessageBox(hwnd,"Unable to find requested file","Error",MB_OK|MB_ICONERROR) ;
|
||||
}
|
||||
exit(0);
|
||||
} else if( !strcmp(p, "-help") || !strcmp(p, "-h") ) {
|
||||
SetTextToClipboard(GetHelpMessage()) ;
|
||||
char buffer[1024];
|
||||
sprintf(buffer, "%s|%s|1|1", (char*)get_param_str("INI"), (char*)get_param_str("SAV") ) ;
|
||||
return Notepad_WinMain(inst, prev, buffer, show) ;
|
||||
#ifdef MOD_LAUNCHER
|
||||
} else if( !strcmp(p, "-launcher") ) {
|
||||
@@ -1105,7 +1158,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
} else if( !strcmp(p, "-title") ) {
|
||||
i++ ;
|
||||
conf_set_str( conf, CONF_wintitle, argv[i] );
|
||||
#ifndef FDJ
|
||||
#ifndef FLJ
|
||||
} else if( !strcmp(p, "-classname") ) {
|
||||
i++ ;
|
||||
if( strlen( argv[i] ) > 0 ) {
|
||||
@@ -1186,6 +1239,13 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
}
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
if( debug_flag ) {
|
||||
if( strlen(conf_get_str(conf,CONF_sessionname))>0 ) {
|
||||
debug_logevent( "Session name: %s", conf_get_str(conf,CONF_sessionname) ) ;
|
||||
} else {
|
||||
debug_logevent( "Session name: -" ) ;
|
||||
}
|
||||
}
|
||||
HICON icon_m ;
|
||||
if( GetIconeFlag() > 0 )
|
||||
icon_m = LoadIcon( GethInstIcons(), MAKEINTRESOURCE(IDI_MAINICON_0 + GetIconeNum() ) );
|
||||
@@ -1229,7 +1289,7 @@ if( conf_get_int(conf,CONF_icone) == 0 ) {
|
||||
wndclass.hCursor = LoadCursor(NULL, IDC_IBEAM);
|
||||
wndclass.hbrBackground = NULL;
|
||||
wndclass.lpszMenuName = NULL;
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
wndclass.lpszClassName = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, KiTTYClassName);
|
||||
#else
|
||||
wndclass.lpszClassName = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, appname);
|
||||
@@ -1277,7 +1337,7 @@ TrayIcone.hWnd = hwnd ;
|
||||
if (guess_height > r.bottom - r.top)
|
||||
guess_height = r.bottom - r.top;
|
||||
}
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
const char* winname = appname;
|
||||
#endif
|
||||
{
|
||||
@@ -1301,7 +1361,7 @@ TrayIcone.hWnd = hwnd ;
|
||||
if (conf_get_bool(conf, CONF_sunken_edge))
|
||||
exwinmode |= WS_EX_CLIENTEDGE;
|
||||
#ifdef MOD_PERSO
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
// TODO: This is the beginning of some work to have windows with fancy
|
||||
// no-client-edge borders. It's not ready yet.
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) )
|
||||
@@ -1565,17 +1625,17 @@ TrayIcone.hWnd = hwnd ;
|
||||
ScriptFileContent = NULL ;
|
||||
ReadInitScript( NULL ) ;
|
||||
|
||||
// Lancement du serveur de chat
|
||||
static char reg_buffer[4096];
|
||||
if( ReadParameter( INIT_SECTION, "chat", reg_buffer ) )
|
||||
{
|
||||
|
||||
// Lancement du serveur de chat
|
||||
if( ReadParameter( INIT_SECTION, "chat", reg_buffer ) ) {
|
||||
int chat_flag = atoi( reg_buffer ) ;
|
||||
if ( chat_flag > 0 ) {
|
||||
//if( chat_flag != 1 ) PORT = chat_flag ;
|
||||
_beginthread( routine_server, 0, NULL ) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Parametrage specifique a la session
|
||||
if( GetSessionField( conf_get_str(conf,CONF_sessionname), conf_get_str(conf,CONF_folder), "InitDelay", reg_buffer ) ) {
|
||||
if( init_delay != (int)(1000*atof( reg_buffer ) ) ) {
|
||||
@@ -1603,12 +1663,12 @@ TrayIcone.hWnd = hwnd ;
|
||||
|
||||
if( IniFileFlag == SAVEMODE_REG ) {
|
||||
sprintf( reg_buffer, "%s@%s:%d (prot=%d) name=%s", conf_get_str(conf,CONF_username), conf_get_str(conf,CONF_host), conf_get_int(conf,CONF_port), conf_get_int(conf,CONF_protocol), conf_get_str(conf,CONF_sessionname)) ;
|
||||
cryptstring( reg_buffer, MASTER_PASSWORD ) ;
|
||||
cryptstring( GetCryptSaltFlag(), reg_buffer, MASTER_PASSWORD ) ;
|
||||
WriteParameter( INIT_SECTION, "KiLastSe", reg_buffer ) ;
|
||||
}
|
||||
|
||||
// Lancement des timer (changement image de fond, rafraichissement)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( (!GetBackgroundImageFlag()) || GetPuttyFlag() ) conf_set_int(conf,CONF_bg_type,0);
|
||||
if( conf_get_int(conf,CONF_bg_type)!=0 ) {
|
||||
if(conf_get_int(conf,CONF_bg_slideshow)>0)
|
||||
@@ -1637,6 +1697,9 @@ else {
|
||||
|
||||
#ifdef MOD_PORTKNOCKING
|
||||
ManagePortKnocking(conf_get_str(conf,CONF_host),conf_get_str(conf,CONF_portknockingoptions));
|
||||
#endif
|
||||
#ifdef MOD_PERSO
|
||||
AddDynamicSFTPConnect( conf ) ;
|
||||
#endif
|
||||
|
||||
if (restricted_acl) {
|
||||
@@ -2080,10 +2143,8 @@ static void win_seat_connection_fatal(Seat *seat, const char *msg)
|
||||
session_closed = true;
|
||||
ReadInitScript(NULL);
|
||||
|
||||
char *title = dupprintf("%s Fatal Error: %s", appname,msg);
|
||||
debug_logevent( "%s Fatal Error: %s", appname,msg ) ;
|
||||
show_mouseptr(true);
|
||||
lp_eventlog(default_logpolicy, title);//MessageBox(hwnd, msg, title, MB_ICONERROR | MB_OK);
|
||||
sfree(title);
|
||||
|
||||
if( conf_get_int(conf,CONF_failure_reconnect) ) {
|
||||
queue_toplevel_callback(close_session, NULL);
|
||||
@@ -3112,7 +3173,7 @@ static bool is_alt_pressed(void)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#if (!defined MOD_BACKGROUNDIMAGE) || (defined FDJ)
|
||||
#if (!defined MOD_BACKGROUNDIMAGE) || (defined FLJ)
|
||||
static bool resizing;
|
||||
#endif
|
||||
#ifdef MOD_PERSO
|
||||
@@ -3130,7 +3191,7 @@ struct ctrl_tab_info {
|
||||
static BOOL CALLBACK CtrlTabWindowProc(HWND hwnd, LPARAM lParam) {
|
||||
struct ctrl_tab_info* info = (struct ctrl_tab_info*) lParam;
|
||||
char lpszClassName[256];
|
||||
#if (defined MOD_PERSO) && (!defined FDJ)
|
||||
#if (defined MOD_PERSO) && (!defined FLJ)
|
||||
strcpy(lpszClassName,KiTTYClassName) ;
|
||||
#else
|
||||
strcpy(lpszClassName,appname) ;
|
||||
@@ -3262,7 +3323,6 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
*/
|
||||
POINT cursor_pt;
|
||||
#endif
|
||||
|
||||
switch (message) {
|
||||
case WM_TIMER:
|
||||
if ((UINT_PTR)wParam == TIMING_TIMER_ID) {
|
||||
@@ -3279,8 +3339,14 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
|
||||
char buffer[4096] = "" ;
|
||||
|
||||
// On charge automatiquement au démarrage (-edit) un fichier dans l'editeur connecté
|
||||
if( !PuttyFlag ) if( LoadFile!=NULL ) { RunPuttyEd( hwnd, LoadFile ) ; free( LoadFile ) ; LoadFile = NULL ; }
|
||||
|
||||
if( !PuttyFlag ) if( LoadFile!=NULL ) {
|
||||
RunPuttyEd( hwnd, LoadFile ) ;
|
||||
free( LoadFile ) ;
|
||||
LoadFile = NULL ;
|
||||
}
|
||||
|
||||
if( debug_flag ) { debug_logevent( "Starting post connection operations" ) ; }
|
||||
|
||||
if( (conf_get_int(conf,CONF_protocol) == PROT_SSH) && (!is_backend_connected) ) break ; // On sort si en SSH on n'est pas connecte
|
||||
// Lancement d'une (ou plusieurs separees par \\n) commande(s) automatique(s) a l'initialisation
|
||||
|
||||
@@ -3296,6 +3362,14 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
|
||||
if( GetSessionField( conf_get_str( conf, CONF_sessionname), conf_get_str( conf, CONF_folder), "Notes", buffer ) )
|
||||
{ if( strlen( buffer ) > 0 ) MessageBox( hwnd, buffer, "Notes", MB_OK ) ; }
|
||||
|
||||
// On met le focus sur la fenêtre
|
||||
if( first_connect ) {
|
||||
if( GetVisibleFlag()!=VISIBLE_TRAY ) {
|
||||
BringWindowToTop( hwnd ) ;
|
||||
SetForegroundWindow( hwnd ) ;
|
||||
}
|
||||
}
|
||||
|
||||
// Envoi automatiquement dans le systeme tray si besoin
|
||||
if( GetAutoSendToTray() ) ManageToTray( hwnd ) ;
|
||||
|
||||
@@ -3304,7 +3378,9 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
|
||||
if( strlen( conf_get_str(conf,CONF_username) ) > 0 ) {
|
||||
if( strlen( conf_get_str(conf,CONF_password) ) > 0 ) {
|
||||
char bufpass[1024]; strcpy(bufpass,conf_get_str(conf,CONF_password)) ;
|
||||
MASKPASS(bufpass); strcat(buffer,bufpass); memset(bufpass,0,strlen(bufpass));
|
||||
MASKPASS(GetCryptSaltFlag(), bufpass);
|
||||
strcat(buffer,bufpass);
|
||||
memset(bufpass,0,strlen(bufpass));
|
||||
strcat( buffer, "\\n" ) ;
|
||||
}
|
||||
}
|
||||
@@ -3317,11 +3393,12 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
|
||||
conf_set_str( conf, CONF_autocommand, buffer );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RenewPassword( conf ) ;
|
||||
|
||||
// On envoie l'autocommand
|
||||
if( strlen( conf_get_str(conf,CONF_autocommand) ) > 0 ) {
|
||||
lp_eventlog(default_logpolicy, "Start autocommand timer" );
|
||||
SetTimer(hwnd, TIMER_AUTOCOMMAND, autocommand_delay, NULL) ;
|
||||
}
|
||||
if( conf_get_int(conf,CONF_logtimerotation) > 0 ) {
|
||||
@@ -3330,6 +3407,8 @@ else if((UINT_PTR)wParam == TIMER_INIT) { // Initialisation
|
||||
}
|
||||
|
||||
RefreshBackground( hwnd ) ;
|
||||
|
||||
first_connect = false ;
|
||||
}
|
||||
|
||||
else if((UINT_PTR)wParam == TIMER_DND){
|
||||
@@ -3399,7 +3478,7 @@ else if((UINT_PTR)wParam == TIMER_AUTOPASTE) { // AutoPaste
|
||||
}
|
||||
}
|
||||
}
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
else if( GetBackgroundImageFlag() && ((UINT_PTR)wParam == TIMER_SLIDEBG) ) { // Changement automatique de l'image de fond
|
||||
NextBgImage( hwnd ) ;
|
||||
InvalidateRect( hwnd, NULL, true ) ;
|
||||
@@ -3430,31 +3509,30 @@ else if((UINT_PTR)wParam == TIMER_BLINKTRAYICON) { // Clignotement de l'icone d
|
||||
static int BlinkingState = 0 ;
|
||||
static HICON hBlinkingIcon = NULL ;
|
||||
|
||||
if( GetVisibleFlag()!=VISIBLE_TRAY )
|
||||
{ KillTimer( hwnd, TIMER_BLINKTRAYICON ) ; TrayIcone.hIcon = hBlinkingIcon ; BlinkingState = 0 ; break ; }
|
||||
if( GetVisibleFlag()!=VISIBLE_TRAY ) {
|
||||
KillTimer( hwnd, TIMER_BLINKTRAYICON ) ; TrayIcone.hIcon = hBlinkingIcon ; BlinkingState = 0 ; break ;
|
||||
}
|
||||
if( (BlinkingState%2)==0 ) {
|
||||
hBlinkingIcon = TrayIcone.hIcon ;
|
||||
TrayIcone.hIcon = LoadIcon(NULL, NULL) ;
|
||||
Shell_NotifyIcon(NIM_MODIFY, &TrayIcone) ;
|
||||
BlinkingState++ ;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if( hBlinkingIcon ) {
|
||||
TrayIcone.hIcon = hBlinkingIcon ;
|
||||
Shell_NotifyIcon(NIM_MODIFY, &TrayIcone) ;
|
||||
BlinkingState++ ;
|
||||
if(MaxBlinkingTime) if(BlinkingState>=MaxBlinkingTime) { KillTimer( hwnd, TIMER_BLINKTRAYICON ) ; BlinkingState = 0 ; break ; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef MOD_RECONNECT
|
||||
else if((UINT_PTR)wParam == TIMER_RECONNECT) {
|
||||
if( !backend && GetAutoreconnectFlag() ) {
|
||||
if( !backend ) {
|
||||
lp_eventlog(default_logpolicy, "No backend connection, reconnecting...") ;
|
||||
PostMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ;
|
||||
} else {
|
||||
KillTimer( hwnd, TIMER_RECONNECT ) ;
|
||||
}
|
||||
KillTimer( hwnd, TIMER_RECONNECT ) ;
|
||||
}
|
||||
#endif
|
||||
else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation
|
||||
@@ -3467,7 +3545,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation
|
||||
{
|
||||
// Initialiation
|
||||
MainHwnd = hwnd ;
|
||||
if( debug_flag ) lp_eventlog(default_logpolicy,"Init");
|
||||
if( debug_flag ) { lp_eventlog(default_logpolicy,"Starting window creation") ; }
|
||||
if( GetIconeFlag() != -1 )
|
||||
SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_INIT ) ;
|
||||
|
||||
@@ -3478,7 +3556,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation
|
||||
SetTransparency( hwnd, 255-conf_get_int(conf,CONF_transparencynumber) ) ;
|
||||
}
|
||||
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetIconeFlag() == -1 ) conf_set_int( conf, CONF_bg_type, 0 ) ;
|
||||
if( !GetBackgroundImageFlag() ) conf_set_int( conf, CONF_bg_type, 0 );
|
||||
#endif
|
||||
@@ -3495,6 +3573,8 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation
|
||||
#ifdef MOD_WTS
|
||||
WTSRegisterSessionNotification(hwnd,NOTIFY_FOR_THIS_SESSION);
|
||||
#endif
|
||||
//SetFocus(hwnd);
|
||||
//PostMessage(hwnd,WM_SETFOCUS,0,0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@@ -3616,7 +3696,7 @@ else if((UINT_PTR)wParam == TIMER_LOGROTATION) { // log rotation
|
||||
|
||||
serbuf = strbuf_new();
|
||||
#ifdef MOD_PERSO
|
||||
/*On gère le répertoire distant*/
|
||||
/*On gère le répertoire distant*/
|
||||
char *cmd, *cmd2=NULL ;
|
||||
cmd = (char*)malloc( strlen(conf_get_str(conf,CONF_autocommand))+1 ) ;
|
||||
strcpy( cmd, conf_get_str(conf,CONF_autocommand) ) ;
|
||||
@@ -3721,7 +3801,7 @@ free(cmd);
|
||||
is_backend_connected = 0 ;
|
||||
start_backend();
|
||||
//if( (!backend || !is_backend_connected) && GetAutoreconnectFlag() ) {
|
||||
if( (!backend) && GetAutoreconnectFlag() ) {
|
||||
if( !backend ) {
|
||||
if ( conf_get_int(conf,CONF_failure_reconnect) && is_backend_first_connected ) {
|
||||
SetTimer(hwnd, TIMER_RECONNECT, GetReconnectDelay()*1000, NULL) ;
|
||||
lp_eventlog(default_logpolicy, "Unable to connect, trying to reconnect...") ;
|
||||
@@ -3745,7 +3825,6 @@ free(cmd);
|
||||
Conf *prev_conf;
|
||||
int init_lvl = 1;
|
||||
bool reconfig_result;
|
||||
|
||||
if (reconfiguring)
|
||||
break;
|
||||
else
|
||||
@@ -3754,7 +3833,6 @@ free(cmd);
|
||||
char buftitle[1024] = "" ;
|
||||
GetWindowText(hwnd, buftitle, sizeof(buftitle));
|
||||
conf_set_str( conf, CONF_wintitle, buftitle ) ;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Copy the current window title into the stored
|
||||
@@ -3763,6 +3841,7 @@ free(cmd);
|
||||
* reset the title to its startup state.
|
||||
*/
|
||||
conf_set_str(conf, CONF_wintitle, window_name);
|
||||
#endif
|
||||
|
||||
prev_conf = conf_copy(conf);
|
||||
#ifdef MOD_PERSO
|
||||
@@ -3788,7 +3867,7 @@ free(cmd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) ) {
|
||||
if(textdc) {
|
||||
DeleteObject(textbm);
|
||||
@@ -4334,7 +4413,7 @@ free(cmd);
|
||||
case WM_MBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
#ifdef MOD_RECONNECT
|
||||
if( ((!backend) || (!is_backend_connected)) && GetAutoreconnectFlag() && is_backend_first_connected ) { // On essaie de se reconnecter
|
||||
if( ((!backend) || (!is_backend_connected)) && GetAutoreconnectFlag() && is_backend_first_connected ) { // trying to reconnect
|
||||
PostMessage( hwnd, WM_COMMAND, IDM_RESTART, 0 ) ;
|
||||
lp_eventlog(default_logpolicy, "No connection on mouse click, trying to reconnect...") ;
|
||||
break ;
|
||||
@@ -4346,7 +4425,7 @@ free(cmd);
|
||||
#ifdef MOD_PERSO
|
||||
if( GetProtectFlag() ) { break ; }
|
||||
if(!PuttyFlag && GetMouseShortcutsFlag() ) {
|
||||
if( (message == WM_LBUTTONUP) && ((wParam & MK_SHIFT)&&(wParam & MK_CONTROL) ) ) { // shift + CTRL + bouton gauche => duplicate session
|
||||
if( (message == WM_LBUTTONUP) && ((wParam & MK_SHIFT) && (wParam & MK_CONTROL) ) ) { // shift + CTRL + left button => duplicate session
|
||||
if( backend && is_backend_connected ) {
|
||||
lp_eventlog(default_logpolicy, "Duplicate session") ;
|
||||
SendMessage( hwnd, WM_COMMAND, IDM_DUPSESS, 0 ) ;
|
||||
@@ -4360,12 +4439,23 @@ free(cmd);
|
||||
}
|
||||
#endif
|
||||
break ;
|
||||
}
|
||||
|
||||
else if (message == WM_LBUTTONUP && ((wParam & MK_CONTROL) ) ) { // ctrl + left button => new icon ?
|
||||
if( !GetHyperlinkFlag() || !conf_get_int(conf,CONF_url_ctrl_click) ) { // if no hyperlink feature or if ctrl + link is disable
|
||||
if( GetIconeFlag() != -1 ) {
|
||||
SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ;
|
||||
}
|
||||
break ;
|
||||
} else {
|
||||
if( !urlhack_is_in_link_region(TO_CHR_X(cursor_pt.x), TO_CHR_Y(cursor_pt.y)) ) { // If the is no hyperlink under mouse
|
||||
if( GetIconeFlag() != -1 ) {
|
||||
SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else if (message == WM_LBUTTONUP && ((wParam & MK_CONTROL) ) ) {// ctrl+bouton gauche => nouvelle icone
|
||||
if( GetIconeFlag() != -1 ) SetNewIcon( hwnd, conf_get_filename(conf,CONF_iconefile)->path, conf_get_int(conf,CONF_icone), SI_NEXT ) ;
|
||||
RefreshBackground( hwnd ) ;
|
||||
//break ;
|
||||
}
|
||||
}
|
||||
|
||||
else if (message == WM_MBUTTONUP && ((wParam & MK_CONTROL) ) ) { // ctrl+bouton milieu => send to tray
|
||||
SendMessage( hwnd, WM_COMMAND, IDM_TOTRAY, 0 ) ;
|
||||
@@ -4526,33 +4616,28 @@ free(cmd);
|
||||
if (urlhack_mouse_old_x != TO_CHR_X(X_POS(lParam)) || urlhack_mouse_old_y != TO_CHR_Y(Y_POS(lParam))) {
|
||||
urlhack_mouse_old_x = TO_CHR_X(X_POS(lParam));
|
||||
urlhack_mouse_old_y = TO_CHR_Y(Y_POS(lParam));
|
||||
|
||||
if ((!conf_get_int(term->conf, CONF_url_ctrl_click) || urlhack_is_ctrl_pressed()) &&
|
||||
urlhack_is_in_link_region(urlhack_mouse_old_x, urlhack_mouse_old_y)) {
|
||||
if (urlhack_cursor_is_hand == 0) {
|
||||
SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)(LONG)LoadCursor(NULL, IDC_HAND));
|
||||
SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_HAND));
|
||||
urlhack_cursor_is_hand = 1;
|
||||
term_update(term); // Force the terminal to update, otherwise the underline will not show (bug somewhere, this is an ugly fix)
|
||||
}
|
||||
}
|
||||
else if (urlhack_cursor_is_hand == 1) {
|
||||
SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)(LONG)LoadCursor(NULL, IDC_IBEAM));
|
||||
SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)LoadCursor(NULL, IDC_IBEAM));
|
||||
urlhack_cursor_is_hand = 0;
|
||||
term_update(term); // Force the terminal to update, see above
|
||||
}
|
||||
|
||||
// If mouse jumps from one link directly into another, we need a forced terminal update too
|
||||
if (urlhack_is_in_link_region(urlhack_mouse_old_x, urlhack_mouse_old_y) != urlhack_current_region) {
|
||||
urlhack_current_region = urlhack_is_in_link_region(urlhack_mouse_old_x, urlhack_mouse_old_y);
|
||||
term_update(term);
|
||||
}
|
||||
|
||||
}
|
||||
/* HACK: PuttyTray / Nutty : END */
|
||||
/* HACK: PuttyTray / Nutty : END */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
{
|
||||
// debug("X %d Y %d => %d:%d\n", X_POS(lParam), Y_POS(lParam), TO_CHR_X(X_POS(lParam)), TO_CHR_Y(Y_POS(lParam)));
|
||||
@@ -4611,7 +4696,7 @@ free(cmd);
|
||||
case WM_PAINT:
|
||||
{
|
||||
PAINTSTRUCT p;
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
HDC hdccod=0, hdcScreen, hdcBack = 0;
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) ) {
|
||||
HideCaret(hwnd);
|
||||
@@ -4682,7 +4767,7 @@ free(cmd);
|
||||
*/
|
||||
//assert(!wintw_hdc);
|
||||
wintw_hdc = hdc;
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) ) {
|
||||
term_paint(term,
|
||||
(p.rcPaint.left-offset_width)/font_width,
|
||||
@@ -4770,7 +4855,7 @@ free(cmd);
|
||||
SelectObject(hdc, GetStockObject(WHITE_PEN));
|
||||
EndPaint(hwnd, &p);
|
||||
ShowCaret(hwnd);
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -4816,7 +4901,7 @@ free(cmd);
|
||||
debug("WM_ENTERSIZEMOVE\n");
|
||||
#endif
|
||||
EnableSizeTip(true);
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (!PuttyFlag) ) GetClientRect(hwnd, &size_before);
|
||||
#endif
|
||||
resizing = true;
|
||||
@@ -4832,7 +4917,7 @@ free(cmd);
|
||||
term_size(term, conf_get_int(conf, CONF_height),
|
||||
conf_get_int(conf, CONF_width),
|
||||
conf_get_int(conf, CONF_savelines));
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (conf_get_int(conf,CONF_bg_image_abs_fixed)==1) && (conf_get_int(conf,CONF_bg_type)!=0) ) RefreshBackground( hwnd ) ;
|
||||
#endif
|
||||
InvalidateRect(hwnd, NULL, true);
|
||||
@@ -4935,7 +5020,7 @@ free(cmd);
|
||||
fullscr_on_max = true;
|
||||
break;
|
||||
#ifdef MOD_PERSO
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
case WM_DISPLAYCHANGE:
|
||||
if( (!GetBackgroundImageFlag()) || GetPuttyFlag() ) return DefWindowProc(hwnd, message, wParam, lParam) ;
|
||||
case WM_MOVE:
|
||||
@@ -5019,10 +5104,9 @@ free(cmd);
|
||||
if (wParam == SIZE_MINIMIZED) {
|
||||
if( GetKeyState( VK_CONTROL ) & 0x8000 ) {
|
||||
SendMessage( hwnd, WM_COMMAND, IDM_TOTRAY, 0 ) ; return 0 ;
|
||||
}
|
||||
else
|
||||
SetWindowText(hwnd, conf_get_bool(conf,CONF_win_name_always) ? window_name : icon_name);
|
||||
}
|
||||
else SetWindowText(hwnd, conf_get_bool(conf,CONF_win_name_always) ? window_name : icon_name);
|
||||
}
|
||||
#else
|
||||
if (wParam == SIZE_MINIMIZED)
|
||||
SetWindowText(hwnd,
|
||||
@@ -5285,10 +5369,10 @@ free(cmd);
|
||||
if( debug_flag ) addkeypressed( message, wParam, lParam, GetKeyState(VK_SHIFT)&0x8000, GetKeyState(VK_CONTROL)&0x8000, (GetKeyState(VK_MENU)&0x8000)||(GetKeyState(VK_LMENU)&0x8000),GetKeyState(VK_RMENU)&0x8000, (GetKeyState(VK_RWIN)&0x8000)||(GetKeyState(VK_LWIN)&0x8000 ) );
|
||||
#endif
|
||||
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( (wParam==VK_SNAPSHOT)&&(GetKeyState(VK_CONTROL)&0x8000) ) { // CTRL + PrintScreen => Screenshot
|
||||
char screenShotFile[1024] ;
|
||||
sprintf( screenShotFile, "%s\\screenshot-%d-%ld.jpg", InitialDirectory, getpid(), time(0) );
|
||||
sprintf( screenShotFile, "%s\\screenshot-%d-%lld.jpg", InitialDirectory, getpid(), time(0) );
|
||||
screenCaptureClientRect( hwnd, screenShotFile, 100 ) ;
|
||||
}
|
||||
#endif
|
||||
@@ -5731,7 +5815,7 @@ static void do_text_internal(
|
||||
static size_t lpDx_len = 0;
|
||||
int *lpDx_maybe;
|
||||
int len2; /* for SURROGATE PAIR */
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
int transBg = backgrounddc ? 1 : 0;
|
||||
UINT etoFlagOpaque = transBg ? 0 : ETO_OPAQUE;
|
||||
#endif
|
||||
@@ -5927,7 +6011,7 @@ static void do_text_internal(
|
||||
GetGValue(fg) * 2 / 3,
|
||||
GetBValue(fg) * 2 / 3);
|
||||
}
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
HDC hdc = wintw_hdc ;
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) ) {
|
||||
line_box.left = x;
|
||||
@@ -6114,7 +6198,7 @@ static void do_text_internal(
|
||||
}
|
||||
if (nlen <= 0)
|
||||
return; /* Eeek! */
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) )
|
||||
// ExtTextOutW(hdc, x,
|
||||
// y - font_height * (lattr == LATTR_BOT) + text_adjust,
|
||||
@@ -6147,7 +6231,7 @@ static void do_text_internal(
|
||||
sgrowarray(directbuf, directlen, len);
|
||||
for (size_t i = 0; i < len; i++)
|
||||
directbuf[i] = text[i] & 0xFF;
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (!GetPuttyFlag()) )
|
||||
// ExtTextOut(hdc, x,
|
||||
// y - font_height * (lattr == LATTR_BOT) + text_adjust,
|
||||
@@ -6193,7 +6277,7 @@ static void do_text_internal(
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
wbuf[i] = text[i];
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
/* print Glyphs as they are, without Windows' Shaping*/
|
||||
if( GetBackgroundImageFlag() && (!PuttyFlag) )
|
||||
// exact_textout(hdc, x, y - font_height * (lattr == LATTR_BOT) + text_adjust,
|
||||
@@ -6241,7 +6325,7 @@ static void do_text_internal(
|
||||
oldpen = SelectObject(wintw_hdc, oldpen);
|
||||
DeleteObject(oldpen);
|
||||
}
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag() && (!PuttyFlag) )
|
||||
if(textdc)
|
||||
{
|
||||
@@ -7216,7 +7300,6 @@ void set_title_internal(TermWin *tw, const char *title) {
|
||||
SetWindowText(hwnd, title);
|
||||
}
|
||||
|
||||
|
||||
/* Creer un titre de fenetre a partir d'un schema donne
|
||||
%%f: le folder auquel apprtient le session
|
||||
%%h: le hostname
|
||||
@@ -7225,7 +7308,8 @@ void set_title_internal(TermWin *tw, const char *title) {
|
||||
%%P: le protocole
|
||||
%%s: nom de la session (vide sinon)
|
||||
%%u: le user
|
||||
%%w: la list des port forward locaux
|
||||
%%l: la liste des port forward locaux
|
||||
%%d: la liste des port forward dynamic
|
||||
Ex: %%P://%%u@%%h:%%p
|
||||
Ex: %%f / %%s
|
||||
*/
|
||||
@@ -7248,7 +7332,7 @@ void make_title( char * res, char * fmt, const char * title ) {
|
||||
case PROT_RLOGIN: strcpy(b,"rlogin"); break;
|
||||
case PROT_SSH: strcpy(b,"ssh"); if(port==-1) port=22 ; break;
|
||||
case PROT_SERIAL: strcpy(b,"serial"); break;
|
||||
}
|
||||
}
|
||||
while( (p=poss( "%%P", res)) > 0 ) { del(res,p,3); insert(res,b,p); }
|
||||
|
||||
sprintf(b,"%d", port ) ;
|
||||
@@ -7256,29 +7340,46 @@ void make_title( char * res, char * fmt, const char * title ) {
|
||||
|
||||
sprintf(b,"%ld", GetCurrentProcessId() ) ;
|
||||
while( (p=poss( "%%i", res)) > 0 ) { del(res,p,3); insert(res,b,p); }
|
||||
|
||||
while( (p=poss( "%%w", res)) > 0 ) { // forward port locaux
|
||||
char *key, *val;
|
||||
while( (p=poss( "%%d", res)) > 0 ) { // forward port dynamic
|
||||
char *key, *val, *k;
|
||||
int nb=0 ;
|
||||
del(res,p,3) ;
|
||||
b[0]='\0';
|
||||
for (val = conf_get_str_strs(conf, CONF_portfwd, NULL, &key);
|
||||
val != NULL;
|
||||
val = conf_get_str_strs(conf, CONF_portfwd, key, &key)) {
|
||||
if ( key[0]=='L' ) {
|
||||
val != NULL;
|
||||
val = conf_get_str_strs(conf, CONF_portfwd, key, &key)) {
|
||||
k=key; if( (k[0]=='4')||(k[0]=='6') ) { k++; }
|
||||
if( (k[0]=='L') && (!strcmp(val,"D")) ) {
|
||||
if(nb!=0) {strcat(b,"|");}
|
||||
strcat(b,key+1);
|
||||
strcat(b,k+1);
|
||||
nb++;
|
||||
}
|
||||
}
|
||||
insert(res,b,p) ;
|
||||
}
|
||||
}
|
||||
while( (p=poss( "%%l", res)) > 0 ) { // forward port locaux
|
||||
char *key, *val, *k;
|
||||
int nb=0 ;
|
||||
del(res,p,3) ;
|
||||
b[0]='\0';
|
||||
for (val = conf_get_str_strs(conf, CONF_portfwd, NULL, &key);
|
||||
val != NULL;
|
||||
val = conf_get_str_strs(conf, CONF_portfwd, key, &key)) {
|
||||
k=key; if( (k[0]=='4')||(k[0]=='6') ) { k++; }
|
||||
if( (k[0]=='L') && (strcmp(val,"D")) ) {
|
||||
if(nb!=0) {strcat(b,"|");}
|
||||
strcat(b,k+1);
|
||||
nb++;
|
||||
}
|
||||
}
|
||||
insert(res,b,p) ;
|
||||
}
|
||||
}
|
||||
|
||||
static void wintw_set_title(TermWin *tw, const char *title_in) {
|
||||
char *buffer, fmt[256]="%s" ;
|
||||
char *title ;
|
||||
|
||||
|
||||
if( title_in==NULL ) { return ; }
|
||||
title = (char*)malloc(strlen(title_in)+1); strcpy(title,title_in);
|
||||
|
||||
@@ -7291,7 +7392,7 @@ static void wintw_set_title(TermWin *tw, const char *title_in) {
|
||||
if( strstr(title, " (PROTECTED)")==(title+strlen(title)-12) )
|
||||
{ title[strlen(title)-12]='\0' ; }
|
||||
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
buffer = (char*) malloc( strlen( title ) + strlen( conf_get_str(conf,CONF_host)) + strlen( conf_get_filename(conf,CONF_bg_image_filename)->path ) + 40 ) ;
|
||||
if( GetBackgroundImageFlag() && GetImageViewerFlag() && (!PuttyFlag) ) { sprintf( buffer, "%s", conf_get_filename(conf,CONF_bg_image_filename)->path ) ; }
|
||||
else
|
||||
@@ -7300,18 +7401,22 @@ static void wintw_set_title(TermWin *tw, const char *title_in) {
|
||||
#endif
|
||||
if( GetSizeFlag() && (!IsZoomed( MainHwnd )) ) {
|
||||
if( strlen( title ) > 0 ) {
|
||||
if( title[strlen(title)-1] == ']' ) make_title( buffer, "%s", title ) ;
|
||||
else {
|
||||
if( title[strlen(title)-1] == ']' ) {
|
||||
make_title( buffer, "%s", title ) ;
|
||||
} else {
|
||||
sprintf( fmt, "%%s [%dx%d]", conf_get_int(conf,CONF_height), conf_get_int(conf,CONF_width)) ;
|
||||
make_title( buffer, fmt, title ) ;
|
||||
}
|
||||
}
|
||||
else sprintf( buffer, "%s [%dx%d] - %s", conf_get_str(conf,CONF_host), conf_get_int(conf,CONF_height), conf_get_int(conf,CONF_width), appname ) ;
|
||||
} else {
|
||||
sprintf( buffer, "%s [%dx%d] - %s", conf_get_str(conf,CONF_host), conf_get_int(conf,CONF_height), conf_get_int(conf,CONF_width), appname ) ;
|
||||
}
|
||||
else {
|
||||
if( strlen( title ) > 0 ) make_title( buffer, "%s", title ) ;
|
||||
else sprintf( buffer, "%s - %s", conf_get_str(conf,CONF_host), appname ) ;
|
||||
} else {
|
||||
if( strlen( title ) > 0 ) {
|
||||
make_title( buffer, "%s", title ) ;
|
||||
} else {
|
||||
sprintf( buffer, "%s - %s", conf_get_str(conf,CONF_host), appname ) ;
|
||||
}
|
||||
}
|
||||
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)" ) ; }
|
||||
set_title_internal( tw, buffer ) ;
|
||||
@@ -8190,19 +8295,21 @@ static void wintw_bell(TermWin *tw, int mode)
|
||||
if(conf_get_bool(conf,CONF_foreground_on_bell) ) { // Tester avec sleep 4 ; echo -e '\a'
|
||||
if( IsIconic(hwnd) ) SwitchToThisWindow( hwnd, TRUE ) ;
|
||||
else SetForegroundWindow( MainHwnd ) ;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if( mode == BELL_VISUAL ) {
|
||||
if( IsIconic(hwnd) )
|
||||
FlashWindow(hwnd, TRUE) ;
|
||||
else
|
||||
flash_window(2) ;
|
||||
}
|
||||
else { if( conf_get_int(conf,CONF_beep_ind)==B_IND_FLASH ) flash_window(2) ; }
|
||||
} else {
|
||||
if( conf_get_int(conf,CONF_beep_ind)==B_IND_FLASH ) flash_window(2) ;
|
||||
}
|
||||
}
|
||||
} else if( GetVisibleFlag()==VISIBLE_TRAY ) {
|
||||
if( conf_get_bool(conf,CONF_foreground_on_bell) ) { SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ); }
|
||||
else if(mode == BELL_VISUAL) SetTimer(hwnd, TIMER_BLINKTRAYICON, (int)500, NULL) ;
|
||||
if( conf_get_bool(conf,CONF_foreground_on_bell) ) {
|
||||
SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 ) ;
|
||||
} else if(mode == BELL_VISUAL)
|
||||
SetTimer(hwnd, TIMER_BLINKTRAYICON, (int)500, NULL) ;
|
||||
//SendMessage( MainHwnd, WM_COMMAND, IDM_FROMTRAY, 0 );
|
||||
//flash_window(2); /* start */
|
||||
//ShowWindow( MainHwnd, SW_MINIMIZE);
|
||||
@@ -8440,7 +8547,7 @@ static void flip_full_screen()
|
||||
SendMessage(hwnd, WM_FULLSCR_ON_MAX, 0, 0);
|
||||
ShowWindow(hwnd, SW_MAXIMIZE);
|
||||
}
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
if( GetBackgroundImageFlag()&&(!PuttyFlag)&&(conf_get_int(conf,CONF_bg_image_abs_fixed)==1)&&(conf_get_int(conf,CONF_bg_type)!=0) ) RefreshBackground( hwnd ) ;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ extern int DirectoryBrowseFlag ;
|
||||
|
||||
#include "../../kitty_crypt.h"
|
||||
#include "../../kitty_commun.h"
|
||||
|
||||
static char pphrase[2048]="";
|
||||
#endif
|
||||
|
||||
#ifndef NO_SECURITY
|
||||
@@ -83,7 +85,12 @@ static filereq *keypath = NULL;
|
||||
#define IDM_PUTTY 0x0060
|
||||
#define IDM_SESSIONS_BASE 0x1000
|
||||
#define IDM_SESSIONS_MAX 0x2000
|
||||
#ifdef MOD_PERSO
|
||||
#define PUTTY_REGKEY "Software\\9bis.com\\KiTTY\\Sessions"
|
||||
#else
|
||||
#define PUTTY_REGKEY "Software\\SimonTatham\\PuTTY\\Sessions"
|
||||
#endif
|
||||
|
||||
#define PUTTY_DEFAULT "Default%20Settings"
|
||||
static int initial_menuitems_count;
|
||||
|
||||
@@ -404,6 +411,14 @@ static void win_add_keyfile(Filename *filename)
|
||||
|
||||
pps.passphrase = &passphrase;
|
||||
pps.comment = err;
|
||||
#ifdef MOD_PERSO
|
||||
if( strlen(pphrase)>0 ) {
|
||||
passphrase=(char*)malloc(strlen(pphrase)+1);
|
||||
strcpy(passphrase,pphrase);
|
||||
|
||||
}
|
||||
else
|
||||
#endif
|
||||
dlgret = DialogBoxParam(hinst, MAKEINTRESOURCE(210),
|
||||
NULL, PassphraseProc, (LPARAM) &pps);
|
||||
passphrase_box = NULL;
|
||||
@@ -1287,6 +1302,11 @@ int WINAPI Agent_WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show
|
||||
} else if (!strcmp(argv[i], "-restrict-putty-acl") ||
|
||||
!strcmp(argv[i], "-restrict_putty_acl")) {
|
||||
restrict_putty_acl = true;
|
||||
#ifdef MOD_PERSO
|
||||
} else if (!strcmp(argv[i], "-pass")) {
|
||||
i++;
|
||||
strcpy(pphrase,argv[i]);
|
||||
#endif
|
||||
} else if (!strcmp(argv[i], "-c")) {
|
||||
/*
|
||||
* If we see `-c', then the rest of the
|
||||
|
||||
@@ -173,7 +173,7 @@ struct FontSpec *fontspec_new(
|
||||
#endif
|
||||
|
||||
#ifdef MOD_PERSO
|
||||
#ifdef FDJ
|
||||
#ifdef FLJ
|
||||
#define PUTTY_REG_POS_SAVE "Software\\9bis.com\\PuTTY_save"
|
||||
#define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY"
|
||||
#define PUTTY_REG_PARENT "Software\\SimonTatham"
|
||||
@@ -328,7 +328,7 @@ void write_aclip(int clipboard, char *, int, bool);
|
||||
#define FILTER_DYNLIB_FILES ("Dynamic Library Files (*.dll)\0*.dll\0" \
|
||||
"All Files (*.*)\0*\0\0\0")
|
||||
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FDJ)
|
||||
#if (defined MOD_BACKGROUNDIMAGE) && (!defined FLJ)
|
||||
#define FILTER_IMAGE_FILES ("Image Files\0*.BMP;*.JPG;*.JPEG\0" \
|
||||
"BMP Files (*.bmp)\0*.BMP\0" \
|
||||
"JPEG Files (*.jpg)\0*.JPG;*.JPEG\0" \
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
# Welcome to the KiTTY introduction web site
|
||||
|
||||
<p style="text-align: center;">
|
||||
All KiTTY documentation is available on the official website<br/>
|
||||
https://www.9bis.com/kitty/
|
||||
</p>
|
||||
|
||||
## What is KiTTY ?
|
||||
KiTTY is a fork from version 0.71 of **PuTTY**, the best telnet / SSH client in the world.
|
||||
KiTTY is only designed for the Microsoft(c) Windows(c) platform. For more information about the original software, or pre-compiled binaries on other systems, you can go to the [Simon Tatham PuTTY page](http://www.chiark.greenend.org.uk/~sgtatham/putty/ "PuTTY").
|
||||
@@ -19,7 +24,6 @@ KiTTY has all the features from the original software, and adds many others as d
|
||||
* Automatic password
|
||||
* Automatic command
|
||||
* Running a locally saved script on a remote session
|
||||
* ~~ZModem integration~~
|
||||
|
||||
### Graphical features
|
||||
* An icon for each session
|
||||
@@ -38,7 +42,6 @@ KiTTY has all the features from the original software, and adds many others as d
|
||||
* Binary compression
|
||||
* Clipboard printing
|
||||
* Cygwin and cmd.exe intégration
|
||||
* ~~Background image~~
|
||||
* File association
|
||||
* Other settings
|
||||
* New command-line options
|
||||
@@ -62,6 +65,6 @@ Simple guide to setup the compile environment:
|
||||
- Download the `mingw-builds-install.exe` from https://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.0/32-bit/
|
||||
- Execute the installer and select the **GUI**.
|
||||
- After installing it, only the "packager manager" it's in fact installed, so execute `$MinGW\libexec\mingw-get\guimain.exe` and select in the Basic Setup the packages: **"mingwg-developer-tools", "mingw32-base", "mingw32-gcc-g++" and "msys-base"**.
|
||||
- When all is installed, to open the SHELL execute `$MinGW\msys\1.0\msys.bat`. Then from from this shell you can compile. Example: `cd $KiTTY_DIR/0.70_My_PuTTY/windows` and `make -f MAKEFILE.MINGW 9bis`.
|
||||
- When all is installed, to open the SHELL execute `$MinGW\msys\1.0\msys.bat`. Then from from this shell you can compile. Example: `cd $KiTTY_DIR/0.74_My_PuTTY/windows` and `make -f MAKEFILE.MINGW 9bis`.
|
||||
|
||||
Original website is [https://kitty.9bis.com/](https://kitty.9bis.com/ "KiTTY website").
|
||||
Original website is [https://www.9bis.com/kitty/](https://www.9bis.com/kitty/ "KiTTY website").
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "notepad.h"
|
||||
|
||||
LRESULT CALLBACK Notepad_WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
@@ -20,6 +21,7 @@ static const char Notepad_szFilenameFilter[] = "Text files, (*.txt, *.log, *.ini
|
||||
static char * IniFile = NULL ;
|
||||
static char * SavFile = NULL ;
|
||||
static char * LoadFile = NULL ;
|
||||
static bool readonly = false ;
|
||||
#endif
|
||||
|
||||
BOOL FileExists(LPCTSTR szPath) {
|
||||
@@ -64,7 +66,7 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l
|
||||
|
||||
#ifdef NOMAIN
|
||||
if( lpCmdLine!=NULL ) {
|
||||
if( strlen(lpCmdLine) > 0 ) {
|
||||
if( strlen(lpCmdLine) > 0 ) {
|
||||
char *st = strstr( lpCmdLine, "|" ) ;
|
||||
if( st!=NULL ) {
|
||||
SavFile=(char*)malloc(strlen(st)+1);
|
||||
@@ -77,6 +79,11 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l
|
||||
LoadFile = (char*)malloc(strlen(st)+1);
|
||||
strcpy( LoadFile, st+1 ) ;
|
||||
st[0] = '\0' ;
|
||||
st = strstr( LoadFile, "|" );
|
||||
if( st!=NULL ) {
|
||||
if( !strcmp(st+1,"1") ) { readonly = true ; }
|
||||
st[0] = '\0' ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,25 +122,28 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l
|
||||
AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_SETFONT, Notepad_LoadString(NOTEPAD_STR_SETFONT));
|
||||
|
||||
hSMFichier = CreateMenu();
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_NEW, Notepad_LoadString(NOTEPAD_STR_NEW));
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_OPEN, Notepad_LoadString(NOTEPAD_STR_OPEN));
|
||||
AppendMenu(hSMFichier, MF_STRING|MF_GRAYED|MF_DISABLED, NOTEPAD_IDM_SAVE, Notepad_LoadString(NOTEPAD_STR_SAVE));
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_SAVEAS, Notepad_LoadString(NOTEPAD_STR_SAVEAS));
|
||||
|
||||
if( !readonly ) {
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_NEW, Notepad_LoadString(NOTEPAD_STR_NEW));
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_OPEN, Notepad_LoadString(NOTEPAD_STR_OPEN));
|
||||
AppendMenu(hSMFichier, MF_STRING|MF_GRAYED|MF_DISABLED, NOTEPAD_IDM_SAVE, Notepad_LoadString(NOTEPAD_STR_SAVE));
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_SAVEAS, Notepad_LoadString(NOTEPAD_STR_SAVEAS));
|
||||
#ifdef NOMAIN
|
||||
AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_INI, TEXT("ini file"));
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_SAV, TEXT("sav file"));
|
||||
if( ParentWindow!=NULL ) {
|
||||
AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_RESIZE, TEXT("&Resize"));
|
||||
}
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_INI, TEXT("ini file"));
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_SAV, TEXT("sav file"));
|
||||
if( ParentWindow!=NULL ) {
|
||||
AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_RESIZE, TEXT("&Resize"));
|
||||
}
|
||||
#endif
|
||||
AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
|
||||
AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
|
||||
}
|
||||
AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_QUIT, Notepad_LoadString(NOTEPAD_STR_QUIT));
|
||||
|
||||
hMenu = CreateMenu();
|
||||
AppendMenu(hMenu,MF_POPUP,(UINT)hSMFichier,Notepad_LoadString(NOTEPAD_STR_FILE));
|
||||
AppendMenu(hMenu,MF_POPUP,(UINT)hSMEdition,Notepad_LoadString(NOTEPAD_STR_EDIT));
|
||||
if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hSMEdition,Notepad_LoadString(NOTEPAD_STR_EDIT)); }
|
||||
|
||||
#ifdef NOMAIN
|
||||
HMENU hSMDelim = CreateMenu() ;
|
||||
@@ -141,20 +151,20 @@ int WINAPI Notepad_WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR l
|
||||
AppendMenu(hSMDelim, MF_STRING|MF_CHECKED, NOTEPAD_IDM_SCOLON, Notepad_LoadString(NOTEPAD_STR_SCOLON));
|
||||
AppendMenu(hSMDelim, MF_STRING|MF_UNCHECKED, NOTEPAD_IDM_SLASH, Notepad_LoadString(NOTEPAD_STR_SLASH));
|
||||
AppendMenu(hSMDelim, MF_STRING|MF_UNCHECKED, NOTEPAD_IDM_TILDE, Notepad_LoadString(NOTEPAD_STR_TILDE));
|
||||
AppendMenu(hMenu,MF_POPUP,(UINT)hSMDelim,Notepad_LoadString(NOTEPAD_STR_DELIM));
|
||||
if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hSMDelim,Notepad_LoadString(NOTEPAD_STR_DELIM)); }
|
||||
|
||||
HMENU hWindows = CreateMenu() ;
|
||||
AppendMenu(hWindows, MF_STRING, NOTEPAD_IDM_RESIZE_ALL, "&Arrange");
|
||||
AppendMenu(hWindows, MF_STRING, NOTEPAD_IDM_CASCADE_ALL, "&Cascade");
|
||||
AppendMenu(hMenu,MF_POPUP,(UINT)hWindows,"&Windows");
|
||||
if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hWindows,"&Windows"); }
|
||||
|
||||
AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND, Notepad_LoadString(NOTEPAD_STR_SEND));
|
||||
if( !readonly ) { AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND, Notepad_LoadString(NOTEPAD_STR_SEND)) ; }
|
||||
//AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND_ALL, Notepad_LoadString(NOTEPAD_STR_SEND_ALL));
|
||||
#endif
|
||||
AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP));
|
||||
if( !readonly ) { AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP)); }
|
||||
|
||||
//hwnd = CreateWindow(Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL);
|
||||
hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL);
|
||||
hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, (int)cxScreen/2, (int)cyScreen/2, NULL, hMenu, hinstance, NULL);
|
||||
|
||||
if (!hwnd) return FALSE;
|
||||
|
||||
@@ -193,9 +203,16 @@ LRESULT CALLBACK Notepad_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_CREATE: {
|
||||
hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE |
|
||||
ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL,
|
||||
0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL);
|
||||
|
||||
if( readonly ) {
|
||||
hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE | ES_READONLY |
|
||||
ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL,
|
||||
0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL);
|
||||
} else {
|
||||
hEdit = CreateWindow("edit", "", WS_CHILD | WS_VISIBLE |
|
||||
ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL,
|
||||
0, 0, 0, 0, hwnd, NULL, notepad_hinst, NULL);
|
||||
}
|
||||
|
||||
ZeroMemory(&lf, sizeof(LOGFONT));
|
||||
lstrcpy(lf.lfFaceName,"Courier");
|
||||
|
||||
@@ -49,5 +49,5 @@ BEGIN
|
||||
|
||||
NOTEPAD_FILE_FILTER "Text files, (*.txt, *.ini)|*.txt;*.ini|C/C++ files, (*.c, *.cpp, *.h, *.rc)|*.c;*.cpp;*.h;*.rc|Script files, (*.ksh, *.sh)|*.ksh;*.sh\0SQL files, (*.sql)|*.sql|All files, (*.*)|*.*\0"
|
||||
|
||||
NOTEPAD_STR_LICENCE " mNotepad 1.0\nwritten by Cyd, 2016, for the Telnet/SSH client TTY"
|
||||
NOTEPAD_STR_LICENCE " mNotepad 1.0\nwritten by Cyd, 2020, for the Telnet/SSH client TTY"
|
||||
END
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^.*page=Donation.*$
|
||||
RewriteRule ^.*$ https://www.9bis.net/kitty/\#!pages/donation.md? [NE,R,L]
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^.*page=Download.*$
|
||||
RewriteRule ^.*$ https://www.9bis.net/kitty/#!pages/download.md? [NE,R,L]
|
||||
|
||||
RewriteCond %{HTTP:Authorization} ^(.*)
|
||||
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
|
||||
|
||||
|
||||
Options -Indexes
|
||||
|
||||
<Files .htaccess>
|
||||
order allow,deny
|
||||
deny from all
|
||||
</Files>
|
||||
|
||||
<Files ~ "\.php">
|
||||
order deny,allow
|
||||
deny from all
|
||||
</Files>
|
||||
|
||||
<Files ~ "^(index|edit|version1|check_update).php">
|
||||
order deny,allow
|
||||
allow from all
|
||||
</Files>
|
||||
|
||||
<filesMatch "\.(html|htm|xml|xsl)$">
|
||||
<ifModule mod_headers.c>
|
||||
Header set Cache-Control "max-age=7200, must-revalidate"
|
||||
</ifModule>
|
||||
</filesMatch>
|
||||
|
||||
<filesMatch "\.(png|gif|ico|jpg|pdf)$">
|
||||
<ifModule mod_headers.c>
|
||||
Header set Cache-Control "max-age=7200, must-revalidate"
|
||||
</ifModule>
|
||||
</filesMatch>
|
||||
|
||||
<filesMatch "\.(exe|dll|zip|rtf|ktx|reg)$">
|
||||
<ifModule mod_headers.c>
|
||||
Header set Cache-Control "max-age=1200, must-revalidate"
|
||||
</ifModule>
|
||||
</filesMatch>
|
||||
|
||||
<filesMatch "\.(md|txt)$">
|
||||
FileETag None
|
||||
<ifModule mod_headers.c>
|
||||
Header unset ETag
|
||||
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
|
||||
Header set Pragma "no-cache"
|
||||
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
|
||||
</ifModule>
|
||||
</filesMatch>
|
||||
@@ -0,0 +1,16 @@
|
||||
<html><head>
|
||||
<title>Bitcoin donation</title>
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script><script type="text/javascript" src="https://blockchain.info/Resources/js/pay-now-button.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<center>
|
||||
<div style="font-size:16px;margin:0 auto;width:300px" class="blockchain-btn" data-address="1KUrsJJidB3GrWFcSgX8tHbYbBn8svtnPb" data-shared="false"> <div class="blockchain stage-begin"> <img src="https://blockchain.info/Resources/buttons/donate_64.png"/> </div> <div class="blockchain stage-loading" style="text-align:center"> <img src="https://blockchain.info/Resources/loading-large.gif"/> </div> <div class="blockchain stage-ready"> <p align="center">Please Donate To Bitcoin Address: <b>[[address]]</b></p> <p align="center" class="qr-code"></p> </div> <div class="blockchain stage-paid"> Donation of <b>[[value]] BTC</b> Received. Thank You. </div> <div class="blockchain stage-error"> <font color="red">[[error]]</font> </div></div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
Bitcoin address:<br/> <br/><b>1KUrsJJidB3GrWFcSgX8tHbYbBn8svtnPb<b><br/> <br/>
|
||||
<img src="bitcoin.png">
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 415 B |
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
if( !isset($_REQUEST["version"]) ) header("Location: http://www.9bis.net/kitty/" ) ;
|
||||
else {
|
||||
|
||||
$bin_version = $_REQUEST["version"] ;
|
||||
if( !preg_match( "/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $bin_version ) ) { $bin_version = "0.0.0.0" ; }
|
||||
|
||||
if( $fd = fopen( "version.txt", "r") ) {
|
||||
$last_version = fgets( $fd, 1024 ) ;
|
||||
fclose( $fd ) ;
|
||||
}
|
||||
else { $last_version="0.0.0.0" ; }
|
||||
$last_version = preg_replace( "/[^0-9\.]/", "", $last_version ) ;
|
||||
|
||||
$bin_array=explode( ".", $bin_version ) ;
|
||||
$last_array=explode( ".", $last_version ) ;
|
||||
|
||||
$test = 0 ;
|
||||
|
||||
if( $bin_array[0]<$last_array[0] ) $test=1 ;
|
||||
else if( $bin_array[1]<$last_array[1] ) $test=1 ;
|
||||
else if( $bin_array[2]<$last_array[2] ) $test=1 ;
|
||||
else if( $bin_array[3]<$last_array[3] ) $test=1 ;
|
||||
|
||||
|
||||
echo "<html><head>" ;
|
||||
echo '<script type="text/javascript">
|
||||
var sec=11 ;
|
||||
function starttimer() {
|
||||
sec = sec -1 ;
|
||||
if( sec>=0 ) {
|
||||
document.getElementById("t").innerHTML = sec ;
|
||||
setTimeout( function(){starttimer()}, 1000 );
|
||||
}
|
||||
else {
|
||||
window.location = "http://www.9bis.net/kitty/" ;
|
||||
}
|
||||
}
|
||||
</script>' ;
|
||||
echo "<title>KiTTY version checker</title></head>\n<body onLoad=\"starttimer();\">\n" ;
|
||||
echo "<center>\n" ;
|
||||
echo '<script type="text/javascript"><!--
|
||||
google_ad_client = "ca-pub-8272224832618193";
|
||||
/* KiTTY */
|
||||
google_ad_slot = "9739478064";
|
||||
google_ad_width = 728;
|
||||
google_ad_height = 90;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
</script>' ;
|
||||
echo "<br> <br> <br> <br> <br> <br> <br>" ;
|
||||
|
||||
if( $test ) {
|
||||
echo "<h1>\n" ;
|
||||
echo "Your version is ".$bin_version."<br>\n" ;
|
||||
echo "The last version is ".$last_version."<br>\n" ;
|
||||
echo " <br>\n" ;
|
||||
echo "<a href=\"http://www.9bis.net/kitty/\">Upgrade</a>\n" ;
|
||||
echo "</h1>\n" ;
|
||||
}
|
||||
else {
|
||||
echo "<h1>Your version is up to date</h1>\n" ;
|
||||
}
|
||||
|
||||
echo " <br>You will be redirected in <div id=\"t\">10</div> seconds." ;
|
||||
|
||||
echo "</center>\n" ;
|
||||
echo "</body>\n</html>\n" ;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"useSideMenu": false,
|
||||
"lineBreaks": "gfm",
|
||||
"additionalFooterText": "Original address of this website is <a href='http://kitty.9bis.com'>http://kitty.9bis.com/</a><br/>by <a href='https://github.com/cyd01'>Cyd</a> since 2005",
|
||||
"anchorCharacter": "#",
|
||||
"title": "KiTTY, a free telnet/ssh client for Windows"
|
||||
}
|
||||
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,9 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY]
|
||||
|
||||
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY\Commands]
|
||||
"Listing directory"="ls -lrtA"
|
||||
|
||||
[HKEY_CURRENT_USER\Software\9bis.com\KiTTY\Commands\SQL]
|
||||
"Connection"="connect login/password"
|
||||
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Google Adsense</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- GOOGLE ADSENSE -->
|
||||
<div id="gad">
|
||||
<script type="text/javascript" async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
|
||||
<ins class="adsbygoogle"
|
||||
style="display:block; text-align:center;"
|
||||
data-ad-layout="in-article"
|
||||
data-ad-format="fluid"
|
||||
data-ad-client="ca-pub-8272224832618193"
|
||||
data-ad-slot="3455125208"></ins>
|
||||
<script type="text/javascript">
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
</script>
|
||||
</div>
|
||||
<!-- GOOGLE ADSENSE -->
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 894 B |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 150 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 168 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 85 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 194 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 142 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 81 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 159 B |
|
After Width: | Height: | Size: 107 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 100 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 99 B |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 4.7 KiB |