Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6835 - (show annotations) (download) (as text)
Tue Jul 4 15:01:42 2017 UTC (6 years, 9 months ago) by doda
File MIME type: text/x-chdr
File size: 10304 byte(s)
バージョン番号を ttxssh-version.h で定義しているマクロから取得するように変更

get_file_version() は少なくとも ttxssh では使わないと思うので廃止。
1 /*
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 /* VS2015(VC14.0)�����AWSASocketA(), inet_ntoa() ������API��deprecated��������
40 * �x�������������A�x�����}�~�����B�����������u���������AVS2005(VC8.0)���r���h
41 * �����������������A�x�����}�~���������������B
42 */
43 #if _MSC_VER >= 1800 // VSC2013(VC12.0) or later
44 #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
45 #define _WINSOCK_DEPRECATED_NO_WARNINGS
46 #endif
47 #endif
48
49 #include <winsock2.h>
50 #include <ws2tcpip.h>
51 /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
52 #undef IN6_IS_ADDR_LOOPBACK
53 #define IN6_IS_ADDR_LOOPBACK(a) \
54 ((*(unsigned int *)(&(a)->s6_addr[0]) == 0) && \
55 (*(unsigned int *)(&(a)->s6_addr[4]) == 0) && \
56 (*(unsigned int *)(&(a)->s6_addr[8]) == 0) && \
57 (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
58 /* work around for MS Platform SDK Oct 2000 */
59 #include <malloc.h> /* prevent of conflict stdlib.h */
60 #include <stdlib.h>
61 #include <stdarg.h>
62 #include <crtdbg.h>
63
64 #include "i18n.h"
65 #include "ttlib.h"
66
67 typedef struct _TInstVar *PTInstVar;
68
69 #include "ttxssh-version.h"
70 #include "util.h"
71 #include "pkt.h"
72 #include "ssh.h"
73 #include "auth.h"
74 #include "crypt.h"
75 #include "hosts.h"
76 #include "fwd.h"
77
78 #include <openssl/dh.h>
79 #include <openssl/ec.h>
80 #include <openssl/evp.h>
81 #include "buffer.h"
82
83 /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
84 * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
85 * (2005.7.9 yutaka)
86 */
87 #include "teraterm.h"
88 #include "tttypes.h"
89 #include "ttplugin.h"
90
91 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
92
93 #define ID_SSHSCPMENU 52110
94 #define ID_SSHSETUPMENU 52310
95 #define ID_SSHAUTHSETUPMENU 52320
96 #define ID_SSHFWDSETUPMENU 52330
97 #define ID_SSHKEYGENMENU 52340
98 #define ID_ABOUTMENU 52910
99
100 #define ID_SSHAUTH 62501
101 #define ID_SSHUNKNOWNHOST 62502
102 #define ID_SSHDIFFERENTKEY 62503
103 #define ID_SSHASYNCMESSAGEBOX 62504
104
105 #define OPTION_NONE 0
106 #define OPTION_CLEAR 1
107 #define OPTION_REPLACE 2
108
109 /*
110 * DisablePopupMessage �p���r�b�g���`
111 */
112 #define POPUP_MSG_default 0
113 #define POPUP_MSG_FWD_received_data (1 << 0)
114
115
116 /*
117 * Host key rotation
118 */
119 #define SSH_UPDATE_HOSTKEYS_NO 0
120 #define SSH_UPDATE_HOSTKEYS_YES 1
121 #define SSH_UPDATE_HOSTKEYS_ASK 2
122 #define SSH_UPDATE_HOSTKEYS_MAX 3
123
124 /*
125 * Server compatibility flag
126 */
127 #define SSH_BUG_DHGEX_LARGE 0x00000001
128
129
130 /*
131 These are the fields that WOULD go in Tera Term's 'ts' structure, if
132 we could put them there.
133 */
134 typedef struct _TS_SSH {
135 BOOL Enabled;
136 int CompressionLevel; /* 0 = NONE, else 1-9 */
137 char DefaultUserName[256];
138
139 /* this next option is a string of digits. Each digit represents a
140 cipher. The first digit is the most preferred cipher, and so on.
141 The digit SSH_CIPHER_NONE signifies that any ciphers after it are
142 disabled. */
143 char CipherOrder[SSH_CIPHER_MAX+1];
144
145 char KnownHostsFiles[2048];
146 int DefaultAuthMethod;
147 char DefaultRhostsLocalUserName[256];
148 char DefaultRhostsHostPrivateKeyFile[1024];
149 char DefaultRSAPrivateKeyFile[1024];
150
151 char DefaultForwarding[4096];
152 BOOL TryDefaultAuth;
153
154 int LogLevel; /* 0 = NONE, 100 = Verbose */
155 int WriteBufferSize;
156
157 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
158 int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
159 // whether password will permanently store on heap memory (2006.8.5 yutaka)
160 int remember_password;
161
162 // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
163 BOOL CheckAuthListFirst;
164
165 // Enable connection to the server that has RSA key length less than 768 bit (2008.9.11 maya)
166 BOOL EnableRsaShortKeyServer;
167
168 // Enable Agent forwarding
169 BOOL ForwardAgent;
170
171 // Confirm Agent forwarding
172 BOOL ForwardAgentConfirm;
173
174 // Confirm Agent forwarding
175 BOOL ForwardAgentNotify;
176
177 // KEX order(derived from teraterm.ini)
178 char KexOrder[KEX_DH_MAX+1];
179 char HostKeyOrder[KEY_MAX+1];
180 char MacOrder[HMAC_MAX+1];
181 char CompOrder[COMP_MAX+1];
182
183 BOOL VerifyHostKeyDNS;
184
185 int IconID;
186
187 int DisablePopupMessage;
188
189 char X11Display[128];
190
191 int UpdateHostkeys;
192
193 int GexMinimalGroupSize;
194 } TS_SSH;
195
196 typedef struct _TInstVar {
197 PTTSet ts;
198 PComVar cv;
199
200 /* shared memory for settings across instances. Basically it's
201 a cache for the INI file.*/
202 TS_SSH *ts_SSH;
203
204 int fatal_error;
205 int showing_err;
206 char *err_msg;
207
208 Tconnect Pconnect;
209 Trecv Precv;
210 Tsend Psend;
211 TWSAAsyncSelect PWSAAsyncSelect;
212 TWSAGetLastError PWSAGetLastError;
213
214 PReadIniFile ReadIniFile;
215 PWriteIniFile WriteIniFile;
216 PParseParam ParseParam;
217
218 HMENU FileMenu;
219
220 SOCKET socket;
221 HWND NotificationWindow;
222 unsigned int notification_msg;
223 long notification_events;
224 HICON OldSmallIcon;
225 HICON OldLargeIcon;
226
227 BOOL hostdlg_activated;
228 BOOL hostdlg_Enabled;
229
230 int protocol_major;
231 int protocol_minor;
232
233 PKTState pkt_state;
234 SSHState ssh_state;
235 AUTHState auth_state;
236 CRYPTState crypt_state;
237 HOSTSState hosts_state;
238 FWDState fwd_state;
239
240 /* The settings applied to the current session. The user may change
241 the settings but usually we don't want that to affect the session
242 in progress (race conditions). So user setup changes usually
243 modify the 'settings' field below. */
244 TS_SSH session_settings;
245
246 /* our copy of the global settings. This is synced up with the shared
247 memory only when we do a ReadIniFile or WriteIniFile
248 (i.e. the user loads or saves setup) */
249 TS_SSH settings;
250
251 // SSH2
252 DH *kexdh;
253 char server_version_string[128];
254 char client_version_string[128];
255 buffer_t *my_kex;
256 buffer_t *peer_kex;
257 kex_algorithm kex_type; // KEX algorithm
258 ssh_keytype hostkey_type;
259 SSHCipher ctos_cipher;
260 SSHCipher stoc_cipher;
261 hmac_type ctos_hmac;
262 hmac_type stoc_hmac;
263 compression_type ctos_compression;
264 compression_type stoc_compression;
265 int we_need;
266 int key_done;
267 int rekeying;
268 char *session_id;
269 int session_id_len;
270 Newkeys ssh2_keys[MODE_MAX];
271 EVP_CIPHER_CTX evpcip[MODE_MAX];
272 int userauth_success;
273 int shell_id;
274 /*int remote_id;*/
275 int session_nego_status;
276 /*
277 unsigned int local_window;
278 unsigned int local_window_max;
279 unsigned int local_consumed;
280 unsigned int local_maxpacket;
281 unsigned int remote_window;
282 unsigned int remote_maxpacket;
283 */
284 int client_key_bits;
285 int server_key_bits;
286 int kexgex_min;
287 int kexgex_bits;
288 int kexgex_max;
289 int ssh2_autologin;
290 int ask4passwd;
291 SSHAuthMethod ssh2_authmethod;
292 char ssh2_username[MAX_PATH];
293 char ssh2_password[MAX_PATH];
294 char ssh2_keyfile[MAX_PATH];
295 time_t ssh_heartbeat_tick;
296 HANDLE ssh_heartbeat_thread;
297 int keyboard_interactive_password_input;
298 int userauth_retry_count;
299 buffer_t *decomp_buffer;
300 char *ssh2_authlist;
301 BOOL tryed_ssh2_authlist;
302 HWND ssh_hearbeat_dialog;
303
304 /* Pageant �������M�p */
305 unsigned char *pageant_key;
306 unsigned char *pageant_curkey;
307 int pageant_keylistlen;
308 int pageant_keycount;
309 int pageant_keycurrent;
310 BOOL pageant_keyfinal;// SSH2 PK_OK ������������ TRUE ������
311
312 // agent forward
313 BOOL agentfwd_enable;
314
315 BOOL origDisableTCPEchoCR;
316
317 BOOL nocheck_known_hosts;
318
319 EC_KEY *ecdh_client_key;
320
321 int dns_key_check;
322
323 unsigned int server_compat_flag;
324
325 void *hostkey_ctx;
326
327 BOOL use_subsystem;
328 char subsystem_name[256];
329 } TInstVar;
330
331 // �o�[�W���������������������X�������B ��: TTSSH_2-81_TS_data
332 #define TTSSH_FILEMAPNAME "TTSSH_" TTSSH_VERSION_STR("-") "_TS_data"
333
334 #define LOG_LEVEL_FATAL 5
335 #define LOG_LEVEL_ERROR 10
336 #define LOG_LEVEL_WARNING 30
337 #define LOG_LEVEL_NOTICE 50
338 #define LOG_LEVEL_INFO 80
339 #define LOG_LEVEL_VERBOSE 100
340 #define LOG_LEVEL_SSHDUMP 200
341
342 #define SSHv1(pvar) ((pvar)->protocol_major == 1)
343 #define SSHv2(pvar) ((pvar)->protocol_major == 2)
344
345 #define LogLevel(pvar, level) ((pvar)->settings.LogLevel >= (level))
346
347 void notify_established_secure_connection(PTInstVar pvar);
348 void notify_closed_connection(PTInstVar pvar, char *send_msg);
349 void notify_nonfatal_error(PTInstVar pvar, char *msg);
350 void notify_fatal_error(PTInstVar pvar, char *msg, BOOL send_disconnect);
351 void logputs(int level, char *msg);
352 void logprintf(int level, char *fmt, ...);
353 void logprintf_hexdump(int level, char *data, int len, char *fmt, ...);
354
355 void get_teraterm_dir_relative_name(char *buf, int bufsize, char *basename);
356 int copy_teraterm_dir_relative_path(char *dest, int destsize, char *basename);
357 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
358
359 #endif

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