1 /*
2  *  Project   : tin - a Usenet reader
3  *  Module    : policy.h
4  *  Author    : Ralf Doeblitz <doeblitz@gmx.de>
5  *  Created   : 1999-01-12
6  *  Updated   : 2015-09-14
7  *  Notes     : #defines and static data for policy configuration
8  *
9  * Copyright (c) 1999-2021 Ralf Doeblitz <doeblitz@gmx.de>
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  *
16  * 1. Redistributions of source code must retain the above copyright notice,
17  *    this list of conditions and the following disclaimer.
18  *
19  * 2. Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * 3. Neither the name of the copyright holder nor the names of its
24  *    contributors may be used to endorse or promote products derived from
25  *    this software without specific prior written permission.
26  *
27  * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGE.
38  */
39 
40 /*
41  * CAUTION: THIS FILE IS OUTDATED AND NO LONGER ACTIVELY MAINTAINED
42  * "disable_gnksa_domain_check=OFF" MIGHT RESULT IN FALSE POSITIVES
43  */
44 
45 /*
46  * tables for TLD search in misc.c, gnksa domain checking
47  */
48 
49 #ifndef TIN_POLICY_H
50 #	define TIN_POLICY_H 1
51 /*
52  * known two letter country codes
53  *
54  * .ac  Ascension Island               .ad  Andorra
55  * .ae  United Arab Emirates           .af  Afghanistan
56  * .ag  Antigua and Barbuda            .ai  Anguilla
57  * .al  Albania                        .am  Armenia
58  * .an  Netherlands Antilles           .ao  Angola
59  * .aq  Antarctica                     .ar  Argentina
60  * .as  American Samoa                 .at  Austria
61  * .au  Australia                      .aw  Aruba
62  * .ax  Aland                          .az  Azerbaijan
63  *
64  * .ba  Bosnia and Herzegowina         .bb  Barbados
65  * .bd  Bangladesh                     .be  Belgium
66  * .bf  Burkina Faso                   .bg  Bulgaria
67  * .bh  Bahrain                        .bi  Burundi
68  * .bj  Benin                          .bm  Bermuda
69  * .bn  Brunei Darussalam              .bo  Bolivia
70  * .br  Brazil                         .bs  Bahamas
71  * .bt  Bhutan                         .bw  Botswana
72  * .by  Belarus                        .bz  Belize
73  *
74  * .ca  Canada                         .cc  Cocos (Keeling) Islands
75  * .cd  Congo, Democratic People's Republic
76  * .cf  Central African Republic       .cg  Congo, Republic of
77  * .ch  Switzerland                    .ci  Côte d'Ivoire
78  * .ck  Cook Islands                   .cl  Chile
79  * .cm  Cameroon                       .cn  China
80  * .co  Colombia                       .cr  Costa Rica
81  * .cu  Cuba                           .cv  Cape Verde
82  * .cw  Curacao                        .cx  Christmas Island
83  * .cy  Cyprus                         .cz  Czech Republic
84  *
85  * .de  Germany                        .dj  Djibouti
86  * .dk  Denmark                        .dm  Dominica
87  * .do  Dominican Republic             .dz  Algeria
88  *
89  * .ec  Ecuador                        .ee  Estonia
90  * .eg  Egypt                          .er  Eritrea
91  * .es  Spain                          .et  Ethiopia
92  * .eu  European Union
93  *
94  * .fi  Finland                        .fj  Fiji
95  * .fk  Falkland Islands (Malvina)     .fm  Micronesia, Federal State of
96  * .fo  Faroe Islands                  .fr  France
97  *
98  * .ga  Gabon                          .gb  United Kingdom
99  * .gd  Grenada                        .ge  Georgia
100  * .gf  French Guiana                  .gg  Guernsey
101  * .gh  Ghana                          .gi  Gibraltar
102  * .gl  Greenland                      .gm  Gambia
103  * .gn  Guinea                         .gp  Guadelope
104  * .gq  Equatorial Guinea              .gr  Greece
105  * .gs  South Georgia and the South Sandwich Islands
106  * .gt  Guatemala                      .gu  Guam
107  * .gw  Guinea-Bissau                  .gy  Guyana
108  *
109  * .hk  Hong Kong                      .hm  Heard and McDonald Islands
110  * .hn  Honduras                       .hr  Croatia/Hrvatska
111  * .ht  Haiti                          .hu  Hungary
112  *
113  * .id  Indonesia                      .ie  Ireland
114  * .il  Israel                         .im  Isle of Man
115  * .in  India                          .io  British Indian Ocean Territory
116  * .iq  Iraq                           .ir  Iran
117  * .is  Iceland                        .it  Italy
118  *
119  * .je  Jersey                         .jm  Jamaica
120  * .jo  Jordan                         .jp  Japan
121  *
122  * .ke  Kenya                          .kg  Kyrgystan
123  * .kh  Cambodia                       .ki  Kiribati
124  * .km  Comoros                        .kn  Saint Kitts and Nevis
125  * .kp  Korea, Democratic People's Republic
126  * .kr  Korea, Republic of             .kw  Kuwait
127  * .ky  Cayman Islands                 .kz  Kazakhstan
128  *
129  * .la  Laos (People's Democratic Republic)
130  * .lb  Lebanon                        .lc  Saint Lucia
131  * .li  Liechtenstein                  .lk  Sri Lanka
132  * .lr  Liberia                        .ls  Lesotho
133  * .lt  Lithuania                      .lu  Luxembourg
134  * .lv  Latvia                         .ly  Libyan Arab Jamahiriya
135  *
136  * .ma  Morocco                        .mc  Monaco
137  * .md  Moldova, Republic of           .me  Montenegro
138  * .mg  Madagascar                     .mh  Marshall Islands
139  * .mk  Macedonia                      .ml  Mali
140  * .mm  Myanmar                        .mn  Mongolia
141  * .mo  Macau                          .mp  Northern Mariana Islands
142  * .mq  Martinique                     .mr  Mauritania
143  * .ms  Montserrat                     .mt  Malta
144  * .mu  Mauritius                      .mv  Maldives
145  * .mw  Malawi                         .mx  Mexico
146  * .my  Malaysia                       .mz  Mozambique
147  *
148  * .na  Namibia                        .nc  New Caledonia
149  * .ne  Niger                          .nf  Norfolk Island
150  * .ng  Nigeria                        .ni  Nicaragua
151  * .nl  The Netherlands                .no  Norway
152  * .np  Nepal                          .nr  Nauru
153  * .nu  Niue                           .nz  New Zealand
154  *
155  * .om  Oman
156  *
157  * .pa  Panama                         .pe  Peru
158  * .pf  French Polynesia               .pg  Papua New Guinea
159  * .ph  Philippines                    .pk  Pakistan
160  * .pl  Poland                         .pm  St. Pierre and Miquelon
161  * .pn  Pitcairn Island                .pr  Puerto Rico
162  * .ps  Palestinian Territories        .pt  Portugal
163  * .pw  Palau                          .py  Paraguay
164  *
165  * .qa  Qatar
166  *
167  * .re  Reunion                        .ro  Romania
168  * .rs  Republic of Serbia             .ru  Russian Federation
169  * .rw  Rwanda
170  *
171  * .sa  Saudi Arabia                   .sb  Solomon Islands
172  * .sc  Seychelles                     .sd  Sudan
173  * .se  Sweden                         .sg  Singapore
174  * .sh  St. Helena                     .si  Slovenia
175  * .sk  Slovakia                       .sl  Sierra Leone
176  * .sm  San Marino                     .sn  Senegal
177  * .so  Somalia                        .sr  Surinam
178  * .st  Sao Tome and Principe          .su  Soviet Union (former)
179  * .sv  El Salvador                    .sx  Sint Maarten (Dutch side)
180  * .sy  Syrian Arab Republic           .sz  Swaziland
181  *
182  * .tc  The Turks & Caicos Islands     .td  Chad
183  * .tf  French Southern Territories    .tg  Togo
184  * .th  Thailand                       .tj  Tajikistan
185  * .tk  Tokelau                        .tl  Timor-Leste
186  * .tm  Turkmenistan                   .tn  Tunisia
187  * .to  Tonga                          .tp  East Timor
188  * .tr  Turkey                         .tt  Trinidad and Tobago
189  * .tv  Tuvalu                         .tw  Taiwan
190  * .tz  Tanzania
191  *
192  * .ua  Ukraine                        .ug  Uganda
193  * .uk  United Kingdom
194  * .us  United States                  .uy  Uruguay
195  * .uz  Uzbekistan
196  *
197  * .va  Holy See (Vatican City State)  .vc  Saint Vincent and the Grenadines
198  * .ve  Venezuela                      .vg  Virgin Islands (British)
199  * .vi  Virgin Islands (U.S)           .vn  Vietnam
200  * .vu  Vanuatu
201  *
202  * .wf  Wallis and Futuna Islands      .ws  Western Samoa
203  *
204  * .ye  Yemen                          .yt  Mayotte
205  *
206  * .za  South Africa                   .zm  Zambia
207  * .zw  Zimbabwe
208  *
209  *
210  * invalid/obsolete TLDs:
211  * .bu  Burma, now .mm
212  * .cs  former Czechoslovakia, now .cz and .sk
213  * .dd  former German Democratic Republic, now .de
214  * .fx  France, Metropolitan
215  * .oz  Australian MHSnet
216  * .um  United States Minor Outlying Islands
217  * .yd  Democratic Yemen, now .ye
218  * .yu  Yugoslavia, now .rs and .me
219  * .wg  West Bank and Gaza, now .ps
220  * .zr  former Zaire, now .cd
221  *
222  * user-assigned code elements:
223  * .aa, .qm, .qz, .xa, .xz, .zz
224  *
225  * unused TLDs:
226  * .bl  Saint Barthélemy
227  * .bq  Bonaire, Sint Eustatius and Saba
228  * .bv  Bouvet Island (Norway)
229  * .eh  Western Sahara
230  * .gb  United Kingdom, use .uk
231  * .mf  Sint Maarten (French side)
232  * .sj  Svalbard and Jan Mayen Islands (Norway)
233  * .ss  South Sudan
234  *
235  * requested new TLDs:
236  *
237  * xccTLDs:
238  * .an  Netherlands Antilles, becomes .bq, .cw, and .sx
239  * .su  former USSR, now .ru
240  * .tp  former East Timor, now .tl
241  */
242 
243 static char gnksa_country_codes[26*26] = {
244 /*      A B C D E  F G H I J  K L M N O  P Q R S T  U V W X Y Z */
245 /* A */ 0,0,1,1,1, 1,1,0,1,0, 0,1,1,1,1, 0,1,1,1,1, 1,0,1,1,0,1,
246 /* B */ 1,1,0,1,1, 1,1,1,1,1, 0,0,1,1,1, 0,0,1,1,1, 0,0,1,0,1,1,
247 /* C */ 1,0,1,1,0, 1,1,1,1,0, 1,1,1,1,1, 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,1,0, 1,1,1,1,1, 0,0,1,0,1, 1,1,0,1,1,1,
264 /* T */ 0,0,1,1,0, 1,1,1,0,1, 1,1,1,1,1, 1,0,1,0,1, 0,1,1,0,0,1,
265 /* U */ 1,0,0,0,0, 0,1,0,0,0, 1,0,0,0,0, 0,0,0,1,0, 0,0,0,0,1,1,
266 /* V */ 1,0,1,0,1, 0,1,0,1,0, 0,0,0,1,0, 0,0,0,0,0, 1,0,0,0,0,0,
267 /* W */ 0,0,0,0,0, 1,0,0,0,0, 0,0,0,0,0, 0,0,0,1,0, 0,0,0,0,0,0,
268 /* X */ 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,
269 /* Y */ 0,0,0,0,1, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,1, 0,0,0,0,0,0,
270 /* Z */ 1,0,0,0,0, 0,0,0,0,0, 0,0,1,0,0, 0,0,0,0,0, 0,0,1,0,0,0
271 /*      A B C D E  F G H I J  K L M N O  P Q R S T  U V W X Y Z */
272 };
273 
274 
275 /*
276  * valid domains with 3 or more characters
277  */
278 static const char *gnksa_domain_list[] = {
279 	"biz",	/* Businesses */
280 	"cat",	/* Catalan linguistic and cultural community */
281 	"com",	/* Commercial */
282 	"edu",	/* Educational */
283 	"gov",	/* US Government */
284 	"int",	/* International Organizations */
285 	"mil",	/* US Dept of Defense */
286 	"net",	/* Networks */
287 	"org",	/* Organizations */
288 	"pro",	/* Accountants, lawyers, and physicians */
289 	"tel",	/* Internet communication */
290 	"xxx",	/* For adult entertainment */
291 	"aero",	/* Air-transport industry */
292 	"arpa",	/* Address and Routing Parameter Area */
293 	"asia",	/* Asia and the Pacific */
294 	"bike",
295 	"coop",	/* Non-profit cooperatives */
296 	"guru",
297 	"info",	/* Unrestricted use */
298 	"jobs",	/* Human resource managers */
299 	"land",
300 	"mobi",	/* Mobile products and services */
301 	"name",	/* For registration by individuals */
302 	"post",	/* Postal sector */
303 	"sexy",
304 	"camera",
305 	"estate",
306 	"museum",	/* Museums */
307 	"tattoo",
308 	"travel",	/* Travel industry */
309 	"voyage",
310 	"gallery",
311 	"singles",
312 	"clothing",
313 	"graphics",
314 	"holdings",
315 	"lighting",
316 	"plumbing",
317 	"ventures",
318 	"equipment",
319 	"technology",
320 	"contractors",
321 	"construction",
322 	/*
323 	 * more gTLDs to come, proposed are:
324 	 *  .kids     .mail     .catholic
325 	 *  (.berlin) (.sco)    (.bzh)    (.cym)    (.gal)
326 	 */
327 #	if 0		/* $DEAD */
328 	"nato",
329 	"uucp",
330 	"csnet",
331 	"bitnet",
332 #	endif /* 0 */
333 	/* the next five are defined in RFC 2606, RFC 6761 */
334 	"invalid",
335 #	if 0
336 	/* but four of them shouldn't be used on usenet */
337 	"test",
338 	"onion",			/* RFC 7686 */
339 	"example",
340 	"localhost",
341 #	endif /* 0 */
342 #	ifdef TINC_DNS
343 	"bofh",	/* There Is No Cabal */
344 #	endif /* TINC_DNS */
345 	/* active IDN ccTLDs */
346 	"xn--lgbbat1ad8j",	/* Algeria */
347 	"xn--fiqs8s",		/* China, Simplified Chinese */
348 	"xn--fiqz9s",		/* China, Traditional Chinese */
349 	"xn--wgbh1c",		/* Egypt */
350 	"xn--j6w193g",		/* Hong Kong, Han */
351 	"xn--45brj9c",		/* India, Bengali */
352 	"xn--gecrj9c",		/* India, Gujarati */
353 	"xn--h2brj9c",		/* India, Hindi */
354 	"xn--s9brj9c",		/* India, Punjabi */
355 	"xn--xkc2dl3a5ee0h",	/* India, Tamil */
356 	"xn--fpcrj9c3d",	/* India, Telugu */
357 	"xn--mgbbh1a71e",	/* India, Urdu */
358 	"xn--mgba3a4f16a",  /* Iran */
359 	"xn--mgbayh7gpa",	/* Jordan */
360 	"xn--80ao21a",		/* Kazakhstan */
361 	"xn--3e0b707e",		/* Korea, Republic of */
362 	"xn--mgbx4cd0ab",	/* Malaysia */
363 	"xn--l1acc",		/* Mongolia */
364 	"xn--mgbc0a9azcg",	/* Morocco */
365 	"xn--mgb9awbf",		/* Oman */
366 	"xn--ygbi2ammx",	/* Palestinian Territory */
367 	"xn--wgbl6a",		/* Qatar */
368 	"xn--p1ai",			/* Russian Federation */
369 	"xn--mgberp4a5d4ar",	/* Saudi Arabia */
370 	"xn--90a3ac",		/* Serbia */
371 	"xn--yfro4i67o",	/* Singapore, Chinese */
372 	"xn--clchc0ea0b2g2a9gcd",	/* Singapore, Tamil */
373 	"xn--fzc2c9e2c",	/* Sri Lanka, Sinhala */
374 	"xn--xkc2al3hye2a",	/* Sri Lanka, Tamil */
375 	"xn--ogbpf8fl",		/* Syrian Arab Republic */
376 	"xn--kpry57d",		/* Taiwan, Simplified Chinese */
377 	"xn--kprw13d",		/* Taiwan, Traditional Chinese */
378 	"xn--o3cw4h",		/* Thailand */
379 	"xn--pgbs0dh",		/* Tunisia */
380 	"xn--j1amh",		/* Ukraine */
381 	"xn--mgbaam7a8h",	/* United Arab Emirates */
382 #	if 0
383 	/* purposed IDN ccTLDs */
384 	"xn--54b7fta0cc",	/* Bangladesh */
385 	"xn--node",			/* Georgia */
386 	"xn--mgbai9azgqp6j",	/* Pakistan */
387 	"xn--mgbpl2fh",		/* Sudan */
388 	"xn--mgb2ddes",		/* Yemen */
389 #	endif /* 0 */
390 #	if 0
391 	/* Desired Variant String(s) IDN ccTLDs */
392 	"xn--mgba3a4fra",	/* Iran */
393 	"xn--mgbai9a5eva00b",	/* Pakistan */
394 	"xn--mgberp4a5d4a87g",	/* Saudi Arabia */
395 	"xn--mgbqly7c0a67fbc",	/* Saudi Arabia */
396 	"xn--mgbqly7cvafr",	/* Saudi Arabia */
397 	"xn--mgbtf8fl",		/* Syria */
398 	"xn--nnx388a",		/* Taiwan */
399 #	endif /* 0 */
400 	/* active IDN gTLDs */
401 	"xn--ngbc5azd",		/* Arabic for "web/network" */
402 	"xn--80asehdb",		/* Cyrillic for "online" */
403 	"xn--80aswg",		/* Cyrillic for "site" */
404 	"xn--unup4y",		/* Chinese for "game(s)" */
405 	/* puposed IDN gTLDs */
406 	/* sentinel */
407 	""
408 };
409 #endif /* !TIN_POLICY_H */
410