Exemplo n.º 1
0
// Generation de la clé privée PuTTY
int GenerePrivateKey( const char * filename ) {
	FILE * fp ;
	char buffer[8192] = "" ;
	strcpy( buffer, private_key_str ) ;
	decryptstring( buffer, MASTER_PASSWORD ) ;
	printf("Generating %s file\n",filename);
	if( ( fp = fopen( filename , "wb" ) ) == NULL ) 
		{ fprintf( stderr, "Unable to open %s\n",filename ) ; return 0 ; }
	printf("Generating %s file\n",filename);
	fwrite( buffer, 1, strlen( buffer ), fp ) ;
	fclose( fp ) ;
	return 1;
	}
Exemplo n.º 2
0
int checkpos(char *buffer,int *vicside,char *ipaddress)
	{
	char *info[20];
	decryptstring(buffer,info);
	*vicside=atoi(info[0]);
	strcpy(ipaddress,info[2]);
	if(gameinfo.side[atoi(info[0])].there==occupied)
		{
		return -1;
		}
	else if(atoi(info[1])==0)
		{
		return 1;
		}
	else return 2;
	}
Exemplo n.º 3
0
void *mang_alls(void *argv)
{

//side is passed as absolute frame
char *serverip,*parameter;
parameter=(char*)argv;
serverip=strtok(parameter,"/");

int portno=atoi(strtok(NULL,"/"));

int side=atoi(strtok(NULL,"/")),sockfd,k,noworr,socketid;
char buffer[256];
char *info[20];
for(k=0;k<20;k++)
	{
	info[k]=(char *)malloc(20*(sizeof(char)));
	}

sockfd=startclient(serverip,portno);
char help[20];
gethostname(help,20);
sprintf(buffer,"%d/0/",side);
strcat(buffer,help);				
noworr=send(sockfd,buffer,strlen(buffer),0);
noworr=recv(sockfd,buffer,256,0);
pthread_t man_left,man_right,man_bottom,man_top,mang;
//tokenize buffer
decryptstring(buffer,info);
gameinfo.me=side;
gameinfo.side[side].mepoints=0;
gameinfo.side[side].mequeen=NO;


int i,j=0;
//updatemygameinfo;
gameinfo.playercount=atoi(info[8])+1;			//make sure abotut this that not added twice
gameinfo.friction=atof(info[9])*0.005;
gameinfo.erest=atof(info[10])*0.001;

gameinfo.turn=atoi(info[11]);
for(i=0;i<4;i++)
	{
	gameinfo.side[i].there=atoi(info[i]);
	strcpy(gameinfo.side[i].ip,info[i+4]);
	}





//figure out positions of others fromgame info, 
for(i=0;i<4;i++)
{
if(i==side)
	{
	printf("side==%d\n",side);
	gameinfo.side[side].there=occupied;
	gethostname(gameinfo.side[side].ip,20);
	continue;
	}		//add for server too
if(atoi(info[i])==occupied)
	{
	if(i!=atoi(info[12]))
		{
		socketid=startclient(info[4+i],portno);gethostname(help,20);
		sprintf(buffer,"%d/1/",side);
		strcat(buffer,help);				//why 1 -it implies already hve info??
		noworr=send(socketid,buffer,strlen(buffer),0);
		}
	else
		{
		socketid=sockfd;
		}
	gameinfo.side[i].sock=socketid;
	switch(i)
		{
		case left: {pthread_create(&man_left,NULL,manl,"1");break;}
		case right: {pthread_create(&man_right,NULL,manr,"3");break;}
		case top: {pthread_create(&man_top,NULL,mant,"2");break;}
		case bottom: {pthread_create(&man_bottom,NULL,manb,"0");break;}

		}
	}

}
char tem_ps[10];printf("exiting with portno=%d\n",portno);
sprintf(tem_ps,"%d",portno);
pthread_create(&mang,NULL,mang_all,tem_ps);			

getc(stdin);



}
Exemplo n.º 4
0
void SaveDumpConfig( FILE *fp, Conf * conf ) {
    char *buf=NULL ;
    CountUp();
    fprintf( fp, "MASTER_PASSWORD=%s\n", MASTER_PASSWORD ) ;
    fprintf( fp, "[[PuTTY structure configuration]]\n" ) ;
    fprintf( fp, "sessionname=%s\n", 		conf_get_str(conf,CONF_sessionname) ) ;
    /* Basic options */
    fprintf( fp, "host=%s\n", 			conf_get_str(conf,CONF_host) ) ;
    fprintf( fp, "port=%d\n", 			conf_get_int(conf,CONF_port) ) ;
    fprintf( fp, "protocol=%d\n", 			conf_get_int(conf,CONF_protocol) ) ;
    fprintf( fp, "addressfamily=%d\n",		conf_get_int(conf,CONF_addressfamily) ) ;
    fprintf( fp, "close_on_exit=%d\n",		conf_get_int(conf,CONF_close_on_exit) ) ;
    fprintf( fp, "warn_on_close=%d\n",		conf_get_int(conf,CONF_warn_on_close) ) ;
    fprintf( fp, "ping_interval=%d\n", 		conf_get_int(conf,CONF_ping_interval) ) ;
    fprintf( fp, "tcp_nodelay=%d\n", 		conf_get_int(conf,CONF_tcp_nodelay) ) ;
    fprintf( fp, "tcp_keepalives=%d\n", 		conf_get_int(conf,CONF_tcp_keepalives) ) ;
    /* Proxy options */
    fprintf( fp, "proxy_exclude_list=%s\n",		conf_get_str(conf,CONF_proxy_exclude_list) ) ;
    fprintf( fp, "proxy_dns=%d\n", 			conf_get_int(conf,CONF_proxy_dns) ) ;
    fprintf( fp, "even_proxy_localhost=%d\n",	conf_get_int(conf,CONF_even_proxy_localhost) ) ;
    fprintf( fp, "proxy_type=%d\n",			conf_get_int(conf,CONF_proxy_type) ) ;

    fprintf( fp, "proxy_host=%s\n", 		conf_get_str(conf,CONF_proxy_host) ) ;
    fprintf( fp, "proxy_port=%d\n", 		conf_get_int(conf,CONF_proxy_port) ) ;
    fprintf( fp, "proxy_username=%s\n", 		conf_get_str(conf,CONF_proxy_username) ) ;
    fprintf( fp, "proxy_password=%s\n", 		conf_get_str(conf,CONF_proxy_password) ) ;
    fprintf( fp, "proxy_telnet_command=%s\n", 	conf_get_str(conf,CONF_proxy_telnet_command) ) ;
    fprintf( fp, "proxy_log_to_term=%d\n", 		conf_get_int(conf,CONF_proxy_log_to_term) ) ;

    /* PERSOPORT Options */
    // fprintf( fp, "bcdelay=%d\n", 			conf_get_int(conf,CONF_bcdelay) ) ;		// Non present systematiquement
    // fprintf( fp, "initdelay=%d\n",			conf_get_int(conf,CONF_initdelay) ) ;		// Non present systematiquement
    fprintf( fp, "transparencynumber=%d\n", 	conf_get_int(conf,CONF_transparencynumber) ) ;
    fprintf( fp, "sendtotray=%d\n",			conf_get_int(conf,CONF_sendtotray) ) ;
    fprintf( fp, "maximize=%d\n",			conf_get_int(conf,CONF_maximize) ) ;
    fprintf( fp, "icone=%d\n",			conf_get_int(conf,CONF_icone) ) ;
    fprintf( fp, "iconefile=%s\n",			conf_get_filename(conf,CONF_iconefile)->path ) ;
    fprintf( fp, "folder=%s\n", 			conf_get_str(conf,CONF_folder) ) ;
    fprintf( fp, "sftpconnect=%s\n", 		conf_get_str(conf,CONF_sftpconnect) ) ;

    char bufpass[4096] ;
    memcpy( bufpass, conf_get_str(conf,CONF_password), 4095 ) ;
    bufpass[4095]='\0';
    MASKPASS(bufpass);
    fprintf( fp, "password=%s\n",			bufpass ) ;
    memset(bufpass,0,strlen(bufpass));

    fprintf( fp, "antiidle=%s\n",			conf_get_str(conf,CONF_antiidle) ) ;
    fprintf( fp, "autocommand=%s\n",		conf_get_str(conf,CONF_autocommand) ) ;
    fprintf( fp, "autocommandout=%s\n",		conf_get_str(conf,CONF_autocommandout) ) ;
    fprintf( fp, "scriptfile=%s\n",			conf_get_filename(conf,CONF_scriptfile)->path ) ;
    fprintf( fp, "scriptfilecontent=%s",		conf_get_str(conf,CONF_scriptfilecontent) ) ;

    buf=(char*)malloc( strlen(conf_get_str(conf,CONF_scriptfilecontent)) + 20 ) ;
    strcpy( buf, conf_get_str(conf,CONF_scriptfilecontent) ) ;
    long l=decryptstring( buf, MASTER_PASSWORD ) ;
    int i;
    for( i=0; i<l ; i++ ) {
        if( buf[i]=='\0' ) buf[i]='\n' ;
    }
    fprintf( fp, " (%s)\n", buf ) ;
    free(buf);
    buf=NULL;

    /* SSH options */
    fprintf( fp, "remote_cmd=%s\n",			conf_get_str(conf,CONF_remote_cmd) ) ;
    //char *remote_cmd_ptr;	       /* might point to a larger command but never for loading/saving */
    //char *remote_cmd_ptr2;	       /* might point to a larger command but never for loading/saving */
    fprintf( fp, "nopty=%d\n",			conf_get_int(conf,CONF_nopty) ) ;
    fprintf( fp, "compression=%d\n",		conf_get_int(conf,CONF_compression) ) ;
    fprintf( fp, "ssh_rekey_time=%d\n",		conf_get_int(conf,CONF_ssh_rekey_time) ) ;
    //int ssh_kexlist[KEX_MAX];
    fprintf( fp, "ssh_rekey_data=%s\n",		conf_get_str(conf,CONF_ssh_rekey_data) ) ;
    fprintf( fp, "tryagent=%d\n",			conf_get_int(conf,CONF_tryagent) ) ;
    fprintf( fp, "agentfwd=%d\n",			conf_get_int(conf,CONF_agentfwd) ) ;
    fprintf( fp, "change_username=%d\n",		conf_get_int(conf,CONF_change_username) ) ;
    //int ssh_cipherlist[CIPHER_MAX];
    fprintf( fp, "keyfile=%s\n",			conf_get_filename(conf,CONF_keyfile)->path ) ;
    fprintf( fp, "sshprot=%d\n",			conf_get_int(conf,CONF_sshprot) ) ;
    fprintf( fp, "ssh2_des_cbc=%d\n",		conf_get_int(conf,CONF_ssh2_des_cbc) ) ;
    fprintf( fp, "ssh_no_userauth=%d\n",		conf_get_int(conf,CONF_ssh_no_userauth) ) ;
    fprintf( fp, "ssh_show_banner=%d\n",		conf_get_int(conf,CONF_ssh_show_banner) ) ;
    fprintf( fp, "try_tis_auth=%d\n",		conf_get_int(conf,CONF_try_tis_auth) ) ;
    fprintf( fp, "try_ki_auth=%d\n",		conf_get_int(conf,CONF_try_ki_auth) ) ;
    fprintf( fp, "try_gssapi_auth=%d\n",		conf_get_int(conf,CONF_try_gssapi_auth) ) ;
    fprintf( fp, "gssapifwd=%d\n",			conf_get_int(conf,CONF_gssapifwd) ) ;
    //fprintf( fp, "ssh_gsslist=%d\n",		conf_get_int(conf,CONF_ssh_gsslist) ) ;
    fprintf( fp, "ssh_gss_custom=%s\n",		conf_get_filename(conf,CONF_ssh_gss_custom)->path ) ;
    //fprintf( fp, "ssh_subsys=%d\n",			conf_get_int(conf,CONF_ssh_subsys) ) ;
    //fprintf( fp, "ssh_subsys2=%d\n",		conf_get_int(conf,CONF_ssh_subsys2) ) ;
    fprintf( fp, "ssh_no_shell=%d\n",		conf_get_int(conf,CONF_ssh_no_shell) ) ;
    //fprintf( fp, "ssh_nc_host=%s\n",		conf_get_str(conf,CONF_ssh_nc_host) ) ;
    //fprintf( fp, "ssh_nc_port=%d\n",		conf_get_int(conf,CONF_ssh_nc_port) ) ;

#ifdef RUTTYPORT
    fprintf( fp, "ScriptFileName=%s\n",		conf_get_filename(conf,CONF_script_filename)->path ) ;
    fprintf( fp, "ScriptMode=%d\n",			conf_get_int(conf,CONF_script_mode) ) ;
    fprintf( fp, "ScriptLineDelay=%d\n",		conf_get_int(conf,CONF_script_line_delay) ) ;
    fprintf( fp, "ScriptCharDelay=%d\n",		conf_get_int(conf,CONF_script_char_delay) ) ;
    fprintf( fp, "ScriptCondLine=%s\n",		conf_get_str(conf,CONF_script_cond_line) ) ;
    fprintf( fp, "ScriptCondUse=%d\n",		conf_get_int(conf,CONF_script_cond_use) ) ;
    fprintf( fp, "ScriptCRLF=%d\n",			conf_get_int(conf,CONF_script_crlf) ) ;
    fprintf( fp, "ScriptEnable=%d\n",		conf_get_int(conf,CONF_script_enable) ) ;
    fprintf( fp, "ScriptExcept=%d\n",		conf_get_int(conf,CONF_script_except) ) ;
    fprintf( fp, "ScriptTimeout=%d\n",		conf_get_int(conf,CONF_script_timeout) ) ;
    fprintf( fp, "ScriptWait=%s\n",			conf_get_str(conf,CONF_script_waitfor) ) ;
    fprintf( fp, "ScriptHalt=%s\n",			conf_get_str(conf,CONF_script_halton) ) ;
#endif
    /* Telnet options */
    fprintf( fp, "termtype=%s\n",			conf_get_str(conf,CONF_termtype ) ) ;
    fprintf( fp, "termspeed=%s\n",			conf_get_str(conf,CONF_termspeed ) ) ;
    //fprintf( fp, "ttymodes=%s\n",			conf_get_str(conf,CONF_ttymodes ) ) ;
    //fprintf( fp, "environmt=%s\n",			conf_get_str(conf,CONF_environmt ) ) ;
    fprintf( fp, "username=%s\n",			conf_get_str(conf,CONF_username ) ) ;
    fprintf( fp, "localusername=%s\n",		conf_get_str(conf,CONF_localusername ) ) ;
    fprintf( fp, "rfc_environ=%d\n",		conf_get_int(conf,CONF_rfc_environ) ) ;
    fprintf( fp, "passive_telnet=%d\n",		conf_get_int(conf,CONF_passive_telnet) ) ;
    /* Serial port options */
    fprintf( fp, "serline=%s\n", 			conf_get_str(conf,CONF_serline) ) ;
    fprintf( fp, "serspeed=%d\n",			conf_get_int(conf,CONF_serspeed) ) ;
    fprintf( fp, "serdatabits=%d\n",		conf_get_int(conf,CONF_serdatabits) ) ;
    fprintf( fp, "serstopbits=%d\n",		conf_get_int(conf,CONF_serstopbits) ) ;
    fprintf( fp, "serparity=%d\n",			conf_get_int(conf,CONF_serparity) ) ;
    fprintf( fp, "serflow=%d\n",			conf_get_int(conf,CONF_serflow) ) ;
#ifdef IVPORT
    /* Background */
    fprintf( fp, "bg_wallpaper=%d\n", 		conf_get_int(conf, CONF_bg_wallpaper));
    fprintf( fp, "bg_effect=%d\n", 			conf_get_int(conf, CONF_bg_effect));
    fprintf( fp, "wp_file=%s\n", 			conf_get_filename(conf,CONF_wp_file)->path ) ;
    fprintf( fp, "wp_position=%d\n", 		conf_get_int(conf, CONF_wp_position));
    fprintf( fp, "wp_align=%d\n", 			conf_get_int(conf, CONF_wp_align));
    fprintf( fp, "wp_valign=%d\n", 			conf_get_int(conf, CONF_wp_valign));
    fprintf( fp, "wp_moving=%d\n", 			conf_get_int(conf, CONF_wp_moving));
#endif
#ifdef CYGTERMPORT
    /* Cygterm options */
    fprintf( fp, "cygcmd=%s\n", 			conf_get_str(conf,CONF_cygcmd) ) ;
    fprintf( fp, "alt_metabit=%d\n", 		conf_get_int(conf,CONF_alt_metabit) ) ;
#endif
    /* Keyboard options */
    fprintf( fp, "bksp_is_delete=%d\n", 		conf_get_int(conf,CONF_bksp_is_delete) ) ;
    fprintf( fp, "rxvt_homeend=%d\n", 		conf_get_int(conf,CONF_rxvt_homeend) ) ;
    fprintf( fp, "funky_type=%d\n", 		conf_get_int(conf,CONF_funky_type) ) ;
    fprintf( fp, "no_applic_c=%d\n", 		conf_get_int(conf,CONF_no_applic_c) ) ;
    fprintf( fp, "no_applic_k=%d\n", 		conf_get_int(conf,CONF_no_applic_k) ) ;
    fprintf( fp, "no_mouse_rep=%d\n", 		conf_get_int(conf,CONF_no_mouse_rep) ) ;
    fprintf( fp, "no_remote_resize=%d\n", 		conf_get_int(conf,CONF_no_remote_resize) ) ;
    fprintf( fp, "no_alt_screen=%d\n", 		conf_get_int(conf,CONF_no_alt_screen) ) ;
    fprintf( fp, "no_remote_wintitle=%d\n", 	conf_get_int(conf,CONF_no_remote_wintitle) ) ;
    fprintf( fp, "no_dbackspace=%d\n", 		conf_get_int(conf,CONF_no_dbackspace) ) ;
    fprintf( fp, "no_remote_charset=%d\n", 		conf_get_int(conf,CONF_no_remote_charset) ) ;
    fprintf( fp, "remote_qtitle_action=%d\n", 	conf_get_int(conf,CONF_remote_qtitle_action) ) ;
    fprintf( fp, "app_cursor=%d\n", 		conf_get_int(conf,CONF_app_cursor) ) ;
    fprintf( fp, "app_keypad=%d\n", 		conf_get_int(conf,CONF_app_keypad) ) ;
    fprintf( fp, "nethack_keypad=%d\n", 		conf_get_int(conf,CONF_nethack_keypad) ) ;
    fprintf( fp, "telnet_keyboard=%d\n", 		conf_get_int(conf,CONF_telnet_keyboard) ) ;
    fprintf( fp, "telnet_newline=%d\n", 		conf_get_int(conf,CONF_telnet_newline) ) ;
    fprintf( fp, "alt_f4=%d\n", 			conf_get_int(conf,CONF_alt_f4) ) ;
    fprintf( fp, "alt_space=%d\n", 			conf_get_int(conf,CONF_alt_space) ) ;
    fprintf( fp, "alt_only=%d\n", 			conf_get_int(conf,CONF_alt_only) ) ;
    fprintf( fp, "localecho=%d\n", 			conf_get_int(conf,CONF_localecho) ) ;
    fprintf( fp, "localedit=%d\n", 			conf_get_int(conf,CONF_localedit) ) ;
    fprintf( fp, "alwaysontop=%d\n", 		conf_get_int(conf,CONF_alwaysontop) ) ;
    fprintf( fp, "fullscreenonaltenter=%d\n", 	conf_get_int(conf,CONF_fullscreenonaltenter) ) ;
    fprintf( fp, "scroll_on_key=%d\n", 		conf_get_int(conf,CONF_scroll_on_key) ) ;
    fprintf( fp, "scroll_on_disp=%d\n", 		conf_get_int(conf,CONF_scroll_on_disp) ) ;
    fprintf( fp, "erase_to_scrollback=%d\n",	conf_get_int(conf,CONF_erase_to_scrollback) ) ;
    fprintf( fp, "compose_key=%d\n", 		conf_get_int(conf,CONF_compose_key) ) ;
    fprintf( fp, "ctrlaltkeys=%d\n", 		conf_get_int(conf,CONF_ctrlaltkeys) ) ;
#ifdef OSX_META_KEY_CONFIG
    fprintf( fp, "osx_option_meta=%d\n", 		conf_get_int(conf,CONF_osx_option_meta) ) ;
    fprintf( fp, "osx_command_meta=%d\n", 		conf_get_int(conf,CONF_osx_command_meta) ) ;
#endif
    fprintf( fp, "wintitle=%s\n",			conf_get_str(conf,CONF_wintitle) ) ;
    /* Terminal options */
    fprintf( fp, "savelines=%d\n", 			conf_get_int(conf,CONF_savelines) ) ;
    fprintf( fp, "dec_om=%d\n", 			conf_get_int(conf,CONF_dec_om) ) ;
    fprintf( fp, "wrap_mode=%d\n", 			conf_get_int(conf,CONF_wrap_mode) ) ;
    fprintf( fp, "lfhascr=%d\n", 			conf_get_int(conf,CONF_lfhascr) ) ;
    fprintf( fp, "cursor_type=%d\n", 		conf_get_int(conf,CONF_cursor_type) ) ;
    fprintf( fp, "blink_cur=%d\n", 			conf_get_int(conf,CONF_blink_cur) ) ;
    fprintf( fp, "beep=%d\n", 			conf_get_int(conf,CONF_beep) ) ;
    fprintf( fp, "beep_ind=%d\n", 			conf_get_int(conf,CONF_beep_ind) ) ;
    fprintf( fp, "bellovl=%d\n", 			conf_get_int(conf,CONF_bellovl) ) ;
    fprintf( fp, "bellovl_n=%d\n", 			conf_get_int(conf,CONF_bellovl_n) ) ;
    fprintf( fp, "bellovl_t=%d\n",			conf_get_int(conf,CONF_bellovl_t) ) ;
    fprintf( fp, "bellovl_s=%d\n",			conf_get_int(conf,CONF_bellovl_s) ) ;
    fprintf( fp, "scrollbar=%d\n",			conf_get_int(conf,CONF_scrollbar) ) ;
    fprintf( fp, "scrollbar_in_fullscreen=%d\n",	conf_get_int(conf,CONF_scrollbar_in_fullscreen) ) ;
    fprintf( fp, "resize_action=%d\n",		conf_get_int(conf,CONF_resize_action) ) ;
    fprintf( fp, "bce=%d\n",			conf_get_int(conf,CONF_bce) ) ;
    fprintf( fp, "blinktext=%d\n",			conf_get_int(conf,CONF_blinktext) ) ;
    fprintf( fp, "win_name_always=%d\n",		conf_get_int(conf,CONF_win_name_always) ) ;
    fprintf( fp, "width=%d\n",			conf_get_int(conf,CONF_width) ) ;
    fprintf( fp, "height=%d\n",			conf_get_int(conf,CONF_height) ) ;
    fprintf( fp, "font_quality=%d\n",		conf_get_int(conf,CONF_font_quality) ) ;
    fprintf( fp, "logtype=%d\n",			conf_get_int(conf,CONF_logtype) ) ;
    fprintf( fp, "logxfovr=%d\n",			conf_get_int(conf,CONF_logxfovr) ) ;
    fprintf( fp, "logflush=%d\n",			conf_get_int(conf,CONF_logflush) ) ;
    fprintf( fp, "logomitpass=%d\n",		conf_get_int(conf,CONF_logomitpass) ) ;
    fprintf( fp, "logomitdata=%d\n",		conf_get_int(conf,CONF_logomitdata) ) ;
    fprintf( fp, "hide_mouseptr=%d\n",		conf_get_int(conf,CONF_hide_mouseptr) ) ;
    fprintf( fp, "sunken_edge=%d\n",		conf_get_int(conf,CONF_sunken_edge) ) ;
    fprintf( fp, "window_border=%d\n",		conf_get_int(conf,CONF_window_border) ) ;
    fprintf( fp, "saveonexit=%d\n",			conf_get_int(conf,CONF_saveonexit) ) ;
    fprintf( fp, "XPos=%d\n",			conf_get_int(conf,CONF_xpos) ) ;
    fprintf( fp, "YPos=%d\n",			conf_get_int(conf,CONF_ypos) ) ;
    fprintf( fp, "fullscreen=%d\n",			conf_get_int(conf,CONF_fullscreen) ) ;
    fprintf( fp, "foreground_on_bell=%d\n",		conf_get_int(conf,CONF_foreground_on_bell) ) ;
    fprintf( fp, "bell_wavefile=%s\n",		conf_get_filename(conf,CONF_bell_wavefile)->path ) ;
    //FontSpec font;
    fprintf( fp, "logfilename=%s\n",		conf_get_filename(conf,CONF_logfilename)->path ) ;
#if (defined IMAGEPORT) && (!defined FDJ)
    /* IMAGEPORT Options */
    fprintf( fp, "bg_opacity=%d\n",			conf_get_int(conf,CONF_bg_opacity) ) ;
    fprintf( fp, "bg_slideshow=%d\n",		conf_get_int(conf,CONF_bg_slideshow) ) ;
    fprintf( fp, "bg_type=%d\n",			conf_get_int(conf,CONF_bg_type) ) ;
    fprintf( fp, "bg_image_style=%d\n",		conf_get_int(conf,CONF_bg_image_style) ) ;
    fprintf( fp, "bg_image_abs_x=%d\n",		conf_get_int(conf,CONF_bg_image_abs_x) ) ;
    fprintf( fp, "bg_image_abs_y=%d\n",		conf_get_int(conf,CONF_bg_image_abs_y) ) ;
    fprintf( fp, "bg_image_abs_fixed=%d\n",		conf_get_int(conf,CONF_bg_image_abs_fixed) ) ;
    fprintf( fp, "bg_image_filename=%s\n",		conf_get_filename(conf,CONF_bg_image_filename)->path ) ;
#endif
    fprintf( fp, "answerback=%s\n",			conf_get_str(conf,CONF_answerback) ) ;
    fprintf( fp, "printer=%s\n",			conf_get_str(conf,CONF_printer) ) ;
    fprintf( fp, "arabicshaping=%d\n",		conf_get_int(conf,CONF_arabicshaping) ) ;
#ifdef PRINTCLIPPORT
    fprintf( fp, "printclip=%d\n",			conf_get_int(conf,CONF_printclip) ) ;
#endif
    fprintf( fp, "bidi=%d\n",			conf_get_int(conf,CONF_bidi) ) ;
    /* Colour options */
    fprintf( fp, "ansi_colour=%d\n",		conf_get_int(conf,CONF_ansi_colour) ) ;
    fprintf( fp, "xterm_256_colour=%d\n",		conf_get_int(conf,CONF_xterm_256_colour) ) ;
    fprintf( fp, "system_colour=%d\n",		conf_get_int(conf,CONF_system_colour) ) ;
    fprintf( fp, "try_palette%d\n",			conf_get_int(conf,CONF_try_palette) ) ;
    fprintf( fp, "bold_style=%d\n",			conf_get_int(conf,CONF_bold_style) ) ;
    //unsigned char colours[22][3];
    /* Selection options */
    fprintf( fp, "mouse_is_xterm=%d\n",		conf_get_int(conf,CONF_mouse_is_xterm) ) ;
    fprintf( fp, "rect_select=%d\n",		conf_get_int(conf,CONF_rect_select) ) ;
    fprintf( fp, "rawcnp=%d\n",			conf_get_int(conf,CONF_rawcnp) ) ;
    fprintf( fp, "rtf_paste=%d\n",			conf_get_int(conf,CONF_rtf_paste) ) ;
    fprintf( fp, "mouse_override=%d\n",		conf_get_int(conf,CONF_mouse_override) ) ;
    //short wordness[256];
    /* translations */
    fprintf( fp, "vtmode=%d\n",			conf_get_int(conf,CONF_vtmode) ) ;
    fprintf( fp, "line_codepage=%s\n",		conf_get_str(conf,CONF_line_codepage) ) ;
    fprintf( fp, "cjk_ambig_wide=%d\n",		conf_get_int(conf,CONF_cjk_ambig_wide) ) ;
    fprintf( fp, "utf8_override=%d\n",		conf_get_int(conf,CONF_utf8_override) ) ;
    fprintf( fp, "xlat_capslockcyr=%d\n",		conf_get_int(conf,CONF_xlat_capslockcyr) ) ;
    /* X11 forwarding */
    fprintf( fp, "x11_forward=%d\n",		conf_get_int(conf,CONF_x11_forward) ) ;
    fprintf( fp, "x11_auth=%d\n",			conf_get_int(conf,CONF_x11_auth) ) ;
    fprintf( fp, "x11_display=%s\n",		conf_get_str(conf,CONF_x11_display) ) ;
    /* port forwarding */
    fprintf( fp, "lport_acceptall=%d\n",		conf_get_int(conf,CONF_lport_acceptall) ) ;
    fprintf( fp, "rport_acceptall=%d\n",		conf_get_int(conf,CONF_rport_acceptall) ) ;
    fprintf( fp, "portfwd=\n") ;
    char *key, *val;
    for (val = conf_get_str_strs(conf, CONF_portfwd, NULL, &key);
            val != NULL;
            val = conf_get_str_strs(conf, CONF_portfwd, key, &key)) {
        if (!strcmp(val, "D")) fprintf( fp, "	D%s\t\n", key+1 ) ;
        else fprintf( fp, "	%s\t%s\n", key, val);
    }
    /* SSH bug compatibility modes */
    fprintf( fp, "sshbug_ignore1=%d\n",		conf_get_int(conf,CONF_sshbug_ignore1) ) ;
    fprintf( fp, "sshbug_plainpw1=%d\n",		conf_get_int(conf,CONF_sshbug_plainpw1) ) ;
    fprintf( fp, "sshbug_rsa1=%d\n",		conf_get_int(conf,CONF_sshbug_rsa1) ) ;
    fprintf( fp, "sshbug_hmac2=%d\n",		conf_get_int(conf,CONF_sshbug_hmac2) ) ;
    fprintf( fp, "sshbug_derivekey2=%d\n",		conf_get_int(conf,CONF_sshbug_derivekey2) ) ;
    fprintf( fp, "sshbug_rsapad2=%d\n",		conf_get_int(conf,CONF_sshbug_rsapad2) ) ;
    fprintf( fp, "sshbug_pksessid2=%d\n",		conf_get_int(conf,CONF_sshbug_pksessid2) ) ;
    fprintf( fp, "sshbug_rekey2=%d\n",		conf_get_int(conf,CONF_sshbug_rekey2) ) ;
    /* Options for pterm. Should split out into platform-dependent part. */
    fprintf( fp, "stamp_utmp=%d\n",			conf_get_int(conf,CONF_stamp_utmp) ) ;
    fprintf( fp, "login_shell=%d\n",		conf_get_int(conf,CONF_login_shell) ) ;
    fprintf( fp, "scrollbar_on_left=%d\n",		conf_get_int(conf,CONF_scrollbar_on_left) ) ;
    fprintf( fp, "shadowbold=%d\n",			conf_get_int(conf,CONF_shadowbold) ) ;
    fprintf( fp, "shadowboldoffset=%d\n",		conf_get_int(conf,CONF_shadowboldoffset) ) ;
    fprintf( fp, "ctrl_tab_switch=%d\n", 		conf_get_int(conf, CONF_ctrl_tab_switch));
    fprintf( fp, "comment=%s\n",			conf_get_str(conf,CONF_comment) ) ;
    fprintf( fp, "acs_in_utf=%d\n", 		conf_get_int(conf, CONF_acs_in_utf));
    fprintf( fp, "scp_auto_pwd=%d\n", 		conf_get_int(conf, CONF_scp_auto_pwd));
#ifdef RECONNECTPORT
    fprintf( fp, "wakeup_reconnect=%d\n",		conf_get_int(conf,CONF_wakeup_reconnect) ) ;
    fprintf( fp, "failure_reconnect=%d\n",		conf_get_int(conf,CONF_failure_reconnect) ) ;
#endif
#ifdef HYPERLINKPORT
    fprintf( fp, "url_ctrl_click=%d\n",		conf_get_int(conf,CONF_url_ctrl_click) ) ;
    fprintf( fp, "url_underline=%d\n",		conf_get_int(conf,CONF_url_underline) ) ;
    fprintf( fp, "url_defbrowser=%d\n",		conf_get_int(conf,CONF_url_defbrowser) ) ;
    fprintf( fp, "url_defregex=%d\n",		conf_get_int(conf,CONF_url_defregex) ) ;
    fprintf( fp, "url_browser=%s\n",		conf_get_filename(conf,CONF_url_browser)->path ) ;
    fprintf( fp, "url_regex=%s\n",			conf_get_str(conf,CONF_url_regex) ) ;
    fprintf( fp, "urlhack_default_regex=%s\n",	urlhack_default_regex ) ;
    fprintf( fp, "urlhack_liberal_regex=%s\n",	urlhack_liberal_regex ) ;
#endif
#ifdef ZMODEMPORT
    fprintf( fp, "rzcommand=%s\n",			conf_get_filename(conf,CONF_rzcommand)->path ) ;
    fprintf( fp, "rzoptions=%s\n",			conf_get_str(conf,CONF_rzoptions) ) ;
    fprintf( fp, "szcommand=%s\n",			conf_get_filename(conf,CONF_szcommand)->path ) ;
    fprintf( fp, "szoptions=%s\n",			conf_get_str(conf,CONF_szoptions) ) ;
    fprintf( fp, "zdownloaddir=%s\n",		conf_get_str(conf,CONF_zdownloaddir) ) ;
#endif
#ifdef TUTTYPORT
    fprintf( fp, "window_closable=%d\n",		conf_get_int(conf,CONF_window_closable) ) ;
    fprintf( fp, "window_minimizable=%d\n",		conf_get_int(conf,CONF_window_minimizable) ) ;
    fprintf( fp, "window_maximizable=%d\n",		conf_get_int(conf,CONF_window_maximizable) ) ;
    fprintf( fp, "window_has_sysmenu=%d\n",		conf_get_int(conf,CONF_window_has_sysmenu) ) ;
    fprintf( fp, "bottom_buttons=%d\n",		conf_get_int(conf,CONF_bottom_buttons) ) ;
    fprintf( fp, "bold_colour=%d\n",		conf_get_int(conf,CONF_bold_colour) ) ;
    fprintf( fp, "under_colour=%d\n",		conf_get_int(conf,CONF_under_colour) ) ;
    fprintf( fp, "sel_colour=%d\n",			conf_get_int(conf,CONF_sel_colour) ) ;
#endif
#ifdef PORTKNOCKINGPORT
    fprintf( fp, "portknocking=%s\n",		conf_get_str(conf,CONF_portknockingoptions) ) ;
#endif
    //FontSpec boldfont; //FontSpec widefont; //FontSpec wideboldfont;

    fprintf( fp, "\n[[KiTTY specific configuration]]\n" ) ;
    fprintf( fp, "IniFileFlag=%d - ",IniFileFlag) ;
    switch(IniFileFlag) {
    case 0:
        fprintf( fp, "Registry\n" ) ;
        break ;
    case 1:
        fprintf( fp, "File\n" ) ;
        break ;
    case 2:
        fprintf( fp, "Directory\n" ) ;
        break ;
    }

    fprintf( fp, "internal_delay=%d\ninit_delay=%d\nautocommand_delay=%d\nbetween_char_delay=%d\nProtectFlag=%d\n",internal_delay,init_delay,autocommand_delay,between_char_delay,ProtectFlag );

    fprintf( fp, "HyperlinkFlag=%d\n", HyperlinkFlag );
    if( AutoCommand!= NULL ) fprintf( fp, "AutoCommand=%s\n", AutoCommand ) ;
    if( ScriptCommand!= NULL ) fprintf( fp, "ScriptCommand=%s\n", ScriptCommand ) ;
    if( PasteCommand!= NULL ) fprintf( fp, "PasteCommand=%s\n", PasteCommand ) ;
    fprintf( fp, "PasteCommandFlag=%d\n", PasteCommandFlag );
    if( ScriptFileContent!= NULL ) {
        char * pst = ScriptFileContent ;
        fprintf( fp, "ScriptFileContent=" ) ;
        while( strlen(pst) > 0 ) {
            fprintf( fp, "%s|", pst ) ;
            pst=pst+strlen(pst)+1 ;
        }
        fprintf( fp, "\n" )  ;
    }
    if( IconFile!= NULL ) fprintf( fp, "IconFile=%s\n", IconFile ) ;
    fprintf( fp, "AutoStoreSSHKeyFlag=%d\nDirectoryBrowseFlag=%d\nVisibleFlag=%d\nShortcutsFlag=%d\nMouseShortcutsFlag=%d\nIconeFlag=%d\nNumberOfIcons=%d\nSizeFlag=%d\nCapsLockFlag=%d\nTitleBarFlag=%d\nCtrlTabFlag=%d\nRuTTYFlag=%d\n"
             ,GetAutoStoreSSHKeyFlag(),DirectoryBrowseFlag,VisibleFlag,ShortcutsFlag,MouseShortcutsFlag,IconeFlag,NumberOfIcons,SizeFlag,CapsLockFlag,TitleBarFlag,CtrlTabFlag,RuTTYFlag);
    //static HINSTANCE hInstIcons =  NULL ;
    fprintf( fp, "WinHeight=%d\nAutoSendToTray=%d\nNoKittyFileFlag=%d\nConfigBoxHeight=%d\nConfigBoxWindowHeight=%d\nConfigBoxNoExitFlag=%d\nUserPassSSHNoSave=%d\nPuttyFlag=%d\n",WinHeight,AutoSendToTray,NoKittyFileFlag,ConfigBoxHeight,ConfigBoxWindowHeight,ConfigBoxNoExitFlag,UserPassSSHNoSave,PuttyFlag);
    fprintf( fp,"BackgroundImageFlag=%d\n",BackgroundImageFlag );
#ifdef RECONNECTPORT
    fprintf( fp,"AutoreconnectFlag=%d\nReconnectDelay=%d\n",AutoreconnectFlag,ReconnectDelay );
#endif
#ifdef IVPORT
    fprintf( fp,"BackgroundImageIVFlag=%d\n",BackgroundImageIVFlag );
#endif
#ifdef CYGTERMPORT
    fprintf( fp,"CygTermFlag=%d\n",cygterm_get_flag() );
#endif
#ifdef ADBPORT
    fprintf( fp,"ADBFlag=%d\n",GetADBFlag() );
#endif
    if( PasswordConf!= NULL ) fprintf( fp, "PasswordConf=%s\n", PasswordConf ) ;
    fprintf( fp, "SessionFilterFlag=%d\nSessionsInDefaultFlag=%d\nDefaultSettingsFlag=%d\nImageViewerFlag=%d\nImageSlideDelay=%d\nMaxBlinkingTime=%d\nPrintCharSize=%d\nPrintMaxLinePerPage=%d\nPrintMaxCharPerLine=%d\n"
             ,SessionFilterFlag,SessionsInDefaultFlag,DefaultSettingsFlag,ImageViewerFlag,ImageSlideDelay,MaxBlinkingTime,PrintCharSize,PrintMaxLinePerPage,PrintMaxCharPerLine);
    fprintf( fp, "AntiIdleCount=%d\nAntiIdleCountMax=%d\nIconeNum=%d\n"
             ,AntiIdleCount,AntiIdleCountMax,IconeNum);
    fprintf( fp, "AntiIdleStr=%s\nInitialDirectory=%s\nConfigDirectory=%s\nBuildVersionTime=%s\n",AntiIdleStr,InitialDirectory,ConfigDirectory,BuildVersionTime);
    if( WinSCPPath!= NULL ) fprintf( fp, "WinSCPPath=%s\n", WinSCPPath ) ;
    if( PSCPPath!= NULL ) fprintf( fp, "PSCPPath=%s\n", PSCPPath ) ;
    if( PlinkPath!= NULL ) fprintf( fp, "PlinkPath=%s\n", PlinkPath ) ;
    if( KittyIniFile!= NULL ) fprintf( fp, "KittyIniFile=%s\n", KittyIniFile ) ;
    if( KittySavFile!= NULL ) fprintf( fp, "KittySavFile=%s\n", KittySavFile ) ;
    if( KiTTYClassName != NULL ) fprintf( fp, "KiTTYClassName=%s\n", KiTTYClassName ) ;
    if( CtHelperPath!= NULL ) fprintf( fp, "CtHelperPath=%s\n", CtHelperPath ) ;
    if( strlen(ManagePassPhrase(NULL))>0 ) fprintf( fp, "PassPhrase=%s\n", ManagePassPhrase(NULL)) ;
}
Exemplo n.º 5
0
void load_open_settings(void *sesskey, Config *cfg)
{
    int i;
    char prot[10];

    cfg->ssh_subsys = 0;	       /* FIXME: load this properly */
    cfg->remote_cmd_ptr = NULL;
    cfg->remote_cmd_ptr2 = NULL;
    cfg->ssh_nc_host[0] = '\0';

    gpps(sesskey, "HostName", "", cfg->host, sizeof(cfg->host));
    gppfile(sesskey, "LogFileName", &cfg->logfilename);
    gppi(sesskey, "LogType", 0, &cfg->logtype);
    gppi(sesskey, "LogFileClash", LGXF_ASK, &cfg->logxfovr);
    gppi(sesskey, "LogFlush", 1, &cfg->logflush);
    gppi(sesskey, "SSHLogOmitPasswords", 1, &cfg->logomitpass);
    gppi(sesskey, "SSHLogOmitData", 0, &cfg->logomitdata);

    gpps(sesskey, "Protocol", "default", prot, 10);
    cfg->protocol = default_protocol;
    cfg->port = default_port;
    {
	const Backend *b = backend_from_name(prot);
	if (b) {
	    cfg->protocol = b->protocol;
	    gppi(sesskey, "PortNumber", default_port, &cfg->port);
	}
    }

    /* Address family selection */
    gppi(sesskey, "AddressFamily", ADDRTYPE_UNSPEC, &cfg->addressfamily);

    /* The CloseOnExit numbers are arranged in a different order from
     * the standard FORCE_ON / FORCE_OFF / AUTO. */
    gppi(sesskey, "CloseOnExit", 1, &i); cfg->close_on_exit = (i+1)%3;
    gppi(sesskey, "WarnOnClose", 1, &cfg->warn_on_close);
    {
	/* This is two values for backward compatibility with 0.50/0.51 */
	int pingmin, pingsec;
	gppi(sesskey, "PingInterval", 0, &pingmin);
	gppi(sesskey, "PingIntervalSecs", 0, &pingsec);
	cfg->ping_interval = pingmin * 60 + pingsec;
    }
    gppi(sesskey, "TCPNoDelay", 1, &cfg->tcp_nodelay);
    gppi(sesskey, "TCPKeepalives", 0, &cfg->tcp_keepalives);
    gpps(sesskey, "TerminalType", "xterm", cfg->termtype,
	 sizeof(cfg->termtype));
    gpps(sesskey, "TerminalSpeed", "38400,38400", cfg->termspeed,
	 sizeof(cfg->termspeed));
    {
	/* This hardcodes a big set of defaults in any new saved
	 * sessions. Let's hope we don't change our mind. */
	int i;
	char *def = dupstr("");
	/* Default: all set to "auto" */
	for (i = 0; ttymodes[i]; i++) {
	    char *def2 = dupprintf("%s%s=A,", def, ttymodes[i]);
	    sfree(def);
	    def = def2;
	}
	gppmap(sesskey, "TerminalModes", def,
	       cfg->ttymodes, lenof(cfg->ttymodes));
	sfree(def);
    }
    /* proxy settings */
    gpps(sesskey, "ProxyExcludeList", "", cfg->proxy_exclude_list,
	 sizeof(cfg->proxy_exclude_list));
    gppi(sesskey, "ProxyDNS", 1, &i); cfg->proxy_dns = (i+1)%3;
    gppi(sesskey, "ProxyLocalhost", 0, &cfg->even_proxy_localhost);
    gppi(sesskey, "ProxyMethod", -1, &cfg->proxy_type);
    if (cfg->proxy_type == -1) {
        int i;
        gppi(sesskey, "ProxyType", 0, &i);
        if (i == 0)
            cfg->proxy_type = PROXY_NONE;
        else if (i == 1)
            cfg->proxy_type = PROXY_HTTP;
        else if (i == 3)
            cfg->proxy_type = PROXY_TELNET;
        else if (i == 4)
            cfg->proxy_type = PROXY_CMD;
        else {
            gppi(sesskey, "ProxySOCKSVersion", 5, &i);
            if (i == 5)
                cfg->proxy_type = PROXY_SOCKS5;
            else
                cfg->proxy_type = PROXY_SOCKS4;
        }
    }
    gpps(sesskey, "ProxyHost", "proxy", cfg->proxy_host,
	 sizeof(cfg->proxy_host));
    gppi(sesskey, "ProxyPort", 80, &cfg->proxy_port);
    gpps(sesskey, "ProxyUsername", "", cfg->proxy_username,
	 sizeof(cfg->proxy_username));
    gpps(sesskey, "ProxyPassword", "", cfg->proxy_password,
	 sizeof(cfg->proxy_password));
    gpps(sesskey, "ProxyTelnetCommand", "connect %host %port\\n",
	 cfg->proxy_telnet_command, sizeof(cfg->proxy_telnet_command));
    gppmap(sesskey, "Environment", "", cfg->environmt, lenof(cfg->environmt));
    gpps(sesskey, "UserName", "", cfg->username, sizeof(cfg->username));
    gppi(sesskey, "UserNameFromEnvironment", 0, &cfg->username_from_env);
    gpps(sesskey, "LocalUserName", "", cfg->localusername,
	 sizeof(cfg->localusername));
    gppi(sesskey, "NoPTY", 0, &cfg->nopty);
    gppi(sesskey, "Compression", 0, &cfg->compression);
    gppi(sesskey, "TryAgent", 1, &cfg->tryagent);
    gppi(sesskey, "AgentFwd", 0, &cfg->agentfwd);
    gppi(sesskey, "ChangeUsername", 0, &cfg->change_username);
    gppi(sesskey, "GssapiFwd", 0, &cfg->gssapifwd);
    gprefs(sesskey, "Cipher", "\0",
	   ciphernames, CIPHER_MAX, cfg->ssh_cipherlist);
    {
	/* Backward-compatibility: we used to have an option to
	 * disable gex under the "bugs" panel after one report of
	 * a server which offered it then choked, but we never got
	 * a server version string or any other reports. */
	char *default_kexes;
	gppi(sesskey, "BugDHGEx2", 0, &i); i = 2-i;
	if (i == FORCE_ON)
	    default_kexes = "dh-group14-sha1,dh-group1-sha1,rsa,WARN,dh-gex-sha1";
	else
	    default_kexes = "dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN";
	gprefs(sesskey, "KEX", default_kexes,
	       kexnames, KEX_MAX, cfg->ssh_kexlist);
    }
    gppi(sesskey, "RekeyTime", 60, &cfg->ssh_rekey_time);
    gpps(sesskey, "RekeyBytes", "1G", cfg->ssh_rekey_data,
	 sizeof(cfg->ssh_rekey_data));
    gppi(sesskey, "SshProt", 2, &cfg->sshprot);
    gpps(sesskey, "LogHost", "", cfg->loghost, sizeof(cfg->loghost));
    gppi(sesskey, "SSH2DES", 0, &cfg->ssh2_des_cbc);
    gppi(sesskey, "SshNoAuth", 0, &cfg->ssh_no_userauth);
    gppi(sesskey, "AuthTIS", 0, &cfg->try_tis_auth);
    gppi(sesskey, "AuthKI", 1, &cfg->try_ki_auth);
    gppi(sesskey, "AuthGSSAPI", 1, &cfg->try_gssapi_auth);
    gprefs(sesskey, "GSSList", "\0",
	   gsslibkeywords, ngsslibs, cfg->ssh_gsslist);
    gppi(sesskey, "SshNoShell", 0, &cfg->ssh_no_shell);
    gppfile(sesskey, "PublicKeyFile", &cfg->keyfile);
    gpps(sesskey, "RemoteCommand", "", cfg->remote_cmd,
	 sizeof(cfg->remote_cmd));
    gppi(sesskey, "RFCEnviron", 0, &cfg->rfc_environ);
    gppi(sesskey, "PassiveTelnet", 0, &cfg->passive_telnet);
    gppi(sesskey, "BackspaceIsDelete", 1, &cfg->bksp_is_delete);
    gppi(sesskey, "RXVTHomeEnd", 0, &cfg->rxvt_homeend);
    gppi(sesskey, "LinuxFunctionKeys", 0, &cfg->funky_type);
    gppi(sesskey, "NoApplicationKeys", 0, &cfg->no_applic_k);
    gppi(sesskey, "NoApplicationCursors", 0, &cfg->no_applic_c);
    gppi(sesskey, "NoMouseReporting", 0, &cfg->no_mouse_rep);
    gppi(sesskey, "NoRemoteResize", 0, &cfg->no_remote_resize);
    gppi(sesskey, "NoAltScreen", 0, &cfg->no_alt_screen);
    gppi(sesskey, "NoRemoteWinTitle", 0, &cfg->no_remote_wintitle);
    {
	/* Backward compatibility */
	int no_remote_qtitle;
	gppi(sesskey, "NoRemoteQTitle", 1, &no_remote_qtitle);
	/* We deliberately interpret the old setting of "no response" as
	 * "empty string". This changes the behaviour, but hopefully for
	 * the better; the user can always recover the old behaviour. */
	gppi(sesskey, "RemoteQTitleAction",
	     no_remote_qtitle ? TITLE_EMPTY : TITLE_REAL,
	     &cfg->remote_qtitle_action);
    }
    gppi(sesskey, "NoDBackspace", 0, &cfg->no_dbackspace);
    gppi(sesskey, "NoRemoteCharset", 0, &cfg->no_remote_charset);
    gppi(sesskey, "ApplicationCursorKeys", 0, &cfg->app_cursor);
    gppi(sesskey, "ApplicationKeypad", 0, &cfg->app_keypad);
    gppi(sesskey, "NetHackKeypad", 0, &cfg->nethack_keypad);
    gppi(sesskey, "AltF4", 1, &cfg->alt_f4);
    gppi(sesskey, "AltSpace", 0, &cfg->alt_space);
    gppi(sesskey, "AltOnly", 0, &cfg->alt_only);
    gppi(sesskey, "ComposeKey", 0, &cfg->compose_key);
    gppi(sesskey, "CtrlAltKeys", 1, &cfg->ctrlaltkeys);
    gppi(sesskey, "TelnetKey", 0, &cfg->telnet_keyboard);
    gppi(sesskey, "TelnetRet", 1, &cfg->telnet_newline);
    gppi(sesskey, "LocalEcho", AUTO, &cfg->localecho);
    gppi(sesskey, "LocalEdit", AUTO, &cfg->localedit);
#if (defined PERSOPORT) && (!defined FDJ)
    gpps(sesskey, "Answerback", "KiTTY", cfg->answerback,
	 sizeof(cfg->answerback));
#else
    gpps(sesskey, "Answerback", "PuTTY", cfg->answerback,
	 sizeof(cfg->answerback));
#endif
    gppi(sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
    gppi(sesskey, "FullScreenOnAltEnter", 0, &cfg->fullscreenonaltenter);
    gppi(sesskey, "HideMousePtr", 0, &cfg->hide_mouseptr);
    gppi(sesskey, "SunkenEdge", 0, &cfg->sunken_edge);
    gppi(sesskey, "WindowBorder", 1, &cfg->window_border);
    gppi(sesskey, "CurType", 0, &cfg->cursor_type);
    gppi(sesskey, "BlinkCur", 0, &cfg->blink_cur);
    /* pedantic compiler tells me I can't use &cfg->beep as an int * :-) */
    gppi(sesskey, "Beep", 1, &cfg->beep);
    gppi(sesskey, "BeepInd", 0, &cfg->beep_ind);
    gppfile(sesskey, "BellWaveFile", &cfg->bell_wavefile);
    gppi(sesskey, "BellOverload", 1, &cfg->bellovl);
    gppi(sesskey, "BellOverloadN", 5, &cfg->bellovl_n);
    gppi(sesskey, "BellOverloadT", 2*TICKSPERSEC
#ifdef PUTTY_UNIX_H
				   *1000
#endif
				   , &i);
    cfg->bellovl_t = i
#ifdef PUTTY_UNIX_H
		    / 1000
#endif
	;
    gppi(sesskey, "BellOverloadS", 5*TICKSPERSEC
#ifdef PUTTY_UNIX_H
				   *1000
#endif
				   , &i);
    cfg->bellovl_s = i
#ifdef PUTTY_UNIX_H
		    / 1000
#endif
	;
    gppi(sesskey, "ScrollbackLines", 200, &cfg->savelines);
    gppi(sesskey, "DECOriginMode", 0, &cfg->dec_om);
    gppi(sesskey, "AutoWrapMode", 1, &cfg->wrap_mode);
    gppi(sesskey, "LFImpliesCR", 0, &cfg->lfhascr);
    gppi(sesskey, "CRImpliesLF", 0, &cfg->crhaslf);
    gppi(sesskey, "DisableArabicShaping", 0, &cfg->arabicshaping);
    gppi(sesskey, "DisableBidi", 0, &cfg->bidi);
    gppi(sesskey, "WinNameAlways", 1, &cfg->win_name_always);
    gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle));
    gppi(sesskey, "TermWidth", 80, &cfg->width);
    gppi(sesskey, "TermHeight", 24, &cfg->height);
    gppfont(sesskey, "Font", &cfg->font);
    gppi(sesskey, "FontQuality", FQ_DEFAULT, &cfg->font_quality);
    gppi(sesskey, "FontVTMode", VT_UNICODE, (int *) &cfg->vtmode);
    gppi(sesskey, "UseSystemColours", 0, &cfg->system_colour);
    gppi(sesskey, "TryPalette", 0, &cfg->try_palette);
    gppi(sesskey, "ANSIColour", 1, &cfg->ansi_colour);
    gppi(sesskey, "Xterm256Colour", 1, &cfg->xterm_256_colour);
    gppi(sesskey, "BoldAsColour", 1, &cfg->bold_colour);

    for (i = 0; i < 22; i++) {
	static const char *const defaults[] = {
	    "187,187,187", "255,255,255", "0,0,0", "85,85,85", "0,0,0",
	    "0,255,0", "0,0,0", "85,85,85", "187,0,0", "255,85,85",
	    "0,187,0", "85,255,85", "187,187,0", "255,255,85", "0,0,187",
	    "85,85,255", "187,0,187", "255,85,255", "0,187,187",
	    "85,255,255", "187,187,187", "255,255,255"
	};
	char buf[20], buf2[30];
	int c0, c1, c2;
	sprintf(buf, "Colour%d", i);
	gpps(sesskey, buf, defaults[i], buf2, sizeof(buf2));
	if (sscanf(buf2, "%d,%d,%d", &c0, &c1, &c2) == 3) {
	    cfg->colours[i][0] = c0;
	    cfg->colours[i][1] = c1;
	    cfg->colours[i][2] = c2;
	}
    }
    gppi(sesskey, "RawCNP", 0, &cfg->rawcnp);
    gppi(sesskey, "PasteRTF", 0, &cfg->rtf_paste);
    gppi(sesskey, "MouseIsXterm", 0, &cfg->mouse_is_xterm);
    gppi(sesskey, "RectSelect", 0, &cfg->rect_select);
    gppi(sesskey, "MouseOverride", 1, &cfg->mouse_override);
    for (i = 0; i < 256; i += 32) {
	static const char *const defaults[] = {
	    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0",
	    "0,1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1",
	    "1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,2",
	    "1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1",
	    "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",
	    "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1",
	    "2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2",
	    "2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2"
	};
	char buf[20], buf2[256], *p;
	int j;
	sprintf(buf, "Wordness%d", i);
	gpps(sesskey, buf, defaults[i / 32], buf2, sizeof(buf2));
	p = buf2;
	for (j = i; j < i + 32; j++) {
	    char *q = p;
	    while (*p && *p != ',')
		p++;
	    if (*p == ',')
		*p++ = '\0';
	    cfg->wordness[j] = atoi(q);
	}
    }
    /*
     * The empty default for LineCodePage will be converted later
     * into a plausible default for the locale.
     */
    gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
	 sizeof(cfg->line_codepage));
    gppi(sesskey, "CJKAmbigWide", 0, &cfg->cjk_ambig_wide);
    gppi(sesskey, "UTF8Override", 1, &cfg->utf8_override);
    gpps(sesskey, "Printer", "", cfg->printer, sizeof(cfg->printer));
    gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
    gppi(sesskey, "ScrollBar", 1, &cfg->scrollbar);
    gppi(sesskey, "ScrollBarFullScreen", 0, &cfg->scrollbar_in_fullscreen);
    gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
    gppi(sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
    gppi(sesskey, "EraseToScrollback", 1, &cfg->erase_to_scrollback);
    gppi(sesskey, "LockSize", 0, &cfg->resize_action);
    gppi(sesskey, "BCE", 1, &cfg->bce);
    gppi(sesskey, "BlinkText", 0, &cfg->blinktext);
    gppi(sesskey, "X11Forward", 0, &cfg->x11_forward);
    gpps(sesskey, "X11Display", "", cfg->x11_display,
	 sizeof(cfg->x11_display));
    gppi(sesskey, "X11AuthType", X11_MIT, &cfg->x11_auth);
    gppfile(sesskey, "X11AuthFile", &cfg->xauthfile);

    gppi(sesskey, "LocalPortAcceptAll", 0, &cfg->lport_acceptall);
    gppi(sesskey, "RemotePortAcceptAll", 0, &cfg->rport_acceptall);
    gppmap(sesskey, "PortForwardings", "", cfg->portfwd, lenof(cfg->portfwd));
    gppi(sesskey, "BugIgnore1", 0, &i); cfg->sshbug_ignore1 = 2-i;
    gppi(sesskey, "BugPlainPW1", 0, &i); cfg->sshbug_plainpw1 = 2-i;
    gppi(sesskey, "BugRSA1", 0, &i); cfg->sshbug_rsa1 = 2-i;
    gppi(sesskey, "BugIgnore2", 0, &i); cfg->sshbug_ignore2 = 2-i;
    {
	int i;
	gppi(sesskey, "BugHMAC2", 0, &i); cfg->sshbug_hmac2 = 2-i;
	if (cfg->sshbug_hmac2 == AUTO) {
	    gppi(sesskey, "BuggyMAC", 0, &i);
	    if (i == 1)
		cfg->sshbug_hmac2 = FORCE_ON;
	}
    }
    gppi(sesskey, "BugDeriveKey2", 0, &i); cfg->sshbug_derivekey2 = 2-i;
    gppi(sesskey, "BugRSAPad2", 0, &i); cfg->sshbug_rsapad2 = 2-i;
    gppi(sesskey, "BugPKSessID2", 0, &i); cfg->sshbug_pksessid2 = 2-i;
    gppi(sesskey, "BugRekey2", 0, &i); cfg->sshbug_rekey2 = 2-i;
    gppi(sesskey, "BugMaxPkt2", 0, &i); cfg->sshbug_maxpkt2 = 2-i;
    cfg->ssh_simple = FALSE;
    gppi(sesskey, "StampUtmp", 1, &cfg->stamp_utmp);
    gppi(sesskey, "LoginShell", 1, &cfg->login_shell);
    gppi(sesskey, "ScrollbarOnLeft", 0, &cfg->scrollbar_on_left);
    gppi(sesskey, "ShadowBold", 0, &cfg->shadowbold);
    gppfont(sesskey, "BoldFont", &cfg->boldfont);
    gppfont(sesskey, "WideFont", &cfg->widefont);
    gppfont(sesskey, "WideBoldFont", &cfg->wideboldfont);
    gppi(sesskey, "ShadowBoldOffset", 1, &cfg->shadowboldoffset);
    gpps(sesskey, "SerialLine", "", cfg->serline, sizeof(cfg->serline));
    gppi(sesskey, "SerialSpeed", 9600, &cfg->serspeed);
    gppi(sesskey, "SerialDataBits", 8, &cfg->serdatabits);
    gppi(sesskey, "SerialStopHalfbits", 2, &cfg->serstopbits);
    gppi(sesskey, "SerialParity", SER_PAR_NONE, &cfg->serparity);
    gppi(sesskey, "SerialFlowControl", SER_FLOW_XONXOFF, &cfg->serflow);
#ifdef SCPORT
    gppi(sesskey, "AuthPKCS11", 0, &cfg->try_pkcs11_auth);
    gppfile(sesskey, "PKCS11LibFile", &cfg->pkcs11_libfile);
    { int k; for(k=0;k<sizeof(cfg->pkcs11_token_label);k++) cfg->pkcs11_token_label[k] = '\0'; }
    gpps(sesskey, "PKCS11TokenLabel", "", cfg->pkcs11_token_label,
 	 sizeof(cfg->pkcs11_token_label));
    { int k; for(k=0;k<sizeof(cfg->pkcs11_cert_label);k++) cfg->pkcs11_cert_label[k] = '\0'; }
    gpps(sesskey, "PKCS11CertLabel", "", cfg->pkcs11_cert_label,
 	 sizeof(cfg->pkcs11_cert_label));
#endif
#ifdef PERSOPORT
    //char buf[25] ="" ;
    //gpps(sesskey, "BCDelay", "0.", buf, sizeof(buf)) ; cfg->bcdelay = atof(buf) ;
    //gpps(sesskey, "InitDelay", "2.0", buf, sizeof(buf)) ; cfg->initdelay = atof(buf) ;
    
    gppi(sesskey, "SendToTray", 0, &cfg->sendtotray);
    gppi(sesskey, "SaveOnExit", 0, &cfg->saveonexit);
    //gpps(sesskey, "TransparencyValue", 0, buf, sizeof(buf)) ; cfg->transparencynumber = 255-atoi(buf) ;
    gppi(sesskey, "TransparencyValue", 0, &cfg->transparencynumber ) ; 
    //cfg->transparencynumber = 255-cfg->transparencynumber ;
    if( cfg->transparencynumber < -1 ) cfg->transparencynumber = -1 ;
    if( cfg->transparencynumber > 255 ) cfg->transparencynumber = 255 ;
    
    char PassKey[1024] = "" ;
    sprintf( PassKey, "%s%sKiTTY", cfg->host, cfg->termtype ) ;
    gpps(sesskey, "Folder", "", cfg->folder, sizeof(cfg->folder));
    gppi(sesskey, "Icone", 1, &cfg->icone);
    gpps(sesskey, "IconeFile", "", cfg->iconefile, sizeof(cfg->iconefile));
    gpps(sesskey, "Password", "", cfg->password, sizeof(cfg->password));
    decryptstring( cfg->password, PassKey ) ;
    
    if( strlen( cfg->password ) > 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", cfg->password ) ;
			fclose( fp ) ;
			}
		}
	}
    gpps(sesskey, "Autocommand", "", cfg->autocommand, sizeof(cfg->autocommand));
    gpps(sesskey, "AutocommandOut", "", cfg->autocommandout, sizeof(cfg->autocommandout));
    gpps(sesskey, "AntiIdle", "", cfg->antiidle, sizeof(cfg->antiidle));
    gpps(sesskey, "LogTimestamp", "", cfg->logtimestamp, sizeof(cfg->logtimestamp));

    gppfile(sesskey, "Scriptfile", &cfg->scriptfile);
	
    gppi(sesskey, "TermXPos", -1, &cfg->xpos);
    gppi(sesskey, "TermYPos", -1, &cfg->ypos);
    gppi(sesskey, "WindowState", 0, &cfg->windowstate);
    gppi(sesskey, "SaveWindowPos", 0, &cfg->save_windowpos); /* BKG */
#endif
#ifdef RECONNECTPORT
    gppi(sesskey, "WakeupReconnect", 0, &cfg->wakeup_reconnect);
    gppi(sesskey, "FailureReconnect", 0, &cfg->failure_reconnect);
#endif
#ifdef IMAGEPORT
    gppi(sesskey, "BgOpacity", 50, &cfg->bg_opacity);
    gppi(sesskey, "BgSlideshow", 0, &cfg->bg_slideshow);
    gppi(sesskey, "BgType", 0, &cfg->bg_type);
    gppfile(sesskey, "BgImageFile", &cfg->bg_image_filename);
    gppi(sesskey, "BgImageStyle", 0, &cfg->bg_image_style);
    gppi(sesskey, "BgImageAbsoluteX", 0, &cfg->bg_image_abs_x);
    gppi(sesskey, "BgImageAbsoluteY", 0, &cfg->bg_image_abs_y);
    gppi(sesskey, "BgImagePlacement", 0, &cfg->bg_image_abs_fixed);
#endif
#ifdef URLPORT
    gppi(sesskey, "CopyURLDetection", 1, &cfg->copy_clipbd_url_reg);
#endif
#ifdef HYPERLINKPORT
	/*
	 * HACK: PuttyTray / Nutty
	 * Hyperlink stuff: Save hyperlink settings
	 */
	gppi(sesskey, "HyperlinkUnderline", 1, &cfg->url_underline);
	gppi(sesskey, "HyperlinkUseCtrlClick", 0, &cfg->url_ctrl_click);
	gppi(sesskey, "HyperlinkBrowserUseDefault", 1, &cfg->url_defbrowser);
	gpps(sesskey, "HyperlinkBrowser", "", cfg->url_browser, sizeof(cfg->url_browser));
	gppi(sesskey, "HyperlinkRegularExpressionUseDefault", 1, &cfg->url_defregex);
