• R/O
  • SSH
  • HTTPS

ttssh2: コミット


コミットメタ情報

リビジョン7090 (tree)
日時2018-04-03 22:49:38
作者doda

ログメッセージ

サービス名 -> ポート番号変換部分を ttpcmn.dll へ移動 #38021

Tera Term 本体と ttssh で共有する為

変更サマリ

差分

--- trunk/teraterm/common/servicenames.c (revision 0)
+++ trunk/teraterm/common/servicenames.c (revision 7090)
@@ -0,0 +1,435 @@
1+/*
2+ * Copyright (c) 1998-2001, Robert O'Callahan
3+ * (C) 2004-2017 TeraTerm Project
4+ * All rights reserved.
5+ *
6+ * Redistribution and use in source and binary forms, with or without
7+ * modification, are permitted provided that the following conditions
8+ * are met:
9+ *
10+ * 1. Redistributions of source code must retain the above copyright
11+ * notice, this list of conditions and the following disclaimer.
12+ * 2. Redistributions in binary form must reproduce the above copyright
13+ * notice, this list of conditions and the following disclaimer in the
14+ * documentation and/or other materials provided with the distribution.
15+ * 3. The name of the author may not be used to endorse or promote products
16+ * derived from this software without specific prior written permission.
17+ *
18+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+ */
29+
30+/*
31+This code is copyright (C) 1998-1999 Robert O'Callahan.
32+See LICENSE.TXT for the license.
33+*/
34+
35+#include <stdio.h>
36+#include <stdlib.h>
37+#include <string.h>
38+#include <ctype.h>
39+#include <windows.h>
40+#include "servicenames.h"
41+
42+#define NUM_ELEM(a) (sizeof(a) / sizeof((a)[0]))
43+
44+typedef struct {
45+ int port;
46+ char *name;
47+} TCP_service_name;
48+
49+static TCP_service_name service_DB[] = {
50+ {384, "arns"},
51+ {204, "at-echo"},
52+ {202, "at-nbp"},
53+ {201, "at-rtmp"},
54+ {206, "at-zis"},
55+ {705, "auditd"},
56+ {113, "auth"},
57+ {113, "authentication"},
58+ {152, "bftp"},
59+ {179, "bgp"},
60+ {67, "bootp"},
61+ {68, "bootpc"},
62+ {67, "bootps"},
63+ {881, "bshell"},
64+ {1133, "bshelldbg"},
65+ {877, "buildd"},
66+ {2003, "cfinger"},
67+ {19, "chargen"},
68+ {531, "chat"},
69+ {2030, "client"},
70+ {514, "cmd"},
71+ {164, "cmip-agent"},
72+ {163, "cmip-man"},
73+ {1431, "coda_aux1"},
74+ {1433, "coda_aux2"},
75+ {1435, "coda_aux3"},
76+ {1407, "coda_backup"},
77+ {1423, "codacon"},
78+ {1285, "codger"},
79+ {1541, "codgerdbg"},
80+ {531, "conference"},
81+ {1389, "controller"},
82+ {530, "courier"},
83+ {1100, "cpsys"},
84+ {1346, "csd"},
85+ {1602, "csddbg"},
86+ {105, "csnet-ns"},
87+ {105, "cso-ns"},
88+ {1999, "cvskserver"},
89+ {987, "daserver"},
90+ {13, "daytime"},
91+ {1429, "dbp"},
92+ {10300, "dictionary"},
93+ {9, "discard"},
94+ {2100, "discuss"},
95+ {1399, "disptool0"},
96+ {1401, "disptool1"},
97+ {1403, "disptool2"},
98+ {1405, "disptool3"},
99+ {53, "domain"},
100+ {7000, "dos"},
101+ {7, "echo"},
102+ {8100, "eda1_mbx"},
103+ {8101, "eda2_mbx"},
104+ {8000, "eda_mbx"},
105+ {520, "efs"},
106+ {2105, "eklogin"},
107+ {545, "ekshell"},
108+ {1377, "erim"},
109+ {1617, "erimdbg"},
110+ {888, "erlogin"},
111+ {512, "exec"},
112+ {2001, "filesrv"},
113+ {79, "finger"},
114+ {21, "ftp"},
115+ {20, "ftp-data"},
116+ {1397, "gds_db"},
117+ {70, "gopher"},
118+ {1025, "greendbg"},
119+ {5999, "grmd"},
120+ {5710, "hcserver"},
121+ {751, "hesupd"},
122+ {101, "hostname"},
123+ {101, "hostnames"},
124+ {80, "http"},
125+ {443, "https"},
126+ {7489, "iasqlsvr"},
127+ {113, "ident"},
128+ {143, "imap"},
129+ {143, "imap2"},
130+ {220, "imap3"},
131+ {143, "imap4"},
132+ {993, "imaps"},
133+ {1524, "ingreslock"},
134+ {1234, "instsrv"},
135+ {1387, "ipt"},
136+ {213, "ipx"},
137+ {194, "irc"},
138+ {6667, "irc-alt"},
139+ {883, "ishell"},
140+ {102, "iso-tsap"},
141+ {885, "itkt"},
142+ {1439, "jeeves"},
143+ {1389, "joysticknav"},
144+ {1629, "joysticknavdbg"},
145+ {544, "kcmd"},
146+ {750, "kdc"},
147+ {10401, "kdebug"},
148+ {750, "kerberos"},
149+ {749, "kerberos-adm"},
150+ {88, "kerberos-sec"},
151+ {751, "kerberos_master"},
152+ {1445, "kjdbc"},
153+ {543, "klogin"},
154+ {561, "kopexec"},
155+ {562, "kopshell"},
156+ {761, "kpasswd"},
157+ {1109, "kpop"},
158+ {1110, "kpopr"},
159+ {761, "kpwd"},
160+ {88, "krb5"},
161+ {4444, "krb524"},
162+ {754, "krb5_prop"},
163+ {754, "krb_prop"},
164+ {760, "krbupdate"},
165+ {545, "krcmd"},
166+ {1443, "krcp"},
167+ {760, "kreg"},
168+ {544, "kshell"},
169+ {750, "ktc"},
170+ {549, "kxct"},
171+ {5696, "lanmgrx.osb"},
172+ {1441, "lcladm"},
173+ {87, "link"},
174+ {98, "linuxconf"},
175+ {2766, "listen"},
176+ {1025, "listener"},
177+ {135, "loc-srv"},
178+ {4045, "lockd"},
179+ {513, "login"},
180+ {25, "mail"},
181+ {9535, "man"},
182+ {3881, "mbatchd"},
183+ {1393, "motionnav"},
184+ {1633, "motionnavdbg"},
185+ {7000, "msdos"},
186+ {18, "msp"},
187+ {57, "mtp"},
188+ {42, "name"},
189+ {42, "nameserver"},
190+ {773, "nanny"},
191+ {138, "nbdgm"},
192+ {137, "nbns"},
193+ {139, "nbssn"},
194+ {1419, "ndim"},
195+ {138, "netbios-dgm"},
196+ {137, "netbios-ns"},
197+ {139, "netbios-ssn"},
198+ {138, "netbios_dgm"},
199+ {137, "netbios_ns"},
200+ {139, "netbios_ssn"},
201+ {2106, "netdist"},
202+ {1287, "netimage"},
203+ {1543, "netimagedbg"},
204+ {532, "netnews"},
205+ {1353, "netreg"},
206+ {1609, "netregdbg"},
207+ {77, "netrjs"},
208+ {15, "netstat"},
209+ {1026, "network_terminal"},
210+ {526, "newdate"},
211+ {144, "news"},
212+ {178, "nextstep"},
213+ {1536, "nft"},
214+ {43, "nicname"},
215+ {119, "nntp"},
216+ {1026, "nterm"},
217+ {123, "ntp"},
218+ {123, "ntpd"},
219+ {9, "null"},
220+ {891, "odexm"},
221+ {560, "opcmd"},
222+ {560, "opshell"},
223+ {879, "pag"},
224+ {893, "papyrus"},
225+ {1379, "parvis"},
226+ {1619, "parvisdbg"},
227+ {600, "pcserver"},
228+ {2026, "pcserverbulk"},
229+ {2025, "pcserverrpc"},
230+ {1385, "pharos"},
231+ {1373, "pierunt"},
232+ {1613, "pieruntdbg"},
233+ {1351, "piesrv"},
234+ {1607, "piesrvdbg"},
235+ {1889, "pmlockd"},
236+ {109, "pop"},
237+ {109, "pop-2"},
238+ {110, "pop-3"},
239+ {109, "pop2"},
240+ {110, "pop3"},
241+ {995, "pop3s"},
242+ {111, "portmap"},
243+ {111, "portmapper"},
244+ {109, "postoffice"},
245+ {170, "print-srv"},
246+ {515, "printer"},
247+ {191, "prospero"},
248+ {1525, "prospero-np"},
249+ {17, "qotd"},
250+ {17, "quote"},
251+ {601, "rauth"},
252+ {5347, "rcisimmux"},
253+ {1530, "rdeliver"},
254+ {3389, "rdp"},
255+ {532, "readnews"},
256+ {7815, "recserv"},
257+ {64, "rem"},
258+ {1025, "remote_file_sharing"},
259+ {1026, "remote_login"},
260+ {556, "remotefs"},
261+ {3878, "res"},
262+ {875, "resolve"},
263+ {1131, "resolvedbg"},
264+ {4672, "rfa"},
265+ {5900, "rfb"},
266+ {5002, "rfe"},
267+ {1025, "rfs"},
268+ {556, "rfs_server"},
269+ {1027, "rfsdbg"},
270+ {77, "rje"},
271+ {1260, "rlb"},
272+ {1425, "rndb2"},
273+ {530, "rpc"},
274+ {111, "rpcbind"},
275+ {1347, "rpl"},
276+ {1603, "rpldbg"},
277+ {107, "rtelnet"},
278+ {3882, "sbatchd"},
279+ {778, "serv"},
280+ {1375, "service_warp"},
281+ {1615, "service_warpdbg"},
282+ {115, "sftp"},
283+ {5232, "sgi-dgl"},
284+ {514, "shell"},
285+ {1135, "shelob"},
286+ {1137, "shelobsrv"},
287+ {4190, "sieve"},
288+ {9, "sink"},
289+ {775, "sms_db"},
290+ {777, "sms_update"},
291+ {25, "smtp"},
292+ {465, "smtps"},
293+ {199, "smux"},
294+ {108, "snagas"},
295+ {19, "source"},
296+ {6111, "spc"},
297+ {515, "spooler"},
298+ {22, "ssh"},
299+ {23523, "sshprop"},
300+ {1391, "statnav"},
301+ {1621, "statnavdbg"},
302+ {1395, "stm_switch"},
303+ {587, "submission"},
304+ {1283, "sunmatrox"},
305+ {1539, "sunmatroxdbg"},
306+ {111, "sunrpc"},
307+ {95, "supdup"},
308+ {1127, "supfiledbg"},
309+ {871, "supfilesrv"},
310+ {1125, "supnamedbg"},
311+ {869, "supnamesrv"},
312+ {1529, "support"},
313+ {11, "systat"},
314+ {601, "ta-rauth"},
315+ {113, "tap"},
316+ {1381, "task_control"},
317+ {1, "tcpmux"},
318+ {23, "telnet"},
319+ {24, "telnet2"},
320+ {992, "telnets"},
321+ {526, "tempo"},
322+ {17, "text"},
323+ {37, "time"},
324+ {37, "timserver"},
325+ {1600, "tnet"},
326+ {102, "tsap"},
327+ {87, "ttylink"},
328+ {19, "ttytst"},
329+ {372, "ulistserv"},
330+ {119, "untp"},
331+ {119, "usenet"},
332+ {11, "users"},
333+ {1400, "usim"},
334+ {540, "uucp"},
335+ {117, "uucp-path"},
336+ {540, "uucpd"},
337+ {1387, "vapor"},
338+ {712, "vexec"},
339+ {712, "vice-exec"},
340+ {713, "vice-login"},
341+ {714, "vice-shell"},
342+ {1371, "visim"},
343+ {1611, "visimdbg"},
344+ {713, "vlogin"},
345+ {5900, "vnc"},
346+ {714, "vshell"},
347+ {210, "wais"},
348+ {1427, "warplite"},
349+ {765, "webster"},
350+ {43, "whois"},
351+ {1421, "wiztemp"},
352+ {2000, "wm"},
353+ {1383, "wnn"},
354+ {22273, "wnn4"},
355+ {22289, "wnn4_cn"},
356+ {22273, "wnn4_jp"},
357+ {1348, "worldc"},
358+ {1604, "worldcdbg"},
359+ {2401, "writesrv"},
360+ {80, "www"},
361+ {6000, "x-server"},
362+ {103, "x400"},
363+ {104, "x400-snd"},
364+ {177, "xdmcp"},
365+ {873, "xtermd"},
366+ {210, "z3950"}
367+};
368+
369+static int compare_services(void const *elem1, void const *elem2)
370+{
371+ TCP_service_name *s1 = (TCP_service_name *) elem1;
372+ TCP_service_name *s2 = (TCP_service_name *) elem2;
373+
374+ return strcmp(s1->name, s2->name);
375+}
376+
377+static BOOL is_service_name_char(char ch)
378+{
379+ return (isalnum(ch) || ch == '_' || ch == '-');
380+}
381+
382+int PASCAL parse_port_from_buf(char * buf)
383+{
384+ int i;
385+
386+ if (buf[0] >= '0' && buf[0] <= '9') {
387+ int result = atoi(buf);
388+
389+ if (result < 1 || result > 65535) {
390+ return -1;
391+ } else {
392+ return result;
393+ }
394+ } else {
395+ char lower_buf[32];
396+ TCP_service_name *result;
397+ TCP_service_name key;
398+
399+ for (i = 0; buf[i] != 0 && i < sizeof(lower_buf) - 1; i++) {
400+ lower_buf[i] = tolower(buf[i]);
401+ }
402+ lower_buf[i] = 0;
403+
404+ key.name = lower_buf;
405+ result = (TCP_service_name *)
406+ bsearch(&key, service_DB, NUM_ELEM(service_DB),
407+ sizeof(service_DB[0]), compare_services);
408+
409+ if (result == NULL) {
410+ return -1;
411+ } else {
412+ return result->port;
413+ }
414+ }
415+}
416+
417+int PASCAL parse_port(char *str, char *buf, int bufsize)
418+{
419+ int i = 0;
420+
421+ while (is_service_name_char(*str) && i < bufsize - 1) {
422+ buf[i] = *str;
423+ str++;
424+ i++;
425+ }
426+ buf[i] = 0;
427+
428+ return parse_port_from_buf(buf);
429+}
430+
431+char * PASCAL service_name(int num) {
432+ if (num < 0 || num >= NUM_ELEM(service_DB))
433+ return NULL;
434+ return (service_DB[num].name);
435+}
--- trunk/teraterm/common/servicenames.h (revision 0)
+++ trunk/teraterm/common/servicenames.h (revision 7090)
@@ -0,0 +1,42 @@
1+/*
2+ * Copyright (C) 2018 TeraTerm Project
3+ * All rights reserved.
4+ *
5+ * Redistribution and use in source and binary forms, with or without
6+ * modification, are permitted provided that the following conditions
7+ * are met:
8+ *
9+ * 1. Redistributions of source code must retain the above copyright
10+ * notice, this list of conditions and the following disclaimer.
11+ * 2. Redistributions in binary form must reproduce the above copyright
12+ * notice, this list of conditions and the following disclaimer in the
13+ * documentation and/or other materials provided with the distribution.
14+ * 3. The name of the author may not be used to endorse or promote products
15+ * derived from this software without specific prior written permission.
16+ *
17+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+ */
28+
29+/* TTCMN.DLL, service name conversion */
30+
31+#ifdef __cplusplus
32+extern "C" {
33+#endif
34+
35+/* proto types */
36+int PASCAL parse_port(char *str, char *buf, int bufsize);
37+int PASCAL parse_port_from_buf(char *buf);
38+char * PASCAL service_name(int num);
39+
40+#ifdef __cplusplus
41+}
42+#endif
--- trunk/ttssh2/ttxssh/fwdui.c (revision 7089)
+++ trunk/ttssh2/ttxssh/fwdui.c (revision 7090)
@@ -38,347 +38,16 @@
3838 #include "x11util.h"
3939 #include "util.h"
4040
41+#include "servicenames.h"
42+
4143 static HFONT DlgFwdEditFont;
4244 static HFONT DlgFwdFont;
4345
4446 typedef struct {
45- int port;
46- char *name;
47-} TCP_service_name;
48-
49-typedef struct {
5047 FWDRequestSpec *spec;
5148 PTInstVar pvar;
5249 } FWDEditClosure;
5350
54-static TCP_service_name service_DB[] = {
55- {384, "arns"},
56- {204, "at-echo"},
57- {202, "at-nbp"},
58- {201, "at-rtmp"},
59- {206, "at-zis"},
60- {705, "auditd"},
61- {113, "auth"},
62- {113, "authentication"},
63- {152, "bftp"},
64- {179, "bgp"},
65- {67, "bootp"},
66- {68, "bootpc"},
67- {67, "bootps"},
68- {881, "bshell"},
69- {1133, "bshelldbg"},
70- {877, "buildd"},
71- {2003, "cfinger"},
72- {19, "chargen"},
73- {531, "chat"},
74- {2030, "client"},
75- {514, "cmd"},
76- {164, "cmip-agent"},
77- {163, "cmip-man"},
78- {1431, "coda_aux1"},
79- {1433, "coda_aux2"},
80- {1435, "coda_aux3"},
81- {1407, "coda_backup"},
82- {1423, "codacon"},
83- {1285, "codger"},
84- {1541, "codgerdbg"},
85- {531, "conference"},
86- {1389, "controller"},
87- {530, "courier"},
88- {1100, "cpsys"},
89- {1346, "csd"},
90- {1602, "csddbg"},
91- {105, "csnet-ns"},
92- {105, "cso-ns"},
93- {1999, "cvskserver"},
94- {987, "daserver"},
95- {13, "daytime"},
96- {1429, "dbp"},
97- {10300, "dictionary"},
98- {9, "discard"},
99- {2100, "discuss"},
100- {1399, "disptool0"},
101- {1401, "disptool1"},
102- {1403, "disptool2"},
103- {1405, "disptool3"},
104- {53, "domain"},
105- {7000, "dos"},
106- {7, "echo"},
107- {8100, "eda1_mbx"},
108- {8101, "eda2_mbx"},
109- {8000, "eda_mbx"},
110- {520, "efs"},
111- {2105, "eklogin"},
112- {545, "ekshell"},
113- {1377, "erim"},
114- {1617, "erimdbg"},
115- {888, "erlogin"},
116- {512, "exec"},
117- {2001, "filesrv"},
118- {79, "finger"},
119- {21, "ftp"},
120- {20, "ftp-data"},
121- {1397, "gds_db"},
122- {70, "gopher"},
123- {1025, "greendbg"},
124- {5999, "grmd"},
125- {5710, "hcserver"},
126- {751, "hesupd"},
127- {101, "hostname"},
128- {101, "hostnames"},
129- {80, "http"},
130- {443, "https"},
131- {7489, "iasqlsvr"},
132- {113, "ident"},
133- {143, "imap"},
134- {143, "imap2"},
135- {220, "imap3"},
136- {143, "imap4"},
137- {993, "imaps"},
138- {1524, "ingreslock"},
139- {1234, "instsrv"},
140- {1387, "ipt"},
141- {213, "ipx"},
142- {194, "irc"},
143- {6667, "irc-alt"},
144- {883, "ishell"},
145- {102, "iso-tsap"},
146- {885, "itkt"},
147- {1439, "jeeves"},
148- {1389, "joysticknav"},
149- {1629, "joysticknavdbg"},
150- {544, "kcmd"},
151- {750, "kdc"},
152- {10401, "kdebug"},
153- {750, "kerberos"},
154- {749, "kerberos-adm"},
155- {88, "kerberos-sec"},
156- {751, "kerberos_master"},
157- {1445, "kjdbc"},
158- {543, "klogin"},
159- {561, "kopexec"},
160- {562, "kopshell"},
161- {761, "kpasswd"},
162- {1109, "kpop"},
163- {1110, "kpopr"},
164- {761, "kpwd"},
165- {88, "krb5"},
166- {4444, "krb524"},
167- {754, "krb5_prop"},
168- {754, "krb_prop"},
169- {760, "krbupdate"},
170- {545, "krcmd"},
171- {1443, "krcp"},
172- {760, "kreg"},
173- {544, "kshell"},
174- {750, "ktc"},
175- {549, "kxct"},
176- {5696, "lanmgrx.osb"},
177- {1441, "lcladm"},
178- {87, "link"},
179- {98, "linuxconf"},
180- {2766, "listen"},
181- {1025, "listener"},
182- {135, "loc-srv"},
183- {4045, "lockd"},
184- {513, "login"},
185- {25, "mail"},
186- {9535, "man"},
187- {3881, "mbatchd"},
188- {1393, "motionnav"},
189- {1633, "motionnavdbg"},
190- {7000, "msdos"},
191- {18, "msp"},
192- {57, "mtp"},
193- {42, "name"},
194- {42, "nameserver"},
195- {773, "nanny"},
196- {138, "nbdgm"},
197- {137, "nbns"},
198- {139, "nbssn"},
199- {1419, "ndim"},
200- {138, "netbios-dgm"},
201- {137, "netbios-ns"},
202- {139, "netbios-ssn"},
203- {138, "netbios_dgm"},
204- {137, "netbios_ns"},
205- {139, "netbios_ssn"},
206- {2106, "netdist"},
207- {1287, "netimage"},
208- {1543, "netimagedbg"},
209- {532, "netnews"},
210- {1353, "netreg"},
211- {1609, "netregdbg"},
212- {77, "netrjs"},
213- {15, "netstat"},
214- {1026, "network_terminal"},
215- {526, "newdate"},
216- {144, "news"},
217- {178, "nextstep"},
218- {1536, "nft"},
219- {43, "nicname"},
220- {119, "nntp"},
221- {1026, "nterm"},
222- {123, "ntp"},
223- {123, "ntpd"},
224- {9, "null"},
225- {891, "odexm"},
226- {560, "opcmd"},
227- {560, "opshell"},
228- {879, "pag"},
229- {893, "papyrus"},
230- {1379, "parvis"},
231- {1619, "parvisdbg"},
232- {600, "pcserver"},
233- {2026, "pcserverbulk"},
234- {2025, "pcserverrpc"},
235- {1385, "pharos"},
236- {1373, "pierunt"},
237- {1613, "pieruntdbg"},
238- {1351, "piesrv"},
239- {1607, "piesrvdbg"},
240- {1889, "pmlockd"},
241- {109, "pop"},
242- {109, "pop-2"},
243- {110, "pop-3"},
244- {109, "pop2"},
245- {110, "pop3"},
246- {995, "pop3s"},
247- {111, "portmap"},
248- {111, "portmapper"},
249- {109, "postoffice"},
250- {170, "print-srv"},
251- {515, "printer"},
252- {191, "prospero"},
253- {1525, "prospero-np"},
254- {17, "qotd"},
255- {17, "quote"},
256- {601, "rauth"},
257- {5347, "rcisimmux"},
258- {1530, "rdeliver"},
259- {3389, "rdp"},
260- {532, "readnews"},
261- {7815, "recserv"},
262- {64, "rem"},
263- {1025, "remote_file_sharing"},
264- {1026, "remote_login"},
265- {556, "remotefs"},
266- {3878, "res"},
267- {875, "resolve"},
268- {1131, "resolvedbg"},
269- {4672, "rfa"},
270- {5900, "rfb"},
271- {5002, "rfe"},
272- {1025, "rfs"},
273- {556, "rfs_server"},
274- {1027, "rfsdbg"},
275- {77, "rje"},
276- {1260, "rlb"},
277- {1425, "rndb2"},
278- {530, "rpc"},
279- {111, "rpcbind"},
280- {1347, "rpl"},
281- {1603, "rpldbg"},
282- {107, "rtelnet"},
283- {3882, "sbatchd"},
284- {778, "serv"},
285- {1375, "service_warp"},
286- {1615, "service_warpdbg"},
287- {115, "sftp"},
288- {5232, "sgi-dgl"},
289- {514, "shell"},
290- {1135, "shelob"},
291- {1137, "shelobsrv"},
292- {4190, "sieve"},
293- {9, "sink"},
294- {775, "sms_db"},
295- {777, "sms_update"},
296- {25, "smtp"},
297- {465, "smtps"},
298- {199, "smux"},
299- {108, "snagas"},
300- {19, "source"},
301- {6111, "spc"},
302- {515, "spooler"},
303- {22, "ssh"},
304- {23523, "sshprop"},
305- {1391, "statnav"},
306- {1621, "statnavdbg"},
307- {1395, "stm_switch"},
308- {587, "submission"},
309- {1283, "sunmatrox"},
310- {1539, "sunmatroxdbg"},
311- {111, "sunrpc"},
312- {95, "supdup"},
313- {1127, "supfiledbg"},
314- {871, "supfilesrv"},
315- {1125, "supnamedbg"},
316- {869, "supnamesrv"},
317- {1529, "support"},
318- {11, "systat"},
319- {601, "ta-rauth"},
320- {113, "tap"},
321- {1381, "task_control"},
322- {1, "tcpmux"},
323- {23, "telnet"},
324- {24, "telnet2"},
325- {992, "telnets"},
326- {526, "tempo"},
327- {17, "text"},
328- {37, "time"},
329- {37, "timserver"},
330- {1600, "tnet"},
331- {102, "tsap"},
332- {87, "ttylink"},
333- {19, "ttytst"},
334- {372, "ulistserv"},
335- {119, "untp"},
336- {119, "usenet"},
337- {11, "users"},
338- {1400, "usim"},
339- {540, "uucp"},
340- {117, "uucp-path"},
341- {540, "uucpd"},
342- {1387, "vapor"},
343- {712, "vexec"},
344- {712, "vice-exec"},
345- {713, "vice-login"},
346- {714, "vice-shell"},
347- {1371, "visim"},
348- {1611, "visimdbg"},
349- {713, "vlogin"},
350- {5900, "vnc"},
351- {714, "vshell"},
352- {210, "wais"},
353- {1427, "warplite"},
354- {765, "webster"},
355- {43, "whois"},
356- {1421, "wiztemp"},
357- {2000, "wm"},
358- {1383, "wnn"},
359- {22273, "wnn4"},
360- {22289, "wnn4_cn"},
361- {22273, "wnn4_jp"},
362- {1348, "worldc"},
363- {1604, "worldcdbg"},
364- {2401, "writesrv"},
365- {80, "www"},
366- {6000, "x-server"},
367- {103, "x400"},
368- {104, "x400-snd"},
369- {177, "xdmcp"},
370- {873, "xtermd"},
371- {210, "z3950"}
372-};
373-
374-static int compare_services(void const *elem1, void const *elem2)
375-{
376- TCP_service_name *s1 = (TCP_service_name *) elem1;
377- TCP_service_name *s2 = (TCP_service_name *) elem2;
378-
379- return strcmp(s1->name, s2->name);
380-}
381-
38251 static void make_X_forwarding_spec(FWDRequestSpec *spec, PTInstVar pvar)
38352 {
38453 spec->type = FWD_REMOTE_X11_TO_LOCAL;
@@ -393,61 +62,6 @@
39362 pvar->ts->UIMsg, spec->to_port - 6000, spec->x11_screen);
39463 }
39564
396-static BOOL is_service_name_char(char ch)
397-{
398- return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')
399- || ch == '_' || ch == '-' || (ch >= '0' && ch <= '9');
400-}
401-
402-static int parse_port_from_buf(char * buf)
403-{
404- int i;
405-
406- if (buf[0] >= '0' && buf[0] <= '9') {
407- int result = atoi(buf);
408-
409- if (result < 1 || result > 65535) {
410- return -1;
411- } else {
412- return result;
413- }
414- } else {
415- char lower_buf[32];
416- TCP_service_name *result;
417- TCP_service_name key;
418-
419- for (i = 0; buf[i] != 0 && i < sizeof(lower_buf) - 1; i++) {
420- lower_buf[i] = tolower(buf[i]);
421- }
422- lower_buf[i] = 0;
423-
424- key.name = lower_buf;
425- result = (TCP_service_name *)
426- bsearch(&key, service_DB, NUM_ELEM(service_DB),
427- sizeof(service_DB[0]), compare_services);
428-
429- if (result == NULL) {
430- return -1;
431- } else {
432- return result->port;
433- }
434- }
435-}
436-
437-static int parse_port(char *str, char *buf, int bufsize)
438-{
439- int i = 0;
440-
441- while (is_service_name_char(*str) && i < bufsize - 1) {
442- buf[i] = *str;
443- str++;
444- i++;
445- }
446- buf[i] = 0;
447-
448- return parse_port_from_buf(buf);
449-}
450-
45165 static BOOL parse_request(FWDRequestSpec *request, char *str, PTInstVar pvar)
45266 {
45367 char *tmp, *ch;
@@ -1029,9 +643,10 @@
1029643 {
1030644 HWND cbox = GetDlgItem(dlg, item);
1031645 int i;
646+ char *svc;
1032647
1033- for (i = 0; i < NUM_ELEM(service_DB); i++) {
1034- SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM) service_DB[i].name);
648+ for (i=0; (svc = service_name(i)) != NULL; i++) {
649+ SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM) svc);
1035650 }
1036651 }
1037652
旧リポジトリブラウザで表示