Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3176 - (hide annotations) (download) (as text)
Sun Nov 30 16:14:41 2008 UTC (15 years, 4 months ago) by maya
Original Path: ttssh2/trunk/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 8360 byte(s)
SSH agent forwarding をサポートした。
  SSH1 の channel 内部処理が port forward しか想定していなかったため、
  local_channel_num に固定値を強引に割り当てている。

1 yutakakn 2728 /*
2     Copyright (c) 1998-2001, Robert O'Callahan
3     All rights reserved.
4    
5     Redistribution and use in source and binary forms, with or without modification,
6     are permitted provided that the following conditions are met:
7    
8     Redistributions of source code must retain the above copyright notice, this list of
9     conditions and the following disclaimer.
10    
11     Redistributions in binary form must reproduce the above copyright notice, this list
12     of conditions and the following disclaimer in the documentation and/or other materials
13     provided with the distribution.
14    
15     The name of Robert O'Callahan may not be used to endorse or promote products derived from
16     this software without specific prior written permission.
17    
18     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
19     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21     THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22     EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27     */
28    
29     /*
30     This code is copyright (C) 1998-1999 Robert O'Callahan.
31     See LICENSE.TXT for the license.
32     */
33    
34     #ifndef __TTXSSH_H
35     #define __TTXSSH_H
36    
37     #pragma warning(3 : 4035)
38    
39 maya 2980 #ifndef NO_INET6
40 yutakakn 2728 #include <winsock2.h>
41     #include <ws2tcpip.h>
42     /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
43     #undef IN6_IS_ADDR_LOOPBACK
44     #define IN6_IS_ADDR_LOOPBACK(a) \
45     ((*(unsigned int *)(&(a)->s6_addr[0]) == 0) && \
46     (*(unsigned int *)(&(a)->s6_addr[4]) == 0) && \
47     (*(unsigned int *)(&(a)->s6_addr[8]) == 0) && \
48     (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
49     /* work around for MS Platform SDK Oct 2000 */
50     #include <malloc.h> /* prevent of conflict stdlib.h */
51 maya 2980 #endif /* NO_INET6 */
52 yutakakn 2728 #include <stdlib.h>
53     #include <crtdbg.h>
54    
55 maya 2937 #include "i18n.h"
56 yutakakn 2728
57 maya 2937
58 yutakakn 2728 typedef struct _TInstVar FAR * PTInstVar;
59    
60     #include "util.h"
61     #include "pkt.h"
62     #include "ssh.h"
63     #include "auth.h"
64     #include "crypt.h"
65     #include "hosts.h"
66     #include "fwd.h"
67    
68     #include <openssl/dh.h>
69     #include <openssl/evp.h>
70     #include "buffer.h"
71    
72 yutakakn 2831 /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
73     * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
74     * (2005.7.9 yutaka)
75     */
76     #include "teraterm.h"
77     #include "tttypes.h"
78     #include "ttplugin.h"
79    
80 yutakakn 2728 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
81    
82 maya 3076 #define ID_SSHSCPMENU 52110
83 maya 3068 #define ID_SSHSETUPMENU 52310
84     #define ID_SSHAUTHSETUPMENU 52320
85     #define ID_SSHFWDSETUPMENU 52330
86     #define ID_SSHKEYGENMENU 52340
87     #define ID_ABOUTMENU 52910
88 yutakakn 2728
89 maya 3068 #define ID_SSHAUTH 62501
90     #define ID_SSHUNKNOWNHOST 62502
91     #define ID_SSHDIFFERENTHOST 62503
92     #define ID_SSHASYNCMESSAGEBOX 62504
93    
94 yutakakn 2728 /*
95 doda 3134 These are the fields that WOULD go in Tera Term's 'ts' structure, if
96 yutakakn 2728 we could put them there.
97     */
98     typedef struct _TS_SSH {
99 maya 3003 BOOL Enabled;
100     int CompressionLevel; /* 0 = NONE, else 1-9 */
101     char DefaultUserName[256];
102 yutakakn 2728
103 maya 3003 /* this next option is a string of digits. Each digit represents a
104     cipher. The first digit is the most preferred cipher, and so on.
105     The digit SSH_CIPHER_NONE signifies that any ciphers after it are
106     disabled. */
107 maya 3171 char CipherOrder[SSH_CIPHER_MAX+1];
108 yutakakn 2728
109 maya 3003 char KnownHostsFiles[2048];
110     int DefaultAuthMethod;
111     char DefaultRhostsLocalUserName[256];
112     char DefaultRhostsHostPrivateKeyFile[1024];
113     char DefaultRSAPrivateKeyFile[1024];
114 yutakakn 2728
115 maya 3003 char DefaultForwarding[2048];
116     BOOL TryDefaultAuth;
117 yutakakn 2728
118 maya 3003 int LogLevel; /* 0 = NONE, 100 = Verbose */
119     int WriteBufferSize;
120     int LocalForwardingIdentityCheck;
121 yutakakn 2728
122 maya 3003 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
123     int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
124 maya 3015 // whether password will permanently store on heap memory (2006.8.5 yutaka)
125     int remember_password;
126    
127     // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
128     BOOL CheckAuthListFirst;
129 maya 3146
130     // Enable connection to the server that has RSA key length less than 768 bit (2008.9.11 maya)
131     BOOL EnableRsaShortKeyServer;
132 maya 3176
133     // Enable Agent forwarding
134     BOOL ForwardAgent;
135 yutakakn 2728 } TS_SSH;
136    
137     typedef struct _TInstVar {
138 maya 3003 PTTSet ts;
139     PComVar cv;
140 yutakakn 2728
141 maya 3003 /* shared memory for settings across instances. Basically it's
142     a cache for the INI file.*/
143     TS_SSH FAR * ts_SSH;
144 yutakakn 2728
145 maya 3003 int fatal_error;
146     int showing_err;
147     char FAR * err_msg;
148 yutakakn 2728
149 maya 3003 Tconnect Pconnect;
150     Trecv Precv;
151     Tsend Psend;
152     TWSAAsyncSelect PWSAAsyncSelect;
153     TWSAGetLastError PWSAGetLastError;
154 yutakakn 2728
155 maya 3003 PReadIniFile ReadIniFile;
156     PWriteIniFile WriteIniFile;
157     PParseParam ParseParam;
158 yutakakn 2728
159 maya 3003 SOCKET socket;
160     HWND NotificationWindow;
161     unsigned int notification_msg;
162     long notification_events;
163     HICON OldSmallIcon;
164     HICON OldLargeIcon;
165 yutakakn 2728
166 maya 3003 BOOL hostdlg_activated;
167     BOOL hostdlg_Enabled;
168 yutakakn 2728
169 maya 3003 int protocol_major;
170     int protocol_minor;
171 yutakakn 2728
172 maya 3003 PKTState pkt_state;
173     SSHState ssh_state;
174     AUTHState auth_state;
175     CRYPTState crypt_state;
176     HOSTSState hosts_state;
177     FWDState fwd_state;
178 yutakakn 2728
179     /* The settings applied to the current session. The user may change
180     the settings but usually we don't want that to affect the session
181     in progress (race conditions). So user setup changes usually
182     modify the 'settings' field below. */
183 maya 3003 TS_SSH session_settings;
184 yutakakn 2728
185     /* our copy of the global settings. This is synced up with the shared
186     memory only when we do a ReadIniFile or WriteIniFile
187     (i.e. the user loads or saves setup) */
188 maya 3003 TS_SSH settings;
189 yutakakn 2728
190 maya 3003 // SSH2
191     DH *kexdh;
192     char server_version_string[128];
193     char client_version_string[128];
194     buffer_t *my_kex;
195     buffer_t *peer_kex;
196     enum kex_exchange kex_type; // KEX algorithm
197     enum hostkey_type hostkey_type;
198     SSHCipher ctos_cipher;
199     SSHCipher stoc_cipher;
200     enum hmac_type ctos_hmac;
201     enum hmac_type stoc_hmac;
202     enum compression_algorithm ctos_compression;
203     enum compression_algorithm stoc_compression;
204     int we_need;
205     int key_done;
206     int rekeying;
207     char *session_id;
208     int session_id_len;
209     Newkeys ssh2_keys[MODE_MAX];
210     EVP_CIPHER_CTX evpcip[MODE_MAX];
211     int userauth_success;
212     int shell_id;
213     /*int remote_id;*/
214     int session_nego_status;
215     /*
216     unsigned int local_window;
217     unsigned int local_window_max;
218     unsigned int local_consumed;
219     unsigned int local_maxpacket;
220     unsigned int remote_window;
221     unsigned int remote_maxpacket;
222     */
223     int client_key_bits;
224     int server_key_bits;
225     int kexgex_min;
226     int kexgex_bits;
227     int kexgex_max;
228     int ssh2_autologin;
229     int ask4passwd;
230     SSHAuthMethod ssh2_authmethod;
231     char ssh2_username[MAX_PATH];
232     char ssh2_password[MAX_PATH];
233     char ssh2_keyfile[MAX_PATH];
234     time_t ssh_heartbeat_tick;
235     HANDLE ssh_heartbeat_thread;
236     int keyboard_interactive_password_input;
237     int userauth_retry_count;
238     buffer_t *decomp_buffer;
239     char *ssh2_authlist;
240 maya 3015 BOOL tryed_ssh2_authlist;
241 yutakapon 3078 HWND ssh_hearbeat_dialog;
242 maya 3108
243     /* Pageant �������M�p */
244     unsigned char *pageant_key;
245     unsigned char *pageant_curkey;
246     int pageant_keylistlen;
247     int pageant_keycount;
248     int pageant_keycurrent;
249     BOOL pageant_keyfinal;// SSH2 PK_OK ������������ TRUE ������
250 maya 3176
251     // agent forward
252     BOOL agentfwd_enable;
253     agent_channel_t agent_channel; // for SSH1 only
254 yutakakn 2728 } TInstVar;
255    
256     #define LOG_LEVEL_FATAL 5
257     #define LOG_LEVEL_ERROR 10
258     #define LOG_LEVEL_URGENT 20
259     #define LOG_LEVEL_WARNING 30
260     #define LOG_LEVEL_VERBOSE 100
261 yutakapon 3142 #define LOG_LEVEL_SSHDUMP 200
262 yutakakn 2728
263     #define SSHv1(pvar) ((pvar)->protocol_major == 1)
264     #define SSHv2(pvar) ((pvar)->protocol_major == 2)
265    
266     void notify_established_secure_connection(PTInstVar pvar);
267     void notify_closed_connection(PTInstVar pvar);
268     void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
269     void notify_fatal_error(PTInstVar pvar, char FAR * msg);
270     void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
271    
272     void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
273     int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
274 yutakakn 2793 void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
275 yutakakn 2856 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
276 yutakakn 2728
277     #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26