#ifndef NO_HYPERLINK
	gpps(sesskey, "HyperlinkRegularExpression", urlhack_default_regex, cfg->url_regex, sizeof(cfg->url_regex));
#endif
#endif
#ifdef CYGTERMPORT
    gppi(sesskey, "CygtermAutoPath", 1, &cfg->cygautopath);
    gpps(sesskey, "CygtermCommand", "", cfg->cygcmd, sizeof(cfg->cygcmd));
#endif
#ifdef ZMODEMPORT
    gpps(sesskey, "rzCommand", "rz", cfg->rzcommand, sizeof(cfg->rzcommand));
    gpps(sesskey, "rzOptions", "-e -v", cfg->rzoptions, sizeof(cfg->rzoptions));
    gpps(sesskey, "szCommand", "sz", cfg->szcommand, sizeof(cfg->szcommand));
    gpps(sesskey, "szOptions", "-e -v", cfg->szoptions, sizeof(cfg->szoptions));
    gpps(sesskey, "zDownloadDir", "C:\\", cfg->zdownloaddir, sizeof(cfg->zdownloaddir));
#endif
}
Exemplo n.º 6
0
void save_open_settings(void *sesskey, Config *cfg)
{
    int i;
    char *p;

    write_setting_i(sesskey, "Present", 1);
    write_setting_s(sesskey, "HostName", cfg->host);
    write_setting_filename(sesskey, "LogFileName", cfg->logfilename);
    write_setting_i(sesskey, "LogType", cfg->logtype);
    write_setting_i(sesskey, "LogFileClash", cfg->logxfovr);
    write_setting_i(sesskey, "LogFlush", cfg->logflush);
    write_setting_i(sesskey, "SSHLogOmitPasswords", cfg->logomitpass);
    write_setting_i(sesskey, "SSHLogOmitData", cfg->logomitdata);
    p = "raw";
    {
	const Backend *b = backend_from_proto(cfg->protocol);
	if (b)
	    p = b->name;
    }
    write_setting_s(sesskey, "Protocol", p);
    write_setting_i(sesskey, "PortNumber", cfg->port);
    /* The CloseOnExit numbers are arranged in a different order from
     * the standard FORCE_ON / FORCE_OFF / AUTO. */
    write_setting_i(sesskey, "CloseOnExit", (cfg->close_on_exit+2)%3);
    write_setting_i(sesskey, "WarnOnClose", !!cfg->warn_on_close);
    write_setting_i(sesskey, "PingInterval", cfg->ping_interval / 60);	/* minutes */
    write_setting_i(sesskey, "PingIntervalSecs", cfg->ping_interval % 60);	/* seconds */
    write_setting_i(sesskey, "TCPNoDelay", cfg->tcp_nodelay);
    write_setting_i(sesskey, "TCPKeepalives", cfg->tcp_keepalives);
    write_setting_s(sesskey, "TerminalType", cfg->termtype);
    write_setting_s(sesskey, "TerminalSpeed", cfg->termspeed);
    wmap(sesskey, "TerminalModes", cfg->ttymodes, lenof(cfg->ttymodes));

    /* Address family selection */
    write_setting_i(sesskey, "AddressFamily", cfg->addressfamily);

    /* proxy settings */
    write_setting_s(sesskey, "ProxyExcludeList", cfg->proxy_exclude_list);
    write_setting_i(sesskey, "ProxyDNS", (cfg->proxy_dns+2)%3);
    write_setting_i(sesskey, "ProxyLocalhost", cfg->even_proxy_localhost);
    write_setting_i(sesskey, "ProxyMethod", cfg->proxy_type);
    write_setting_s(sesskey, "ProxyHost", cfg->proxy_host);
    write_setting_i(sesskey, "ProxyPort", cfg->proxy_port);
    write_setting_s(sesskey, "ProxyUsername", cfg->proxy_username);
    write_setting_s(sesskey, "ProxyPassword", cfg->proxy_password);
    write_setting_s(sesskey, "ProxyTelnetCommand", cfg->proxy_telnet_command);
    wmap(sesskey, "Environment", cfg->environmt, lenof(cfg->environmt));
    write_setting_s(sesskey, "UserName", cfg->username);
    write_setting_i(sesskey, "UserNameFromEnvironment", cfg->username_from_env);
    write_setting_s(sesskey, "LocalUserName", cfg->localusername);
    write_setting_i(sesskey, "NoPTY", cfg->nopty);
    write_setting_i(sesskey, "Compression", cfg->compression);
    write_setting_i(sesskey, "TryAgent", cfg->tryagent);
    write_setting_i(sesskey, "AgentFwd", cfg->agentfwd);
    write_setting_i(sesskey, "GssapiFwd", cfg->gssapifwd);
    write_setting_i(sesskey, "ChangeUsername", cfg->change_username);
    wprefs(sesskey, "Cipher", ciphernames, CIPHER_MAX,
	   cfg->ssh_cipherlist);
    wprefs(sesskey, "KEX", kexnames, KEX_MAX, cfg->ssh_kexlist);
    write_setting_i(sesskey, "RekeyTime", cfg->ssh_rekey_time);
    write_setting_s(sesskey, "RekeyBytes", cfg->ssh_rekey_data);
    write_setting_i(sesskey, "SshNoAuth", cfg->ssh_no_userauth);
    write_setting_i(sesskey, "AuthTIS", cfg->try_tis_auth);
    write_setting_i(sesskey, "AuthKI", cfg->try_ki_auth);
    write_setting_i(sesskey, "AuthGSSAPI", cfg->try_gssapi_auth);
    wprefs(sesskey, "GSSLibs", gsslibkeywords, ngsslibs,
	   cfg->ssh_gsslist);
    write_setting_i(sesskey, "SshNoShell", cfg->ssh_no_shell);
    write_setting_i(sesskey, "SshProt", cfg->sshprot);
    write_setting_s(sesskey, "LogHost", cfg->loghost);
    write_setting_i(sesskey, "SSH2DES", cfg->ssh2_des_cbc);
    write_setting_filename(sesskey, "PublicKeyFile", cfg->keyfile);
    write_setting_s(sesskey, "RemoteCommand", cfg->remote_cmd);
    write_setting_i(sesskey, "RFCEnviron", cfg->rfc_environ);
    write_setting_i(sesskey, "PassiveTelnet", cfg->passive_telnet);
    write_setting_i(sesskey, "BackspaceIsDelete", cfg->bksp_is_delete);
    write_setting_i(sesskey, "RXVTHomeEnd", cfg->rxvt_homeend);
    write_setting_i(sesskey, "LinuxFunctionKeys", cfg->funky_type);
    write_setting_i(sesskey, "NoApplicationKeys", cfg->no_applic_k);
    write_setting_i(sesskey, "NoApplicationCursors", cfg->no_applic_c);
    write_setting_i(sesskey, "NoMouseReporting", cfg->no_mouse_rep);
    write_setting_i(sesskey, "NoRemoteResize", cfg->no_remote_resize);
    write_setting_i(sesskey, "NoAltScreen", cfg->no_alt_screen);
    write_setting_i(sesskey, "NoRemoteWinTitle", cfg->no_remote_wintitle);
    write_setting_i(sesskey, "RemoteQTitleAction", cfg->remote_qtitle_action);
    write_setting_i(sesskey, "NoDBackspace", cfg->no_dbackspace);
    write_setting_i(sesskey, "NoRemoteCharset", cfg->no_remote_charset);
    write_setting_i(sesskey, "ApplicationCursorKeys", cfg->app_cursor);
    write_setting_i(sesskey, "ApplicationKeypad", cfg->app_keypad);
    write_setting_i(sesskey, "NetHackKeypad", cfg->nethack_keypad);
    write_setting_i(sesskey, "AltF4", cfg->alt_f4);
    write_setting_i(sesskey, "AltSpace", cfg->alt_space);
    write_setting_i(sesskey, "AltOnly", cfg->alt_only);
    write_setting_i(sesskey, "ComposeKey", cfg->compose_key);
    write_setting_i(sesskey, "CtrlAltKeys", cfg->ctrlaltkeys);
    write_setting_i(sesskey, "TelnetKey", cfg->telnet_keyboard);
    write_setting_i(sesskey, "TelnetRet", cfg->telnet_newline);
    write_setting_i(sesskey, "LocalEcho", cfg->localecho);
    write_setting_i(sesskey, "LocalEdit", cfg->localedit);
    write_setting_s(sesskey, "Answerback", cfg->answerback);
    write_setting_i(sesskey, "AlwaysOnTop", cfg->alwaysontop);
    write_setting_i(sesskey, "FullScreenOnAltEnter", cfg->fullscreenonaltenter);
    write_setting_i(sesskey, "HideMousePtr", cfg->hide_mouseptr);
    write_setting_i(sesskey, "SunkenEdge", cfg->sunken_edge);
    write_setting_i(sesskey, "WindowBorder", cfg->window_border);
    write_setting_i(sesskey, "CurType", cfg->cursor_type);
    write_setting_i(sesskey, "BlinkCur", cfg->blink_cur);
    write_setting_i(sesskey, "Beep", cfg->beep);
    write_setting_i(sesskey, "BeepInd", cfg->beep_ind);
    write_setting_filename(sesskey, "BellWaveFile", cfg->bell_wavefile);
    write_setting_i(sesskey, "BellOverload", cfg->bellovl);
    write_setting_i(sesskey, "BellOverloadN", cfg->bellovl_n);
    write_setting_i(sesskey, "BellOverloadT", cfg->bellovl_t
#ifdef PUTTY_UNIX_H
		    * 1000
#endif
		    );
    write_setting_i(sesskey, "BellOverloadS", cfg->bellovl_s
#ifdef PUTTY_UNIX_H
		    * 1000
#endif
		    );
    write_setting_i(sesskey, "ScrollbackLines", cfg->savelines);
    write_setting_i(sesskey, "DECOriginMode", cfg->dec_om);
    write_setting_i(sesskey, "AutoWrapMode", cfg->wrap_mode);
    write_setting_i(sesskey, "LFImpliesCR", cfg->lfhascr);
    write_setting_i(sesskey, "CRImpliesLF", cfg->crhaslf);
    write_setting_i(sesskey, "DisableArabicShaping", cfg->arabicshaping);
    write_setting_i(sesskey, "DisableBidi", cfg->bidi);
    write_setting_i(sesskey, "WinNameAlways", cfg->win_name_always);
    write_setting_s(sesskey, "WinTitle", cfg->wintitle);
    write_setting_i(sesskey, "TermWidth", cfg->width);
    write_setting_i(sesskey, "TermHeight", cfg->height);
    write_setting_fontspec(sesskey, "Font", cfg->font);
    write_setting_i(sesskey, "FontQuality", cfg->font_quality);
    write_setting_i(sesskey, "FontVTMode", cfg->vtmode);
    write_setting_i(sesskey, "UseSystemColours", cfg->system_colour);
    write_setting_i(sesskey, "TryPalette", cfg->try_palette);
    write_setting_i(sesskey, "ANSIColour", cfg->ansi_colour);
    write_setting_i(sesskey, "Xterm256Colour", cfg->xterm_256_colour);
    write_setting_i(sesskey, "BoldAsColour", cfg->bold_colour);

    for (i = 0; i < 22; i++) {
	char buf[20], buf2[30];
	sprintf(buf, "Colour%d", i);
	sprintf(buf2, "%d,%d,%d", cfg->colours[i][0],
		cfg->colours[i][1], cfg->colours[i][2]);
	write_setting_s(sesskey, buf, buf2);
    }
    write_setting_i(sesskey, "RawCNP", cfg->rawcnp);
    write_setting_i(sesskey, "PasteRTF", cfg->rtf_paste);
    write_setting_i(sesskey, "MouseIsXterm", cfg->mouse_is_xterm);
    write_setting_i(sesskey, "RectSelect", cfg->rect_select);
    write_setting_i(sesskey, "MouseOverride", cfg->mouse_override);
    for (i = 0; i < 256; i += 32) {
	char buf[20], buf2[256];
	int j;
	sprintf(buf, "Wordness%d", i);
	*buf2 = '\0';
	for (j = i; j < i + 32; j++) {
	    sprintf(buf2 + strlen(buf2), "%s%d",
		    (*buf2 ? "," : ""), cfg->wordness[j]);
	}
	write_setting_s(sesskey, buf, buf2);
    }
    write_setting_s(sesskey, "LineCodePage", cfg->line_codepage);
    write_setting_i(sesskey, "CJKAmbigWide", cfg->cjk_ambig_wide);
    write_setting_i(sesskey, "UTF8Override", cfg->utf8_override);
    write_setting_s(sesskey, "Printer", cfg->printer);
    write_setting_i(sesskey, "CapsLockCyr", cfg->xlat_capslockcyr);
    write_setting_i(sesskey, "ScrollBar", cfg->scrollbar);
    write_setting_i(sesskey, "ScrollBarFullScreen", cfg->scrollbar_in_fullscreen);
    write_setting_i(sesskey, "ScrollOnKey", cfg->scroll_on_key);
    write_setting_i(sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
    write_setting_i(sesskey, "EraseToScrollback", cfg->erase_to_scrollback);
    write_setting_i(sesskey, "LockSize", cfg->resize_action);
    write_setting_i(sesskey, "BCE", cfg->bce);
    write_setting_i(sesskey, "BlinkText", cfg->blinktext);
    write_setting_i(sesskey, "X11Forward", cfg->x11_forward);
    write_setting_s(sesskey, "X11Display", cfg->x11_display);
    write_setting_i(sesskey, "X11AuthType", cfg->x11_auth);
    write_setting_filename(sesskey, "X11AuthFile", cfg->xauthfile);
    write_setting_i(sesskey, "LocalPortAcceptAll", cfg->lport_acceptall);
    write_setting_i(sesskey, "RemotePortAcceptAll", cfg->rport_acceptall);
    wmap(sesskey, "PortForwardings", cfg->portfwd, lenof(cfg->portfwd));
    write_setting_i(sesskey, "BugIgnore1", 2-cfg->sshbug_ignore1);
    write_setting_i(sesskey, "BugPlainPW1", 2-cfg->sshbug_plainpw1);
    write_setting_i(sesskey, "BugRSA1", 2-cfg->sshbug_rsa1);
    write_setting_i(sesskey, "BugIgnore2", 2-cfg->sshbug_ignore2);
    write_setting_i(sesskey, "BugHMAC2", 2-cfg->sshbug_hmac2);
    write_setting_i(sesskey, "BugDeriveKey2", 2-cfg->sshbug_derivekey2);
    write_setting_i(sesskey, "BugRSAPad2", 2-cfg->sshbug_rsapad2);
    write_setting_i(sesskey, "BugPKSessID2", 2-cfg->sshbug_pksessid2);
    write_setting_i(sesskey, "BugRekey2", 2-cfg->sshbug_rekey2);
    write_setting_i(sesskey, "BugMaxPkt2", 2-cfg->sshbug_maxpkt2);
    write_setting_i(sesskey, "StampUtmp", cfg->stamp_utmp);
    write_setting_i(sesskey, "LoginShell", cfg->login_shell);
    write_setting_i(sesskey, "ScrollbarOnLeft", cfg->scrollbar_on_left);
    write_setting_fontspec(sesskey, "BoldFont", cfg->boldfont);
    write_setting_fontspec(sesskey, "WideFont", cfg->widefont);
    write_setting_fontspec(sesskey, "WideBoldFont", cfg->wideboldfont);
    write_setting_i(sesskey, "ShadowBold", cfg->shadowbold);
    write_setting_i(sesskey, "ShadowBoldOffset", cfg->shadowboldoffset);
    write_setting_s(sesskey, "SerialLine", cfg->serline);
    write_setting_i(sesskey, "SerialSpeed", cfg->serspeed);
    write_setting_i(sesskey, "SerialDataBits", cfg->serdatabits);
    write_setting_i(sesskey, "SerialStopHalfbits", cfg->serstopbits);
    write_setting_i(sesskey, "SerialParity", cfg->serparity);
    write_setting_i(sesskey, "SerialFlowControl", cfg->serflow);
#ifdef SCPORT
    write_setting_i(sesskey, "AuthPKCS11", cfg->try_pkcs11_auth);
    write_setting_filename(sesskey, "PKCS11LibFile", cfg->pkcs11_libfile);
    write_setting_s(sesskey, "PKCS11TokenLabel", cfg->pkcs11_token_label);
    write_setting_s(sesskey, "PKCS11CertLabel", cfg->pkcs11_cert_label);
#endif
#ifdef RECONNECTPORT
    write_setting_i(sesskey, "WakeupReconnect", cfg->wakeup_reconnect);
    write_setting_i(sesskey, "FailureReconnect", cfg->failure_reconnect);
#endif
#ifdef IMAGEPORT
	if( get_param("BACKGROUNDIMAGE") ) {
    write_setting_i(sesskey, "BgOpacity", cfg->bg_opacity);
    write_setting_i(sesskey, "BgSlideshow", cfg->bg_slideshow);
    write_setting_i(sesskey, "BgType", cfg->bg_type);
    write_setting_filename(sesskey, "BgImageFile", cfg->bg_image_filename);
    write_setting_i(sesskey, "BgImageStyle", cfg->bg_image_style);
    write_setting_i(sesskey, "BgImageAbsoluteX", cfg->bg_image_abs_x);
    write_setting_i(sesskey, "BgImageAbsoluteY", cfg->bg_image_abs_y);
    write_setting_i(sesskey, "BgImagePlacement", cfg->bg_image_abs_fixed);  
	}
#endif
#ifdef URLPORT
    write_setting_i(sesskey, "CopyURLDetection", cfg->copy_clipbd_url_reg);
#endif
#ifdef HYPERLINKPORT
	/*
	 * HACK: PuttyTray / Nutty
	 * Hyperlink stuff: Save hyperlink settings
	 */
	write_setting_i(sesskey, "HyperlinkUnderline", cfg->url_underline);
	write_setting_i(sesskey, "HyperlinkUseCtrlClick", cfg->url_ctrl_click);
	write_setting_i(sesskey, "HyperlinkBrowserUseDefault", cfg->url_defbrowser);
	write_setting_s(sesskey, "HyperlinkBrowser", cfg->url_browser);
	write_setting_i(sesskey, "HyperlinkRegularExpressionUseDefault", cfg->url_defregex);
	write_setting_s(sesskey, "HyperlinkRegularExpression", cfg->url_regex);
#endif
#ifdef CYGTERMPORT
    //if (do_host)
	write_setting_i(sesskey, "CygtermAutoPath", cfg->cygautopath);
	write_setting_s(sesskey, "CygtermCommand", cfg->cygcmd);
#endif
#ifdef PERSOPORT
    //char buf[128] ;
    //sprintf( buf, "%g", cfg->bcdelay ) ; write_setting_s(sesskey, "BCDelay", buf ) ;
    //sprintf( buf, "%g", cfg->initdelay ) ; write_setting_s(sesskey, "InitDelay", buf ) ;
    write_setting_i(sesskey, "TransparencyValue", (unsigned int) cfg->transparencynumber) ;
    write_setting_i(sesskey, "SendToTray", cfg->sendtotray);
    write_setting_i(sesskey, "SaveOnExit", cfg->saveonexit);
    sprintf( PassKey, "%s%sKiTTY", cfg->host, cfg->termtype ) ;
    write_setting_i(sesskey, "Icone", cfg->icone);
    write_setting_s(sesskey, "IconeFile", cfg->iconefile);
    cryptstring( cfg->password, PassKey ) ;
    write_setting_s(sesskey, "Password", cfg->password);
    decryptstring( cfg->password, PassKey ) ;
    write_setting_filename(sesskey, "Scriptfile", cfg->scriptfile);
    write_setting_s(sesskey, "AntiIdle", cfg->antiidle);
    write_setting_s(sesskey, "LogTimestamp", cfg->logtimestamp);
    write_setting_s(sesskey, "AutocommandOut", cfg->autocommandout);
    write_setting_s(sesskey, "Autocommand", cfg->autocommand);
    write_setting_s(sesskey, "Folder", cfg->folder) ;
    write_setting_i(sesskey, "TermXPos", cfg->xpos) ;
    write_setting_i(sesskey, "TermYPos", cfg->ypos) ;
    write_setting_i(sesskey, "WindowState", cfg->windowstate) ;
    write_setting_i(sesskey, "SaveWindowPos", cfg->save_windowpos); /* BKG */
#endif
#ifdef ZMODEMPORT
    write_setting_s(sesskey, "rzCommand", cfg->rzcommand);
    write_setting_s(sesskey, "rzOptions", cfg->rzoptions);
    write_setting_s(sesskey, "szCommand", cfg->szcommand);
    write_setting_s(sesskey, "szOptions", cfg->szoptions);
    write_setting_s(sesskey, "zDownloadDir", cfg->zdownloaddir);
#endif
}