⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.c

📁 远程登陆工具软件源码 用于远程登陆unix
💻 C
📖 第 1 页 / 共 4 页
字号:
    c = ctrl_text(s, "RGB value:", HELPCTX(colours_config));
    c->generic.column = 1;
    cd->redit = ctrl_editbox(s, "Red", 'r', 50, HELPCTX(colours_config),
			     colour_handler, P(cd), P(NULL));
    cd->redit->generic.column = 1;
    cd->gedit = ctrl_editbox(s, "Green", 'n', 50, HELPCTX(colours_config),
			     colour_handler, P(cd), P(NULL));
    cd->gedit->generic.column = 1;
    cd->bedit = ctrl_editbox(s, "Blue", 'e', 50, HELPCTX(colours_config),
			     colour_handler, P(cd), P(NULL));
    cd->bedit->generic.column = 1;
    cd->button = ctrl_pushbutton(s, "Modify", 'm', HELPCTX(colours_config),
				 colour_handler, P(cd));
    cd->button->generic.column = 1;
    ctrl_columns(s, 1, 100);

    /*
     * The Connection panel. This doesn't show up if we're in a
     * non-network utility such as pterm. We tell this by being
     * passed a protocol < 0.
     */
    if (protocol >= 0) {
	ctrl_settitle(b, "Connection", "Options controlling the connection");

	if (!midsession) {
	    s = ctrl_getset(b, "Connection", "data",
			    "Data to send to the server");
	    ctrl_editbox(s, "Terminal-type string", 't', 50,
			 HELPCTX(connection_termtype),
			 dlg_stdeditbox_handler, I(offsetof(Config,termtype)),
			 I(sizeof(((Config *)0)->termtype)));
	    ctrl_editbox(s, "Terminal speeds", 's', 50,
			 HELPCTX(connection_termspeed),
			 dlg_stdeditbox_handler, I(offsetof(Config,termspeed)),
			 I(sizeof(((Config *)0)->termspeed)));
	    ctrl_editbox(s, "Auto-login username", 'u', 50,
			 HELPCTX(connection_username),
			 dlg_stdeditbox_handler, I(offsetof(Config,username)),
			 I(sizeof(((Config *)0)->username)));
	}

	s = ctrl_getset(b, "Connection", "keepalive",
			"Sending of null packets to keep session active");
	ctrl_editbox(s, "Seconds between keepalives (0 to turn off)", 'k', 20,
		     HELPCTX(connection_keepalive),
		     dlg_stdeditbox_handler, I(offsetof(Config,ping_interval)),
		     I(-1));

	if (!midsession) {
	    s = ctrl_getset(b, "Connection", "tcp",
			    "Low-level TCP connection options");
	    ctrl_checkbox(s, "Disable Nagle's algorithm (TCP_NODELAY option)",
			  'n', HELPCTX(connection_nodelay),
			  dlg_stdcheckbox_handler,
			  I(offsetof(Config,tcp_nodelay)));
	    ctrl_checkbox(s, "Enable TCP keepalives (SO_KEEPALIVE option)",
			  'p', HELPCTX(connection_tcpkeepalive),
			  dlg_stdcheckbox_handler,
			  I(offsetof(Config,tcp_keepalives)));
	}

    }

    if (!midsession) {
	/*
	 * The Connection/Proxy panel.
	 */
	ctrl_settitle(b, "Connection/Proxy",
		      "Options controlling proxy usage");

	s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
	ctrl_radiobuttons(s, "Proxy type:", 't', 3,
			  HELPCTX(proxy_type),
			  dlg_stdradiobutton_handler,
			  I(offsetof(Config, proxy_type)),
			  "None", I(PROXY_NONE),
			  "SOCKS 4", I(PROXY_SOCKS4),
			  "SOCKS 5", I(PROXY_SOCKS5),
			  "HTTP", I(PROXY_HTTP),
			  "Telnet", I(PROXY_TELNET),
			  NULL);
	ctrl_columns(s, 2, 80, 20);
	c = ctrl_editbox(s, "Proxy hostname", 'y', 100,
			 HELPCTX(proxy_main),
			 dlg_stdeditbox_handler,
			 I(offsetof(Config,proxy_host)),
			 I(sizeof(((Config *)0)->proxy_host)));
	c->generic.column = 0;
	c = ctrl_editbox(s, "Port", 'p', 100,
			 HELPCTX(proxy_main),
			 dlg_stdeditbox_handler,
			 I(offsetof(Config,proxy_port)),
			 I(-1));
	c->generic.column = 1;
	ctrl_columns(s, 1, 100);
	ctrl_editbox(s, "Exclude Hosts/IPs", 'e', 100,
		     HELPCTX(proxy_exclude),
		     dlg_stdeditbox_handler,
		     I(offsetof(Config,proxy_exclude_list)),
		     I(sizeof(((Config *)0)->proxy_exclude_list)));
	ctrl_checkbox(s, "Consider proxying local host connections", 'x',
		      HELPCTX(proxy_exclude),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,even_proxy_localhost)));
	ctrl_radiobuttons(s, "Do DNS name lookup at proxy end:", 'd', 3,
			  HELPCTX(proxy_dns),
			  dlg_stdradiobutton_handler,
			  I(offsetof(Config, proxy_dns)),
			  "No", I(FORCE_OFF),
			  "Auto", I(AUTO),
			  "Yes", I(FORCE_ON), NULL);
	ctrl_editbox(s, "Username", 'u', 60,
		     HELPCTX(proxy_auth),
		     dlg_stdeditbox_handler,
		     I(offsetof(Config,proxy_username)),
		     I(sizeof(((Config *)0)->proxy_username)));
	c = ctrl_editbox(s, "Password", 'w', 60,
			 HELPCTX(proxy_auth),
			 dlg_stdeditbox_handler,
			 I(offsetof(Config,proxy_password)),
			 I(sizeof(((Config *)0)->proxy_password)));
	c->editbox.password = 1;
	ctrl_editbox(s, "Telnet command", 'm', 100,
		     HELPCTX(proxy_command),
		     dlg_stdeditbox_handler,
		     I(offsetof(Config,proxy_telnet_command)),
		     I(sizeof(((Config *)0)->proxy_telnet_command)));
    }

    /*
     * The Telnet panel exists in the base config box, and in a
     * mid-session reconfig box _if_ we're using Telnet.
     */
    if (!midsession || protocol == PROT_TELNET) {
	/*
	 * The Connection/Telnet panel.
	 */
	ctrl_settitle(b, "Connection/Telnet",
		      "Options controlling Telnet connections");

	if (!midsession) {
	    s = ctrl_getset(b, "Connection/Telnet", "data",
			    "Data to send to the server");
	    ctrl_text(s, "Environment variables:", HELPCTX(telnet_environ));
	    ctrl_columns(s, 2, 80, 20);
	    ed = (struct environ_data *)
		ctrl_alloc(b, sizeof(struct environ_data));
	    ed->varbox = ctrl_editbox(s, "Variable", 'v', 60,
				      HELPCTX(telnet_environ),
				      environ_handler, P(ed), P(NULL));
	    ed->varbox->generic.column = 0;
	    ed->valbox = ctrl_editbox(s, "Value", 'l', 60,
				      HELPCTX(telnet_environ),
				      environ_handler, P(ed), P(NULL));
	    ed->valbox->generic.column = 0;
	    ed->addbutton = ctrl_pushbutton(s, "Add", 'd',
					    HELPCTX(telnet_environ),
					    environ_handler, P(ed));
	    ed->addbutton->generic.column = 1;
	    ed->rembutton = ctrl_pushbutton(s, "Remove", 'r',
					    HELPCTX(telnet_environ),
					    environ_handler, P(ed));
	    ed->rembutton->generic.column = 1;
	    ctrl_columns(s, 1, 100);
	    ed->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
				       HELPCTX(telnet_environ),
				       environ_handler, P(ed));
	    ed->listbox->listbox.height = 3;
	    ed->listbox->listbox.ncols = 2;
	    ed->listbox->listbox.percentages = snewn(2, int);
	    ed->listbox->listbox.percentages[0] = 30;
	    ed->listbox->listbox.percentages[1] = 70;
	}

	s = ctrl_getset(b, "Connection/Telnet", "protocol",
			"Telnet protocol adjustments");

	if (!midsession) {
	    ctrl_radiobuttons(s, "Handling of OLD_ENVIRON ambiguity:",
			      NO_SHORTCUT, 2,
			      HELPCTX(telnet_oldenviron),
			      dlg_stdradiobutton_handler,
			      I(offsetof(Config, rfc_environ)),
			      "BSD (commonplace)", 'b', I(0),
			      "RFC 1408 (unusual)", 'f', I(1), NULL);
	    ctrl_radiobuttons(s, "Telnet negotiation mode:", 't', 2,
			      HELPCTX(telnet_passive),
			      dlg_stdradiobutton_handler,
			      I(offsetof(Config, passive_telnet)),
			      "Passive", I(1), "Active", I(0), NULL);
	}
	ctrl_checkbox(s, "Keyboard sends telnet Backspace and Interrupt", 'k',
		      HELPCTX(telnet_specialkeys),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,telnet_keyboard)));
	ctrl_checkbox(s, "Return key sends telnet New Line instead of ^M",
		      NO_SHORTCUT, HELPCTX(telnet_newline),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,telnet_newline)));
    }

    if (!midsession) {

	/*
	 * The Connection/Rlogin panel.
	 */
	ctrl_settitle(b, "Connection/Rlogin",
		      "Options controlling Rlogin connections");

	s = ctrl_getset(b, "Connection/Rlogin", "data",
			"Data to send to the server");
	ctrl_editbox(s, "Local username:", 'l', 50,
		     HELPCTX(rlogin_localuser),
		     dlg_stdeditbox_handler, I(offsetof(Config,localusername)),
		     I(sizeof(((Config *)0)->localusername)));

    }

    /*
     * All the SSH stuff is omitted in PuTTYtel.
     */

    if (!midsession && backends[3].name != NULL) {

	/*
	 * The Connection/SSH panel.
	 */
	ctrl_settitle(b, "Connection/SSH",
		      "Options controlling SSH connections");

	s = ctrl_getset(b, "Connection/SSH", "data",
			"Data to send to the server");
	ctrl_editbox(s, "Remote command:", 'r', 100,
		     HELPCTX(ssh_command),
		     dlg_stdeditbox_handler, I(offsetof(Config,remote_cmd)),
		     I(sizeof(((Config *)0)->remote_cmd)));

	s = ctrl_getset(b, "Connection/SSH", "protocol", "Protocol options");
	ctrl_checkbox(s, "Don't allocate a pseudo-terminal", 'p',
		      HELPCTX(ssh_nopty),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,nopty)));
	ctrl_checkbox(s, "Enable compression", 'e',
		      HELPCTX(ssh_compress),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,compression)));
	ctrl_radiobuttons(s, "Preferred SSH protocol version:", NO_SHORTCUT, 4,
			  HELPCTX(ssh_protocol),
			  dlg_stdradiobutton_handler,
			  I(offsetof(Config, sshprot)),
			  "1 only", 'l', I(0),
			  "1", '1', I(1),
			  "2", '2', I(2),
			  "2 only", 'n', I(3), NULL);

	s = ctrl_getset(b, "Connection/SSH", "encryption", "Encryption options");
	c = ctrl_draglist(s, "Encryption cipher selection policy:", 's',
			  HELPCTX(ssh_ciphers),
			  cipherlist_handler, P(NULL));
	c->listbox.height = 6;
	
	ctrl_checkbox(s, "Enable legacy use of single-DES in SSH 2", 'i',
		      HELPCTX(ssh_ciphers),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,ssh2_des_cbc)));

	/*
	 * The Connection/SSH/Auth panel.
	 */
	ctrl_settitle(b, "Connection/SSH/Auth",
		      "Options controlling SSH authentication");

	s = ctrl_getset(b, "Connection/SSH/Auth", "methods",
			"Authentication methods");
	ctrl_checkbox(s, "Attempt TIS or CryptoCard auth (SSH1)", 'm',
		      HELPCTX(ssh_auth_tis),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,try_tis_auth)));
	ctrl_checkbox(s, "Attempt \"keyboard-interactive\" auth (SSH2)",
		      'i', HELPCTX(ssh_auth_ki),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,try_ki_auth)));

	s = ctrl_getset(b, "Connection/SSH/Auth", "params",
			"Authentication parameters");
	ctrl_checkbox(s, "Allow agent forwarding", 'f',
		      HELPCTX(ssh_auth_agentfwd),
		      dlg_stdcheckbox_handler, I(offsetof(Config,agentfwd)));
	ctrl_checkbox(s, "Allow attempted changes of username in SSH2", 'u',
		      HELPCTX(ssh_auth_changeuser),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,change_username)));
	ctrl_filesel(s, "Private key file for authentication:", 'k',
		     FILTER_KEY_FILES, FALSE, "Select private key file",
		     HELPCTX(ssh_auth_privkey),
		     dlg_stdfilesel_handler, I(offsetof(Config, keyfile)));

	/*
	 * The Connection/SSH/Tunnels panel.
	 */
	ctrl_settitle(b, "Connection/SSH/Tunnels",
		      "Options controlling SSH tunnelling");

	s = ctrl_getset(b, "Connection/SSH/Tunnels", "x11", "X11 forwarding");
	ctrl_checkbox(s, "Enable X11 forwarding", 'e',
		      HELPCTX(ssh_tunnels_x11),
		      dlg_stdcheckbox_handler,I(offsetof(Config,x11_forward)));
	ctrl_editbox(s, "X display location", 'x', 50,
		     HELPCTX(ssh_tunnels_x11),
		     dlg_stdeditbox_handler, I(offsetof(Config,x11_display)),
		     I(sizeof(((Config *)0)->x11_display)));
	ctrl_radiobuttons(s, "Remote X11 authentication protocol", 'u', 2,
			  HELPCTX(ssh_tunnels_x11auth),
			  dlg_stdradiobutton_handler,
			  I(offsetof(Config, x11_auth)),
			  "MIT-Magic-Cookie-1", I(X11_MIT),
			  "XDM-Authorization-1", I(X11_XDM), NULL);

	s = ctrl_getset(b, "Connection/SSH/Tunnels", "portfwd",
			"Port forwarding");
	ctrl_checkbox(s, "Local ports accept connections from other hosts",'t',
		      HELPCTX(ssh_tunnels_portfwd_localhost),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,lport_acceptall)));
	ctrl_checkbox(s, "Remote ports do the same (SSH v2 only)", 'p',
		      HELPCTX(ssh_tunnels_portfwd_localhost),
		      dlg_stdcheckbox_handler,
		      I(offsetof(Config,rport_acceptall)));

	ctrl_columns(s, 3, 55, 20, 25);
	c = ctrl_text(s, "Forwarded ports:", HELPCTX(ssh_tunnels_portfwd));
	c->generic.column = COLUMN_FIELD(0,2);
	/* You want to select from the list, _then_ hit Remove. So tab order
	 * should be that way round. */
	pfd = (struct portfwd_data *)ctrl_alloc(b,sizeof(struct portfwd_data));
	pfd->rembutton = ctrl_pushbutton(s, "Remove", 'r',
					 HELPCTX(ssh_tunnels_portfwd),
					 portfwd_handler, P(pfd));
	pfd->rembutton->generic.column = 2;
	pfd->rembutton->generic.tabdelay = 1;
	pfd->listbox = ctrl_listbox(s, NULL, NO_SHORTCUT,
				    HELPCTX(ssh_tunnels_portfwd),
				    portfwd_handler, P(pfd));
	pfd->listbox->listbox.height = 3;
	pfd->listbox->listbox.ncols = 2;
	pfd->listbox->listbox.percentages = snewn(2, int);
	pfd->listbox->listbox.percentages[0] = 20;
	pfd->listbox->listbox.percentages[1] = 80;
	ctrl_tabdelay(s, pfd->rembutton);
	ctrl_text(s, "Add new forwarded port:", HELPCTX(ssh_tunnels_portfwd));
	/* You want to enter source, destination and type, _then_ hit Add.
	 * Again, we adjust the tab order to reflect this. */
	pfd->addbutton = ctrl_pushbutton(s, "Add", 'd',
					 HELPCTX(ssh_tunnels_portfwd),
					 portfwd_handler, P(pfd));
	pfd->addbutton->generic.column = 2;
	pfd->addbutton->generic.tabdelay = 1;
	pfd->sourcebox = ctrl_editbox(s, "Source port", 's', 40,
				      HELPCTX(ssh_tunnels_portfwd),
				      portfwd_handler, P(pfd), P(NULL));
	pfd->sourcebox->generic.column = 0;
	pfd->destbox = ctrl_editbox(s, "Destination", 'i', 67,
				    HELPCTX(ssh_tunnels_portfwd),
				    portfwd_handler, P(pfd), P(NULL));
	pfd->direction = ctrl_radiobuttons(s, NULL, NO_SHORTCUT, 3,
					   HELPCTX(ssh_tunnels_portfwd),
					   portfwd_handler, P(pfd),
					   "Local", 'l', P(NULL),
					   "Remote", 'm', P(NULL),
					   "Dynamic", 'y', P(NULL),
					   NULL);
	ctrl_tabdelay(s, pfd->addbutton);
	ctrl_columns(s, 1, 100);

	/*
	 * The Connection/SSH/Bugs panel.
	 */
	ctrl_settitle(b, "Connection/SSH/Bugs",
		      "Workarounds for SSH server bugs");

	s = ctrl_getset(b, "Connection/SSH/Bugs", "main",
			"Detection of known bugs in SSH servers");
	ctrl_droplist(s, "Chokes on SSH1 ignore messages", 'i', 20,
		      HELPCTX(ssh_bugs_ignore1),
		      sshbug_handler, I(offsetof(Config,sshbug_ignore1)));
	ctrl_droplist(s, "Refuses all SSH1 password camouflage", 's', 20,
		      HELPCTX(ssh_bugs_plainpw1),
		      sshbug_handler, I(offsetof(Config,sshbug_plainpw1)));
	ctrl_droplist(s, "Chokes on SSH1 RSA authentication", 'r', 20,
		      HELPCTX(ssh_bugs_rsa1),
		      sshbug_handler, I(offsetof(Config,sshbug_rsa1)));
	ctrl_droplist(s, "Miscomputes SSH2 HMAC keys", 'm', 20,
		      HELPCTX(ssh_bugs_hmac2),
		      sshbug_handler, I(offsetof(Config,sshbug_hmac2)));
	ctrl_droplist(s, "Miscomputes SSH2 encryption keys", 'e', 20,
		      HELPCTX(ssh_bugs_derivekey2),
		      sshbug_handler, I(offsetof(Config,sshbug_derivekey2)));
	ctrl_droplist(s, "Requires padding on SSH2 RSA signatures", 'p', 20,
		      HELPCTX(ssh_bugs_rsapad2),
		      sshbug_handler, I(offsetof(Config,sshbug_rsapad2)));
	ctrl_droplist(s, "Chokes on Diffie-Hellman group exchange", 'd', 20,
		      HELPCTX(ssh_bugs_dhgex2),
		      sshbug_handler, I(offsetof(Config,sshbug_dhgex2)));
	ctrl_droplist(s, "Misuses the session ID in PK auth", 'n', 20,
		      HELPCTX(ssh_bugs_pksessid2),
		      sshbug_handler, I(offsetof(Config,sshbug_pksessid2)));
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -